-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve fork config generation for develop. #14285
Conversation
when generating a fork config.
!ci-build-me |
2 similar comments
!ci-build-me |
!ci-build-me |
…x-fork-config-generation-berkeley
c932a4b
to
2f3f5ab
Compare
!ci-build-me |
…ntimir/fix-fork-generation-develop
2f3f5ab
to
984d5fa
Compare
!ci-build-me |
!ci-build-me |
!ci-build-me |
!ci-build-me |
@bkase any chance to review this PR ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when you hit this graphql endpoint for a node synced to mainnet? Does it hang the node for X seconds? What is X? Something we should keep in mind operationally, though I think we can survive even if it's really slow since only one (or a very small number of) nodes needs to run this
@@ -1,9 +1,21 @@ | |||
open Core_kernel | |||
|
|||
module Fork_config = struct | |||
(* previous_global_slot here is a global slot since genesis. previous |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment bitrot a bit (previous_global_slot renamed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you inline these comments for each field, that will make it easier to notice when they change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in a681c0f.
!ci-build-me |
a681c0f
to
c83dc68
Compare
!ci-build-me |
@@ -2293,15 +2293,6 @@ module Queries = struct | |||
|> Runtime_config.to_yojson |> Yojson.Safe.to_basic ) | |||
|
|||
let fork_config = | |||
let rec map_results ~f = function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
map_results ~f xs
should be equivalent to List.map ~f xs |> Result.all
. In case you find it tedius to define it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it's less efficient, as it iterates over the list twice, doesn't it?
let runtime_config = Mina_lib.runtime_config mina in | ||
match | ||
let open Result.Let_syntax in | ||
let%bind staking_ledger = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a check that the ledger hash of the staking_ledger
equal to the staking_epoch.ledger
and also the ledger hash of the next_epoch_ledger
equal to the next_epoch.ledger
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I obtain a hash from the ledger in order to compare it? I cannot find a function for this in the interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get that by calling Ledger.Any_ledger.M.merkle_root
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 27157c9.
src/lib/mina_graphql/mina_graphql.ml
Outdated
Runtime_config.make_fork_config ~staged_ledger ~global_slot | ||
~staking_ledger ~staking_epoch_seed ~next_epoch_ledger | ||
~next_epoch_seed ~blockchain_length | ||
~protocol_state_hash:protocol_state.previous_state_hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use the previous_state_hash
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What else should I use? As far as I can see, the protocol_state
only contains that and the genesis_state_hash
within body
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be the current protocol_state_hash
instead of the previous one. You can get the current state_hash by Transition_frontier.Breadcrumb.state_hash best tip
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 27157c9.
Can you expanded a little more on how you tested this PR? |
@ghost-not-in-the-shell , there's an integration test for this in review: #14342. Once it's merged, we can add more checks to it to test this change. For the time being I tested manually by extracting the runtime config from a running node and started a new network from it. In particular I did synchronise with |
} | ||
|
||
let ledger_accounts (ledger : Mina_ledger.Ledger.Any_ledger.witness) = | ||
Mina_ledger.Ledger.Any_ledger.M.foldi ~init:[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are just using the foldi
here to return a list of accounts. Then why not use the to_list_sequential
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, see 27157c9.
!ci-build-me |
!ci-build-me |
I'm going to revert this PR as the |
Explain your changes:
berkeley
.Explain how you tested your changes:
Checklist: