Skip to content

Commit

Permalink
Merge pull request #187 from zeko-labs/fixup-compatible
Browse files Browse the repository at this point in the history
Fix up merge
  • Loading branch information
L-as authored Jul 12, 2024
2 parents fe9cb15 + 5456eac commit b682182
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 74 deletions.
5 changes: 3 additions & 2 deletions src/app/archive/lib/diff.ml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ module Builder = struct
; sender_receipt_chains_from_parent_ledger
}

let transaction_added
(* ZEKO NOTE: needed by archive relay *)
let zeko_transaction_added
~(constraint_constants : Genesis_constants.Constraint_constants.t)
~accounts_created ~new_state_hash ~protocol_state ~ledger ~txn =
let advance_protocol_state ~protocol_state ~new_state_hash
Expand Down Expand Up @@ -236,7 +237,7 @@ module Builder = struct
in
let header =
Mina_block.Header.create ~protocol_state
~protocol_state_proof:Proof.blockchain_dummy
~protocol_state_proof:(Lazy.force Proof.blockchain_dummy)
~delta_block_chain_proof:(State_hash.dummy, []) ()
in
let body =
Expand Down
18 changes: 0 additions & 18 deletions src/app/zeko/dune
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@
genesis_constants
hash_prefixes
h_list
kimchi_backend
kimchi_backend.common
kimchi_backend_common
kimchi_backend.pasta
kimchi_backend.pasta.basic
kimchi_backend.pasta.constraint_system
kimchi_bindings
kimchi_pasta
kimchi_types
logger
mina_base
mina_base.import
Expand Down Expand Up @@ -94,15 +85,6 @@
genesis_constants
hash_prefixes
h_list
kimchi_backend
kimchi_backend.common
kimchi_backend_common
kimchi_backend.pasta
kimchi_backend.pasta.basic
kimchi_backend.pasta.constraint_system
kimchi_bindings
kimchi_pasta
kimchi_types
logger
mina_base
mina_base.import
Expand Down
2 changes: 1 addition & 1 deletion src/app/zeko/sequencer/cli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ let snark_queue =
Mina_ledger.Ledger.Db.create ~directory_name:db_dir
~depth:Zeko_sequencer.constraint_constants.ledger_depth ()
in
let kvdb = Mina_ledger.Ledger.Db.kvdb db in
let kvdb = Mina_ledger.Ledger.Db.zeko_kvdb db in
let (module T), (module M) =
Lazy.force Zeko_sequencer.prover_modules
in
Expand Down
2 changes: 0 additions & 2 deletions src/app/zeko/sequencer/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
pickles
pickles.backend
pickles_types
kimchi_backend.pasta
kimchi_backend.pasta.basic
transition_frontier
transition_frontier_base
base58_check
Expand Down
23 changes: 12 additions & 11 deletions src/app/zeko/sequencer/lib/gql.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module Make
let merkle_path_element :
(_, [ `Left of Zkapp_basic.F.t | `Right of Zkapp_basic.F.t ] option) typ
=
let field_elem = Mina_base_unix.Graphql_scalars.FieldElem.typ () in
let field_elem = Mina_base_graphql.Graphql_scalars.FieldElem.typ () in
obj "MerklePathElement" ~fields:(fun _ ->
[ field "left" ~typ:field_elem
~args:Arg.[]
Expand Down Expand Up @@ -460,13 +460,14 @@ module Make
[ field "verificationKey" ~doc:"verification key in Base64 format"
~typ:
( non_null
@@ Pickles_unix.Graphql_scalars.VerificationKey.typ () )
@@ Pickles_graphql.Graphql_scalars.VerificationKey.typ () )
~args:Arg.[]
~resolve:(fun _ (vk : _ With_hash.t) -> vk.data)
; field "hash" ~doc:"Hash of verification key"
~typ:
( non_null
@@ Pickles_unix.Graphql_scalars.VerificationKeyHash.typ () )
@@ Pickles_graphql.Graphql_scalars.VerificationKeyHash.typ ()
)
~args:Arg.[]
~resolve:(fun _ (vk : _ With_hash.t) -> vk.hash)
] )
Expand Down Expand Up @@ -600,7 +601,7 @@ module Make
; field "zkappState"
~typ:
( list @@ non_null
@@ Mina_base_unix.Graphql_scalars.FieldElem.typ () )
@@ Mina_base_graphql.Graphql_scalars.FieldElem.typ () )
~doc:
"The 8 field elements comprising the zkApp state \
associated with this account encoded as bignum strings"
Expand Down Expand Up @@ -644,7 +645,7 @@ module Make
~typ:
(list
( non_null
@@ Snark_params_unix.Graphql_scalars.Action.typ () ) )
@@ Snark_params_graphql.Graphql_scalars.Action.typ () ) )
~args:Arg.[]
~resolve:(fun _ { account; _ } ->
Option.map account.Account.Poly.zkapp
Expand All @@ -655,7 +656,7 @@ module Make
~doc:
"The base58Check-encoded hash of this account to \
bootstrap the merklePath"
~typ:(Mina_base_unix.Graphql_scalars.FieldElem.typ ())
~typ:(Mina_base_graphql.Graphql_scalars.FieldElem.typ ())
~args:Arg.[]
~resolve:(fun _ { account; _ } ->
let open Option.Let_syntax in
Expand Down Expand Up @@ -690,8 +691,8 @@ module Make
; field "failures"
~typ:
( non_null @@ list @@ non_null
@@ Mina_base_unix.Graphql_scalars.TransactionStatusFailure.typ
() )
@@ Mina_base_graphql.Graphql_scalars.TransactionStatusFailure
.typ () )
~args:[]
~doc:
"Failure reason for the account update or any nested zkapp \
Expand Down Expand Up @@ -781,8 +782,8 @@ module Make
~deprecated:(Deprecated (Some "use receiver field instead"))
; abstract_field "failureReason"
~typ:
(Mina_base_unix.Graphql_scalars.TransactionStatusFailure.typ
() )
(Mina_base_graphql.Graphql_scalars.TransactionStatusFailure
.typ () )
~args:[]
~doc:"null is no failure, reason for failure otherwise."
] )
Expand Down Expand Up @@ -912,7 +913,7 @@ module Make
@@ Signed_command.receiver cmd.With_hash.data )
; field "failureReason"
~typ:
(Mina_base_unix.Graphql_scalars.TransactionStatusFailure.typ ())
(Mina_base_graphql.Graphql_scalars.TransactionStatusFailure.typ ())
~args:[]
~doc:
"null is no failure or status unknown, reason for failure \
Expand Down
2 changes: 1 addition & 1 deletion src/app/zeko/sequencer/lib/kvdb.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Db = Mina_ledger.Ledger.Kvdb

type t = Db.t

let of_db db = Mina_ledger.Ledger.Db.kvdb db
let of_db db = Mina_ledger.Ledger.Db.zeko_kvdb db

let of_dir dir = Mina_ledger.Ledger.Kvdb.create dir

Expand Down
9 changes: 5 additions & 4 deletions src/app/zeko/sequencer/lib/zeko_sequencer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ module Make (T : Transaction_snark.S) (M : Zkapps_rollup.S) = struct

let dispatch_transaction t ~ledger ~accounts_created ~new_state_hash ~txn =
let new_protocol_state, diff =
Archive_lib.Diff.Builder.transaction_added ~constraint_constants
Archive_lib.Diff.Builder.zeko_transaction_added ~constraint_constants
~accounts_created ~new_state_hash ~protocol_state:t.protocol_state
~ledger ~txn
in
Expand Down Expand Up @@ -760,11 +760,12 @@ module Make (T : Transaction_snark.S) (M : Zkapps_rollup.S) = struct
in
let t =
{ db
; archive = Archive.create ~kvdb:(L.Db.kvdb db)
; archive = Archive.create ~kvdb:(L.Db.zeko_kvdb db)
; config
; da_config
; snark_q =
Snark_queue.create ~da_config ~config ~signer ~kvdb:(L.Db.kvdb db)
Snark_queue.create ~da_config ~config ~signer
~kvdb:(L.Db.zeko_kvdb db)
; stop = Ivar.create ()
; genesis_accounts
; protocol_state = compile_time_genesis_state
Expand All @@ -776,7 +777,7 @@ module Make (T : Transaction_snark.S) (M : Zkapps_rollup.S) = struct
else (
load_protocol_state_exn t ;

Snark_queue.get_state ~kvdb:(L.Db.kvdb db)
Snark_queue.get_state ~kvdb:(L.Db.zeko_kvdb db)
|> Option.iter ~f:(fun state -> t.snark_q.state <- state) ;

printf "Staged %d commands \n%!"
Expand Down
2 changes: 0 additions & 2 deletions src/app/zeko/sequencer/tests/testing_ledger/dune
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
pickles
pickles.backend
pickles_types
kimchi_backend.pasta
kimchi_backend.pasta.basic
transition_frontier
transition_frontier_base
base58_check
Expand Down
23 changes: 13 additions & 10 deletions src/app/zeko/sequencer/tests/testing_ledger/gql.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module Types = struct

let merkle_path_element :
(_, [ `Left of Zkapp_basic.F.t | `Right of Zkapp_basic.F.t ] option) typ =
let field_elem = Mina_base_unix.Graphql_scalars.FieldElem.typ () in
let field_elem = Mina_base_graphql.Graphql_scalars.FieldElem.typ () in
obj "MerklePathElement" ~fields:(fun _ ->
[ field "left" ~typ:field_elem
~args:Arg.[]
Expand Down Expand Up @@ -447,13 +447,14 @@ module Types = struct
~fields:(fun _ ->
[ field "verificationKey" ~doc:"verification key in Base64 format"
~typ:
(non_null @@ Pickles_unix.Graphql_scalars.VerificationKey.typ ())
( non_null
@@ Pickles_graphql.Graphql_scalars.VerificationKey.typ () )
~args:Arg.[]
~resolve:(fun _ (vk : _ With_hash.t) -> vk.data)
; field "hash" ~doc:"Hash of verification key"
~typ:
( non_null
@@ Pickles_unix.Graphql_scalars.VerificationKeyHash.typ () )
@@ Pickles_graphql.Graphql_scalars.VerificationKeyHash.typ () )
~args:Arg.[]
~resolve:(fun _ (vk : _ With_hash.t) -> vk.hash)
] )
Expand Down Expand Up @@ -583,7 +584,7 @@ module Types = struct
; field "zkappState"
~typ:
( list @@ non_null
@@ Mina_base_unix.Graphql_scalars.FieldElem.typ () )
@@ Mina_base_graphql.Graphql_scalars.FieldElem.typ () )
~doc:
"The 8 field elements comprising the zkApp state associated \
with this account encoded as bignum strings"
Expand Down Expand Up @@ -624,7 +625,7 @@ module Types = struct
~typ:
(list
( non_null
@@ Snark_params_unix.Graphql_scalars.Action.typ () ) )
@@ Snark_params_graphql.Graphql_scalars.Action.typ () ) )
~args:Arg.[]
~resolve:(fun _ { account; _ } ->
Option.map account.Account.Poly.zkapp
Expand All @@ -635,7 +636,7 @@ module Types = struct
~doc:
"The base58Check-encoded hash of this account to bootstrap \
the merklePath"
~typ:(Mina_base_unix.Graphql_scalars.FieldElem.typ ())
~typ:(Mina_base_graphql.Graphql_scalars.FieldElem.typ ())
~args:Arg.[]
~resolve:(fun _ { account; _ } ->
let open Option.Let_syntax in
Expand Down Expand Up @@ -668,8 +669,8 @@ module Types = struct
; field "failures"
~typ:
( non_null @@ list @@ non_null
@@ Mina_base_unix.Graphql_scalars.TransactionStatusFailure.typ
() )
@@ Mina_base_graphql.Graphql_scalars.TransactionStatusFailure
.typ () )
~args:[]
~doc:
"Failure reason for the account update or any nested zkapp \
Expand Down Expand Up @@ -758,7 +759,8 @@ module Types = struct
~deprecated:(Deprecated (Some "use receiver field instead"))
; abstract_field "failureReason"
~typ:
(Mina_base_unix.Graphql_scalars.TransactionStatusFailure.typ ())
(Mina_base_graphql.Graphql_scalars.TransactionStatusFailure.typ
() )
~args:[] ~doc:"null is no failure, reason for failure otherwise."
] )

Expand Down Expand Up @@ -879,7 +881,8 @@ module Types = struct
AccountObj.get_best_ledger_account (Ledger.of_database t.db)
@@ Signed_command.receiver cmd.With_hash.data )
; field "failureReason"
~typ:(Mina_base_unix.Graphql_scalars.TransactionStatusFailure.typ ())
~typ:
(Mina_base_graphql.Graphql_scalars.TransactionStatusFailure.typ ())
~args:[]
~doc:
"null is no failure or status unknown, reason for failure \
Expand Down
18 changes: 0 additions & 18 deletions src/app/zeko/tests/dune
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
genesis_constants
hash_prefixes
h_list
kimchi_backend
kimchi_backend.common
kimchi_backend_common
kimchi_backend.pasta
kimchi_backend.pasta.basic
kimchi_backend.pasta.constraint_system
kimchi_bindings
kimchi_pasta
kimchi_types
Expand Down Expand Up @@ -103,12 +97,6 @@
genesis_constants
hash_prefixes
h_list
kimchi_backend
kimchi_backend.common
kimchi_backend_common
kimchi_backend.pasta
kimchi_backend.pasta.basic
kimchi_backend.pasta.constraint_system
kimchi_bindings
kimchi_pasta
kimchi_types
Expand Down Expand Up @@ -181,12 +169,6 @@
genesis_constants
hash_prefixes
h_list
kimchi_backend
kimchi_backend.common
kimchi_backend_common
kimchi_backend.pasta
kimchi_backend.pasta.basic
kimchi_backend.pasta.constraint_system
kimchi_bindings
kimchi_pasta
kimchi_types
Expand Down
8 changes: 6 additions & 2 deletions src/app/zeko/zkapps_rollup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,9 @@ module Make (T' : Transaction_snark.S) = struct
(force Action_state_extension.tag)
] ) )

let vk = Pickles.Side_loaded.Verification_key.of_compiled tag
let vk =
Async.Thread_safe.block_on_async_exn (fun () ->
Pickles.Side_loaded.Verification_key.of_compiled tag )

let vk_hash = Zkapp_account.digest_vk vk

Expand Down Expand Up @@ -940,7 +942,9 @@ module Make (T' : Transaction_snark.S) = struct
(force Action_state_extension.tag)
] ) )

let vk = Pickles.Side_loaded.Verification_key.of_compiled tag
let vk =
Async.Thread_safe.block_on_async_exn (fun () ->
Pickles.Side_loaded.Verification_key.of_compiled tag )

let vk_hash = Zkapp_account.digest_vk vk

Expand Down
3 changes: 2 additions & 1 deletion src/lib/merkle_ledger/database.ml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ module Make (Inputs : Intf.Inputs.DATABASE) = struct
; detached_parent_signal = Async.Ivar.create ()
}

let kvdb t = t.kvdb
(* ZEKO NOTE: we store actions here *)
let zeko_kvdb t = t.kvdb

let create_checkpoint t ~directory_name () =
let uuid = Uuid_unix.create () in
Expand Down
1 change: 1 addition & 0 deletions src/lib/merkle_ledger/database.mli
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ module Make (Inputs : Intf.Inputs.DATABASE) :
and type hash := Inputs.Hash.t
and type account_id := Inputs.Account_id.t
and type account_id_set := Inputs.Account_id.Set.t
and type zeko_kvdb := Inputs.Kvdb.t
5 changes: 5 additions & 0 deletions src/lib/merkle_ledger/intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,11 @@ module Ledger = struct
val gen_account_location :
ledger_depth:int -> Location.t Quickcheck.Generator.t
end

type zeko_kvdb

(** ZEKO NOTE: we store actions here *)
val zeko_kvdb : t -> zeko_kvdb
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/lib/mina_ledger/ledger.ml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ module Ledger_inner = struct
and type account := Account.t
and type account_id_set := Account_id.Set.t
and type account_id := Account_id.t
and type kvdb := Kvdb.t =
and type zeko_kvdb := Kvdb.t =
Database.Make (Inputs)

module Null = Null_ledger.Make (Inputs)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/mina_ledger/ledger.mli
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Db :
and type token_id_set := Token_id.Set.t
and type account_id := Account_id.t
and type account_id_set := Account_id.Set.t
and type kvdb := Kvdb.t
and type zeko_kvdb := Kvdb.t

module Any_ledger :
Merkle_ledger.Intf.Ledger.ANY
Expand Down

0 comments on commit b682182

Please sign in to comment.