Skip to content

Commit 46c9cc4

Browse files
committed
Ledger/scan_state: use mina_curves::pasta::Fp instead of mina_hasher
1 parent 8061ff3 commit 46c9cc4

File tree

10 files changed

+1389
-1405
lines changed

10 files changed

+1389
-1405
lines changed

ledger/src/scan_state/transaction_logic/local_state.rs

Lines changed: 341 additions & 346 deletions
Large diffs are not rendered by default.

ledger/src/scan_state/transaction_logic/mod.rs

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,7 @@
1-
use std::{
2-
collections::{BTreeMap, HashMap, HashSet},
3-
fmt::Display,
4-
};
5-
6-
use itertools::FoldWhile;
7-
use mina_core::constants::ConstraintConstants;
8-
use mina_hasher::Fp;
9-
use mina_macros::SerdeYojsonEnum;
10-
use mina_p2p_messages::{
11-
bigint::InvalidBigInt,
12-
binprot,
13-
v2::{MinaBaseUserCommandStableV2, MinaTransactionTransactionStableV2},
14-
};
15-
use mina_signer::CompressedPubKey;
16-
use poseidon::hash::{
17-
hash_with_kimchi,
18-
params::{CODA_RECEIPT_UC, MINA_ZKAPP_MEMO},
19-
Inputs,
20-
};
21-
22-
use crate::{
23-
proofs::witness::Witness,
24-
scan_state::transaction_logic::{
25-
transaction_applied::{CommandApplied, Varying},
26-
transaction_partially_applied::FullyApplied,
27-
zkapp_command::MaybeWithStatus,
28-
},
29-
sparse_ledger::{LedgerIntf, SparseLedger},
30-
zkapps,
31-
zkapps::non_snark::{LedgerNonSnark, ZkappNonSnark},
32-
Account, AccountId, AccountIdOrderable, AppendToInputs, BaseLedger, ControlTag,
33-
ReceiptChainHash, Timing, TokenId, VerificationKeyWire,
34-
};
35-
361
use self::{
372
local_state::{
38-
apply_zkapp_command_first_pass, apply_zkapp_command_second_pass, CallStack,
39-
LocalStateEnv, StackFrame,
3+
apply_zkapp_command_first_pass, apply_zkapp_command_second_pass, CallStack, LocalStateEnv,
4+
StackFrame,
405
},
416
protocol_state::{GlobalState, ProtocolStateView},
427
signed_command::{SignedCommand, SignedCommandPayload},
@@ -46,14 +11,47 @@ use self::{
4611
},
4712
zkapp_command::{AccessedOrNot, AccountUpdate, WithHash, ZkAppCommand},
4813
};
49-
5014
use super::{
5115
currency::{Amount, Balance, Fee, Index, Length, Magnitude, Nonce, Signed, Slot},
5216
fee_excess::FeeExcess,
5317
fee_rate::FeeRate,
5418
scan_state::transaction_snark::OneOrTwo,
5519
};
56-
use crate::zkapps::zkapp_logic::ZkAppCommandElt;
20+
use crate::{
21+
proofs::witness::Witness,
22+
scan_state::transaction_logic::{
23+
transaction_applied::{CommandApplied, Varying},
24+
transaction_partially_applied::FullyApplied,
25+
zkapp_command::MaybeWithStatus,
26+
},
27+
sparse_ledger::{LedgerIntf, SparseLedger},
28+
zkapps,
29+
zkapps::{
30+
non_snark::{LedgerNonSnark, ZkappNonSnark},
31+
zkapp_logic::ZkAppCommandElt,
32+
},
33+
Account, AccountId, AccountIdOrderable, AppendToInputs, BaseLedger, ControlTag,
34+
ReceiptChainHash, Timing, TokenId, VerificationKeyWire,
35+
};
36+
use itertools::FoldWhile;
37+
use mina_core::constants::ConstraintConstants;
38+
use mina_curves::pasta::Fp;
39+
use mina_macros::SerdeYojsonEnum;
40+
use mina_p2p_messages::{
41+
bigint::InvalidBigInt,
42+
binprot,
43+
v2::{MinaBaseUserCommandStableV2, MinaTransactionTransactionStableV2},
44+
};
45+
use mina_signer::CompressedPubKey;
46+
use poseidon::hash::{
47+
hash_with_kimchi,
48+
params::{CODA_RECEIPT_UC, MINA_ZKAPP_MEMO},
49+
Inputs,
50+
};
51+
use std::{
52+
collections::{BTreeMap, HashMap, HashSet},
53+
fmt::Display,
54+
};
5755

5856
/// <https://github.com/MinaProtocol/mina/blob/2ee6e004ba8c6a0541056076aab22ea162f7eb3a/src/lib/mina_base/transaction_status.ml#L9>
5957
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
@@ -1034,11 +1032,11 @@ impl From<&Transaction> for MinaTransactionTransactionStableV2 {
10341032
}
10351033
}
10361034

1037-
pub mod transaction_applied;
1038-
pub mod transaction_witness;
1039-
pub mod protocol_state;
10401035
pub mod local_state;
1036+
pub mod protocol_state;
1037+
pub mod transaction_applied;
10411038
pub mod transaction_partially_applied;
1039+
pub mod transaction_witness;
10421040
pub use transaction_partially_applied::{
10431041
apply_transaction_first_pass, apply_transaction_second_pass, apply_transactions,
10441042
apply_user_command, set_with_location, AccountState,

ledger/src/scan_state/transaction_logic/protocol_state.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
use mina_hasher::Fp;
2-
use mina_p2p_messages::{
3-
bigint::InvalidBigInt,
4-
v2::{self, MinaStateProtocolStateValueStableV2},
5-
};
6-
71
use crate::{
82
proofs::field::FieldWitness,
93
scan_state::currency::{Amount, Length, Signed, Slot},
104
sparse_ledger::LedgerIntf,
115
};
6+
use mina_curves::pasta::Fp;
7+
use mina_p2p_messages::{
8+
bigint::InvalidBigInt,
9+
v2::{self, MinaStateProtocolStateValueStableV2},
10+
};
1211

1312
#[derive(Debug, Clone)]
1413
pub struct EpochLedger<F: FieldWitness> {

ledger/src/scan_state/transaction_logic/transaction_applied.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use mina_core::constants::ConstraintConstants;
2-
use mina_hasher::Fp;
2+
use mina_curves::pasta::Fp;
33

44
use crate::{Account, AccountId};
55

0 commit comments

Comments
 (0)