diff --git a/docs/specs/types_and_structures/serialized_key.md b/docs/specs/types_and_structures/serialized_key.md index a116e926cc9..9fcfd7eb3f1 100644 --- a/docs/specs/types_and_structures/serialized_key.md +++ b/docs/specs/types_and_structures/serialized_key.md @@ -130,7 +130,7 @@ To help ensure no download errors have occurred, the `length` field should match | - | - | - | | `previous_state_hash` | `String` | State hash in hex | | `previous_length` | `Number` | Height | -| `previous_global_slot` | `Number` | Slot | +| `genesis_slot` | `Number` | Slot | ### `commits` diff --git a/src/app/test_executive/hard_fork.ml b/src/app/test_executive/hard_fork.ml index 7f500277824..7220e0bfc5f 100644 --- a/src/app/test_executive/hard_fork.ml +++ b/src/app/test_executive/hard_fork.ml @@ -21,7 +21,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct { previous_state_hash = "3NKSiqFZQmAS12U8qeX4KNo8b4199spwNh7mrSs4Ci1Vacpfix2Q" ; previous_length = 300000 - ; previous_global_slot = 500000 + ; genesis_slot = 500000 } let config = @@ -448,7 +448,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct let bad_slot = Mina_numbers.Global_slot_since_genesis.to_int global_slot_since_genesis - < fork_config.previous_global_slot + < fork_config.genesis_slot in if bad_height && bad_slot then Malleable_error.hard_error @@ -472,7 +472,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct section_hard "running replayer" (let%bind logs = Network.Node.run_replayer - ~start_slot_since_genesis:fork_config.previous_global_slot ~logger + ~start_slot_since_genesis:fork_config.genesis_slot ~logger (List.hd_exn @@ (Network.archive_nodes network |> Core.Map.data)) in check_replayer_logs ~logger logs ) diff --git a/src/config/fork.mlh b/src/config/fork.mlh index 0c8e8dab67e..65e7457ec82 100644 --- a/src/config/fork.mlh +++ b/src/config/fork.mlh @@ -1,3 +1,3 @@ [%%undef fork_previous_length] [%%undef fork_previous_state_hash] -[%%undef fork_previous_global_slot] +[%%undef fork_genesis_slot] diff --git a/src/config/fork_at_3757.mlh b/src/config/fork_at_3757.mlh index 5ff73e82f57..0c27577faf0 100644 --- a/src/config/fork_at_3757.mlh +++ b/src/config/fork_at_3757.mlh @@ -1,3 +1,3 @@ [%%define fork_previous_length 3757] [%%define fork_previous_state_hash "3NKR3QYJ7qwxiGgX39umahgdT8BH5yXBQwQtpYZdvodCXcsndK7f"] -[%%define fork_previous_global_slot 12796] \ No newline at end of file +[%%define fork_genesis_slot 12796] \ No newline at end of file diff --git a/src/lib/consensus/constants.ml b/src/lib/consensus/constants.ml index c2a6f029825..2c67f951a6f 100644 --- a/src/lib/consensus/constants.ml +++ b/src/lib/consensus/constants.ml @@ -239,8 +239,7 @@ let create' (type a b c) | Some f -> M.( + ) (M.constant - (Mina_numbers.Global_slot_since_genesis.to_int - f.previous_global_slot ) ) + (Mina_numbers.Global_slot_since_genesis.to_int f.genesis_slot) ) slots in let res : (a, b, c) Poly.t = diff --git a/src/lib/consensus/proof_of_stake.ml b/src/lib/consensus/proof_of_stake.ml index a07c8ba7e51..a9ef8cf0755 100644 --- a/src/lib/consensus/proof_of_stake.ml +++ b/src/lib/consensus/proof_of_stake.ml @@ -2066,10 +2066,10 @@ module Make_str (A : Wire_types.Concrete) = struct match constraint_constants.fork with | None -> (Length.zero, Mina_numbers.Global_slot_since_genesis.zero) - | Some { previous_length; previous_global_slot; _ } -> + | Some { previous_length; genesis_slot; _ } -> (*Note: global_slot_since_genesis at fork point is the same as global_slot_since_genesis in the new genesis. This value is used to check transaction validity and existence of locked tokens. For reviewers, should this be incremented by 1 because it's technically a new block? we don't really know how many slots passed since the fork point*) - (previous_length, previous_global_slot) + (previous_length, genesis_slot) in let default_epoch_data = Genesis_epoch_data.Data. @@ -3592,7 +3592,7 @@ module Make_str (A : Wire_types.Concrete) = struct | Some fork -> assert ( Mina_numbers.Global_slot_since_genesis.( - equal fork.previous_global_slot + equal fork.genesis_slot previous_consensus_state.global_slot_since_genesis) ) ; assert ( Mina_numbers.Length.( @@ -3673,7 +3673,7 @@ module Make_str (A : Wire_types.Concrete) = struct assert ( Mina_numbers.Global_slot_since_genesis.( equal - (add fork.previous_global_slot slot_diff) + (add fork.genesis_slot slot_diff) next_consensus_state.global_slot_since_genesis) ) ; assert ( Mina_numbers.Length.( @@ -3781,8 +3781,7 @@ module Make_str (A : Wire_types.Concrete) = struct "3NL3bc213VQEFx6XTLbc3HxHqHH9ANbhHxRxSnBcRzXcKgeFA6TY" ) ) ; previous_length = Mina_numbers.Length.of_int 100 - ; previous_global_slot = - Mina_numbers.Global_slot_since_genesis.of_int 200 + ; genesis_slot = Mina_numbers.Global_slot_since_genesis.of_int 200 } in { constraint_constants with fork = fork_constants } diff --git a/src/lib/genesis_constants/genesis_constants.ml b/src/lib/genesis_constants/genesis_constants.ml index 203a81356d5..aae92cf5d62 100644 --- a/src/lib/genesis_constants/genesis_constants.ml +++ b/src/lib/genesis_constants/genesis_constants.ml @@ -28,8 +28,7 @@ module Fork_constants = struct type t = { previous_state_hash : Pickles.Backend.Tick.Field.Stable.Latest.t ; previous_length : Mina_numbers.Length.Stable.Latest.t - ; previous_global_slot : - Mina_numbers.Global_slot_since_genesis.Stable.Latest.t + ; genesis_slot : Mina_numbers.Global_slot_since_genesis.Stable.Latest.t } [@@deriving bin_io_unversioned, sexp, equal, compare, yojson] end @@ -68,15 +67,15 @@ module Constraint_constants = struct ; account_creation_fee = Currency.Fee.to_uint64 t.account_creation_fee ; fork = ( match t.fork with - | Some { previous_length; previous_state_hash; previous_global_slot } -> + | Some { previous_length; previous_state_hash; genesis_slot } -> Some { previous_length = Unsigned.UInt32.to_int previous_length ; previous_state_hash = Pickles.Backend.Tick.Field.to_string previous_state_hash - ; previous_global_slot = + ; genesis_slot = Unsigned.UInt32.to_int (Mina_numbers.Global_slot_since_genesis.to_uint32 - previous_global_slot ) + genesis_slot ) } | None -> None ) @@ -165,7 +164,7 @@ module Constraint_constants = struct [%%inject "fork_previous_state_hash", fork_previous_state_hash] - [%%inject "fork_previous_global_slot", fork_previous_global_slot] + [%%inject "fork_genesis_slot", fork_genesis_slot] let fork = Some @@ -173,9 +172,8 @@ module Constraint_constants = struct Data_hash_lib.State_hash.of_base58_check_exn fork_previous_state_hash ; previous_length = Mina_numbers.Length.of_int fork_previous_length - ; previous_global_slot = - Mina_numbers.Global_slot_since_genesis.of_int - fork_previous_global_slot + ; genesis_slot = + Mina_numbers.Global_slot_since_genesis.of_int fork_genesis_slot } [%%endif] diff --git a/src/lib/genesis_ledger_helper/lib/genesis_ledger_helper_lib.ml b/src/lib/genesis_ledger_helper/lib/genesis_ledger_helper_lib.ml index fd8c59e669e..d452b4dfe23 100644 --- a/src/lib/genesis_ledger_helper/lib/genesis_ledger_helper_lib.ml +++ b/src/lib/genesis_ledger_helper/lib/genesis_ledger_helper_lib.ml @@ -458,14 +458,13 @@ let make_constraint_constants ( match config.fork with | None -> default.fork - | Some { previous_state_hash; previous_length; previous_global_slot } -> + | Some { previous_state_hash; previous_length; genesis_slot } -> Some { previous_state_hash = State_hash.of_base58_check_exn previous_state_hash ; previous_length = Mina_numbers.Length.of_int previous_length - ; previous_global_slot = - Mina_numbers.Global_slot_since_genesis.of_int - previous_global_slot + ; genesis_slot = + Mina_numbers.Global_slot_since_genesis.of_int genesis_slot } ) } @@ -494,13 +493,12 @@ let runtime_config_of_constraint_constants ; account_creation_fee = Some constraint_constants.account_creation_fee ; fork = Option.map constraint_constants.fork - ~f:(fun { previous_state_hash; previous_length; previous_global_slot } - -> + ~f:(fun { previous_state_hash; previous_length; genesis_slot } -> { Runtime_config.Fork_config.previous_state_hash = State_hash.to_base58_check previous_state_hash ; previous_length = Mina_numbers.Length.to_int previous_length - ; previous_global_slot = - Mina_numbers.Global_slot_since_genesis.to_int previous_global_slot + ; genesis_slot = + Mina_numbers.Global_slot_since_genesis.to_int genesis_slot } ) } diff --git a/src/lib/mina_graphql/mina_graphql.ml b/src/lib/mina_graphql/mina_graphql.ml index c2a6b73feaf..3f2b6b228da 100644 --- a/src/lib/mina_graphql/mina_graphql.ml +++ b/src/lib/mina_graphql/mina_graphql.ml @@ -2347,7 +2347,7 @@ module Queries = struct protocol_state.previous_state_hash ; previous_length = Option.value ~default:global_slot previous_length - ; previous_global_slot = global_slot + ; genesis_slot = global_slot } in let update = diff --git a/src/lib/network_pool/indexed_pool.ml b/src/lib/network_pool/indexed_pool.ml index 5b5b7a07c8d..88c7d2688e7 100644 --- a/src/lib/network_pool/indexed_pool.ml +++ b/src/lib/network_pool/indexed_pool.ml @@ -259,13 +259,12 @@ let global_slot_since_genesis conf = |> to_global_slot) in match conf.constraint_constants.fork with - | Some { previous_global_slot; _ } -> + | Some { genesis_slot; _ } -> let slot_span = Mina_numbers.Global_slot_since_hard_fork.to_uint32 current_slot |> Mina_numbers.Global_slot_span.of_uint32 in - Mina_numbers.Global_slot_since_genesis.( - add previous_global_slot slot_span) + Mina_numbers.Global_slot_since_genesis.(add genesis_slot slot_span) | None -> (* we're in the genesis "hard fork", so consider current slot as since-genesis diff --git a/src/lib/runtime_config/runtime_config.ml b/src/lib/runtime_config/runtime_config.ml index 74af6888f43..b8ef65dde18 100644 --- a/src/lib/runtime_config/runtime_config.ml +++ b/src/lib/runtime_config/runtime_config.ml @@ -2,10 +2,7 @@ open Core_kernel module Fork_config = struct type t = - { previous_state_hash : string - ; previous_length : int - ; previous_global_slot : int - } + { previous_state_hash : string; previous_length : int; genesis_slot : int } [@@deriving yojson, dhall_type, bin_io_unversioned] end diff --git a/src/lib/snark_keys_header/snark_keys_header.ml b/src/lib/snark_keys_header/snark_keys_header.ml index e34b387c773..2ec090fc5e3 100644 --- a/src/lib/snark_keys_header/snark_keys_header.ml +++ b/src/lib/snark_keys_header/snark_keys_header.ml @@ -89,7 +89,7 @@ module Constraint_constants = struct type t = { previous_state_hash : string ; previous_length : int - ; previous_global_slot : int + ; genesis_slot : int } [@@deriving yojson, sexp, ord, equal]