Skip to content

Instantly share code, notes, and snippets.

@psteckler
Created August 25, 2023 21:10
Show Gist options
  • Save psteckler/090e645b2783657ac1816336ce9c6508 to your computer and use it in GitHub Desktop.
Save psteckler/090e645b2783657ac1816336ce9c6508 to your computer and use it in GitHub Desktop.
processor.ml diff, 1.3.1.2 to 1.4
diff processor.ml processor_1-3-1-2.ml
9c9
< open Mina_block
---
> open Mina_transition
1369,1377d1368
< let global_slot_since_hard_fork =
< Consensus.Data.Consensus_state.curr_global_slot consensus_state
< |> Unsigned.UInt32.to_int64
< in
< let chain_status =
< if Int64.equal global_slot_since_hard_fork 0L then
< Chain_status.(to_string Canonical)
< else Chain_status.(to_string Pending)
< in
1404c1395,1397
< ; global_slot_since_hard_fork
---
> ; global_slot_since_hard_fork =
> Consensus.Data.Consensus_state.curr_global_slot consensus_state
> |> Unsigned.UInt32.to_int64
1412c1405,1406
< ; chain_status
---
> (* we don't yet know the chain status for a block we're adding *)
> ; chain_status = Chain_status.(to_string Pending)
1657c1651
< ({ data = t; hash } : (Mina_block.t, State_hash.t) With_hash.t) =
---
> ({ data = t; hash } : (External_transition.t, State_hash.t) With_hash.t) =
1659,1660c1653,1654
< ~protocol_state:(Header.protocol_state @@ Mina_block.header t)
< ~staged_ledger_diff:(Body.staged_ledger_diff @@ Mina_block.body t)
---
> ~protocol_state:(External_transition.protocol_state t)
> ~staged_ledger_diff:(External_transition.staged_ledger_diff t)
1663c1657,1658
< let add_from_precomputed conn ~constraint_constants (t : Precomputed.t) =
---
> let add_from_precomputed conn ~constraint_constants
> (t : External_transition.Precomputed_block.t) =
2170,2172d2164
< [%log info] "Attempting to add block data for $state_hash"
< ~metadata:
< [ ("state_hash", Mina_base.State_hash.to_yojson (hash block)) ] ;
2211c2203,2205
< (block.Precomputed.protocol_state |> Protocol_state.hashes).state_hash )
---
> ( block.External_transition.Precomputed_block.protocol_state
> |> Protocol_state.hashes )
> .state_hash )
2223,2224c2217
< add_block_aux ~logger ~delete_older_than ~hash ~add_block pool
< (With_hash.map ~f:External_transition.decompose block)
---
> add_block_aux ~logger ~delete_older_than ~hash ~add_block pool block
2291,2322d2283
< (* blocks depend on having the protocol version set, which the daemon does on startup;
< the actual value doesn't affect the block state hash, which is how we
< identify a block in the archive db
<
< here, we just set the protocol version to a dummy value *)
< Protocol_version.(set_current zero) ;
< let proof_level = Genesis_constants.Proof_level.compiled in
< let constraint_constants =
< Genesis_constants.Constraint_constants.compiled
< in
< let%bind precomputed_values =
< match%map
< Genesis_ledger_helper.init_from_config_file ~logger
< ~proof_level:(Some proof_level) runtime_config
< with
< | Ok (precomputed_values, _) ->
< precomputed_values
< | Error err ->
< failwithf "Could not get precomputed values, error: %s"
< (Error.to_string_hum err) ()
< in
< let genesis_block =
< let With_hash.{ data = block; hash = the_hashes }, _ =
< Mina_block.genesis ~precomputed_values
< in
< With_hash.{ data = block; hash = the_hashes.state_hash }
< in
< let%bind _ =
< Block.add_if_doesn't_exist
< (module Conn)
< ~constraint_constants genesis_block
< in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment