Skip to content

Commit 150b1bb

Browse files
authored
Merge pull request #930 from openmina/move-out-poseidon
Move poseidon code out of `ledger`
2 parents fd22fa5 + b4256cc commit 150b1bb

Some content is hidden

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

51 files changed

+4453
-3812
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ members = [
2020

2121
"mina-p2p-messages",
2222
"ledger",
23+
"poseidon",
2324

2425
"tools/transport",
2526
"tools/bootstrap-sandbox",
@@ -42,14 +43,15 @@ indexing_slicing = "warn"
4243

4344
[workspace.dependencies]
4445
mina-p2p-messages = { path = "mina-p2p-messages" }
46+
poseidon = { path = "poseidon" }
4547
ledger = { path = "ledger", package = "mina-tree" }
46-
mina-hasher = { git = "https://github.com/openmina/proof-systems", rev = "2fdb5a7" }
47-
mina-signer = { git = "https://github.com/openmina/proof-systems", rev = "2fdb5a7" }
48-
mina-curves = { git = "https://github.com/openmina/proof-systems", rev = "2fdb5a7" }
49-
o1-utils = { git = "https://github.com/openmina/proof-systems", rev = "2fdb5a7" }
50-
kimchi = { git = "https://github.com/openmina/proof-systems", rev = "2fdb5a7" }
51-
mina-poseidon = {git = "https://github.com/openmina/proof-systems", rev = "2fdb5a7"}
52-
poly-commitment = {git = "https://github.com/openmina/proof-systems", rev = "2fdb5a7"}
48+
mina-hasher = { git = "https://github.com/openmina/proof-systems", rev = "d0cd63b" }
49+
mina-signer = { git = "https://github.com/openmina/proof-systems", rev = "d0cd63b" }
50+
mina-curves = { git = "https://github.com/openmina/proof-systems", rev = "d0cd63b" }
51+
o1-utils = { git = "https://github.com/openmina/proof-systems", rev = "d0cd63b" }
52+
kimchi = { git = "https://github.com/openmina/proof-systems", rev = "d0cd63b" }
53+
mina-poseidon = {git = "https://github.com/openmina/proof-systems", rev = "d0cd63b"}
54+
poly-commitment = {git = "https://github.com/openmina/proof-systems", rev = "d0cd63b"}
5355
libp2p = { git = "https://github.com/openmina/rust-libp2p", rev = "5c44c7d9", default-features = false }
5456
vrf = { path = "vrf" }
5557
openmina-node-account = { path = "node/account" }

core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ thiserror = "1.0.37"
2929

3030
mina-hasher = { workspace = true }
3131
mina-p2p-messages = { workspace = true }
32+
poseidon = { workspace = true }
3233
hex = "0.4.3"
3334
ark-ff = { version = "0.3.0", features = [ "parallel", "asm", "std" ] }
3435

core/src/network.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
use once_cell::sync::OnceCell;
2+
use poseidon::hash::{
3+
legacy,
4+
params::{CODA_SIGNATURE, MAINNET_ZKAPP_BODY, MINA_SIGNATURE_MAINNET, TESTNET_ZKAPP_BODY},
5+
};
26

37
use crate::constants::ConstraintConstants;
48

@@ -16,8 +20,9 @@ pub enum NetworkId {
1620
pub struct NetworkConfig {
1721
pub name: &'static str,
1822
pub network_id: NetworkId,
19-
pub signature_prefix: &'static str,
20-
pub account_update_hash_param: &'static str,
23+
pub signature_prefix: &'static poseidon::hash::LazyParam,
24+
pub legacy_signature_prefix: &'static poseidon::hash::LazyParam,
25+
pub account_update_hash_param: &'static poseidon::hash::LazyParam,
2126
pub constraint_system_digests: &'static [[u8; 16]; 3],
2227
pub default_peers: Vec<&'static str>,
2328
pub circuits_config: &'static CircuitsConfig,
@@ -76,8 +81,9 @@ impl NetworkConfig {
7681
Self {
7782
name: mainnet::NAME,
7883
network_id: mainnet::NETWORK_ID,
79-
signature_prefix: mainnet::SIGNATURE_PREFIX,
80-
account_update_hash_param: mainnet::ACCOUNT_UPDATE_HASH_PARAM,
84+
signature_prefix: &MINA_SIGNATURE_MAINNET,
85+
legacy_signature_prefix: &legacy::params::MINA_SIGNATURE_MAINNET,
86+
account_update_hash_param: &MAINNET_ZKAPP_BODY,
8187
constraint_system_digests: &mainnet::CONSTRAINT_SYSTEM_DIGESTS,
8288
default_peers: mainnet::default_peers(),
8389
circuits_config: &mainnet::CIRCUITS_CONFIG,
@@ -89,8 +95,9 @@ impl NetworkConfig {
8995
Self {
9096
name: devnet::NAME,
9197
network_id: devnet::NETWORK_ID,
92-
signature_prefix: devnet::SIGNATURE_PREFIX,
93-
account_update_hash_param: devnet::ACCOUNT_UPDATE_HASH_PARAM,
98+
signature_prefix: &CODA_SIGNATURE,
99+
legacy_signature_prefix: &legacy::params::CODA_SIGNATURE,
100+
account_update_hash_param: &TESTNET_ZKAPP_BODY,
94101
constraint_system_digests: &devnet::CONSTRAINT_SYSTEM_DIGESTS,
95102
default_peers: devnet::default_peers(),
96103
circuits_config: &devnet::CIRCUITS_CONFIG,

ledger/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ kimchi = { workspace = true }
2727
mina-poseidon = { workspace = true }
2828
poly-commitment = { workspace = true }
2929
juniper = { workspace = true }
30+
poseidon = { workspace = true }
3031
openmina-macros = { path = "../macros" }
3132
strum = "0.26.2"
3233
strum_macros = "0.26.4"

0 commit comments

Comments
 (0)