Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 49 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ members = [
"modules/accounts_state", # Tracks stake and reward accounts
"modules/assets_state", # Tracks native asset mints and burns
"modules/historical_accounts_state", # Tracks historical account information
"modules/consensus", # Chooses favoured chain across multiple options
"modules/chain_store", # Tracks historical information about blocks and TXs

# Process builds
Expand Down
1 change: 1 addition & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ imbl = { workspace = true }
dashmap = { workspace = true }
rayon = "1.11.0"
cryptoxide = "0.5.1"
thiserror = "2.0.17"
sha2 = "0.10.8"
caryatid_process.workspace = true
config.workspace = true
Expand Down
1 change: 1 addition & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub mod snapshot;
pub mod stake_addresses;
pub mod state_history;
pub mod types;
pub mod validation;

// Flattened re-exports
pub use self::address::*;
Expand Down
21 changes: 9 additions & 12 deletions common/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,20 @@ use crate::queries::{

use crate::byte_array::*;
use crate::types::*;
use crate::validation::ValidationStatus;

// Caryatid core messages which we re-export
pub use caryatid_module_clock::messages::ClockTickMessage;
pub use caryatid_module_rest_server::messages::{GetRESTResponse, RESTRequest, RESTResponse};

/// Block header message
/// Raw block data message
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct BlockHeaderMessage {
/// Raw Data
pub raw: Vec<u8>,
}
pub struct RawBlockMessage {
/// Header raw data
pub header: Vec<u8>,

/// Block body message
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct BlockBodyMessage {
/// Raw Data
pub raw: Vec<u8>,
/// Body raw data
pub body: Vec<u8>,
}

/// Snapshot completion message
Expand Down Expand Up @@ -281,8 +278,8 @@ pub struct SPOStateMessage {
/// Cardano message enum
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub enum CardanoMessage {
BlockHeader(BlockHeaderMessage), // Block header available
BlockBody(BlockBodyMessage), // Block body available
BlockAvailable(RawBlockMessage), // Block body available
BlockValidation(ValidationStatus), // Result of a block validation
SnapshotComplete, // Mithril snapshot loaded
ReceivedTxs(RawTxsMessage), // Transaction available
GenesisComplete(GenesisCompleteMessage), // Genesis UTXOs done + genesis params
Expand Down
29 changes: 29 additions & 0 deletions common/src/validation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//! Validation results for Acropolis consensus

// We don't use these types in the acropolis_common crate itself
#![allow(dead_code)]

use thiserror::Error;

/// Validation error
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Error)]
pub enum ValidationError {
#[error("VRF failure")]
BadVRF,

#[error("KES failure")]
BadKES,

#[error("Doubly spent UTXO: {0}")]
DoubleSpendUTXO(String),
}

/// Validation status
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub enum ValidationStatus {
/// All good
Go,

/// Error
NoGo(ValidationError),
}
6 changes: 3 additions & 3 deletions modules/block_unpacker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ everything except the section header can be left out.
[module.block-unpacker]

# Message topics
subscribe-topic = "cardano.block.body"
subscribe-topic = "cardano.block.proposed"
publish-topic = "cardano.txs"

```

## Messages

The block unpacker subscribes for BlockBodyMessages on
`cardano.block.body` (see the [Upstream Chain
The block unpacker subscribes for RawBlockMessages on
`cardano.block.proposed` (see the [Upstream Chain
Fetcher](../upstream_chain_fetcher) module for details). It unpacks
this into transactions, which it publishes as a single RawTxsMessage
on `cardano.txs`, containing the block information and an ordered vector of
Expand Down
Loading