Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge queue: embarking unstable (59afe41) and [#6817 + #6917 + #6766] together #6944

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
791395a
Use oldest_block_slot to break of pruning payloads
dapplion Dec 28, 2024
016e58e
Add prune_payloads false
chong-he Jan 3, 2025
9d85619
add log
chong-he Jan 3, 2025
a9c2f78
Merge remote-tracking branch 'origin/unstable' into keep-execution-pa…
chong-he Jan 8, 2025
412e8e9
Add prune_payload in config.rs
chong-he Jan 8, 2025
7c414cc
Update beacon_node/store/src/hot_cold_store.rs
dapplion Jan 9, 2025
c958809
Merge remote-tracking branch 'lion/anchor_slot_pruning' into keep-exe…
chong-he Jan 9, 2025
b86434a
Merge branch 'unstable' into keep-execution-payload
chong-he Jan 13, 2025
0a61483
get to prune_paylods correctly
chong-he Jan 13, 2025
9492cab
Simplify logging
chong-he Jan 13, 2025
7b5d5de
Even more simplified logging
chong-he Jan 15, 2025
2e2efa6
remove info
chong-he Jan 15, 2025
beefb92
Add test
chong-he Jan 17, 2025
86c65d6
Remove unused metrics
ackintosh Jan 18, 2025
2ffb739
Re-added block_availability_delay and utilized it
ackintosh Jan 24, 2025
4d06b67
Revert "Re-added block_availability_delay and utilized it"
ackintosh Jan 25, 2025
e1f81ce
test
chong-he Feb 6, 2025
833d4e2
Merge branch 'unstable' into keep-execution-payload
chong-he Feb 6, 2025
424d4c1
test
chong-he Feb 6, 2025
702fad7
Remove un-used batch sync error condition
dapplion Feb 6, 2025
42fb4d5
Fix test
chong-he Feb 6, 2025
b2abae9
Test
chong-he Feb 6, 2025
f791df1
test
chong-he Feb 6, 2025
f97f50b
Update test
chong-he Feb 6, 2025
617abb0
remove split_slot
chong-he Feb 6, 2025
5db1b78
assert
chong-he Feb 6, 2025
f24d564
Merge branch 'unstable' into keep-execution-payload
chong-he Feb 7, 2025
aeeae2c
Merge of #6817
mergify[bot] Feb 7, 2025
b9d6e80
Merge of #6917
mergify[bot] Feb 7, 2025
a380ce7
Merge of #6766
mergify[bot] Feb 7, 2025
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
18 changes: 14 additions & 4 deletions beacon_node/beacon_chain/src/historical_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,20 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
});
}

let blinded_block = block.clone_as_blinded();
// Store block in the hot database without payload.
self.store
.blinded_block_as_kv_store_ops(&block_root, &blinded_block, &mut hot_batch);
if !self.store.get_config().prune_payloads {
// If prune-payloads is set to false, store the block which includes the execution payload
self.store
.block_as_kv_store_ops(&block_root, (*block).clone(), &mut hot_batch)?;
} else {
let blinded_block = block.clone_as_blinded();
// Store block in the hot database without payload.
self.store.blinded_block_as_kv_store_ops(
&block_root,
&blinded_block,
&mut hot_batch,
);
}

// Store the blobs too
if let Some(blobs) = maybe_blobs {
new_oldest_blob_slot = Some(block.slot());
Expand Down
55 changes: 0 additions & 55 deletions beacon_node/beacon_chain/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ pub static BLOCK_PROCESSING_COMMITTEE: LazyLock<Result<Histogram>> = LazyLock::n
"Time spent building/obtaining committees for block processing.",
)
});
pub static BLOCK_PROCESSING_SIGNATURE: LazyLock<Result<Histogram>> = LazyLock::new(|| {
try_create_histogram(
"beacon_block_processing_signature_seconds",
"Time spent doing signature verification for a block.",
)
});
pub static BLOCK_PROCESSING_CORE: LazyLock<Result<Histogram>> = LazyLock::new(|| {
try_create_histogram(
"beacon_block_processing_core_seconds",
Expand Down Expand Up @@ -591,12 +585,6 @@ pub static FORK_CHOICE_WRITE_LOCK_AQUIRE_TIMES: LazyLock<Result<Histogram>> = La
exponential_buckets(1e-3, 4.0, 7),
)
});
pub static FORK_CHOICE_SET_HEAD_LAG_TIMES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
try_create_histogram(
"beacon_fork_choice_set_head_lag_times",
"Time taken between finding the head and setting the canonical head value",
)
});
pub static BALANCES_CACHE_HITS: LazyLock<Result<IntCounter>> = LazyLock::new(|| {
try_create_int_counter(
"beacon_balances_cache_hits_total",
Expand Down Expand Up @@ -651,12 +639,6 @@ pub static DEFAULT_ETH1_VOTES: LazyLock<Result<IntCounter>> = LazyLock::new(|| {
/*
* Chain Head
*/
pub static UPDATE_HEAD_TIMES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
try_create_histogram(
"beacon_update_head_seconds",
"Time taken to update the canonical head",
)
});
pub static HEAD_STATE_SLOT: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
try_create_int_gauge(
"beacon_head_state_slot",
Expand Down Expand Up @@ -1547,20 +1529,6 @@ pub static SYNC_CONTRIBUTION_PROCESSING_APPLY_TO_OP_POOL: LazyLock<Result<Histog
"Time spent applying a sync contribution to the block inclusion pool",
)
});
pub static SYNC_CONTRIBUTION_PROCESSING_SIGNATURE_SETUP_TIMES: LazyLock<Result<Histogram>> =
LazyLock::new(|| {
try_create_histogram(
"beacon_sync_contribution_processing_signature_setup_seconds",
"Time spent on setting up for the signature verification of sync contribution processing"
)
});
pub static SYNC_CONTRIBUTION_PROCESSING_SIGNATURE_TIMES: LazyLock<Result<Histogram>> =
LazyLock::new(|| {
try_create_histogram(
"beacon_sync_contribution_processing_signature_seconds",
"Time spent on the signature verification of sync contribution processing",
)
});

/*
* General Sync Committee Contribution Processing
Expand Down Expand Up @@ -1690,13 +1658,6 @@ pub static DATA_COLUMN_SIDECAR_GOSSIP_VERIFICATION_TIMES: LazyLock<Result<Histog
"Full runtime of data column sidecars gossip verification",
)
});
pub static DATA_COLUMNS_SIDECAR_PROCESSING_SUCCESSES: LazyLock<Result<IntCounter>> =
LazyLock::new(|| {
try_create_int_counter(
"beacon_data_column_sidecar_processing_successes_total",
"Number of data column sidecars verified for gossip",
)
});

pub static BLOBS_FROM_EL_HIT_TOTAL: LazyLock<Result<IntCounter>> = LazyLock::new(|| {
try_create_int_counter(
Expand Down Expand Up @@ -1873,15 +1834,6 @@ pub static BLOCK_PRODUCTION_BLOBS_VERIFICATION_TIMES: LazyLock<Result<Histogram>
)
},
);
/*
* Availability related metrics
*/
pub static BLOCK_AVAILABILITY_DELAY: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
try_create_int_gauge(
"block_availability_delay",
"Duration between start of the slot and the time at which all components of the block are available.",
)
});

/*
* Data Availability cache metrics
Expand All @@ -1900,13 +1852,6 @@ pub static DATA_AVAILABILITY_OVERFLOW_MEMORY_STATE_CACHE_SIZE: LazyLock<Result<I
"Number of entries in the data availability overflow state memory cache.",
)
});
pub static DATA_AVAILABILITY_OVERFLOW_STORE_CACHE_SIZE: LazyLock<Result<IntGauge>> =
LazyLock::new(|| {
try_create_int_gauge(
"data_availability_overflow_store_cache_size",
"Number of entries in the data availability overflow store cache.",
)
});
pub static DATA_AVAILABILITY_RECONSTRUCTION_TIME: LazyLock<Result<Histogram>> =
LazyLock::new(|| {
try_create_histogram(
Expand Down
19 changes: 15 additions & 4 deletions beacon_node/beacon_chain/tests/store_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ type E = MinimalEthSpec;
type TestHarness = BeaconChainHarness<DiskHarnessType<E>>;

fn get_store(db_path: &TempDir) -> Arc<HotColdDB<E, BeaconNodeBackend<E>, BeaconNodeBackend<E>>> {
get_store_generic(db_path, StoreConfig::default(), test_spec::<E>())
let store_config = StoreConfig {
prune_payloads: false,
..StoreConfig::default()
};
get_store_generic(db_path, store_config, test_spec::<E>())
}

fn get_store_generic(
Expand Down Expand Up @@ -2571,6 +2575,15 @@ async fn weak_subjectivity_sync_test(slots: Vec<Slot>, checkpoint_slot: Slot) {
if block_root != prev_block_root {
assert_eq!(block.slot(), slot);
}

// Prune_payloads is set to false in the default config, so the payload should exist
if block.message().execution_payload().is_ok() {
assert!(beacon_chain
.store
.execution_payload_exists(&block_root)
.unwrap(),);
}

prev_block_root = block_root;
}

Expand Down Expand Up @@ -3558,7 +3571,6 @@ fn check_split_slot(
/// Check that all the states in a chain dump have the correct tree hash.
fn check_chain_dump(harness: &TestHarness, expected_len: u64) {
let mut chain_dump = harness.chain.chain_dump().unwrap();
let split_slot = harness.chain.store.get_split_slot();

assert_eq!(chain_dump.len() as u64, expected_len);

Expand All @@ -3585,13 +3597,12 @@ fn check_chain_dump(harness: &TestHarness, expected_len: u64) {

// Check presence of execution payload on disk.
if harness.chain.spec.bellatrix_fork_epoch.is_some() {
assert_eq!(
assert!(
harness
.chain
.store
.execution_payload_exists(&checkpoint.beacon_block_root)
.unwrap(),
checkpoint.beacon_block.slot() >= split_slot,
"incorrect payload storage for block at slot {}: {:?}",
checkpoint.beacon_block.slot(),
checkpoint.beacon_block_root,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
debug!(self.log, "Backfill batch processed";
"batch_epoch" => epoch,
"first_block_slot" => start_slot,
"keep_execution_payload" => !self.chain.store.get_config().prune_payloads,
"last_block_slot" => end_slot,
"processed_blocks" => sent_blocks,
"processed_blobs" => n_blobs,
Expand Down
20 changes: 2 additions & 18 deletions beacon_node/network/src/sync/backfill_sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,24 +422,8 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
self.request_batches(network)?;
self.process_completed_batches(network)
}
Err(result) => {
let (expected_boundary, received_boundary, outcome) = match result {
Err(e) => {
self.fail_sync(BackFillError::BatchInvalidState(batch_id, e.0))?;
return Ok(ProcessResult::Successful);
}
Ok(v) => v,
};
warn!(self.log, "Batch received out of range blocks"; "expected_boundary" => expected_boundary, "received_boundary" => received_boundary,
"peer_id" => %peer_id, batch);

if let BatchOperationOutcome::Failed { blacklist: _ } = outcome {
error!(self.log, "Backfill failed"; "epoch" => batch_id, "received_boundary" => received_boundary, "expected_boundary" => expected_boundary);
self.fail_sync(BackFillError::BatchDownloadFailed(batch_id))?;
return Ok(ProcessResult::Successful);
}
// this batch can't be used, so we need to request it again.
self.retry_batch_download(network, batch_id)?;
Err(e) => {
self.fail_sync(BackFillError::BatchInvalidState(batch_id, e.0))?;
Ok(ProcessResult::Successful)
}
}
Expand Down
9 changes: 3 additions & 6 deletions beacon_node/network/src/sync/range_sync/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,7 @@ impl<E: EthSpec, B: BatchConfig> BatchInfo<E, B> {
pub fn download_completed(
&mut self,
blocks: Vec<RpcBlock<E>>,
) -> Result<
usize, /* Received blocks */
Result<(Slot, Slot, BatchOperationOutcome), WrongState>,
> {
) -> Result<usize /* Received blocks */, WrongState> {
match self.state.poison() {
BatchState::Downloading(peer, _request_id) => {
let received = blocks.len();
Expand All @@ -284,10 +281,10 @@ impl<E: EthSpec, B: BatchConfig> BatchInfo<E, B> {
BatchState::Poisoned => unreachable!("Poisoned batch"),
other => {
self.state = other;
Err(Err(WrongState(format!(
Err(WrongState(format!(
"Download completed for batch in wrong state {:?}",
self.state
))))
)))
}
}
}
Expand Down
49 changes: 15 additions & 34 deletions beacon_node/network/src/sync/range_sync/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,40 +265,21 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
}
};

{
// A stream termination has been sent. This batch has ended. Process a completed batch.
// Remove the request from the peer's active batches
self.peers
.get_mut(peer_id)
.map(|active_requests| active_requests.remove(&batch_id));

match batch.download_completed(blocks) {
Ok(received) => {
let awaiting_batches = batch_id
.saturating_sub(self.optimistic_start.unwrap_or(self.processing_target))
/ EPOCHS_PER_BATCH;
debug!(self.log, "Batch downloaded"; "epoch" => batch_id, "blocks" => received, "batch_state" => self.visualize_batch_state(), "awaiting_batches" => awaiting_batches);

// pre-emptively request more blocks from peers whilst we process current blocks,
self.request_batches(network)?;
self.process_completed_batches(network)
}
Err(result) => {
let (expected_boundary, received_boundary, outcome) = result?;
warn!(self.log, "Batch received out of range blocks"; "expected_boundary" => expected_boundary, "received_boundary" => received_boundary,
"peer_id" => %peer_id, batch);

if let BatchOperationOutcome::Failed { blacklist } = outcome {
return Err(RemoveChain::ChainFailed {
blacklist,
failing_batch: batch_id,
});
}
// this batch can't be used, so we need to request it again.
self.retry_batch_download(network, batch_id)
}
}
}
// A stream termination has been sent. This batch has ended. Process a completed batch.
// Remove the request from the peer's active batches
self.peers
.get_mut(peer_id)
.map(|active_requests| active_requests.remove(&batch_id));

let received = batch.download_completed(blocks)?;
let awaiting_batches = batch_id
.saturating_sub(self.optimistic_start.unwrap_or(self.processing_target))
/ EPOCHS_PER_BATCH;
debug!(self.log, "Batch downloaded"; "epoch" => batch_id, "blocks" => received, "batch_state" => self.visualize_batch_state(), "awaiting_batches" => awaiting_batches);

// pre-emptively request more blocks from peers whilst we process current blocks,
self.request_batches(network)?;
self.process_completed_batches(network)
}

/// Processes the batch with the given id.
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/store/src/hot_cold_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
.ok_or(Error::AddPayloadLogicError)
}

/// Prepare a signed beacon block for storage in the datbase *without* its payload.
/// Prepare a signed beacon block for storage in the database *without* its payload.
pub fn blinded_block_as_kv_store_ops(
&self,
key: &Hash256,
Expand Down