Skip to content

Commit

Permalink
Merge pull request #15094 from MinaProtocol/fix/state-dump-graphql
Browse files Browse the repository at this point in the history
Use the correct values for the fork config
  • Loading branch information
mrmr1993 authored Feb 14, 2024
2 parents 3e6284a + 7635f12 commit 85fc613
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 62 deletions.
10 changes: 0 additions & 10 deletions buildkite/src/Jobs/Lint/Merge.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,6 @@ Pipeline.build
image = (../../Constants/ContainerImages.dhall).toolchainBase
}
}
, Command.build
Command.Config::{
commands = [ Cmd.run "buildkite/scripts/merges-cleanly.sh rampup"]
, label = "Check merges cleanly into rampup"
, key = "clean-merge-rampup"
, target = Size.Small
, docker = Some Docker::{
image = (../../Constants/ContainerImages.dhall).toolchainBase
}
}
, Command.build
Command.Config::{
commands = [ Cmd.run "true" ] : List Cmd.Type
Expand Down
5 changes: 3 additions & 2 deletions src/lib/mina_graphql/mina_graphql.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2318,6 +2318,7 @@ module Queries = struct
Transition_frontier.Breadcrumb.staged_ledger breadcrumb
|> Staged_ledger.ledger
in
let state_hash = Transition_frontier.Breadcrumb.state_hash breadcrumb in
let protocol_state =
Transition_frontier.Breadcrumb.protocol_state breadcrumb
in
Expand Down Expand Up @@ -2372,8 +2373,8 @@ module Queries = struct
next_epoch.ledger.hash ) ) ;
let%bind new_config =
Runtime_config.make_fork_config ~staged_ledger ~global_slot
~staking_ledger ~staking_epoch_seed ~next_epoch_ledger
~next_epoch_seed ~blockchain_length ~protocol_state runtime_config
~state_hash ~staking_ledger ~staking_epoch_seed ~next_epoch_ledger
~next_epoch_seed ~blockchain_length runtime_config
in
let%map () =
let open Async.Deferred.Infix in
Expand Down
67 changes: 17 additions & 50 deletions src/lib/runtime_config/runtime_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1456,9 +1456,9 @@ let ledger_of_accounts accounts =
; add_genesis_winner = Some false
}

let make_fork_config ~staged_ledger ~global_slot ~blockchain_length
~protocol_state ~staking_ledger ~staking_epoch_seed ~next_epoch_ledger
~next_epoch_seed (runtime_config : t) =
let make_fork_config ~staged_ledger ~global_slot ~state_hash ~blockchain_length
~staking_ledger ~staking_epoch_seed ~next_epoch_ledger ~next_epoch_seed
(runtime_config : t) =
let open Async.Deferred.Result.Let_syntax in
let global_slot_since_genesis =
Mina_numbers.Global_slot_since_hard_fork.to_int global_slot
Expand All @@ -1474,37 +1474,10 @@ let make_fork_config ~staged_ledger ~global_slot ~blockchain_length
|> ledger_accounts
in
let ledger = Option.value_exn runtime_config.ledger in
let fork_blockchain_length =
let open Option.Let_syntax in
let%bind proof = runtime_config.proof in
let%map fork = proof.fork in
fork.blockchain_length + blockchain_length
in
let protocol_constants = Mina_state.Protocol_state.constants protocol_state in
let genesis =
{ Genesis.k =
Some
(Unsigned.UInt32.to_int
protocol_constants.Genesis_constants.Protocol.Poly.k )
; delta = Some (Unsigned.UInt32.to_int protocol_constants.delta)
; slots_per_epoch =
Some (Unsigned.UInt32.to_int protocol_constants.slots_per_epoch)
; slots_per_sub_window =
Some (Unsigned.UInt32.to_int protocol_constants.slots_per_sub_window)
; genesis_state_timestamp =
Some
(Block_time.to_string_exn protocol_constants.genesis_state_timestamp)
; grace_period_slots =
Some (Unsigned.UInt32.to_int protocol_constants.grace_period_slots)
}
in
let fork =
Fork_config.
{ state_hash =
Mina_base.State_hash.to_base58_check
(Mina_state.Protocol_state.hashes protocol_state).state_hash
; blockchain_length =
Option.value ~default:blockchain_length fork_blockchain_length
{ state_hash = Mina_base.State_hash.to_base58_check state_hash
; blockchain_length
; global_slot_since_genesis
}
in
Expand All @@ -1530,24 +1503,18 @@ let make_fork_config ~staged_ledger ~global_slot ~blockchain_length
{ ledger = ledger_of_accounts accounts; seed = next_epoch_seed } )
}
in
let update =
make
(* add_genesis_winner must be set to false, because this
config effectively creates a continuation of the current
blockchain state and therefore the genesis ledger already
contains the winner of the previous block. No need to
artificially add it. In fact, it wouldn't work at all,
because the new node would try to create this account at
startup, even though it already exists, leading to an error.*)
~epoch_data ~genesis
~ledger:
{ ledger with
base = Accounts accounts
; add_genesis_winner = Some false
}
~proof:(Proof_keys.make ~fork ()) ()
in
combine runtime_config update
make
(* add_genesis_winner must be set to false, because this
config effectively creates a continuation of the current
blockchain state and therefore the genesis ledger already
contains the winner of the previous block. No need to
artificially add it. In fact, it wouldn't work at all,
because the new node would try to create this account at
startup, even though it already exists, leading to an error.*)
~epoch_data
~ledger:
{ ledger with base = Accounts accounts; add_genesis_winner = Some false }
~proof:(Proof_keys.make ~fork ()) ()

let slot_tx_end_or_default, slot_chain_end_or_default =
let f compile get_runtime t =
Expand Down

0 comments on commit 85fc613

Please sign in to comment.