Skip to content

Commit 17adba3

Browse files
committed
Make verifier index static
1 parent dcafb63 commit 17adba3

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

operator/mina/lib/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

operator/mina/lib/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ mina-tree = { git = "https://github.com/lambdaclass/openmina/", branch = "mina_b
2121
mina-p2p-messages = { git = "https://github.com/lambdaclass/openmina/", branch = "mina_bridge" }
2222
base64 = "0.22.1"
2323
bs58 = "0.5.1"
24+
lazy_static = "1.5.0"
2425

2526
[patch.crates-io]
2627
ark-ff = { git = "https://github.com/openmina/algebra", branch = "openmina" }

operator/mina/lib/src/lib.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
use std::str::FromStr;
22

3+
use ark_ec::short_weierstrass_jacobian::GroupAffine;
34
use base64::prelude::*;
4-
use kimchi::mina_curves::pasta::Fp;
5+
use kimchi::mina_curves::pasta::{Fp, PallasParameters};
6+
use kimchi::verifier_index::VerifierIndex;
7+
use lazy_static::lazy_static;
58
use mina_p2p_messages::binprot::BinProtRead;
69
use mina_p2p_messages::v2::{MinaBaseProofStableV2, StateHash};
710
use mina_tree::proofs::verification::verify_block;
811
use mina_tree::proofs::verifier_index::{get_verifier_index, VerifierKind};
912
use mina_tree::verifier::get_srs;
1013

14+
lazy_static! {
15+
static ref VERIFIER_INDEX: VerifierIndex<GroupAffine<PallasParameters>> =
16+
get_verifier_index(VerifierKind::Blockchain);
17+
}
18+
1119
// TODO(xqft): check proof size
1220
const MAX_PROOF_SIZE: usize = 16 * 1024;
1321
const MAX_PUB_INPUT_SIZE: usize = 1024;
@@ -46,14 +54,15 @@ pub extern "C" fn verify_protocol_state_proof_ffi(
4654
return false;
4755
};
4856

49-
let verifier_index = get_verifier_index(VerifierKind::Blockchain);
57+
// TODO(xqft): srs should be a static, but can't make it so because it doesn't have all its
58+
// parameters initialized.
5059
let srs = get_srs::<Fp>();
5160
let srs = srs.lock().unwrap();
5261

5362
verify_block(
5463
&protocol_state_proof,
5564
protocol_state_hash,
56-
&verifier_index,
65+
&VERIFIER_INDEX,
5766
&srs,
5867
)
5968
}

0 commit comments

Comments
 (0)