Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ members = [
resolver = "2"

[workspace.dependencies]
mina-p2p-messages = { path = "mina-p2p-messages", features = ["hashing"] }
mina-p2p-messages = { path = "mina-p2p-messages" }
ledger = { path = "ledger", package = "mina-tree" }
mina-hasher = { git = "https://github.com/openmina/proof-systems", branch = "ledger-newtypes-rampup4-vrf" }
mina-signer = { git = "https://github.com/openmina/proof-systems", branch = "ledger-newtypes-rampup4-vrf" }
Expand Down Expand Up @@ -66,13 +66,12 @@ incremental = false
codegen-units = 1

[patch.crates-io]
ark-ff = { git = "https://github.com/openmina/algebra", branch = "openmina" }
ark-ec = { git = "https://github.com/openmina/algebra", branch = "openmina" }
ark-poly = { git = "https://github.com/openmina/algebra", branch = "openmina" }
ark-serialize = { git = "https://github.com/openmina/algebra", branch = "openmina" }
ark-ff = { git = "https://github.com/openmina/algebra", rev = "938e0ff" } # branch: fix-openmina
ark-ec = { git = "https://github.com/openmina/algebra", rev = "938e0ff" } # branch: fix-openmina
ark-poly = { git = "https://github.com/openmina/algebra", rev = "938e0ff" } # branch: fix-openmina
ark-serialize = { git = "https://github.com/openmina/algebra", rev = "938e0ff" } # branch: fix-openmina

[profile.test.package."*"]
opt-level = 3
debug-assertions = true
overflow-checks = false

2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ openmina-fuzzer = { path = "../fuzzer", optional = true }
mina-hasher = { workspace = true }
mina-p2p-messages = { workspace = true }
hex = "0.4.3"
ark-ff = { git = "https://github.com/openmina/algebra", branch = "openmina", features = [ "parallel", "asm", "std" ] }
ark-ff = { version = "0.3.0", features = [ "parallel", "asm", "std" ] }

[target.'cfg(not(target_family = "wasm"))'.dependencies]
redux = { workspace = true, features=["serializable_callbacks"] }
Expand Down
16 changes: 5 additions & 11 deletions core/src/block/block_with_hash.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use ark_ff::fields::arithmetic::InvalidBigInt;
use mina_p2p_messages::v2::{
ConsensusProofOfStakeDataConsensusStateValueStableV2, LedgerHash,
MinaBaseProtocolConstantsCheckedValueStableV1, MinaBaseStagedLedgerHashStableV1,
Expand Down Expand Up @@ -31,11 +32,11 @@ pub struct BlockHeaderWithHash<T: AsRef<BlockHeader>> {
}

impl<T: AsRef<Block>> BlockWithHash<T> {
pub fn new(block: T) -> Self {
Self {
hash: block.as_ref().hash(),
pub fn try_new(block: T) -> Result<Self, InvalidBigInt> {
Ok(Self {
hash: block.as_ref().try_hash()?,
block,
}
})
}

pub fn hash(&self) -> &BlockHash {
Expand Down Expand Up @@ -150,13 +151,6 @@ impl<T: AsRef<Block>> BlockWithHash<T> {
}

impl<T: AsRef<BlockHeader>> BlockHeaderWithHash<T> {
pub fn new(header: T) -> Self {
Self {
hash: header.as_ref().hash(),
header,
}
}

pub fn hash(&self) -> &BlockHash {
&self.hash
}
Expand Down
18 changes: 12 additions & 6 deletions core/src/block/genesis.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use ark_ff::fields::arithmetic::InvalidBigInt;
use mina_p2p_messages::v2::{self, StateHash};

use crate::constants::{constraint_constants, slots_per_window};
Expand All @@ -19,10 +20,14 @@ pub fn genesis_and_negative_one_protocol_states(
staking_epoch_seed: v2::EpochSeed,
next_epoch_seed: v2::EpochSeed,
updated_next_epoch_seed: v2::EpochSeed,
) -> (
v2::MinaStateProtocolStateValueStableV2,
v2::MinaStateProtocolStateValueStableV2,
) {
) -> Result<
(
v2::MinaStateProtocolStateValueStableV2,
v2::MinaStateProtocolStateValueStableV2,
StateHash,
),
InvalidBigInt,
> {
let negative_one = protocol_state(
constants.clone(),
genesis_ledger_hash.clone(),
Expand All @@ -39,7 +44,7 @@ pub fn genesis_and_negative_one_protocol_states(
next_epoch_seed.clone(),
true,
);
let negative_one_hash = negative_one.hash();
let negative_one_hash = negative_one.try_hash()?;
let mut genesis = protocol_state(
constants,
genesis_ledger_hash,
Expand Down Expand Up @@ -68,8 +73,9 @@ pub fn genesis_and_negative_one_protocol_states(
epoch_length: 2.into(),
..genesis.body.consensus_state.next_epoch_data
};
let genesis_hash = genesis.try_hash()?;

(negative_one, genesis)
Ok((negative_one, genesis, genesis_hash))
}

#[allow(clippy::too_many_arguments)]
Expand Down
10 changes: 5 additions & 5 deletions ledger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ poly-commitment = { workspace = true }
openmina-macros = { path = "../macros" }

bs58 = "0.4.0"
mina-p2p-messages = { workspace = true, features = ["hashing"] }
mina-p2p-messages = { workspace = true }

sha2 = "0.10"
base64 = "0.13"
Expand All @@ -42,10 +42,10 @@ libc = "0.2"

itertools = "0.10"

ark-ff = { git = "https://github.com/openmina/algebra", branch = "openmina", features = [ "parallel", "asm", "std" ] }
ark-ec = { git = "https://github.com/openmina/algebra", branch = "openmina", features = [ "std" ] }
ark-serialize = { git = "https://github.com/openmina/algebra", branch = "openmina", features = [ "std" ] }
ark-poly = { git = "https://github.com/openmina/algebra", branch = "openmina", features = [ "std" ] }
ark-ff = { version = "0.3.0", features = [ "parallel", "asm", "std" ] }
ark-ec = { version = "0.3.0", features = [ "std" ] }
ark-serialize = { version = "0.3.0", features = [ "std" ] }
ark-poly = { version = "0.3.0", features = [ "std" ] }

rayon = "1.5"

Expand Down
Loading
Loading