@@ -14,8 +14,7 @@ use openmina_macros::SerdeYojsonEnum;
14
14
use crate :: proofs:: witness:: Witness ;
15
15
use crate :: scan_state:: transaction_logic:: transaction_partially_applied:: FullyApplied ;
16
16
use crate :: scan_state:: transaction_logic:: zkapp_command:: MaybeWithStatus ;
17
- use crate :: zkapps:: intefaces:: LedgerInterface ;
18
- use crate :: zkapps:: non_snark:: ZkappNonSnark ;
17
+ use crate :: zkapps:: non_snark:: { LedgerNonSnark , ZkappNonSnark } ;
19
18
use crate :: {
20
19
hash_with_kimchi, zkapps, AccountIdOrderable , BaseLedger , ControlTag , Inputs ,
21
20
VerificationKeyWire ,
@@ -5624,7 +5623,7 @@ pub mod local_state {
5624
5623
5625
5624
// impl<L> LocalStateEnv<L>
5626
5625
// where
5627
- // L: LedgerInterface<W = (), Bool = bool, Account = Account, AccountUpdate = AccountUpdate> ,
5626
+ // L: LedgerNonSnark ,
5628
5627
// {
5629
5628
// pub fn add_new_failure_status_bucket(&self) -> Self {
5630
5629
// let mut failure_status_tbl = self.failure_status_tbl.clone();
@@ -5805,114 +5804,14 @@ pub mod local_state {
5805
5804
}
5806
5805
}
5807
5806
5808
- // let equal' (t1 : t) (t2 : t) =
5809
- // let ( ! ) f x y = Impl.run_checked (f x y) in
5810
- // let f eq acc f = Core_kernel.Field.(eq (get f t1) (get f t2)) :: acc in
5811
- // Mina_transaction_logic.Zkapp_command_logic.Local_state.Fields.fold ~init:[]
5812
- // ~stack_frame:(f Stack_frame.Digest.Checked.equal)
5813
- // ~call_stack:(f Call_stack_digest.Checked.equal)
5814
- // ~transaction_commitment:(f Field.equal)
5815
- // ~full_transaction_commitment:(f Field.equal)
5816
- // ~excess:(f !Currency.Amount.Signed.Checked.equal)
5817
- // ~supply_increase:(f !Currency.Amount.Signed.Checked.equal)
5818
- // ~ledger:(f !Ledger_hash.equal_var) ~success:(f Impl.Boolean.equal)
5819
- // ~account_update_index:(f !Mina_numbers.Index.Checked.equal)
5820
- // ~failure_status_tbl:(f (fun () () -> Impl.Boolean.true_))
5821
- // ~will_succeed:(f Impl.Boolean.equal)
5822
-
5823
- pub enum Eff <
5824
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
5825
- > {
5826
- CheckValidWhilePrecondition ( Numeric < Slot > , GlobalState < L > ) ,
5827
- CheckAccountPrecondition ( AccountUpdate , Account , bool , LocalStateEnv < L > ) ,
5828
- CheckProtocolStatePrecondition ( Box < ZkAppPreconditions > , GlobalState < L > ) ,
5829
- InitAccount ( AccountUpdate , Account ) ,
5830
- }
5831
-
5832
- pub struct Env <
5833
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
5834
- > {
5835
- account_update : AccountUpdate ,
5836
- zkapp_command : ZkAppCommand ,
5837
- account : Account ,
5838
- ledger : L ,
5839
- amount : Amount ,
5840
- signed_amount : Signed < Amount > ,
5841
- bool : bool ,
5842
- token_id : TokenId ,
5843
- global_state : GlobalState < L > ,
5844
- local_state : LocalStateEnv < L > ,
5845
- protocol_state_precondition : ZkAppPreconditions ,
5846
- valid_while_precondition : Numeric < Slot > ,
5847
- transaction_commitment : Fp ,
5848
- full_transaction_commitment : Fp ,
5849
- field : Fp ,
5850
- failure : Option < TransactionFailure > ,
5851
- }
5852
-
5853
- pub enum PerformResult <
5854
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
5855
- > {
5856
- Bool ( bool ) ,
5857
- LocalState ( Box < LocalStateEnv < L > > ) ,
5858
- Account ( Box < Account > ) ,
5859
- }
5860
-
5861
- impl < L > PerformResult < L >
5862
- where
5863
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
5864
- {
5865
- pub fn to_bool ( self ) -> bool {
5866
- match self {
5867
- PerformResult :: Bool ( v) => v,
5868
- _ => panic ! ( "Not a bool" ) ,
5869
- }
5870
- }
5871
- }
5872
-
5873
- // impl<L> Env<L>
5874
- // where
5875
- // L: LedgerInterface<W = (), Bool = bool, Account = Account, AccountUpdate = AccountUpdate>,
5876
- // {
5877
- // pub fn perform(eff: Eff<L>) -> PerformResult<L> {
5878
- // match eff {
5879
- // Eff::CheckValidWhilePrecondition(valid_while, global_state) => PerformResult::Bool(
5880
- // valid_while
5881
- // .out_zcheck(
5882
- // || "valid_while_precondition".to_string(),
5883
- // &global_state.block_global_slot,
5884
- // )
5885
- // .is_ok(),
5886
- // ),
5887
- // Eff::CheckProtocolStatePrecondition(pred, global_state) => {
5888
- // PerformResult::Bool(pred.out_zcheck(&global_state.protocol_state).is_ok())
5889
- // }
5890
- // Eff::CheckAccountPrecondition(account_update, account, new_account, local_state) => {
5891
- // let local_state = {
5892
- // let precondition_account = &account_update.body.preconditions.account.0;
5893
- // let mut _local_state = local_state;
5894
- // let check = |failure, b| {
5895
- // _local_state = _local_state.add_check(failure, b);
5896
- // };
5897
- // precondition_account.out_zcheck(new_account, check, &account);
5898
- // _local_state
5899
- // };
5900
- // PerformResult::LocalState(Box::new(local_state))
5901
- // }
5902
- // Eff::InitAccount(_account_update, a) => PerformResult::Account(Box::new(a)),
5903
- // }
5904
- // }
5905
- // }
5906
-
5907
5807
fn step_all < A , L > (
5908
5808
_constraint_constants : & ConstraintConstants ,
5909
5809
f : & impl Fn ( A , ( & GlobalState < L > , & LocalStateEnv < L > ) ) -> A ,
5910
- // handler: &Handler<L>,
5911
5810
mut user_acc : A ,
5912
5811
( g_state, l_state) : ( & mut GlobalState < L > , & mut LocalStateEnv < L > ) ,
5913
5812
) -> Result < ( A , Vec < Vec < TransactionFailure > > ) , String >
5914
5813
where
5915
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
5814
+ L : LedgerNonSnark ,
5916
5815
{
5917
5816
while !l_state. stack_frame . calls . is_empty ( ) {
5918
5817
zkapps:: non_snark:: step ( g_state, l_state) ?;
@@ -5936,7 +5835,7 @@ pub fn apply_zkapp_command_first_pass_aux<A, F, L>(
5936
5835
command : & ZkAppCommand ,
5937
5836
) -> Result < ( ZkappCommandPartiallyApplied < L > , A ) , String >
5938
5837
where
5939
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
5838
+ L : LedgerNonSnark ,
5940
5839
F : Fn ( A , ( & GlobalState < L > , & LocalStateEnv < L > ) ) -> A ,
5941
5840
{
5942
5841
let fee_excess = fee_excess. unwrap_or_else ( Signed :: zero) ;
@@ -6025,7 +5924,7 @@ fn apply_zkapp_command_first_pass<L>(
6025
5924
command : & ZkAppCommand ,
6026
5925
) -> Result < ZkappCommandPartiallyApplied < L > , String >
6027
5926
where
6028
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
5927
+ L : LedgerNonSnark ,
6029
5928
{
6030
5929
let ( partial_stmt, _user_acc) = apply_zkapp_command_first_pass_aux (
6031
5930
constraint_constants,
@@ -6050,7 +5949,7 @@ pub fn apply_zkapp_command_second_pass_aux<A, F, L>(
6050
5949
c : ZkappCommandPartiallyApplied < L > ,
6051
5950
) -> Result < ( ZkappCommandApplied , A ) , String >
6052
5951
where
6053
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
5952
+ L : LedgerNonSnark ,
6054
5953
F : Fn ( A , ( & GlobalState < L > , & LocalStateEnv < L > ) ) -> A ,
6055
5954
{
6056
5955
// let perform = |eff: Eff<L>| Env::perform(eff);
@@ -6236,7 +6135,7 @@ fn apply_zkapp_command_second_pass<L>(
6236
6135
c : ZkappCommandPartiallyApplied < L > ,
6237
6136
) -> Result < ZkappCommandApplied , String >
6238
6137
where
6239
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
6138
+ L : LedgerNonSnark ,
6240
6139
{
6241
6140
let ( x, _) =
6242
6141
apply_zkapp_command_second_pass_aux ( constraint_constants, ( ) , |a, _| a, ledger, c) ?;
@@ -6255,7 +6154,7 @@ fn apply_zkapp_command_unchecked_aux<A, F, L>(
6255
6154
command : & ZkAppCommand ,
6256
6155
) -> Result < ( ZkappCommandApplied , A ) , String >
6257
6156
where
6258
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
6157
+ L : LedgerNonSnark ,
6259
6158
F : Fn ( A , ( & GlobalState < L > , & LocalStateEnv < L > ) ) -> A ,
6260
6159
{
6261
6160
let ( partial_stmt, user_acc) = apply_zkapp_command_first_pass_aux (
@@ -6281,7 +6180,7 @@ fn apply_zkapp_command_unchecked<L>(
6281
6180
command : & ZkAppCommand ,
6282
6181
) -> Result < ( ZkappCommandApplied , ( LocalStateEnv < L > , Signed < Amount > ) ) , String >
6283
6182
where
6284
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
6183
+ L : LedgerNonSnark ,
6285
6184
{
6286
6185
let zkapp_partially_applied: ZkappCommandPartiallyApplied < L > = apply_zkapp_command_first_pass (
6287
6186
constraint_constants,
@@ -6312,9 +6211,7 @@ pub mod transaction_partially_applied {
6312
6211
} ;
6313
6212
6314
6213
#[ derive( Clone , Debug ) ]
6315
- pub struct ZkappCommandPartiallyApplied <
6316
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
6317
- > {
6214
+ pub struct ZkappCommandPartiallyApplied < L : LedgerNonSnark > {
6318
6215
pub command : ZkAppCommand ,
6319
6216
pub previous_hash : Fp ,
6320
6217
pub original_first_pass_account_states :
@@ -6332,9 +6229,7 @@ pub mod transaction_partially_applied {
6332
6229
}
6333
6230
6334
6231
#[ derive( Clone , Debug ) ]
6335
- pub enum TransactionPartiallyApplied <
6336
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
6337
- > {
6232
+ pub enum TransactionPartiallyApplied < L : LedgerNonSnark > {
6338
6233
SignedCommand ( FullyApplied < SignedCommandApplied > ) ,
6339
6234
ZkappCommand ( Box < ZkappCommandPartiallyApplied < L > > ) ,
6340
6235
FeeTransfer ( FullyApplied < FeeTransferApplied > ) ,
@@ -6343,7 +6238,7 @@ pub mod transaction_partially_applied {
6343
6238
6344
6239
impl < L > TransactionPartiallyApplied < L >
6345
6240
where
6346
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
6241
+ L : LedgerNonSnark ,
6347
6242
{
6348
6243
pub fn command ( self ) -> Transaction {
6349
6244
use Transaction as T ;
@@ -6370,7 +6265,7 @@ pub fn apply_transaction_first_pass<L>(
6370
6265
transaction : & Transaction ,
6371
6266
) -> Result < TransactionPartiallyApplied < L > , String >
6372
6267
where
6373
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
6268
+ L : LedgerNonSnark ,
6374
6269
{
6375
6270
use Transaction :: * ;
6376
6271
use UserCommand :: * ;
@@ -6430,7 +6325,7 @@ pub fn apply_transaction_second_pass<L>(
6430
6325
partial_transaction : TransactionPartiallyApplied < L > ,
6431
6326
) -> Result < TransactionApplied , String >
6432
6327
where
6433
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
6328
+ L : LedgerNonSnark ,
6434
6329
{
6435
6330
use TransactionPartiallyApplied as P ;
6436
6331
@@ -6481,7 +6376,7 @@ pub fn apply_transactions<L>(
6481
6376
txns : & [ Transaction ] ,
6482
6377
) -> Result < Vec < TransactionApplied > , String >
6483
6378
where
6484
- L : LedgerInterface < W = ( ) , Bool = bool , Account = Account , AccountUpdate = AccountUpdate > ,
6379
+ L : LedgerNonSnark ,
6485
6380
{
6486
6381
let first_pass: Vec < _ > = txns
6487
6382
. iter ( )
0 commit comments