[Merged by Bors] - Add finalized to HTTP API responses#3753
[Merged by Bors] - Add finalized to HTTP API responses#3753danielrachi1 wants to merge 28 commits intosigp:unstablefrom
finalized to HTTP API responses#3753Conversation
e7652a7 to
f31a4e2
Compare
f31a4e2 to
ee990af
Compare
michaelsproul
left a comment
There was a problem hiding this comment.
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 |
michaelsproul
left a comment
There was a problem hiding this comment.
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.
michaelsproul
left a comment
There was a problem hiding this comment.
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 |
michaelsproul
left a comment
There was a problem hiding this comment.
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 <[email protected]>
|
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 <[email protected]>
|
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 <[email protected]>
- 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 <[email protected]>
Issue Addressed
#3708
Proposed Changes
is_finalized_blockmethod toBeaconChaininbeacon_node/beacon_chain/src/beacon_chain.rs.is_finalized_statemethod toBeaconChaininbeacon_node/beacon_chain/src/beacon_chain.rs.fork_and_execution_optimistic_and_finalizedinbeacon_node/http_api/src/state_id.rs.ExecutionOptimisticFinalizedForkVersionedResponsetype inconsensus/types/src/fork_versioned_response.rs.execution_optimistic_finalized_fork_versioned_responsefunction inbeacon_node/http_api/src/version.rs.ExecutionOptimisticFinalizedResponsetype incommon/eth2/src/types.rs.add_execution_optimistic_finalizedmethod incommon/eth2/src/types.rs.execution_optimistic_fork_versioned_response