@@ -41,11 +41,14 @@ pub enum ZkAppCommandElt {
41
41
ZkAppCommandCommitment ( crate :: ReceiptChainHash ) ,
42
42
}
43
43
44
- fn assert_ < Z : ZkappApplication > ( _b : Z :: Bool ) -> Result < ( ) , String > {
44
+ fn assert_ < Z : ZkappApplication > ( b : Z :: Bool , s : & str ) -> Result < ( ) , String > {
45
45
// Used only for circuit generation (add constraints)
46
46
// https://github.com/MinaProtocol/mina/blob/e44ddfe1ca54b3855e1ed336d89f6230d35aeb8c/src/lib/transaction_logic/zkapp_command_logic.ml#L929
47
47
48
- // TODO: In non-witness generation, we raise an exception
48
+ if let Boolean :: False = b. as_boolean ( ) {
49
+ return Err ( s. to_string ( ) ) ;
50
+ }
51
+
49
52
Ok ( ( ) )
50
53
}
51
54
@@ -345,8 +348,8 @@ where
345
348
let is_empty_call_forest = local_state. stack_frame . calls ( ) . is_empty ( w) ;
346
349
match is_start {
347
350
IsStart :: Compute ( _) => ( ) ,
348
- IsStart :: Yes ( _) => assert_ :: < Z > ( is_empty_call_forest) ?,
349
- IsStart :: No => assert_ :: < Z > ( is_empty_call_forest. neg ( ) ) ?,
351
+ IsStart :: Yes ( _) => assert_ :: < Z > ( is_empty_call_forest, "is_empty_call_forest" ) ?,
352
+ IsStart :: No => assert_ :: < Z > ( is_empty_call_forest. neg ( ) , "is_empty_call_forest.neg()" ) ?,
350
353
} ;
351
354
match is_start {
352
355
IsStart :: Yes ( _) => Z :: Bool :: true_ ( ) ,
@@ -566,16 +569,14 @@ where
566
569
w,
567
570
)
568
571
} ;
569
- assert_ :: < Z > ( Z :: Bool :: equal (
570
- proof_verifies,
571
- account_update. is_proved ( ) ,
572
- w,
573
- ) ) ?;
574
- assert_ :: < Z > ( Z :: Bool :: equal (
575
- signature_verifies,
576
- account_update. is_signed ( ) ,
577
- w,
578
- ) ) ?;
572
+ assert_ :: < Z > (
573
+ Z :: Bool :: equal ( proof_verifies, account_update. is_proved ( ) , w) ,
574
+ "not proved" ,
575
+ ) ?;
576
+ assert_ :: < Z > (
577
+ Z :: Bool :: equal ( signature_verifies, account_update. is_signed ( ) , w) ,
578
+ "not signed" ,
579
+ ) ?;
579
580
580
581
Z :: LocalState :: add_check (
581
582
local_state,
@@ -650,11 +651,14 @@ where
650
651
SetOrKeep :: Keep => a. get ( ) . timing . clone ( ) ,
651
652
}
652
653
} ) ;
653
- assert_ :: < Z > ( Z :: GlobalSlotSpan :: greater_than (
654
- & timing. to_record ( ) . vesting_period ,
655
- & SlotSpan :: zero ( ) ,
656
- w,
657
- ) ) ?;
654
+ assert_ :: < Z > (
655
+ Z :: GlobalSlotSpan :: greater_than (
656
+ & timing. to_record ( ) . vesting_period ,
657
+ & SlotSpan :: zero ( ) ,
658
+ w,
659
+ ) ,
660
+ "vesting_period zero" ,
661
+ ) ?;
658
662
a. get_mut ( ) . timing = timing;
659
663
( ( ) , ( ) )
660
664
} ;
@@ -1184,7 +1188,7 @@ where
1184
1188
Z :: SignedAmount :: is_non_neg ( & local_delta) ,
1185
1189
w,
1186
1190
) ;
1187
- assert_ :: < Z > ( Z :: Bool :: or ( is_start2. neg ( ) , first, w) ) ?;
1191
+ assert_ :: < Z > ( Z :: Bool :: or ( is_start2. neg ( ) , first, w) , "is_start2 or first" ) ?;
1188
1192
let ( new_local_fee_excess, overflow) =
1189
1193
Z :: SignedAmount :: add_flagged ( & local_state. excess , & local_delta, w) ;
1190
1194
// We decompose this way because of OCaml evaluation order
0 commit comments