Skip to content

Commit 04800c5

Browse files
Formatting
1 parent 5088bba commit 04800c5

File tree

21 files changed

+74
-74
lines changed

21 files changed

+74
-74
lines changed

crates/ledger/src/account/account.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
use crate::{
22
gen_compressed,
3+
hash::{
4+
hash_noinputs, hash_with_kimchi,
5+
params::{
6+
get_merkle_param_for_height, MINA_ACCOUNT, MINA_DERIVE_TOKEN_ID, MINA_SIDELOADED_VK,
7+
MINA_ZKAPP_ACCOUNT, MINA_ZKAPP_URI, NO_INPUT_ZKAPP_ACTION_STATE_EMPTY_ELT,
8+
},
9+
Inputs,
10+
},
311
proofs::{
412
field::{Boolean, FieldWitness, ToBoolean},
513
numbers::{
@@ -26,14 +34,6 @@ use mina_p2p_messages::{
2634
};
2735
use mina_signer::CompressedPubKey;
2836
use once_cell::sync::{Lazy, OnceCell};
29-
use crate::hash::{
30-
hash_noinputs, hash_with_kimchi,
31-
params::{
32-
get_merkle_param_for_height, MINA_ACCOUNT, MINA_DERIVE_TOKEN_ID, MINA_SIDELOADED_VK,
33-
MINA_ZKAPP_ACCOUNT, MINA_ZKAPP_URI, NO_INPUT_ZKAPP_ACTION_STATE_EMPTY_ELT,
34-
},
35-
Inputs,
36-
};
3737
use rand::{prelude::ThreadRng, seq::SliceRandom, Rng};
3838
use serde::{Deserialize, Serialize};
3939
use std::{io::Cursor, str::FromStr, sync::Arc};

crates/ledger/src/hash.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use crate::{proofs::witness::Witness, scan_state::currency};
55
use mina_hasher::{DomainParameter, Hashable, Hasher, ROInput};
66
use mina_poseidon::{
77
constants::PlonkSpongeConstantsKimchi,
8+
pasta::FULL_ROUNDS,
89
poseidon::{ArithmeticSponge, Sponge},
910
};
10-
use mina_poseidon::pasta::FULL_ROUNDS;
1111

1212
#[derive(Clone)]
1313
pub struct CustomDomain(pub String);
@@ -221,8 +221,7 @@ pub fn hash_fields_fq(fields: &[Fq]) -> Fq {
221221
}
222222

223223
pub fn hash_noinputs(domain: &str) -> Fp {
224-
mina_hasher::create_kimchi::<GenericHashable>(CustomDomain(domain.to_string()))
225-
.digest()
224+
mina_hasher::create_kimchi::<GenericHashable>(CustomDomain(domain.to_string())).digest()
226225
}
227226

228227
#[derive(Clone)]

crates/ledger/src/proofs/block.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use std::{rc::Rc, sync::Arc};
22

3+
use crate::hash::{
4+
params::{MINA_PROTO_STATE, MINA_PROTO_STATE_BODY},
5+
Inputs,
6+
};
37
use anyhow::Context;
48
use consensus::ConsensusState;
59
use mina_core::constants::{constraint_constants, ForkConstants};
610
use mina_curves::pasta::{Fp, Fq};
711
use mina_p2p_messages::{bigint::InvalidBigInt, v2};
8-
use crate::hash::{
9-
params::{MINA_PROTO_STATE, MINA_PROTO_STATE_BODY},
10-
Inputs,
11-
};
1212

1313
use crate::{
1414
dummy,
@@ -609,8 +609,8 @@ mod snarky_taylor {
609609
mod vrf {
610610
use std::ops::Neg;
611611

612-
use mina_signer::{CompressedPubKey, PubKey};
613612
use crate::hash::params::{MINA_VRF_MESSAGE, MINA_VRF_OUTPUT};
613+
use mina_signer::{CompressedPubKey, PubKey};
614614

615615
use crate::{
616616
checked_verify_merkle_path,
@@ -814,9 +814,9 @@ mod vrf {
814814
}
815815

816816
pub mod consensus {
817+
use crate::hash::params::MINA_EPOCH_SEED;
817818
use ark_ff::Zero;
818819
use mina_signer::CompressedPubKey;
819-
use crate::hash::params::MINA_EPOCH_SEED;
820820

821821
use super::{vrf::VRF_OUTPUT_NBITS, *};
822822
use crate::{

crates/ledger/src/proofs/field.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use mina_poseidon::{
99
constants::PlonkSpongeConstantsKimchi, pasta::FULL_ROUNDS, sponge::DefaultFqSponge,
1010
};
1111

12-
1312
use crate::proofs;
1413

1514
use super::{

crates/ledger/src/proofs/public_input/protocol_state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ use mina_curves::pasta::Fp;
22
use mina_p2p_messages::v2::MinaBaseProtocolConstantsCheckedValueStableV1;
33

44
use crate::{
5+
hash::Inputs,
56
proofs::block::{
67
consensus::{CheckedConsensusState, ConsensusState},
78
ProtocolStateBody,
89
},
910
scan_state::transaction_logic::protocol_state::{EpochData, EpochLedger},
1011
AppendToInputs as _, ToInputs,
1112
};
12-
use crate::hash::Inputs;
1313

1414
impl ToInputs for crate::proofs::block::BlockchainState {
1515
fn to_inputs(&self, inputs: &mut Inputs) {

crates/ledger/src/proofs/step.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ use kimchi::proof::{PointEvaluations, ProverCommitments, RecursionChallenge};
4545
use mina_curves::pasta::{Fp, Fq, Pallas, VestaParameters};
4646
use mina_p2p_messages::{bigint::InvalidBigInt, v2};
4747
use mina_poseidon::{
48-
constants::PlonkSpongeConstantsKimchi, pasta::FULL_ROUNDS, poseidon::{ArithmeticSponge, Sponge},
49-
sponge::DefaultFqSponge, FqSponge,
48+
constants::PlonkSpongeConstantsKimchi,
49+
pasta::FULL_ROUNDS,
50+
poseidon::{ArithmeticSponge, Sponge},
51+
sponge::DefaultFqSponge,
52+
FqSponge,
5053
};
5154
use poly_commitment::{commitment::b_poly_coefficients, ipa::OpeningProof};
5255
use std::rc::Rc;
@@ -2011,9 +2014,10 @@ pub fn expand_deferred(params: ExpandDeferredParams) -> anyhow::Result<DeferredV
20112014
sponge.squeeze()
20122015
};
20132016

2014-
let mut sponge = DefaultFqSponge::<VestaParameters, PlonkSpongeConstantsKimchi, FULL_ROUNDS>::new(
2015-
mina_poseidon::pasta::fq_kimchi::static_params(),
2016-
);
2017+
let mut sponge =
2018+
DefaultFqSponge::<VestaParameters, PlonkSpongeConstantsKimchi, FULL_ROUNDS>::new(
2019+
mina_poseidon::pasta::fq_kimchi::static_params(),
2020+
);
20172021
sponge.absorb_fq(&to_fqs(&[four_u64_to_field(
20182022
&proof_state.sponge_digest_before_evaluations,
20192023
)?]));
@@ -2707,18 +2711,10 @@ pub struct StepProof {
27072711
}
27082712

27092713
fn to_fqs(fps: &[Fp]) -> Vec<Fq> {
2710-
27112714
fps.iter().map(|fp| Fq::from((*fp).into_bigint())).collect()
2712-
27132715
}
27142716

2715-
2716-
2717-
2718-
2719-
pub fn step<
2720-
2721-
C: ProofConstants, const N_PREVIOUS: usize>(
2717+
pub fn step<C: ProofConstants, const N_PREVIOUS: usize>(
27222718
params: StepParams<N_PREVIOUS>,
27232719
w: &mut Witness<Fp>,
27242720
) -> anyhow::Result<StepProof> {

crates/ledger/src/proofs/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2398,6 +2398,7 @@ pub mod transaction_snark {
23982398
use crate::{
23992399
checked_equal_compressed_key, checked_equal_compressed_key_const_and,
24002400
checked_verify_merkle_path,
2401+
hash::Inputs,
24012402
proofs::{
24022403
block::ProtocolStateBody,
24032404
numbers::{
@@ -2416,7 +2417,6 @@ pub mod transaction_snark {
24162417
zkapps::interfaces::{SignedAmountBranchParam, SignedAmountInterface},
24172418
AccountId, PermissionTo, PermsConst, Timing, TimingAsRecordChecked, ToInputs,
24182419
};
2419-
use crate::hash::Inputs;
24202420
use ark_ff::Zero;
24212421

24222422
use crate::scan_state::{

crates/ledger/src/proofs/zkapp.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use std::{cell::RefCell, rc::Rc};
22

3+
use crate::hash::{
4+
hash_with_kimchi,
5+
params::{MINA_ACCOUNT_UPDATE_CONS, MINA_PROTO_STATE_BODY},
6+
};
37
use ark_ff::{BigInteger256, Zero};
48
use kimchi::proof::PointEvaluations;
59
use mina_curves::pasta::{Fp, Fq};
610
use mina_p2p_messages::{bigint::InvalidBigInt, v2};
711
use poly_commitment::ipa::OpeningProof;
8-
use crate::hash::{
9-
hash_with_kimchi,
10-
params::{MINA_ACCOUNT_UPDATE_CONS, MINA_PROTO_STATE_BODY},
11-
};
1212

1313
use crate::{
1414
proofs::{
@@ -961,9 +961,8 @@ fn check_protocol_state(params: CheckProtocolStateParams, w: &mut Witness<Fp>) {
961961
state_body,
962962
} = params;
963963

964-
let state_body_hash = state_body.checked_hash_with_param(MINA_PROTO_STATE_BODY, w);
964+
let state_body_hash = state_body.checked_hash_with_param(MINA_PROTO_STATE_BODY, w);
965965

966-
967966
let global_slot = block_global_slot;
968967
let computed_pending_coinbase_stack_after =
969968
pending_coinbase_stack_init.checked_push_state(state_body_hash, global_slot, w);

crates/ledger/src/scan_state/fee_excess.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
//! Port of the implementation from:
3232
//! <https://github.com/MinaProtocol/mina/blob/2ee6e004ba8c6a0541056076aab22ea162f7eb3a/src/lib/mina_base/fee_excess.ml#L1>
3333
34+
use crate::hash::Inputs;
3435
use ark_ff::{BigInteger, BigInteger256, Zero};
3536
use mina_curves::pasta::Fp;
36-
use crate::hash::Inputs;
3737

3838
use crate::{
3939
proofs::{

crates/ledger/src/scan_state/pending_coinbase.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
/// Stack operations are done for transaction snarks and tree operations are done for the blockchain snark*)
2121
use std::{collections::HashMap, fmt::Write, marker::PhantomData};
2222

23-
use ark_ff::Zero;
24-
use mina_core::constants::constraint_constants;
25-
use mina_curves::pasta::Fp;
26-
use mina_p2p_messages::bigint::InvalidBigInt;
27-
use mina_signer::CompressedPubKey;
2823
use crate::hash::{
2924
hash_noinputs, hash_with_kimchi,
3025
params::{
3126
get_coinbase_param_for_height, COINBASE_STACK, MINA_PROTO_STATE, NO_INPUT_COINBASE_STACK,
3227
},
3328
Inputs,
3429
};
30+
use ark_ff::Zero;
31+
use mina_core::constants::constraint_constants;
32+
use mina_curves::pasta::Fp;
33+
use mina_p2p_messages::bigint::InvalidBigInt;
34+
use mina_signer::CompressedPubKey;
3535
use sha2::{Digest, Sha256};
3636

3737
use crate::{

0 commit comments

Comments
 (0)