Convert RpcBlock to an enum that indicates availability (#8424)

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Mark Mackey <mark@sigmaprime.io>

Co-Authored-By: Eitan Seri-Levi <eserilev@gmail.com>

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
Eitan Seri-Levi
2026-01-27 21:59:32 -08:00
committed by GitHub
parent c4409cdf28
commit f7b5c7ee3f
23 changed files with 1368 additions and 579 deletions

View File

@@ -19,6 +19,7 @@ use beacon_chain::{
PayloadVerificationOutcome, PayloadVerificationStatus,
blob_verification::GossipVerifiedBlob,
block_verification_types::{AsBlock, BlockImportData},
custody_context::NodeCustodyType,
data_availability_checker::Availability,
test_utils::{
BeaconChainHarness, EphemeralHarnessType, NumBlobs, generate_rand_block_and_blobs,
@@ -54,6 +55,10 @@ type DCByRootId = (SyncRequestId, Vec<ColumnIndex>);
impl TestRig {
pub fn test_setup() -> Self {
Self::test_setup_with_custody_type(NodeCustodyType::Fullnode)
}
pub fn test_setup_with_custody_type(node_custody_type: NodeCustodyType) -> Self {
// Use `fork_from_env` logic to set correct fork epochs
let spec = test_spec::<E>();
@@ -68,6 +73,7 @@ impl TestRig {
Duration::from_secs(0),
Duration::from_secs(12),
))
.node_custody_type(node_custody_type)
.build();
let chain = harness.chain.clone();
@@ -101,8 +107,6 @@ impl TestRig {
.network_globals
.set_sync_state(SyncState::Synced);
let spec = chain.spec.clone();
// deterministic seed
let rng_08 = <rand_chacha_03::ChaCha20Rng as rand_08::SeedableRng>::from_seed([0u8; 32]);
let rng = ChaCha20Rng::from_seed([0u8; 32]);
@@ -128,7 +132,6 @@ impl TestRig {
),
harness,
fork_name,
spec,
}
}
@@ -1929,7 +1932,6 @@ mod deneb_only {
block_verification_types::{AsBlock, RpcBlock},
data_availability_checker::AvailabilityCheckError,
};
use ssz_types::RuntimeVariableList;
use std::collections::VecDeque;
struct DenebTester {
@@ -2283,15 +2285,13 @@ mod deneb_only {
fn parent_block_unknown_parent(mut self) -> Self {
self.rig.log("parent_block_unknown_parent");
let block = self.unknown_parent_block.take().unwrap();
let max_len = self.rig.spec.max_blobs_per_block(block.epoch()) as usize;
// Now this block is the one we expect requests from
self.block = block.clone();
let block = RpcBlock::new(
Some(block.canonical_root()),
block,
self.unknown_parent_blobs
.take()
.map(|vec| RuntimeVariableList::new(vec, max_len).unwrap()),
None,
&self.rig.harness.chain.data_availability_checker,
self.rig.harness.chain.spec.clone(),
)
.unwrap();
self.rig.parent_block_processed(