sigil-zk · fallback
Source declarations, signatures and documentation for fallback.
Source: sigil/node/sigil-zk/src/fallback.rs. SHA-256: 297b18fb1a75e5f56a285e85cdf3be06cc859a64d24a7c1c0fcec18b99972d8a.
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.
fallback::HashCommitmentProver
Hash-commitment prover (fallback when full ZK is unavailable).
Generates [HashCommitmentProof] by hashing the execution trace
and state transition data, then signing the commitment with Ed25519.
The prover's DID is included for attribution.
#[derive(Debug, Clone)]
pub struct HashCommitmentProver {
/// OAS DID of the prover (Block Producer).
pub prover_did: String
}Source line: 35.
fallback::HashCommitmentProver::new
Create a new hash-commitment prover with the given prover DID and Ed25519 signing key.
pub fn new(prover_did: String, signing_key: ed25519_dalek::SigningKey) -> Self;Source line: 44.
fallback::HashCommitmentProver::generate_commitment
Generate a hash-commitment "proof" for a block.
This hashes the block body as an execution trace commitment and combines the pre/post state roots with the tx root as a state transition commitment. The resulting hashes are signed with the prover's Ed25519 key for cryptographic attribution.
This is not a ZK proof but provides a verifiable, signed commitment to specific execution outcomes.
pub fn generate_commitment(
&self,
block: &Block,
pre_state_root: SigilHash,
post_state_root: SigilHash,
) -> Result<HashCommitmentProof, ZkError>;Source line: 60.
fallback::HashCommitmentVerifier
Hash-commitment verifier.
Verifies that a [HashCommitmentProof] is internally consistent with
the given block data and state roots, and that the Ed25519 signature is
valid. This checks that the hashes were computed correctly and the prover
signed them, but does not verify that the block was executed correctly
(that requires a real ZK proof or re-execution).
#[derive(Debug, Clone, Default)]
pub struct HashCommitmentVerifier;Source line: 104.
fallback::HashCommitmentVerifier::new
Create a new hash-commitment verifier.
pub fn new() -> Self;Source line: 108.
fallback::HashCommitmentVerifier::verify_commitment
Verify a hash commitment against a block.
Checks:
- The block height in the proof matches the block.
- The execution trace hash matches the serialized block body.
- The state transition hash matches (pre_root || post_root || tx_root).
- The prover signature is exactly 64 bytes (Ed25519).
- The Ed25519 signature verifies against the provided public key.
Parameters
proof: The hash commitment proof to verify.block: The block to verify against.pre_state_root: State root before executing the block.post_state_root: State root after executing the block.verifying_key: The Ed25519 public key of the claimed prover.
Returns
Ok(true) if all checks pass, Ok(false) if hashes don't match,
or Err if the proof structure is invalid or signature verification fails.
pub fn verify_commitment(
&self,
proof: &HashCommitmentProof,
block: &Block,
pre_state_root: SigilHash,
post_state_root: SigilHash,
verifying_key: &ed25519_dalek::VerifyingKey,
) -> Result<bool, ZkError>;Source line: 131.