text stringlengths 0 601k |
|---|
let of_yojson = function | ` String str -> Result . map_error ( of_base58_check str ) str ~ f ( : fun _ -> " Transaction_hash . of_yojson : Error decoding string from base58_check \ format " ) | _ -> Error " Transaction_hash . of_yojson : Expected a string " |
let hash_signed_command = Fn . compose digest_string Signed_command . to_base58_check |
let hash_command = Fn . compose digest_string User_command . to_base58_check |
let hash_fee_transfer = Fn . compose digest_string Fee_transfer . Single . to_base58_check |
let hash_coinbase = Fn . compose digest_string Coinbase . to_base58_check |
module User_command_with_valid_signature = struct type hash = T . t [ @@ deriving sexp , compare , hash ] hash let hash_to_yojson = to_yojson let hash_of_yojson = of_yojson [ %% versioned module Stable = struct module V2 = struct type t = ( ( User_command . Valid . Stable . V2 . t [ t @ hash . ignore ] ignore ) ignore ... |
module User_command = struct type hash = T . t [ @@ deriving sexp , compare , hash ] hash let hash_to_yojson = to_yojson let hash_of_yojson = of_yojson [ %% versioned module Stable = struct module V2 = struct type t = ( ( User_command . Stable . V2 . t [ t @ hash . ignore ] ignore ) ignore , ( T . Stable . V1 . t [ t @... |
module State = struct [ %% versioned module Stable = struct module V1 = struct type t = Pending | Included | Unknown [ @@ deriving equal , sexp , compare ] compare let to_latest = Fn . id end end ] end let to_string = function | Pending -> " PENDING " | Included -> " INCLUDED " | Unknown -> " UNKOWN " end |
let get_status ~ frontier_broadcast_pipe ~ transaction_pool cmd = let open Or_error . Let_syntax in let % map check_cmd = Result . of_option ( User_command . check cmd ) cmd ~ error ( : Error . of_string " Invalid signature ) " |> Result . map ~ f ( : fun x -> Transaction_hash . User_command_with_valid_signature . crea... |
module type Transition_frontier_intf = sig type t type staged_ledger module Breadcrumb : sig type t val staged_ledger : t -> staged_ledger end type best_tip_diff = { new_commands : User_command . Valid . t With_status . t list ; removed_commands : User_command . Valid . t With_status . t list ; reorg_best_tip : bool } ... |
module Diff_versioned = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V2 = struct type t = User_command . Stable . V2 . t list [ @@ deriving sexp , yojson , hash ] hash let to_latest = Fn . id end end ] end type t = User_command . t list [ @@ deriving sexp ,... |
type Structured_log_events . t += | Rejecting_command_for_reason of { command : User_command . t ; reason : Diff_versioned . Diff_error . t ; error_extra : ( string * Yojson . Safe . t ) t list } [ @@ deriving register_event { msg = " Rejecting command because : $ reason " } ] |
module type S = sig open Intf type transition_frontier module Resource_pool : sig include Transaction_resource_pool_intf with type transition_frontier := transition_frontier module Diff : Transaction_pool_diff_intf with type resource_pool := t and type Diff_error . t = Diff_versioned . Diff_error . t and type Rejected ... |
module Make0 ( Base_ledger : Intf . Base_ledger_intf ) Base_ledger_intf ( Staged_ledger : sig type t val ledger : t -> Base_ledger . t end ) end ( Transition_frontier : Transition_frontier_intf with type staged_ledger := Staged_ledger . t ) t = struct type verification_failure = | Command_failure of Diff_versioned . Di... |
module Make ( Staged_ledger : sig type t val ledger : t -> Mina_ledger . Ledger . t end ) end with type staged_ledger := Staged_ledger . t ) t : S with type transition_frontier := Transition_frontier . t = Make0 ( Mina_ledger . Ledger ) Ledger ( Staged_ledger ) Staged_ledger ( Transition_frontier ) Transition_frontier ... |
let top_hash_logging_enabled = ref false |
let to_preunion ( t : Transaction . t ) t = match t with | Command ( Signed_command x ) x -> ` Transaction ( Transaction . Command x ) x | Fee_transfer x -> ` Transaction ( Fee_transfer x ) x | Coinbase x -> ` Transaction ( Coinbase x ) x | Command ( Parties x ) x -> ` Parties x |
let with_top_hash_logging f = let old = ! top_hash_logging_enabled in top_hash_logging_enabled := true ; try let ret = f ( ) in top_hash_logging_enabled := old ; ret with err -> top_hash_logging_enabled := old ; raise err |
module Proof_type = struct [ %% versioned module Stable = struct module V1 = struct type t = [ ` Base | ` Merge ] [ @@ deriving compare , equal , hash , sexp , yojson ] yojson let to_latest = Fn . id end end ] end end |
module Pending_coinbase_stack_state = struct module Init_stack = struct [ %% versioned module Stable = struct module V1 = struct type t = Base of Pending_coinbase . Stack_versioned . Stable . V1 . t | Merge [ @@ deriving sexp , hash , compare , equal , yojson ] yojson let to_latest = Fn . id end end ] end end module Po... |
module Statement = struct module Poly = struct [ %% versioned module Stable = struct module V2 = struct type ( ' ledger_hash , ' amount , ' pending_coinbase , ' fee_excess , ' sok_digest , ' local_state ) t = { source : ( ' ledger_hash , ' pending_coinbase , ' local_state ) Registers . Stable . V1 . t ; target : ( ' le... |
module Proof = struct [ %% versioned module Stable = struct module V2 = struct type t = Pickles . Proof . Proofs_verified_2 . Stable . V2 . t [ @@ deriving version { asserted } , yojson , bin_io , compare , equal , sexp , hash ] hash let to_latest = Fn . id end end ] end end [ %% versioned |
module Stable = struct module V2 = struct type t = { statement : Statement . With_sok . Stable . V2 . t ; proof : Proof . Stable . V2 . t } [ @@ deriving compare , equal , fields , sexp , version , yojson , hash ] hash let to_latest = Fn . id end end ] end |
let proof t = t . proof |
let statement t = { t . statement with sok_digest = ( ) } |
let sok_digest t = t . statement . sok_digest |
let create ~ statement ~ proof = { statement ; proof } |
let chain if_ b ~ then_ ~ else_ = let % bind then_ = then_ and else_ = else_ in if_ b ~ then_ ~ else_ |
module Parties_segment = struct module Spec = struct type single = { auth_type : Control . Tag . t ; is_start : [ ` Yes | ` No | ` Compute_in_circuit ] } type t = single list end module Basic = struct module N = Side_loaded_verification_key . Max_branches [ %% versioned module Stable = struct module V1 = struct type t ... |
let dummy_constraints ( ) = make_checked Impl ( . fun ( ) -> let x = exists Field . typ ~ compute ( : fun ( ) -> Field . Constant . of_int 3 ) 3 in let g = exists Inner_curve . typ ~ compute ( : fun _ -> Inner_curve . one ) one in ignore ( Pickles . Scalar_challenge . to_field_checked ' ( module Impl ) Impl ~ num_bits ... |
module Base = struct module User_command_failure = struct type ' bool t = { predicate_failed : ' bool ; source_not_present : ' bool ; receiver_not_present : ' bool ; amount_insufficient_to_create : ' bool ; token_cannot_create : ' bool ; source_insufficient_balance : ' bool ; source_minimum_balance_violation : ' bool ;... |
module Transition_data = struct type t = { proof : Proof_type . t ; supply_increase : Amount . t ; fee_excess : Fee_excess . t ; sok_digest : Sok_message . Digest . t ; pending_coinbase_stack_state : Pending_coinbase_stack_state . t } [ @@ deriving fields ] fields end |
module Merge = struct open Tick let % snarkydef main ( [ s1 ; s2 ] : ( Statement . With_sok . var * ( Statement . With_sok . var * _ ) _ ) _ Pickles_types . Hlist . HlistId . t ) ( s : Statement . With_sok . Checked . t ) t = let % bind fee_excess = Fee_excess . combine_checked s1 . Statement . fee_excess s2 . Statemen... |
type tag = ( Statement . With_sok . Checked . t , Statement . With_sok . t , Nat . N2 . n , Nat . N5 . n ) Pickles . Tag . t |
let time lab f = let start = Time . now ( ) in let x = f ( ) in let stop = Time . now ( ) in printf " % s : % s \ n " %! lab ( Time . Span . to_string_hum ( Time . diff stop start ) start ) start ; x |
let system ~ proof_level ~ constraint_constants = time " Transaction_snark . system " ( fun ( ) -> Pickles . compile ~ cache : Cache_dir . cache ( module Statement . With_sok . Checked ) Checked ( module Statement . With_sok ) With_sok ~ typ : Statement . With_sok . typ ~ branches ( : module Nat . N5 ) N5 ~ max_proofs_... |
module Verification = struct module type S = sig val tag : tag val verify : ( t * Sok_message . t ) t list -> bool Async . Deferred . t val id : Pickles . Verification_key . Id . t Lazy . t val verification_key : Pickles . Verification_key . t Lazy . t val verify_against_digest : t -> bool Async . Deferred . t val cons... |
module type S = sig include Verification . S val constraint_constants : Genesis_constants . Constraint_constants . t val cache_handle : Pickles . Cache_handle . t val of_non_parties_transaction : statement : Statement . With_sok . t -> init_stack : Pending_coinbase . Stack . t -> Transaction . Valid . t Transaction_pro... |
let check_transaction_union ( ? preeval = false ) false ~ constraint_constants sok_message source target init_stack pending_coinbase_stack_state transaction state_body handler = if preeval then failwith " preeval currently disabled " ; let sok_digest = Sok_message . digest sok_message in let handler = Base . transactio... |
let check_transaction ? preeval ~ constraint_constants ~ sok_message ~ source ~ target ~ init_stack ~ pending_coinbase_stack_state ~ zkapp_account1 : _ ~ zkapp_account2 : _ ( transaction_in_block : Transaction . Valid . t Transaction_protocol_state . t ) t handler = let transaction = Transaction_protocol_state . transa... |
let check_user_command ~ constraint_constants ~ sok_message ~ source ~ target ~ init_stack ~ pending_coinbase_stack_state t_in_block handler = let user_command = Transaction_protocol_state . transaction t_in_block in check_transaction ~ constraint_constants ~ sok_message ~ source ~ target ~ init_stack ~ pending_coinbas... |
let generate_transaction_union_witness ( ? preeval = false ) false ~ constraint_constants sok_message source target transaction_in_block init_stack pending_coinbase_stack_state handler = if preeval then failwith " preeval currently disabled " ; let transaction = Transaction_protocol_state . transaction transaction_in_b... |
let generate_transaction_witness ? preeval ~ constraint_constants ~ sok_message ~ source ~ target ~ init_stack ~ pending_coinbase_stack_state ~ zkapp_account1 : _ ~ zkapp_account2 : _ ( transaction_in_block : Transaction . Valid . t Transaction_protocol_state . t ) t handler = match to_preunion ( Transaction_protocol_s... |
let verify ( ts : ( t * _ ) _ list ) list ~ key = if List . for_all ts ~ f ( : fun ( { statement ; _ } , message ) message -> Sok_message . Digest . equal ( Sok_message . digest message ) message statement . sok_digest ) then Pickles . verify ( module Nat . N2 ) N2 ( module Statement . With_sok ) With_sok key ( List . ... |
let constraint_system_digests ~ constraint_constants ( ) = let digest = Tick . R1CS_constraint_system . digest in [ ( " transaction - merge " , digest Merge ( . Tick . constraint_system ~ exposing [ : Statement . With_sok . typ ] ~ return_typ ( : Snarky_backendless . Typ . unit ( ) ) ( fun x -> let open Tick in let % b... |
type local_state = ( Stack_frame . value , Stack_frame . value list , Token_id . t , Currency . Amount . Signed . t , Sparse_ledger . t , bool , unit , Transaction_status . Failure . Collection . t ) Mina_transaction_logic . Parties_logic . Local_state . t |
module Parties_intermediate_state = struct type state = { global : global_state ; local : local_state } type t = { kind : [ ` Same | ` New | ` Two_new ] ; spec : Parties_segment . Basic . t ; state_before : state ; state_after : state ; use_full_commitment : [ ` Others | ` Proved_use_full_commitment of bool ] } end |
let group_by_parties_rev ( partiess : Party . t list list ) list ( stmtss : ( global_state * local_state ) local_state list list ) list : Parties_intermediate_state . t list = let use_full_commitment ( p : Party . t ) t = match p . authorization with | Proof _ -> ` Proved_use_full_commitment p . body . use_full_commitm... |
let rec accumulate_call_stack_hashes ( ~ hash_frame : ' frame -> Stack_frame . Digest . t ) t ( frames : ' frame list ) list : ( ' frame , Call_stack_digest . t ) t With_stack_hash . t list = match frames with | [ ] -> [ ] | f :: fs -> let h_f = hash_frame f in let tl = accumulate_call_stack_hashes ~ hash_frame fs in l... |
let parties_witnesses_exn ~ constraint_constants ~ state_body ~ fee_excess ledger ( partiess : ( [ ` Pending_coinbase_init_stack of Pending_coinbase . Stack . t ] * [ ` Pending_coinbase_of_statement of Pending_coinbase_stack_state . t ] * Parties . t ) list ) = let sparse_ledger = match ledger with | ` Ledger ledger ->... |
module Make ( Inputs : sig val constraint_constants : Genesis_constants . Constraint_constants . t val proof_level : Genesis_constants . Proof_level . t struct open Inputs let constraint_constants = constraint_constants let ( tag , cache_handle , p , Pickles . Provers . [ base ; merge ; opt_signed_opt_signed ; opt_sign... |
module For_tests = struct module Spec = struct type t = { fee : Currency . Fee . t ; sender : Signature_lib . Keypair . t * Mina_base . Account . Nonce . t ; fee_payer : ( Signature_lib . Keypair . t * Mina_base . Account . Nonce . t ) t option ; receivers : ( Signature_lib . Public_key . Compressed . t * Currency . Am... |
module Sparse_ledger = struct include Mina_ledger . Sparse_ledger let merkle_root t = Frozen_ledger_hash . of_ledger_hash @@ merkle_root t end |
let create_ledger_and_transactions num_transitions = let num_accounts = 4 in let constraint_constants = Genesis_constants . Constraint_constants . compiled in let ledger = Mina_ledger . Ledger . create ~ depth : constraint_constants . ledger_depth ( ) in let keys = Array . init num_accounts ~ f ( : fun _ -> Signature_l... |
let time thunk = let start = Time . now ( ) in let x = thunk ( ) in let stop = Time . now ( ) in ( Time . diff stop start , x ) x |
let rec pair_up = function | [ ] -> [ ] | x :: y :: xs -> ( x , y ) y :: pair_up xs | _ -> failwith " Expected even length list " |
let state_body = Mina_state ( . Lazy . map precomputed_values ~ f ( : fun values -> values . protocol_state_with_hashes . data |> Protocol_state . body ) ) |
let curr_state_view = Lazy . map state_body ~ f : Mina_state . Protocol_state . Body . view |
let state_body_hash = Lazy . map ~ f : Mina_state . Protocol_state . Body . hash state_body |
let pending_coinbase_stack_target ( t : Transaction . t ) t stack = let stack_with_state = Pending_coinbase . Stack ( . push_state ( Lazy . force state_body_hash ) state_body_hash stack ) stack in let target = match t with | Coinbase c -> Pending_coinbase ( . Stack . push_coinbase c stack_with_state ) stack_with_state ... |
let profile ( module T : Transaction_snark . S ) S sparse_ledger0 ( transitions : Transaction . Valid . t list ) list _ = let constraint_constants = Genesis_constants . Constraint_constants . compiled in let txn_state_view = Lazy . force curr_state_view in let ( base_proof_time , _ , _ ) _ , base_proofs = List . fold_m... |
let check_base_snarks sparse_ledger0 ( transitions : Transaction . Valid . t list ) list preeval = let constraint_constants = Genesis_constants . Constraint_constants . compiled in ignore ( let sok_message = Sok_message . create ~ fee : Currency . Fee . zero ~ prover : Public_key ( . compress ( of_private_key_exn ( Pri... |
let generate_base_snarks_witness sparse_ledger0 ( transitions : Transaction . Valid . t list ) list preeval = let constraint_constants = Genesis_constants . Constraint_constants . compiled in ignore ( let sok_message = Sok_message . create ~ fee : Currency . Fee . zero ~ prover : Public_key ( . compress ( of_private_ke... |
let run profiler num_transactions repeats preeval = let ledger , transactions = create_ledger_and_transactions num_transactions in let sparse_ledger = Mina_ledger . Sparse_ledger . of_ledger_subset_exn ledger ( List . fold ~ init [ ] : transactions ~ f ( : fun participants t -> List . rev_append ( Transaction . account... |
let main num_transactions repeats preeval ( ) = Test_util . with_randomness 123456789 ( fun ( ) -> let module T = Transaction_snark . Make ( struct let constraint_constants = Genesis_constants . Constraint_constants . compiled let proof_level = Genesis_constants . Proof_level . Full end ) end in run ( profile ( module ... |
let dry num_transactions repeats preeval ( ) = Test_util . with_randomness 123456789 ( fun ( ) -> run check_base_snarks num_transactions repeats preeval ) |
let witness num_transactions repeats preeval ( ) = Test_util . with_randomness 123456789 ( fun ( ) -> run generate_base_snarks_witness num_transactions repeats preeval ) |
let command = let open Command . Let_syntax in Command . basic ~ summary " : transaction snark profiler " ( let % map_open n = flag " - k " ~ doc : " count count = log_2 ( log_2number of transactions to snark ) snark or none for \ the mocked ones " ( optional int ) int and repeats = flag " -- repeat " ~ aliases [ : " r... |
let map2_or_error xs ys ~ f = let rec go xs ys acc = match ( xs , ys ) ys with | [ ] , [ ] -> Ok ( List . rev acc ) acc | x :: xs , y :: ys -> ( match f x y with Error e -> Error e | Ok z -> go xs ys ( z :: acc ) acc ) | _ , _ -> Or_error . error_string " Length mismatch " in go xs ys [ ] |
module type Monad_with_Or_error_intf = sig type ' a t include Monad . S with type ' a t := ' a t module Or_error : sig type nonrec ' a t = ' a Or_error . t t include Monad . S with type ' a t := ' a t end end |
module Transaction_with_witness = struct [ %% versioned module Stable = struct module V2 = struct type t = { transaction_with_info : Mina_transaction_logic . Transaction_applied . Stable . V2 . t ; state_hash : State_hash . Stable . V1 . t * State_body_hash . Stable . V1 . t ; statement : Transaction_snark . Statement ... |
module Ledger_proof_with_sok_message = struct [ %% versioned module Stable = struct module V2 = struct type t = Ledger_proof . Stable . V2 . t * Sok_message . Stable . V1 . t [ @@ deriving sexp ] sexp let to_latest = Fn . id end end ] end end |
module Available_job = struct type t = ( Ledger_proof_with_sok_message . t , Transaction_with_witness . t ) Parallel_scan . Available_job . t [ @@ deriving sexp ] sexp end |
module Job_view = struct type t = Transaction_snark . Statement . t Parallel_scan . Job_view . t [ @@ deriving sexp ] sexp let to_yojson ( { value ; position } : t ) t : Yojson . Safe . t = let module R = struct type t = ( Frozen_ledger_hash . t , Pending_coinbase . Stack_versioned . t , Mina_state . Local_state . t ) ... |
type job = Available_job . t [ @@ deriving sexp ] sexp [ %% versioned |
module Stable = struct module V2 = struct type t = ( Ledger_proof_with_sok_message . Stable . V2 . t , Transaction_with_witness . Stable . V2 . t ) Parallel_scan . State . Stable . V1 . t [ @@ deriving sexp ] sexp let to_latest = Fn . id let hash ( t : t ) t = let state_hash = Parallel_scan . State . hash t ( Binable .... |
let create_expected_statement ~ constraint_constants ( ~ get_state : State_hash . t -> Mina_state . Protocol_state . value Or_error . t ) t { Transaction_with_witness . transaction_with_info ; state_hash ; ledger_witness ; init_stack ; statement } = let open Or_error . Let_syntax in let source_merkle_root = Frozen_ledg... |
let completed_work_to_scanable_work ( job : job ) job ( fee , current_proof , prover ) prover : Ledger_proof_with_sok_message . t Or_error . t = let sok_digest = Ledger_proof . sok_digest current_proof and proof = Ledger_proof . underlying_proof current_proof in match job with | Base { statement ; _ } -> let ledger_pro... |
let total_proofs ( works : Transaction_snark_work . t list ) list = List . sum ( module Int ) Int works ~ f ( : fun w -> One_or_two . length w . proofs ) proofs |
module P = struct type t = Ledger_proof_with_sok_message . t end |
module Make_statement_scanner ( Verifier : sig type t val verify : verifier : t -> P . t list -> bool Deferred . Or_error . t struct module Fold = Parallel_scan . State . Make_foldable ( Deferred ) Deferred let logger = lazy ( Logger . create ( ) ) module Timer = struct module Info = struct module Time_span = struct ty... |
let statement_of_job : job -> Transaction_snark . Statement . t option = function | Base { statement ; _ } -> Some statement | Merge ( ( p1 , _ ) _ , ( p2 , _ ) _ ) _ -> Transaction_snark . Statement . merge ( Ledger_proof . statement p1 ) p1 ( Ledger_proof . statement p2 ) p2 |> Result . ok |
let create ~ work_delay ~ transaction_capacity_log_2 = let k = Int . pow 2 transaction_capacity_log_2 in Parallel_scan . empty ~ delay : work_delay ~ max_base_jobs : k |
let empty ( ~ constraint_constants : Genesis_constants . Constraint_constants . t ) t ( ) = create ~ work_delay : constraint_constants . work_delay ~ transaction_capacity_log_2 : constraint_constants . transaction_capacity_log_2 |
let extract_txns txns_with_witnesses = List . map txns_with_witnesses ~ f ( : fun ( txn_with_witness : Transaction_with_witness . t ) t -> let txn = Ledger . Transaction_applied . transaction txn_with_witness . transaction_with_info in let state_hash = fst txn_with_witness . state_hash in ( txn , state_hash ) state_has... |
let latest_ledger_proof t = let open Option . Let_syntax in let % map proof , txns_with_witnesses = Parallel_scan . last_emitted_value t in ( proof , extract_txns txns_with_witnesses ) txns_with_witnesses |
let staged_transactions t = List . map ~ f ( : fun ( t : Transaction_with_witness . t ) t -> t . transaction_with_info |> Ledger . Transaction_applied . transaction ) @@ Parallel_scan . pending_data t |
let staged_transactions_with_protocol_states t ( ~ get_state : State_hash . t -> Mina_state . Protocol_state . value Or_error . t ) t = let open Or_error . Let_syntax in List . map ~ f ( : fun ( t : Transaction_with_witness . t ) t -> let txn = t . transaction_with_info |> Ledger . Transaction_applied . transaction in ... |
let partition_if_overflowing t = let bundle_count work_count = ( work_count + 1 ) 1 / 2 in let { Space_partition . first = slots , job_count ; second } = Parallel_scan . partition_if_overflowing t in { Space_partition . first = ( slots , bundle_count job_count ) job_count ; second = Option . map second ~ f ( : fun ( sl... |
let extract_from_job ( job : job ) job = match job with | Parallel_scan . Available_job . Base d -> First ( d . transaction_with_info , d . statement , d . state_hash , d . ledger_witness , d . init_stack ) | Merge ( ( p1 , _ ) _ , ( p2 , _ ) _ ) _ -> Second ( p1 , p2 ) p2 |
let snark_job_list_json t = let all_jobs : Job_view . t list list = let fa ( a : Ledger_proof_with_sok_message . t ) t = Ledger_proof . statement ( fst a ) a in let fd ( d : Transaction_with_witness . t ) t = d . statement in Parallel_scan . view_jobs_with_position t fa fd in Yojson . Safe . to_string ( ` List ( List .... |
let all_work_statements_exn t : Transaction_snark_work . Statement . t list = let work_seqs = all_jobs t in List . concat_map work_seqs ~ f ( : fun work_seq -> One_or_two . group_list ( List . map work_seq ~ f ( : fun job -> match statement_of_job job with | None -> assert false | Some stmt -> stmt ) ) ) |
let required_work_pairs t ~ slots = let work_list = Parallel_scan . jobs_for_slots t ~ slots in List . concat_map work_list ~ f ( : fun works -> One_or_two . group_list works ) works |
let k_work_pairs_for_new_diff t ~ k = let work_list = Parallel_scan . jobs_for_next_update t in List ( . take ( concat_map work_list ~ f ( : fun works -> One_or_two . group_list works ) works ) works k ) k |
let work_statements_for_new_diff t : Transaction_snark_work . Statement . t list = let work_list = Parallel_scan . jobs_for_next_update t in List . concat_map work_list ~ f ( : fun work_seq -> One_or_two . group_list ( List . map work_seq ~ f ( : fun job -> match statement_of_job job with | None -> assert false | Some ... |
let all_work_pairs t ( ~ get_state : State_hash . t -> Mina_state . Protocol_state . value Or_error . t ) t : ( Transaction_witness . t , Ledger_proof . t ) t Snark_work_lib . Work . Single . Spec . t One_or_two . t list Or_error . t = let all_jobs = all_jobs t in let module A = Available_job in let open Or_error . Let... |
let fill_work_and_enqueue_transactions t transactions work = let open Or_error . Let_syntax in let fill_in_transaction_snark_work t ( works : Transaction_snark_work . t list ) list : ( Ledger_proof . t * Sok_message . t ) t list Or_error . t = let next_jobs = List ( . take ( concat @@ Parallel_scan . jobs_for_next_upda... |
let required_state_hashes t = List . fold ~ init : State_hash . Set . empty ~ f ( : fun acc ( t : Transaction_with_witness . t ) t -> Set . add acc ( fst t . state_hash ) state_hash ) ( Parallel_scan . pending_data t ) t |
let check_required_protocol_states t ~ protocol_states = let open Or_error . Let_syntax in let required_state_hashes = required_state_hashes t in let check_length states = let required = State_hash . Set . length required_state_hashes in let received = List . length states in if required = received then Or_error . retu... |
module Statement = struct module Arg = struct [ %% versioned module Stable = struct module V2 = struct type t = Transaction_snark . Statement . Stable . V2 . t One_or_two . Stable . V1 . t [ @@ deriving hash , sexp , compare ] compare let to_latest = Fn . id end end ] end end [ %% versioned module Stable = struct [ @@@... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.