Skip to content

Commit

Permalink
Do not include new deposits in produced beacon block if deposit reque…
Browse files Browse the repository at this point in the history
…sts started being processed
  • Loading branch information
Povilas Liubauskas committed Oct 29, 2024
1 parent 9e75876 commit 9d09c5e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion block_producer/src/eth1_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use ssz::ContiguousList;
use thiserror::Error;
use typenum::Unsigned as _;
use types::{
combined::BeaconState as CombinedBeaconState,
config::Config,
phase0::{
containers::{Deposit, Eth1Data},
Expand Down Expand Up @@ -179,7 +180,7 @@ pub trait Eth1Storage {

fn pending_deposits<P: Preset>(
&self,
state: &impl BeaconState<P>,
state: &CombinedBeaconState<P>,
eth1_vote: Eth1Data,
metrics: Option<&Arc<Metrics>>,
) -> Result<ContiguousList<Deposit, P::MaxDeposits>> {
Expand All @@ -199,6 +200,17 @@ pub trait Eth1Storage {

let eth1_deposit_index = state.eth1_deposit_index();

if let CombinedBeaconState::Electra(state) = state {
let eth1_deposit_index_limit = state
.eth1_data()
.deposit_count
.min(state.deposit_requests_start_index);

if eth1_deposit_index >= eth1_deposit_index_limit {
return Ok(ContiguousList::default());
}
}

features::log!(DebugEth1, "state.eth1_deposit_index: {eth1_deposit_index}");
features::log!(DebugEth1, "eth1_data: {eth1_data:?}");

Expand Down

0 comments on commit 9d09c5e

Please sign in to comment.