-
Notifications
You must be signed in to change notification settings - Fork 747
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
[Merged by Bors] - Add finalized
to HTTP API responses
#3753
Conversation
e7652a7
to
f31a4e2
Compare
f31a4e2
to
ee990af
Compare
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.
This is great, thanks for digging into it!
You're definitely on the right track, I just left a few pointers about how to progress from here
7e8a079
to
5679214
Compare
I think that's all :) Some things to settle before it's... finalized:
|
Sorry I didn't get back to you about this! Your approach to error handling looks good at a quick glance and I agree we don't need I'll try to give this a more thorough review on Monday & help with writing tests if you need help |
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.
This is looking really nice on the whole, I've just made a few suggestions which I hope will decrease the impact on performance.
In general my suggestions try to avoid disk I/O and repetition. Disk I/O, particularly loading full states, is a major source of slowness.
It would also be really cool to do some real-world benchmarks of nodes before and after this change is applied. We could write a utility into lcli
which uses the API wrappers from eth2
to make different calls against a live node, and record how long they take. I'd be happy to work on this as it would also be useful for testing other API changes and optimisations.
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.
Looks good
There are a few merge conflicts to fix up but once they're resolved I'll give it another look and we can merge.
Most of the conflicts will be from #4068, which changed all the HTTP handlers to return warp::reply::Response
. Sprinkling a few into_response()
calls in a couple of places might be all we need. The blocking_json_task
already takes care of returning a Response
, so any calls using that should be OK.
Unless I missed something, it seems like the conflicts were quite simple. Just some |
Thanks @danielrachi, seeing as this is quite a major change and isn't essential for Capella I'm nominating it for inclusion in v4.1.0, which should be released in a few weeks. |
- Remove unnecessary tuple nesting like `((data, finalized), optimistic)` - Return `finalized` from `BlockId` functions to avoid repeated block loads from disk - Add `finalized` status to new rewards APIs added after this PR was opened
@danielrachi I pushed some minor changes in 5e2be5f that I thought of while reviewing. I'll deploy this PR on some of our nodes, and then I think it's good to merge |
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.
This has been:
- Manually reviewed
- Benchmarked
- Deployed on Goerli
We're good to go
bors r+ |
## Issue Addressed #3708 ## Proposed Changes - Add `is_finalized_block` method to `BeaconChain` in `beacon_node/beacon_chain/src/beacon_chain.rs`. - Add `is_finalized_state` method to `BeaconChain` in `beacon_node/beacon_chain/src/beacon_chain.rs`. - Add `fork_and_execution_optimistic_and_finalized` in `beacon_node/http_api/src/state_id.rs`. - Add `ExecutionOptimisticFinalizedForkVersionedResponse` type in `consensus/types/src/fork_versioned_response.rs`. - Add `execution_optimistic_finalized_fork_versioned_response`function in `beacon_node/http_api/src/version.rs`. - Add `ExecutionOptimisticFinalizedResponse` type in `common/eth2/src/types.rs`. - Add `add_execution_optimistic_finalized` method in `common/eth2/src/types.rs`. - Update API response methods to include finalized. - Remove `execution_optimistic_fork_versioned_response` Co-authored-by: Michael Sproul <michael@sigmaprime.io>
Will batch this actually bors r- |
Canceled. |
## Issue Addressed #3708 ## Proposed Changes - Add `is_finalized_block` method to `BeaconChain` in `beacon_node/beacon_chain/src/beacon_chain.rs`. - Add `is_finalized_state` method to `BeaconChain` in `beacon_node/beacon_chain/src/beacon_chain.rs`. - Add `fork_and_execution_optimistic_and_finalized` in `beacon_node/http_api/src/state_id.rs`. - Add `ExecutionOptimisticFinalizedForkVersionedResponse` type in `consensus/types/src/fork_versioned_response.rs`. - Add `execution_optimistic_finalized_fork_versioned_response`function in `beacon_node/http_api/src/version.rs`. - Add `ExecutionOptimisticFinalizedResponse` type in `common/eth2/src/types.rs`. - Add `add_execution_optimistic_finalized` method in `common/eth2/src/types.rs`. - Update API response methods to include finalized. - Remove `execution_optimistic_fork_versioned_response` Co-authored-by: Michael Sproul <michael@sigmaprime.io>
Pull request successfully merged into unstable. Build succeeded:
|
finalized
to HTTP API responsesfinalized
to HTTP API responses
## Issue Addressed sigp#3708 ## Proposed Changes - Add `is_finalized_block` method to `BeaconChain` in `beacon_node/beacon_chain/src/beacon_chain.rs`. - Add `is_finalized_state` method to `BeaconChain` in `beacon_node/beacon_chain/src/beacon_chain.rs`. - Add `fork_and_execution_optimistic_and_finalized` in `beacon_node/http_api/src/state_id.rs`. - Add `ExecutionOptimisticFinalizedForkVersionedResponse` type in `consensus/types/src/fork_versioned_response.rs`. - Add `execution_optimistic_finalized_fork_versioned_response`function in `beacon_node/http_api/src/version.rs`. - Add `ExecutionOptimisticFinalizedResponse` type in `common/eth2/src/types.rs`. - Add `add_execution_optimistic_finalized` method in `common/eth2/src/types.rs`. - Update API response methods to include finalized. - Remove `execution_optimistic_fork_versioned_response` Co-authored-by: Michael Sproul <michael@sigmaprime.io>
- Add `is_finalized_block` method to `BeaconChain` in `beacon_node/beacon_chain/src/beacon_chain.rs`. - Add `is_finalized_state` method to `BeaconChain` in `beacon_node/beacon_chain/src/beacon_chain.rs`. - Add `fork_and_execution_optimistic_and_finalized` in `beacon_node/http_api/src/state_id.rs`. - Add `ExecutionOptimisticFinalizedForkVersionedResponse` type in `consensus/types/src/fork_versioned_response.rs`. - Add `execution_optimistic_finalized_fork_versioned_response`function in `beacon_node/http_api/src/version.rs`. - Add `ExecutionOptimisticFinalizedResponse` type in `common/eth2/src/types.rs`. - Add `add_execution_optimistic_finalized` method in `common/eth2/src/types.rs`. - Update API response methods to include finalized. - Remove `execution_optimistic_fork_versioned_response` Co-authored-by: Michael Sproul <michael@sigmaprime.io>
Issue Addressed
#3708
Proposed Changes
is_finalized_block
method toBeaconChain
inbeacon_node/beacon_chain/src/beacon_chain.rs
.is_finalized_state
method toBeaconChain
inbeacon_node/beacon_chain/src/beacon_chain.rs
.fork_and_execution_optimistic_and_finalized
inbeacon_node/http_api/src/state_id.rs
.ExecutionOptimisticFinalizedForkVersionedResponse
type inconsensus/types/src/fork_versioned_response.rs
.execution_optimistic_finalized_fork_versioned_response
function inbeacon_node/http_api/src/version.rs
.ExecutionOptimisticFinalizedResponse
type incommon/eth2/src/types.rs
.add_execution_optimistic_finalized
method incommon/eth2/src/types.rs
.execution_optimistic_fork_versioned_response