Skip to content

Commit a82fd67

Browse files
committed
Document Mina verifier
1 parent 8755559 commit a82fd67

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

operator/mina/lib/src/consensus_state.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ const GRACE_PERIOD_END: u32 = 1440;
1313
const SUB_WINDOWS_PER_WINDOW: u32 = 11;
1414
const SLOTS_PER_SUB_WINDOW: u32 = 7;
1515

16+
/// The result of the comparison of security between chains done in the `select_secure_chain`
17+
/// function.
1618
#[derive(Debug, PartialEq)]
1719
pub enum ChainResult {
1820
Bridge,
1921
Candidate,
2022
}
2123

24+
/// Given two Mina chains, `candidate` and `tip`, returns an enum variant `ChainResult` that
25+
/// indicates which chain is more secure.
26+
/// Returns `ChainResult::Bridge` if `tip` is the most secure chain. `ChainResult::Candidate`
27+
/// otherwise.
2228
pub fn select_secure_chain(
2329
candidate: &MinaProtocolState,
2430
tip: &MinaProtocolState,

operator/mina/lib/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ fn inner_verify_mina_state_ffi(
7575
verify_mina_state(proof_bytes, pub_input_bytes)
7676
}
7777

78+
/// Verifies that the Mina state included in `proof_bytes` is valid.
79+
/// This includes checking that:
80+
///
81+
/// - The Mina state corresponds to the tip of the most secure chain
82+
/// - The corresponding Pickles proof is valid
7883
pub fn verify_mina_state(proof_bytes: &[u8], pub_input_bytes: &[u8]) -> bool {
7984
let proof: MinaStateProof = match bincode::deserialize(proof_bytes) {
8085
Ok(proof) => proof,

0 commit comments

Comments
 (0)