requests block + blob always post eip4844

This commit is contained in:
realbigsean
2022-12-07 15:30:08 -05:00
parent b616c0a056
commit a0d4aecf30
9 changed files with 85 additions and 36 deletions

View File

@@ -103,6 +103,7 @@ use store::{
use task_executor::{ShutdownReason, TaskExecutor};
use tree_hash::TreeHash;
use types::beacon_state::CloneConfig;
use types::consts::eip4844::MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS;
use types::signed_block_and_blobs::BlockWrapper;
use types::*;
@@ -5421,9 +5422,24 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
/// The epoch at which we require a data availability check in block processing.
/// `None` if the `Eip4844` fork is disabled.
pub fn data_availability_boundary(&self) -> Option<Epoch> {
self.spec
self.spec.eip4844_fork_epoch.map(|fork_epoch| {
self.epoch().ok().map(|current_epoch|{
std::cmp::max(
fork_epoch,
current_epoch - *MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS,
)
})
}).flatten()
}
/// Returns `true` if we are at or past the `Eip4844` fork. This will always return `false` if
/// the `Eip4844` fork is disabled.
pub fn is_data_availability_check_required(&self) -> Result<bool, Error> {
let current_epoch = self.epoch()?;
Ok(self.spec
.eip4844_fork_epoch
.map(|e| std::cmp::max(e, self.head().finalized_checkpoint().epoch))
.map(|fork_epoch| fork_epoch <= current_epoch)
.unwrap_or(false))
}
}

View File

@@ -1,10 +1,10 @@
use slot_clock::SlotClock;
use crate::beacon_chain::{BeaconChain, BeaconChainTypes, MAXIMUM_GOSSIP_CLOCK_DISPARITY};
use bls::PublicKey;
use types::consts::eip4844::BLS_MODULUS;
use crate::{kzg_utils, BeaconChainError};
use bls::PublicKey;
use state_processing::per_block_processing::eip4844::eip4844::verify_kzg_commitments_against_transactions;
use types::consts::eip4844::BLS_MODULUS;
use types::{BeaconStateError, BlobsSidecar, Hash256, KzgCommitment, Slot, Transactions};
#[derive(Debug)]