Skip to content

Commit d2fbd55

Browse files
committed
Updated proof system and algebra version
1 parent b131408 commit d2fbd55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+4953
-868
lines changed

Cargo.lock

Lines changed: 418 additions & 308 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,24 @@ ledger = { path = "ledger", package = "mina-tree" }
5050
mina-p2p-messages = { path = "mina-p2p-messages" }
5151
poseidon = { path = "poseidon" }
5252

53-
mina-curves = { git = "https://github.com/openmina/proof-systems", rev = "f461b4b" }
54-
mina-hasher = { git = "https://github.com/openmina/proof-systems", rev = "f461b4b" }
55-
mina-signer = { git = "https://github.com/openmina/proof-systems", rev = "f461b4b" }
56-
# UNCOMMENTED_IN_CI mina-curves = { git = "https://github.com/openmina/proof-systems", rev = "f461b4b", features = [ "32x9" ] }
57-
kimchi = { git = "https://github.com/openmina/proof-systems", rev = "f461b4b" }
58-
mina-poseidon = { git = "https://github.com/openmina/proof-systems", rev = "f461b4b" }
59-
o1-utils = { git = "https://github.com/openmina/proof-systems", rev = "f461b4b" }
60-
poly-commitment = { git = "https://github.com/openmina/proof-systems", rev = "f461b4b" }
53+
# UNCOMMENTED_IN_CI mina-curves = { git = "https://github.com/openmina/proof-systems", branch = "rebase-openmina", features = [ "32x9" ] }
54+
mina-curves = { git = "https://github.com/openmina/proof-systems", branch = "rebase-openmina" }
55+
mina-hasher = { git = "https://github.com/openmina/proof-systems", branch = "rebase-openmina" }
56+
mina-signer = { git = "https://github.com/openmina/proof-systems", branch = "rebase-openmina" }
57+
kimchi = { git = "https://github.com/openmina/proof-systems", branch = "rebase-openmina" }
58+
kimchi-stubs = { git = "https://github.com/openmina/proof-systems", branch = "rebase-openmina" }
59+
mina-poseidon = { git = "https://github.com/openmina/proof-systems", branch = "rebase-openmina" }
60+
o1-utils = { git = "https://github.com/openmina/proof-systems", branch = "rebase-openmina" }
61+
poly-commitment = { git = "https://github.com/openmina/proof-systems", branch = "rebase-openmina" }
62+
63+
# kimchi.path = "../deps/proof-systems/kimchi"
64+
# kimchi-stubs.path = "../deps/proof-systems/kimchi-stubs"
65+
# mina-curves.path = "../deps/proof-systems/curves"
66+
# mina-hasher.path = "../deps/proof-systems/hasher"
67+
# mina-poseidon.path = "../deps/proof-systems/poseidon"
68+
# mina-signer.path = "../deps/proof-systems/signer"
69+
# o1-utils.path = "../deps/proof-systems/utils"
70+
# poly-commitment.path = "../deps/proof-systems/poly-commitment"
6171

6272
juniper = { version = "0.16" }
6373
libp2p = { git = "https://github.com/openmina/rust-libp2p", rev = "5c44c7d9", default-features = false }
@@ -72,8 +82,29 @@ serde_with = { version = "3.7.0", features = ["hex"] }
7282
static_assertions = "1.1.0"
7383
vrf = { path = "vrf" }
7484

75-
ark-ff = { version = "0.3.0", features = ["parallel", "asm", "std"] }
76-
# UNCOMMENTED_IN_CI ark-ff = { version = "0.3.0", features = [ "parallel", "asm", "std", "32x9" ] }
85+
86+
ark-ec = { git = "https://github.com/openmina/algebra", branch = "rebase-fix-openmina-webnode", features = [
87+
"std",
88+
] } # branch: fix-openmina-webnode
89+
ark-ff = { git = "https://github.com/openmina/algebra", branch = "rebase-fix-openmina-webnode", features = [
90+
"parallel",
91+
"asm",
92+
"std",
93+
] } # branch: fix-openmina-webnode
94+
ark-poly = { git = "https://github.com/openmina/algebra", branch = "rebase-fix-openmina-webnode" } # branch: fix-openmina-webnode
95+
ark-serialize = { git = "https://github.com/openmina/algebra", branch = "rebase-fix-openmina-webnode", features = [
96+
"std",
97+
] } # branch: fix-openmina-webnode
98+
# Local
99+
# ark-ec = { path = "../deps/algebra/ec", features = ["std"] }
100+
# ark-ff = { path = "../deps/algebra/ff", features = ["parallel", "asm", "std"] }
101+
# ark-poly = { path = "../deps/algebra/poly", features = ["std"] }
102+
# ark-serialize = { path = "../deps/algebra/serialize" }
103+
104+
num-bigint = { git = "https://github.com/openmina/num-bigint", branch = "rebase-onstack" } # branch: rebase-onstack
105+
# num-bigint.path = "../deps/num-bigint"
106+
107+
# UNCOMMENTED_IN_CI ark-ff = { git = "https://github.com/openmina/algebra", branch = "rebase-fix-openmina-webnode", features = ["parallel", "asm", "std", "32x9" ] }
77108

78109
graphannis-malloc_size_of = { git = "https://github.com/openmina/graphannis-malloc_size_of.git", rev = "f7da9f6" }
79110
graphannis-malloc_size_of_derive = { git = "https://github.com/openmina/graphannis-malloc_size_of_derive.git" }
@@ -92,13 +123,19 @@ incremental = false
92123
codegen-units = 1
93124

94125
[patch.crates-io]
95-
ark-ff = { git = "https://github.com/openmina/algebra", rev = "150ab8d" } # branch: fix-openmina-webnode
96-
ark-ec = { git = "https://github.com/openmina/algebra", rev = "150ab8d" } # branch: fix-openmina-webnode
97-
ark-poly = { git = "https://github.com/openmina/algebra", rev = "150ab8d" } # branch: fix-openmina-webnode
98-
ark-serialize = { git = "https://github.com/openmina/algebra", rev = "150ab8d" } # branch: fix-openmina-webnode
99-
100-
num-bigint = { git = "https://github.com/openmina/num-bigint", rev = "8bb5ee4" } # branch: on-stack
101-
num-rational = { git = "https://github.com/openmina/num-rational", rev = "336f11d" } # branch: on-stack
126+
ark-ff = { git = "https://github.com/openmina/algebra", branch = "rebase-fix-openmina-webnode" } # branch: fix-openmina-webnode
127+
ark-ec = { git = "https://github.com/openmina/algebra", branch = "rebase-fix-openmina-webnode" } # branch: fix-openmina-webnode
128+
ark-poly = { git = "https://github.com/openmina/algebra", branch = "rebase-fix-openmina-webnode" } # branch: fix-openmina-webnode
129+
ark-serialize = { git = "https://github.com/openmina/algebra", branch = "rebase-fix-openmina-webnode" } # branch: fix-openmina-webnode
130+
# ark-ff.path = "../deps/algebra/ff" # branch: fix-openmina-webnode
131+
# ark-ec.path = "../deps/algebra/ec" # branch: fix-openmina-webnode
132+
# ark-poly.path = "../deps/algebra/poly" # branch: fix-openmina-webnode
133+
# ark-serialize.path = "../deps/algebra/serialize" # branch: fix-openmina-webnode
134+
135+
num-bigint = { git = "https://github.com/openmina/num-bigint", branch = "rebase-onstack" } # branch: rebase-onstack
136+
# num-bigint.path = "../deps/num-bigint" # branch: on-stack
137+
num-rational = { git = "https://github.com/openmina/num-rational", branch = "rebase-onstack" } # branch: rebase-onstack
138+
# num-rational.path = "../deps/num-rational" # branch: on-stack
102139

103140
[profile.test.package."*"]
104141
opt-level = 3

core/src/network.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ pub mod devnet {
151151
// ourselves right now, we cannot react to changes in this value,
152152
// so it will be hardcoded for now.
153153
fork: Some(ForkConstants {
154-
state_hash: ark_ff::field_new!(
155-
Fp,
154+
state_hash: ark_ff::MontFp!(
156155
"7908066420535064797069631664846455037440232590837253108938061943122344055350"
157156
),
158157
blockchain_length: 296371,
@@ -231,8 +230,7 @@ pub mod mainnet {
231230
// ourselves right now, we cannot react to changes in this value,
232231
// so it will be hardcoded for now.
233232
fork: Some(ForkConstants {
234-
state_hash: ark_ff::field_new!(
235-
Fp,
233+
state_hash: ark_ff::MontFp!(
236234
"24465973112608446515163575794792913472627621028836869800891179577915755065526"
237235
),
238236
blockchain_length: 359604,

ledger/Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ strum = "0.26.2"
3333
strum_macros = "0.26.4"
3434

3535
bs58 = "0.4.0"
36+
kimchi-stubs = { workspace = true }
3637
mina-p2p-messages = { workspace = true }
3738

3839
base64 = "0.13"
@@ -46,16 +47,16 @@ sha2 = "0.10"
4647

4748
itertools = "0.12"
4849

49-
ark-ec = { version = "0.3.0", features = ["std"] }
50-
ark-ff = { workspace = true }
51-
ark-poly = { version = "0.3.0", features = ["std"] }
52-
ark-serialize = { version = "0.3.0", features = ["std"] }
50+
ark-ec.workspace = true
51+
ark-ff.workspace = true
52+
ark-poly.workspace = true
53+
ark-serialize.workspace = true
5354

5455
rayon = "1.5"
5556

5657
bitvec = "1.0.0"
5758
hex = "0.4.3"
58-
num-bigint = "0.4"
59+
num-bigint.workspace = true
5960

6061
once_cell = "1"
6162
rand = { version = "0.8", features = ["small_rng"] }

ledger/src/account/account.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ impl TokenSymbol {
126126
let mut s = <[u8; 32]>::default();
127127
self.to_bytes(&mut s);
128128

129-
let bigint = BigInteger256::read(&s[..]).unwrap();
129+
let value = FromBytes::read(&s[..]).expect("Shoudn't fail");
130+
let bigint = BigInteger256::new(value);
130131
F::try_from(bigint).unwrap() // Never fail, `self` contain 6 bytes at most
131132
}
132133
}

ledger/src/account/conv.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![allow(clippy::type_complexity)]
22

3-
use ark_ec::short_weierstrass_jacobian::GroupAffine;
3+
use ark_ec::short_weierstrass::Affine;
44
use ark_ff::{fields::arithmetic::InvalidBigInt, Field, PrimeField};
55
use mina_curves::pasta::Fp;
66
use mina_p2p_messages::{
@@ -82,7 +82,7 @@ where
8282
F: Field + Into<BigInt>,
8383
{
8484
fn from(fps: InnerCurve<F>) -> Self {
85-
let GroupAffine { x, y, .. } = fps.to_affine();
85+
let Affine { x, y, .. } = fps.to_affine();
8686
(x.into(), y.into())
8787
}
8888
}
@@ -106,7 +106,7 @@ where
106106
F: Field + Into<BigInt>,
107107
{
108108
fn from(fps: &InnerCurve<F>) -> Self {
109-
let GroupAffine { x, y, .. } = fps.to_affine();
109+
let Affine { x, y, .. } = fps.to_affine();
110110
(x.into(), y.into())
111111
}
112112
}
@@ -667,7 +667,7 @@ impl From<AccountIndex> for MinaBaseAccountIndexStableV1 {
667667

668668
impl From<ReceiptChainHash> for mina_p2p_messages::v2::ReceiptChainHash {
669669
fn from(value: ReceiptChainHash) -> Self {
670-
MinaBaseReceiptChainHashStableV1(value.0.into_repr().into()).into()
670+
MinaBaseReceiptChainHashStableV1(value.0.into_bigint().into()).into()
671671
}
672672
}
673673

ledger/src/cache.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ macro_rules! cache_one {
6868

6969
#[cfg(test)]
7070
mod tests {
71-
use crate::proofs::field::FieldWitness;
72-
use ark_ec::short_weierstrass_jacobian::GroupAffine;
73-
use poly_commitment::srs::endos;
71+
use crate::proofs::{self, field::FieldWitness};
72+
use ark_ec::short_weierstrass::Affine;
73+
use poly_commitment::ipa::endos;
7474
use std::sync::atomic::{AtomicUsize, Ordering::Relaxed};
7575

7676
#[cfg(target_family = "wasm")]
@@ -82,10 +82,10 @@ mod tests {
8282

8383
static COUNTER: AtomicUsize = AtomicUsize::new(0);
8484

85-
fn my_test<F: FieldWitness>() -> (F, F::Scalar) {
86-
cache!((F, F::Scalar), {
85+
fn my_test<F: FieldWitness>() -> (F, <F as proofs::field::FieldWitness>::Scalar) {
86+
cache!((F, <F as proofs::field::FieldWitness>::Scalar), {
8787
COUNTER.fetch_add(1, Relaxed);
88-
endos::<GroupAffine<F::Parameters>>()
88+
endos::<Affine<F::Parameters>>()
8989
})
9090
}
9191

ledger/src/port_ocaml/hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn hash_field(f: &Fp) -> u32 {
9191
let mut acc = 0;
9292

9393
let bigint: BigInteger256 = (*f).into();
94-
let bigint = bigint.to_64x4();
94+
let bigint = bigint.0;
9595
let nignore: usize = bigint.iter().rev().take_while(|&b| *b == 0).count();
9696

9797
for bigint in bigint.iter().take(BigInteger256::NUM_LIMBS - nignore) {

ledger/src/poseidon/fp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ mod tests {
562562
let mina_fp = mina_curves::pasta::Fp::from_str(s).unwrap();
563563
assert_eq!(fp.0, mina_fp.0 .0);
564564

565-
assert_eq!(fp.into_repr(), mina_fp.into_repr().0)
565+
assert_eq!(fp.into_bigint(), mina_fp.into_bigint().0)
566566
}
567567

568568
for chunk in CONSTANTS.chunks(2) {

ledger/src/proofs/accumulator_check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use ark_ff::fields::arithmetic::InvalidBigInt;
22
use mina_curves::pasta::{Fp, Vesta};
33
use mina_p2p_messages::{bigint::BigInt, v2::PicklesProofProofsVerified2ReprStableV2};
4-
use poly_commitment::{commitment::CommitmentCurve, srs::SRS};
4+
use poly_commitment::{commitment::CommitmentCurve, ipa::SRS};
55

66
use super::{public_input::scalar_challenge::ScalarChallenge, urs_utils};
77

0 commit comments

Comments
 (0)