Skip to content

Commit a8dc366

Browse files
committed
refactor zkapp command creation to eliminate a non-existent code path
1 parent 607974e commit a8dc366

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

src/lib/mina_base/zkapp_command.ml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ end = struct
574574
| Zkapp_basic.Set_or_keep.Set vk_next ->
575575
Account_id.Map.set !vks_overridden ~key:account_id
576576
~data:vk_next
577-
| Zkapp_basic.Set_or_keep.Keep ->
577+
| Keep ->
578578
!vks_overridden
579579
in
580580
Account_update.check_authorization p
@@ -586,7 +586,7 @@ end = struct
586586
; ("error", Error_json.error_to_yojson err)
587587
] ) ) ;
588588
match (p.body.authorization_kind, failed) with
589-
| Proof vk_hash, false -> (
589+
| Proof vk_hash, false ->
590590
let prioritized_vk =
591591
(* only lookup _past_ vk setting, ie exclude the new one we
592592
* potentially set in this account_update (use the non-'
@@ -597,15 +597,15 @@ end = struct
597597
ok_if_vk_hash_expected ~got:vk ~expected:vk_hash
598598
with
599599
| Ok vk ->
600-
Some vk
600+
vk
601601
| Error err ->
602602
Queue.enqueue error_messages
603603
(`Assoc
604604
[ ("account_id", Account_id.to_yojson account_id)
605605
; ("update_index", `Int update_idx)
606606
; ("error", Error_json.error_to_yojson err)
607607
] ) ;
608-
Some dummy_vk )
608+
dummy_vk )
609609
| Some None ->
610610
(* we explicitly have erased the key *)
611611
Queue.enqueue error_messages
@@ -618,7 +618,7 @@ end = struct
618618
update: the verification key was removed by a \
619619
previous account update" )
620620
] ) ;
621-
Some dummy_vk
621+
dummy_vk
622622
| None -> (
623623
(* we haven't set anything; lookup the vk in the fallback *)
624624
match find_vk vk_hash account_id with
@@ -629,20 +629,15 @@ end = struct
629629
; ("update_index", `Int update_idx)
630630
; ("error", Error_json.error_to_yojson err)
631631
] ) ;
632-
Some dummy_vk
632+
dummy_vk
633633
| Ok vk ->
634-
Some vk )
634+
vk )
635635
in
636-
match prioritized_vk with
637-
| Some prioritized_vk ->
638-
Account_id.Table.update tbl account_id ~f:(fun _ ->
639-
With_hash.hash prioritized_vk ) ;
640-
(* return the updated overrides *)
641-
vks_overridden := vks_overriden' ;
642-
(p, Some prioritized_vk)
643-
| None ->
644-
(* The transaction failed, so we allow the vk to be missing. *)
645-
(p, None) )
636+
Account_id.Table.update tbl account_id
637+
~f:(const @@ With_hash.hash prioritized_vk) ;
638+
(* return the updated overrides *)
639+
vks_overridden := vks_overriden' ;
640+
(p, Some prioritized_vk)
646641
| _ ->
647642
vks_overridden := vks_overriden' ;
648643
(p, None) )

0 commit comments

Comments
 (0)