-
Notifications
You must be signed in to change notification settings - Fork 171
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
Add new endpoint to fetch fork choice context from a client. #232
Conversation
Just a couple of quick comments: The API says Prysm cannot know the justified checkpoints of the nodes, it does know the justified epoch though. Finalized checkpoint is fine cause we do not keep any node beyond finalized and all nodes are descendant of the same finalized checkpoint. Edit: actually due to an implementation detail we may not even know the finalized checkpoint of older nodes if forkchoice is small enough |
I feel like other store specifics are universal: the best justified checkpoint, the proposer boost root (perhaps even the previous proposer boost root), |
The prysm structure from the issue suggested you had the checkpoint I thought?
|
That's the store's checkpoint, not the node's ones |
I'll change that to epoch and we can always embed the extra in extra_data if we think we need it... @tbenr hopefully epoch is sufficient for what you were thinking... |
I'm currently thinking about something like: {
"data_source": "teku", // self consistency, no API call to version required to get the context for interpreting extra_data
"effective_ballance": "112228712638716", // effective balance for the current epoch
"weight_mode": "COMULATIVE_TO_ROOT", // NON_COMULATIVE | COMULATIVE_TO_ROOT | COMULATIVE_TO_HEAD
"fork_choice_store": [
{
"slot": "123",
"block_root": "0x...",
"parent_root": "0x...",
"justified_epoch": "1",
"finalized_epoch": "2",
"execution_payload_root": "0x...",
"validity": "VALID", // VAILD | INVALID | OPTIMISTIC
"weight": "678976",
"extra_data": {
"best_descendant_index": "3" // teku specific
}
},
...
]
} @potuz does
|
I assume the "cumulative-to-root" weight of a node means the sum of all the non-cummulative weights of every descendant (including itself)? Except perhaps for proposer boost. Cumulative to head seems to be the right thing for visualization. You can derive any one from any other, so if teams use majoritarily cumulative to root, we can easily adapt to that. In addition to the list of nodes (that I would call something like Also if possible it would be nicer to teams to avoid the |
I think it should be for the justified checkpoint which is what's used in computations and not the current epoch. It's easy for us to include this one, but not sure if it would be for other teams |
Implements a proposed REST endpoint for analyzing fork choice behaviour. See ethereum/beacon-APIs#232
Implements a proposed REST endpoint for analyzing fork choice behaviour. See ethereum/beacon-APIs#232
Implements a proposed REST endpoint for analyzing fork choice behaviour. See ethereum/beacon-APIs#232
Co-authored-by: Enrico Del Fante <[email protected]>
I'm wondering if it's not worth to have timestamp as a mandatory field in all of the reorgs we've had from mainnet having the timestamp was instrumental to quickly assess that the cause was simply a late block |
Teku doesn't currently track this and it's not a necessary thing to track (also there's a lot of variation in what you might want to track as a client - arrival time vs actual import time etc). So I'd be keen to keep it as an optional field so we don't lock ourselves into tracking unnecessary data, but it could be provided if available. I'm not against tracking it in teku if it's useful for debugging just don't want to be locked into it forever by this API. The other way to see if a block is late would be to request the fork choice state at 4s into the slot - if the block's not there then, it must have been late. Teku also provides info in logs about late blocks etc so the data is available if needed. |
The one big advantage of having the timestamp on the dump is when using @tbenr viewer: if you order the nodes by timestamp instead of by slot number, you get a much more clear picture of the forkchoice context in the event of reorgs. Before we added timestamps to our node, we would have to go to the logs for each slot individually to find out when the block was received. I do recognize that there's a difference between receival time, forkchoice insertion time, etc. But I think these are minor issues in front of the better UX |
incorporate latest changes
Yeah, I acknowledge it's useful, but I wouldn't want to require fork choice tracks it just for this API, hence I think it should be optional. Clients can then choose if its worth tracking or not and if they don't support it they just won't be able to sort by arrival time in the viewer. |
I'm not sure whether we decided on |
thanks @rolfyone for proxying the PR and linting it :)
At the beginning of the thread @potuz says prysm doesn't track the full justified checkpoint but only the epoch. So I erroneously downgraded all Or we could have them defined as CheckpointOrEpoch:
oneOf:
- $ref: '../../beacon-node-oapi.yaml#/components/schemas/Checkpoint'
- $ref: './primitive.yaml#/Uint64' So I added an extra_data field in the topmost object so clients can add more info as a general context for the dump. I was thinking about adding |
Co-authored-by: Michael Sproul <[email protected]>
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.
LGTM!
## Issue Addressed Which issue # does this PR address? #3669 ## Proposed Changes Please list or describe the changes introduced by this PR. - A new API to fetch fork choice data, as specified [here](ethereum/beacon-APIs#232) - A new integration test to test the new API ## Additional Info Please provide any additional information. For example, future considerations or information useful for reviewers. - `extra_data` field specified in the beacon-API spec is not implemented, please let me know if I should instead. Co-authored-by: Michael Sproul <[email protected]>
Syncs the `/eth/v1/debug/fork_choice` REST endpoint with latest specs. - Validity is now reported as tri-state `enum` instead of two `bool`s - Response includes store's justified and finalized checkpoints - Additional `ExtraData` field on outer layer (empty for now) ethereum/beacon-APIs#232
Syncs the `/eth/v1/debug/fork_choice` REST endpoint with latest specs. - Validity is now reported as tri-state `enum` instead of two `bool`s - Response includes store's justified and finalized checkpoints - Additional `ExtraData` field on outer layer (empty for now) ethereum/beacon-APIs#232
## Issue Addressed Which issue # does this PR address? sigp#3669 ## Proposed Changes Please list or describe the changes introduced by this PR. - A new API to fetch fork choice data, as specified [here](ethereum/beacon-APIs#232) - A new integration test to test the new API ## Additional Info Please provide any additional information. For example, future considerations or information useful for reviewers. - `extra_data` field specified in the beacon-API spec is not implemented, please let me know if I should instead. Co-authored-by: Michael Sproul <[email protected]>
Which issue # does this PR address? sigp#3669 Please list or describe the changes introduced by this PR. - A new API to fetch fork choice data, as specified [here](ethereum/beacon-APIs#232) - A new integration test to test the new API Please provide any additional information. For example, future considerations or information useful for reviewers. - `extra_data` field specified in the beacon-API spec is not implemented, please let me know if I should instead. Co-authored-by: Michael Sproul <[email protected]>
Fixes #231