Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 20 additions & 5 deletions block_producer/src/block_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use itertools::{Either, Itertools as _};
use keymanager::ProposerConfigs;
use logging::{error_with_peers, info_with_peers, warn_with_peers};
use operation_pools::{
AttestationAggPool, BlsToExecutionChangePool, PoolAdditionOutcome, PoolRejectionReason,
SyncCommitteeAggPool,
AttestationAggPool, BlsToExecutionChangePool, PayloadAttestationAggPool, PoolAdditionOutcome,
PoolRejectionReason, SyncCommitteeAggPool,
};
use prometheus_metrics::Metrics;
use pubkey_cache::PubkeyCache;
Expand Down Expand Up @@ -74,7 +74,7 @@ use types::{
fulu::containers::{BeaconBlock as FuluBeaconBlock, BeaconBlockBody as FuluBeaconBlockBody},
gloas::containers::{
BeaconBlock as GloasBeaconBlock, BeaconBlockBody as GloasBeaconBlockBody,
SignedExecutionPayloadBid,
PayloadAttestation, SignedExecutionPayloadBid,
},
nonstandard::{BlockRewards, Phase, WithBlobsAndMev},
phase0::{
Expand Down Expand Up @@ -125,6 +125,7 @@ impl<P: Preset, W: Wait> BlockProducer<P, W> {
attestation_agg_pool: Arc<AttestationAggPool<P, W>>,
bls_to_execution_change_pool: Arc<BlsToExecutionChangePool>,
sync_committee_agg_pool: Arc<SyncCommitteeAggPool<P, W>>,
payload_attestation_agg_pool: Arc<PayloadAttestationAggPool<P, W>>,
metrics: Option<Arc<Metrics>>,
options: Option<Options>,
) -> Self {
Expand All @@ -143,6 +144,7 @@ impl<P: Preset, W: Wait> BlockProducer<P, W> {
attestation_agg_pool,
bls_to_execution_change_pool,
sync_committee_agg_pool,
payload_attestation_agg_pool,
prepared_proposers: Mutex::new(HashMap::new()),
proposer_slashings: Mutex::new(vec![]),
attester_slashings: Mutex::new(vec![]),
Expand Down Expand Up @@ -617,6 +619,7 @@ struct ProducerContext<P: Preset, W: Wait> {
attestation_agg_pool: Arc<AttestationAggPool<P, W>>,
bls_to_execution_change_pool: Arc<BlsToExecutionChangePool>,
sync_committee_agg_pool: Arc<SyncCommitteeAggPool<P, W>>,
payload_attestation_agg_pool: Arc<PayloadAttestationAggPool<P, W>>,
prepared_proposers: Mutex<HashMap<ValidatorIndex, ExecutionAddress>>,
proposer_slashings: Mutex<Vec<ProposerSlashing>>,
attester_slashings: Mutex<Vec<AttesterSlashing<P>>>,
Expand Down Expand Up @@ -969,8 +972,7 @@ impl<P: Preset, W: Wait> BlockBuildContext<P, W> {
},
})),
Phase::Gloas => {
// TODO(gloas): prepare_payload_attestations
let payload_attestations = ContiguousList::default();
let payload_attestations = self.prepare_payload_attestations().await?;

BeaconBlock::from(Hc::new(GloasBeaconBlock {
slot,
Expand Down Expand Up @@ -1380,6 +1382,19 @@ impl<P: Preset, W: Wait> BlockBuildContext<P, W> {
.await
}

// Constructed `payload_attestations` in current block is to aggregate all payload attestations for the previous block payload.
// See <https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.1/specs/gloas/validator.md#constructing-payload_attestations>
async fn prepare_payload_attestations(
&self,
) -> Result<ContiguousList<PayloadAttestation<P>, P::MaxPayloadAttestation>> {
let message_slot = misc::previous_slot(self.beacon_state.slot());

self.producer_context
.payload_attestation_agg_pool
.aggregate_payload_attestations(message_slot)
.await
}

async fn prepare_voluntary_exits(
&self,
) -> ContiguousList<SignedVoluntaryExit, P::MaxVoluntaryExits> {
Expand Down
4 changes: 2 additions & 2 deletions builder_api/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl Api {
let url = self.url("/eth/v1/builder/blinded_blocks")?;

let (next_interval, remaining_time) =
clock::next_interval_with_remaining_time(chain_config, genesis_time)?;
clock::next_interval_with_remaining_time::<P>(chain_config, genesis_time)?;

let use_json = self.config.builder_api_format == BuilderApiFormat::Json
|| self
Expand Down Expand Up @@ -410,7 +410,7 @@ impl Api {
let url = self.url("/eth/v2/builder/blinded_blocks")?;

let (next_interval, remaining_time) =
clock::next_interval_with_remaining_time(chain_config, genesis_time)?;
clock::next_interval_with_remaining_time::<P>(chain_config, genesis_time)?;

let use_json = self.config.builder_api_format == BuilderApiFormat::Json
|| self
Expand Down
Loading
Loading