-
Notifications
You must be signed in to change notification settings - Fork 958
Description
Description
The beacon-apis spec recently added a v2 block publishing endpoint which includes the ability to validate blocks before broadcasting them: ethereum/beacon-APIs#317
It is expected that this will be used by MEV relays in order to mitigate unbundling attacks.
Currently the relays are running forks of Prysm and Lighthouse: #4168.
Steps to resolve
Drawing on the existing implementation from @realbigsean's branch, implement the new POST /eth/v2/beacon/blocks and POST /eth/v2/beacon/blinded_blocks endpoints. We also need to add some tests of the basic scenarios: trying to broadcast a block that is gossip-valid but holistically invalid (e.g. has an invalid state root), trying to broadcast a block that is valid but equivocates.
In terms of parts of the codebase affected:
beacon_node/http_api/src/publish_blocks.rs: this is where the impl of the API should happen. We should try to share as much as possible between the v1 and v2 endpoints.beacon_node/http_api/src/lib.rs: wiring for the v1/v2 endpointscommon/eth2: HTTP client implementation (for accessing the new API).beacon_node/http_api/tests/interactive_tests.rs: probably the best place for the tests (or maybelib.rs, or a new file).
One complication I foresee with the equivocation test is controlling the timing: we want the honest block to pass gossip validation before the equivocating block is processed. But then we want the equivocating block to be processed before the honest block attempts broadcast. We may need to manually inject some events/state in order to simulate this (aside from just supplying the blocks).