mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-17 03:42:46 +00:00
Gloas local block building MVP (#8754)
The flow for local block building is 1. Create execution payload and bid 2. Construct beacon block 3. Sign beacon block and publish 4. Sign execution payload and publish This PR adds the beacon block v4 flow , GET payload envelope and POST payload envelope (local block building only). The spec for these endpoints can be found here: https://github.com/ethereum/beacon-APIs/pull/552 and is subject to change. We needed a way to store the unsigned execution payload envelope associated to the execution payload bid that was included in the block. I introduced a new cache that stores these unsigned execution payload envelopes. the GET payload envelope queries this cache directly so that a proposer, after publishing a block, can fetch the payload envelope + sign and publish it. I kept payload signing and publishing within the validators block service to keep things simple for now. The idea was to build out a block production MVP for devnet 0, try not to affect any non gloas code paths and build things out in such a way that it will be easy to deprecate pre-gloas code paths later on (for example block production v2 and v3). We will eventually need to track which beacon node was queried for the block so that we can later query it for the payload. But thats not needed for the devnet. Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com> Co-Authored-By: Michael Sproul <michael@sigmaprime.io> Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com> Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>
This commit is contained in:
@@ -36,6 +36,9 @@ mod validator_inclusion;
|
||||
mod validators;
|
||||
mod version;
|
||||
|
||||
use crate::beacon::execution_payload_envelope::{
|
||||
post_beacon_execution_payload_envelope, post_beacon_execution_payload_envelope_ssz,
|
||||
};
|
||||
use crate::beacon::pool::*;
|
||||
use crate::light_client::{get_light_client_bootstrap, get_light_client_updates};
|
||||
use crate::utils::{AnyVersionFilter, EthV1Filter};
|
||||
@@ -92,6 +95,7 @@ use types::{
|
||||
BeaconStateError, Checkpoint, ConfigAndPreset, Epoch, EthSpec, ForkName, Hash256,
|
||||
SignedBlindedBeaconBlock, Slot,
|
||||
};
|
||||
use validator::execution_payload_envelope::get_validator_execution_payload_envelope;
|
||||
use version::{
|
||||
ResponseIncludesVersion, V1, V2, add_consensus_version_header, add_ssz_content_type_header,
|
||||
execution_optimistic_finalized_beacon_response, inconsistent_fork_rejection,
|
||||
@@ -1486,6 +1490,22 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
let post_beacon_pool_bls_to_execution_changes =
|
||||
post_beacon_pool_bls_to_execution_changes(&network_tx_filter, &beacon_pool_path);
|
||||
|
||||
// POST beacon/execution_payload_envelope
|
||||
let post_beacon_execution_payload_envelope = post_beacon_execution_payload_envelope(
|
||||
eth_v1.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
chain_filter.clone(),
|
||||
network_tx_filter.clone(),
|
||||
);
|
||||
|
||||
// POST beacon/execution_payload_envelope (SSZ)
|
||||
let post_beacon_execution_payload_envelope_ssz = post_beacon_execution_payload_envelope_ssz(
|
||||
eth_v1.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
chain_filter.clone(),
|
||||
network_tx_filter.clone(),
|
||||
);
|
||||
|
||||
let beacon_rewards_path = eth_v1
|
||||
.clone()
|
||||
.and(warp::path("beacon"))
|
||||
@@ -2444,7 +2464,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// GET validator/duties/proposer/{epoch}
|
||||
let get_validator_duties_proposer = get_validator_duties_proposer(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
@@ -2452,7 +2472,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// GET validator/blocks/{slot}
|
||||
let get_validator_blocks = get_validator_blocks(
|
||||
any_version.clone().clone(),
|
||||
any_version.clone(),
|
||||
chain_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
@@ -2460,7 +2480,15 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// GET validator/blinded_blocks/{slot}
|
||||
let get_validator_blinded_blocks = get_validator_blinded_blocks(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
);
|
||||
|
||||
// GET validator/execution_payload_envelope/{slot}/{builder_index}
|
||||
let get_validator_execution_payload_envelope = get_validator_execution_payload_envelope(
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
@@ -2468,7 +2496,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// GET validator/attestation_data?slot,committee_index
|
||||
let get_validator_attestation_data = get_validator_attestation_data(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
@@ -2476,7 +2504,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// GET validator/aggregate_attestation?attestation_data_root,slot
|
||||
let get_validator_aggregate_attestation = get_validator_aggregate_attestation(
|
||||
any_version.clone().clone(),
|
||||
any_version.clone(),
|
||||
chain_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
@@ -2484,7 +2512,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// POST validator/duties/attester/{epoch}
|
||||
let post_validator_duties_attester = post_validator_duties_attester(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
@@ -2492,7 +2520,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// POST validator/duties/sync/{epoch}
|
||||
let post_validator_duties_sync = post_validator_duties_sync(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
@@ -2500,7 +2528,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// GET validator/sync_committee_contribution
|
||||
let get_validator_sync_committee_contribution = get_validator_sync_committee_contribution(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
@@ -2508,7 +2536,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// POST validator/aggregate_and_proofs
|
||||
let post_validator_aggregate_and_proofs = post_validator_aggregate_and_proofs(
|
||||
any_version.clone().clone(),
|
||||
any_version.clone(),
|
||||
chain_filter.clone(),
|
||||
network_tx_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
@@ -2516,7 +2544,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
);
|
||||
|
||||
let post_validator_contribution_and_proofs = post_validator_contribution_and_proofs(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
network_tx_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
@@ -2526,7 +2554,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
// POST validator/beacon_committee_subscriptions
|
||||
let post_validator_beacon_committee_subscriptions =
|
||||
post_validator_beacon_committee_subscriptions(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
validator_subscription_tx_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
@@ -2534,7 +2562,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// POST validator/prepare_beacon_proposer
|
||||
let post_validator_prepare_beacon_proposer = post_validator_prepare_beacon_proposer(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
network_tx_filter.clone(),
|
||||
not_while_syncing_filter.clone(),
|
||||
@@ -2543,13 +2571,13 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// POST validator/register_validator
|
||||
let post_validator_register_validator = post_validator_register_validator(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
);
|
||||
// POST validator/sync_committee_subscriptions
|
||||
let post_validator_sync_committee_subscriptions = post_validator_sync_committee_subscriptions(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
validator_subscription_tx_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
@@ -2557,7 +2585,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
|
||||
// POST validator/liveness/{epoch}
|
||||
let post_validator_liveness_epoch = post_validator_liveness_epoch(
|
||||
eth_v1.clone().clone(),
|
||||
eth_v1.clone(),
|
||||
chain_filter.clone(),
|
||||
task_spawner_filter.clone(),
|
||||
);
|
||||
@@ -3336,6 +3364,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
.uor(get_validator_duties_proposer)
|
||||
.uor(get_validator_blocks)
|
||||
.uor(get_validator_blinded_blocks)
|
||||
.uor(get_validator_execution_payload_envelope)
|
||||
.uor(get_validator_attestation_data)
|
||||
.uor(get_validator_aggregate_attestation)
|
||||
.uor(get_validator_sync_committee_contribution)
|
||||
@@ -3374,7 +3403,8 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
post_beacon_blocks_ssz
|
||||
.uor(post_beacon_blocks_v2_ssz)
|
||||
.uor(post_beacon_blinded_blocks_ssz)
|
||||
.uor(post_beacon_blinded_blocks_v2_ssz),
|
||||
.uor(post_beacon_blinded_blocks_v2_ssz)
|
||||
.uor(post_beacon_execution_payload_envelope_ssz),
|
||||
)
|
||||
.uor(post_beacon_blocks)
|
||||
.uor(post_beacon_blinded_blocks)
|
||||
@@ -3386,6 +3416,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
.uor(post_beacon_pool_voluntary_exits)
|
||||
.uor(post_beacon_pool_sync_committees)
|
||||
.uor(post_beacon_pool_bls_to_execution_changes)
|
||||
.uor(post_beacon_execution_payload_envelope)
|
||||
.uor(post_beacon_state_validators)
|
||||
.uor(post_beacon_state_validator_balances)
|
||||
.uor(post_beacon_state_validator_identities)
|
||||
|
||||
Reference in New Issue
Block a user