sigil-core · block
Source declarations, signatures and documentation for block.
Source: sigil/node/sigil-core/src/block.rs. SHA-256: 0eadbef175837a1271abe0244993b837f5bf0e58f1affab3dc2ed9471d7e5386.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
block::Block
A complete Sigil blockchain block.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Block {
/// Block header with metadata and commitments.
pub header: BlockHeader,
/// Block body with transactions and receipts.
pub body: BlockBody
}Source line: 15.
block::Block::hash
Compute the block hash from the header.
pub fn hash(&self) -> SigilHash;Source line: 24.
block::Block::height
Returns the block height.
pub fn height(&self) -> u64;Source line: 29.
block::Block::tx_count
Returns the number of transactions in this block.
pub fn tx_count(&self) -> usize;Source line: 34.
block::Block::verify_tx_root
Verify that the tx_root in the header matches the actual transactions.
Returns an error if any transaction fails to serialize.
pub fn verify_tx_root(&self) -> Result<bool, CoreError>;Source line: 41.
block::Block::verify_receipt_root
Verify that the receipt_root matches the actual receipts.
Returns an error if any receipt fails to serialize.
pub fn verify_receipt_root(&self) -> Result<bool, CoreError>;Source line: 49.
block::BlockHeader
Block header containing metadata and Merkle root commitments.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BlockHeader {
/// Hash of the parent block (ZERO for genesis).
pub parent_hash: SigilHash,
/// Merkle root of the post-execution state.
pub state_root: SigilHash,
/// Merkle root of the transactions in this block.
pub tx_root: SigilHash,
/// Merkle root of the transaction receipts.
pub receipt_root: SigilHash,
/// OAS DID of the block proposer.
pub proposer_did: String,
/// Block height (0 for genesis).
pub height: u64,
/// Unix timestamp in seconds.
pub timestamp: u64,
/// Epoch number (height / BLOCKS_PER_EPOCH).
pub epoch: u64,
/// Chain ID string.
pub chain_id: String,
/// Protocol version at time of block creation.
pub protocol_version: String,
/// Optional ZK proof of correct block execution.
/// Only Block Producers generate this; Block Validators verify it.
#[serde(skip_serializing_if = "Option::is_none")]
pub zk_proof: Option<ZkProof>,
/// Gas used by all transactions in this block.
pub gas_used: u64,
/// Gas limit for this block.
pub gas_limit: u64,
/// Extra data (up to 32 bytes, for proposer vanity or protocol signals).
#[serde(default)]
pub extra_data: Vec<u8>
}Source line: 57.
block::BlockHeader::compute_hash
Compute the block hash: BLAKE3 of the serialized header (excluding zk_proof).
pub fn compute_hash(&self) -> SigilHash;Source line: 93.
block::BlockHeader::is_genesis
Check if this is a genesis block header.
pub fn is_genesis(&self) -> bool;Source line: 113.
block::ZkProof
A zero-knowledge proof of correct block execution.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ZkProof {
/// The proof bytes (format depends on proving system).
pub proof_bytes: Vec<u8>,
/// The proving system identifier (e.g., "jolt-v1").
pub proving_system: String,
/// Public inputs to the proof (block hash, state transitions).
pub public_inputs: Vec<Vec<u8>>,
/// Verification key hash (identifies the circuit).
pub verification_key_hash: SigilHash
}Source line: 120.
block::BlockBody
Block body containing transactions and their receipts.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BlockBody {
/// Signed transactions included in this block.
pub transactions: Vec<SignedTransaction>,
/// Receipts for each transaction (same order as transactions).
pub receipts: Vec<Receipt>
}Source line: 133.
block::MAX_EXTRA_DATA_SIZE
Maximum allowed size of the block header extra_data field (bytes).
pub const MAX_EXTRA_DATA_SIZE: usize;Source line: 141.
block::MAX_CLOCK_DRIFT_SECS
Maximum allowed clock drift for block timestamps (seconds).
pub const MAX_CLOCK_DRIFT_SECS: u64;Source line: 144.
block::validate_timestamp
Validate that a block timestamp is strictly after the parent and within acceptable clock drift of the current time.
pub fn validate_timestamp(
header: &BlockHeader,
parent_timestamp: u64,
current_time: u64,
) -> Result<(), CoreError>;Source line: 148.
block::validate_extra_data
Validate that the extra_data field does not exceed the maximum allowed size.
pub fn validate_extra_data(extra_data: &[u8]) -> Result<(), CoreError>;Source line: 169.
block::compute_tx_root
Compute the Merkle root of a list of signed transactions.
Returns an error if any transaction fails to serialize.
pub fn compute_tx_root(txs: &[SignedTransaction]) -> Result<SigilHash, CoreError>;Source line: 183.
block::compute_receipt_root
Compute the Merkle root of a list of receipts.
Returns an error if any receipt fails to serialize.
pub fn compute_receipt_root(receipts: &[Receipt]) -> Result<SigilHash, CoreError>;Source line: 197.