sigil-node · crate
Source declarations, signatures and documentation for crate.
Source: sigil/node/sigil-node/src/lib.rs. SHA-256: a00ce310d188c4e4b5318bbd77b8febc186e97f1486e7d25ce7aae7d65ec829b.
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.
admission
pub mod admission;Source line: 10.
bootstrap
pub mod bootstrap;Source line: 12.
compute_durable
#[cfg(feature = "compute")]
pub mod compute_durable;Source line: 14.
compute_state
#[cfg(feature = "compute")]
pub mod compute_state;Source line: 16.
consensus_coordinator
pub mod consensus_coordinator;Source line: 17.
contract_durable
#[cfg(feature = "contracts")]
pub mod contract_durable;Source line: 19.
crucible_durable
pub mod crucible_durable;Source line: 20.
dex_durable
pub mod dex_durable;Source line: 21.
engine
pub mod engine;Source line: 22.
error
pub mod error;Source line: 23.
executor
pub mod executor;Source line: 24.
executor_compute
#[cfg(feature = "compute")]
pub mod executor_compute;Source line: 26.
executor_contract
#[cfg(feature = "contracts")]
pub mod executor_contract;Source line: 28.
executor_crucible
pub mod executor_crucible;Source line: 29.
executor_dao
#[cfg(feature = "dao-validators")]
pub mod executor_dao;Source line: 31.
executor_dex
pub mod executor_dex;Source line: 32.
executor_evidence
pub mod executor_evidence;Source line: 33.
executor_gal
#[cfg(feature = "tower")]
pub mod executor_gal;Source line: 35.
executor_labor
pub mod executor_labor;Source line: 36.
executor_mail
pub mod executor_mail;Source line: 37.
executor_nft
pub mod executor_nft;Source line: 38.
executor_nova
pub mod executor_nova;Source line: 39.
executor_recovery
pub mod executor_recovery;Source line: 40.
executor_storage
pub mod executor_storage;Source line: 41.
executor_username
pub mod executor_username;Source line: 42.
executor_vigils
#[cfg(feature = "vigils-v1")]
pub mod executor_vigils;Source line: 44.
gal_durable
#[cfg(feature = "tower")]
pub mod gal_durable;Source line: 46.
genesis_loader
pub mod genesis_loader;Source line: 47.
governance_durable
pub mod governance_durable;Source line: 48.
health
pub mod health;Source line: 49.
host_backend
#[cfg(feature = "wasm")]
pub mod host_backend;Source line: 51.
labor_durable
pub mod labor_durable;Source line: 52.
logging
pub mod logging;Source line: 53.
mail_durable
pub mod mail_durable;Source line: 54.
mempool
pub mod mempool;Source line: 55.
metrics
pub mod metrics;Source line: 56.
nft_durable
pub mod nft_durable;Source line: 57.
nova_durable
pub mod nova_durable;Source line: 58.
recovery_durable
pub mod recovery_durable;Source line: 59.
rpc_compute
#[cfg(feature = "compute")]
pub mod rpc_compute;Source line: 61.
rpc_contract
#[cfg(feature = "contracts")]
pub mod rpc_contract;Source line: 63.
rpc_crucible
pub mod rpc_crucible;Source line: 64.
rpc_dex
pub mod rpc_dex;Source line: 65.
rpc_evidence
pub mod rpc_evidence;Source line: 66.
rpc_gal
#[cfg(feature = "tower")]
pub mod rpc_gal;Source line: 68.
rpc_labor
pub mod rpc_labor;Source line: 69.
rpc_mail
pub mod rpc_mail;Source line: 70.
rpc_middleware
pub mod rpc_middleware;Source line: 71.
rpc_nft
pub mod rpc_nft;Source line: 72.
rpc_nova
pub mod rpc_nova;Source line: 73.
rpc_server
pub mod rpc_server;Source line: 74.
rpc_storage_market
pub mod rpc_storage_market;Source line: 75.
rpc_sync
pub mod rpc_sync;Source line: 76.
rpc_username
pub mod rpc_username;Source line: 77.
rpc_vigils
#[cfg(feature = "vigils-v1")]
pub mod rpc_vigils;Source line: 79.
snapshot
pub mod snapshot;Source line: 80.
storage_market_durable
pub mod storage_market_durable;Source line: 82.
storage_migration
pub mod storage_migration;Source line: 83.
tee_verify
#[cfg(feature = "tee-verify")]
pub mod tee_verify;Source line: 85.
tower_durable
pub mod tower_durable;Source line: 86.
tower_runtime
pub mod tower_runtime;Source line: 87.
username_durable
pub mod username_durable;Source line: 88.
validator_agent
pub mod validator_agent;Source line: 89.
weave
pub mod weave;Source line: 90.
ws
pub mod ws;Source line: 91.
::NodeMode
Node operating modes.
Each mode determines which subsystems are activated and how much data the node stores.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, clap::ValueEnum, Serialize, Deserialize)]
pub enum NodeMode {
/// Block Producer: execute transactions, generate ZK proofs.
Producer,
/// Block Validator: verify ZK proofs, participate in consensus.
Validator,
/// RPC node: serve API queries (no consensus participation).
Rpc,
/// Archive node: store full chain history.
Archive,
/// Light node: verify block headers only.
Light,
/// Tower coordination chain validator: participate in Tower consensus,
/// committee selection, finality voting, and slashing evidence processing.
/// Runs the Tower chain alongside the execution chain.
#[cfg(feature = "tower")]
Tower,
/// Observer node: subscribe to blocks and transactions without participating
/// in consensus. Useful for analytics, indexing, and monitoring dashboards.
Observer,
}Source line: 142.
::StateSyncMode
Startup state-sync mode for nodes booting from an existing chain.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, clap::ValueEnum, Serialize, Deserialize)]
pub enum StateSyncMode {
/// Do not attempt snapshot restore or state sync at startup.
Off,
/// Restore the latest signed snapshot, then catch up from peers.
SnapshotThenP2pCatchup,
/// Header sync first, then fetch state chunks against the finalized root.
HeaderThenStateFetch,
}Source line: 181.
::NodeConfig
Node configuration parsed from CLI arguments.
#[derive(Debug, Clone, Parser)]
#[command(name = "sigil-node", version, about = "Sigil blockchain node")]
pub struct NodeConfig {
/// Node operating mode.
#[arg(long, value_enum, default_value_t = NodeMode::Validator)]
pub mode: NodeMode,
/// Chain ID.
#[arg(long, default_value = "sigil-mainnet-1")]
pub chain_id: String,
/// Data directory for chain state and blocks.
#[arg(long, default_value = "./data")]
pub data_dir: String,
/// RPC listen address.
#[arg(long, default_value = "0.0.0.0:12618")]
pub rpc_addr: String,
/// P2P listen address.
#[arg(long, default_value = "0.0.0.0:26656")]
pub p2p_addr: String,
/// Validator DID (required for producer/validator modes).
#[arg(long)]
pub validator_did: Option<String>,
/// Log level (e.g. "info", "debug", "trace").
#[arg(long, default_value = "info")]
pub log_level: String,
/// Genesis file path.
#[arg(long, default_value = "genesis.json")]
pub genesis: String,
/// Expected BLAKE3 state-root hash of the loaded genesis file.
///
/// When set, startup recomputes the canonical genesis hash and refuses to
/// start if it differs. Mainnet chain IDs require this flag so a validator
/// or RPC pod cannot silently boot against stale or tampered genesis data.
#[arg(long)]
pub expected_genesis_hash: Option<String>,
/// Tower coordination chain listen address (Tower mode only).
#[arg(long, default_value = "0.0.0.0:26660")]
pub tower_addr: String,
/// Geographic region for Tower committee diversity (e.g., "us-east", "eu-west").
#[arg(long)]
pub tower_region: Option<String>,
/// Path to a pre-provisioned validator key file (`validator_keys.json`).
///
/// When set, the node reads Ed25519 validator keys from this path instead
/// of the default `<data-dir>/keys/validator_keys.json`. This allows
/// operators to keep key material on an HSM-backed FUSE mount, a sealed
/// volume, or a separate read-only filesystem.
///
/// **Mainnet requirement**: on mainnet (`chain-id` starting with
/// `sigil-mainnet-`) this flag (or a pre-existing key file at the default
/// path) is mandatory. The node will refuse to start without pre-provisioned
/// keys — auto-generation and DID-derived keys are forbidden on mainnet.
///
/// Recommended HSM workflows:
/// - **Software HSM / OpenBao / Vault**: use `vault kv get` to export the
/// key JSON to a tempfs path, mount it read-only, and point this flag at
/// it. Revoke the export token after startup.
/// - **Hardware HSM (YubiHSM / Thales)**: generate the key inside the HSM,
/// export the public components to `validator_keys.json` (keep the private
/// key in the HSM), and adapt `BlockEngine` to call the HSM signing API.
/// - **Sealed file (e.g., Linux Keyring / TPM)**: decrypt the key file at
/// boot via `systemd-creds` or `clevis`, write to a tmpfs path, and pass
/// that path here.
///
/// See `docs/operator/validator-key-provisioning.md` for step-by-step
/// instructions and the audit checklist.
#[arg(long)]
pub validator_key_path: Option<PathBuf>,
/// Snapshot URI to restore before bootstrapping a fresh data directory.
///
/// Supported forms are an unpacked local snapshot directory, a local
/// `.tar`/`.tar.zst` archive, or an HTTP(S) `latest.json` manifest that
/// points to the archive payload. The restored state root is verified
/// against genesis for height 0 snapshots or against the restored canonical
/// block header for height > 0 snapshots.
#[arg(long)]
pub restore_from: Option<String>,
/// Startup state-sync strategy.
#[arg(long, value_enum, default_value_t = StateSyncMode::Off)]
pub state_sync_mode: StateSyncMode,
/// Public snapshot base URL used when `state-sync-mode` is
/// `snapshot-then-p2p-catchup` and `--restore-from` is omitted.
#[arg(long)]
pub snapshot_base_url: Option<String>,
/// Finalized block retention window kept for snapshot restore and
/// state-sync catchup.
#[arg(long, default_value_t = 100_000)]
pub retain_finalized_blocks: u64
}Source line: 217.
::NodeConfig::apply_env_overrides
Apply environment overrides supplied by Kubernetes manifests.
pub fn apply_env_overrides(&mut self) -> Result<(), error::NodeError>;Source line: 321.
::NodeConfig::is_public_production_chain
Returns true for public production/canary chain IDs where validator nodes must not silently fall back to solo block production.
pub fn is_public_production_chain(&self) -> bool;Source line: 349.
::NodeConfig::validate_public_validator_peers
Validate peer configuration for public validator/producer chains.
pub fn validate_public_validator_peers(
&self,
sigil_peers: Option<&str>,
) -> Result<(), error::NodeError>;Source line: 354.
::NodeConfig::effective_restore_uri
Resolve the concrete snapshot URI to restore, if startup should use one.
pub fn effective_restore_uri(&self) -> Option<String>;Source line: 371.
::NodeConfig::requires_validator
Returns true if this mode requires a validator DID.
pub fn requires_validator(&self) -> bool;Source line: 384.
::NodeConfig::requires_zk_prover
Returns true if this mode needs the ZK proving subsystem.
pub fn requires_zk_prover(&self) -> bool;Source line: 394.
::NodeConfig::requires_full_state
Returns true if this mode maintains full state.
pub fn requires_full_state(&self) -> bool;Source line: 399.
::NodeConfig::stores_full_history
Returns true if this mode stores the complete block history.
pub fn stores_full_history(&self) -> bool;Source line: 404.
::NodeConfig::runs_tower_chain
Returns true if this mode participates in the Tower coordination chain.
#[cfg(feature = "tower")]
pub fn runs_tower_chain(&self) -> bool;Source line: 410.
::NodeConfig::is_observer
Returns true if this mode only observes (no consensus participation).
pub fn is_observer(&self) -> bool;Source line: 418.
::NodeConfig::validate
Validate the configuration. Returns an error if the config is inconsistent (e.g. producer mode without a validator DID).
pub fn validate(&self) -> Result<(), error::NodeError>;Source line: 424.
::is_public_production_chain_id
Public networks where validator/producer mode must fail closed without explicit peers.
pub fn is_public_production_chain_id(chain_id: &str) -> bool;Source line: 468.
::peer_config_empty
True when the comma-separated peer config is absent or contains only whitespace/empty entries.
pub fn peer_config_empty(sigil_peers: Option<&str>) -> bool;Source line: 474.
::NodeInfo
Summary of the running node's state.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct NodeInfo {
/// Software version.
pub version: String,
/// Chain ID.
pub chain_id: String,
/// Operating mode.
pub mode: NodeMode,
/// Current block height.
pub current_height: u64,
/// Current epoch number.
pub current_epoch: u64,
/// Number of connected peers.
pub peer_count: usize,
/// Whether the node has finished initial sync.
pub synced: bool,
/// Current Tower slot number (Tower/Validator/Producer modes only).
#[cfg(feature = "tower")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tower_slot: Option<u64>,
/// Latest finalized epoch via Casper FFG (Tower modes only).
#[cfg(feature = "tower")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finalized_epoch: Option<u64>
}Source line: 482.