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

v7.0.0-beta.1 (Holesky Rescue) #7041

Draft
wants to merge 20 commits into
base: unstable
Choose a base branch
from
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
8 changes: 4 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion beacon_node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "beacon_node"
version = "7.0.0-beta.0"
version = "7.0.0-beta.1"
authors = [
"Paul Hauner <paul@paulhauner.com>",
"Age Manning <Age@AgeManning.com",
Expand Down
33 changes: 30 additions & 3 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4848,7 +4848,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let proposer_index = if let Some(proposer) = cached_proposer {
proposer.index as u64
} else {
if head_epoch + 2 < proposal_epoch {
if 2 + 2 == 5 && head_epoch + 2 < proposal_epoch {
warn!(
self.log,
"Skipping proposer preparation";
Expand Down Expand Up @@ -6089,8 +6089,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
//
// This prevents the routine from running during sync.
let head_slot = cached_head.head_slot();
if head_slot + T::EthSpec::slots_per_epoch() * PREPARE_PROPOSER_HISTORIC_EPOCHS
< current_slot
if 2 + 2 == 5
&& head_slot
+ T::EthSpec::slots_per_epoch() * PREPARE_PROPOSER_HISTORIC_EPOCHS
< current_slot
{
debug!(
chain.log,
Expand Down Expand Up @@ -7280,6 +7282,31 @@ impl<T: BeaconChainTypes> BeaconChain<T> {

Ok(None)
}

/// Retrieves block roots (in ascending slot order) within some slot range from fork choice.
pub fn block_roots_from_fork_choice(&self, start_slot: u64, count: u64) -> Vec<Hash256> {
let head_block_root = self.canonical_head.cached_head().head_block_root();
let fork_choice_read_lock = self.canonical_head.fork_choice_read_lock();
let block_roots_iter = fork_choice_read_lock
.proto_array()
.iter_block_roots(&head_block_root);
let end_slot = start_slot.saturating_add(count);
let mut roots = vec![];

for (root, slot) in block_roots_iter {
if slot < end_slot && slot >= start_slot {
roots.push(root);
}
if slot < start_slot {
break;
}
}

drop(fork_choice_read_lock);
// return in ascending slot order
roots.reverse();
roots
}
}

impl<T: BeaconChainTypes> Drop for BeaconChain<T> {
Expand Down
36 changes: 30 additions & 6 deletions beacon_node/beacon_chain/src/block_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ use std::borrow::Cow;
use std::fmt::Debug;
use std::fs;
use std::io::Write;
use std::str::FromStr;
use std::sync::Arc;
use store::{Error as DBError, HotStateSummary, KeyValueStore, StoreOp};
use strum::AsRefStr;
Expand Down Expand Up @@ -146,7 +147,9 @@ pub enum BlockError {
///
/// It's unclear if this block is valid, but it cannot be processed without already knowing
/// its parent.
ParentUnknown { parent_root: Hash256 },
ParentUnknown {
parent_root: Hash256,
},
/// The block slot is greater than the present slot.
///
/// ## Peer scoring
Expand All @@ -161,7 +164,10 @@ pub enum BlockError {
/// ## Peer scoring
///
/// The peer has incompatible state transition logic and is faulty.
StateRootMismatch { block: Hash256, local: Hash256 },
StateRootMismatch {
block: Hash256,
local: Hash256,
},
/// The block was a genesis block, these blocks cannot be re-imported.
GenesisBlock,
/// The slot is finalized, no need to import.
Expand All @@ -180,7 +186,9 @@ pub enum BlockError {
///
/// It's unclear if this block is valid, but it conflicts with finality and shouldn't be
/// imported.
NotFinalizedDescendant { block_parent_root: Hash256 },
NotFinalizedDescendant {
block_parent_root: Hash256,
},
/// Block is already known and valid, no need to re-import.
///
/// ## Peer scoring
Expand All @@ -207,7 +215,10 @@ pub enum BlockError {
/// ## Peer scoring
///
/// The block is invalid and the peer is faulty.
IncorrectBlockProposer { block: u64, local_shuffling: u64 },
IncorrectBlockProposer {
block: u64,
local_shuffling: u64,
},
/// The `block.proposal_index` is not known.
///
/// ## Peer scoring
Expand All @@ -225,7 +236,10 @@ pub enum BlockError {
/// ## Peer scoring
///
/// The block is invalid and the peer is faulty.
BlockIsNotLaterThanParent { block_slot: Slot, parent_slot: Slot },
BlockIsNotLaterThanParent {
block_slot: Slot,
parent_slot: Slot,
},
/// At least one block in the chain segment did not have it's parent root set to the root of
/// the prior block.
///
Expand Down Expand Up @@ -281,7 +295,10 @@ pub enum BlockError {
/// If it's actually our fault (e.g. our execution node database is corrupt) we have bigger
/// problems to worry about than losing peers, and we're doing the network a favour by
/// disconnecting.
ParentExecutionPayloadInvalid { parent_root: Hash256 },
ParentExecutionPayloadInvalid {
parent_root: Hash256,
},
KnownInvalidExecutionPayload(Hash256),
/// The block is a slashable equivocation from the proposer.
///
/// ## Peer scoring
Expand Down Expand Up @@ -1326,6 +1343,13 @@ impl<T: BeaconChainTypes> ExecutionPendingBlock<T> {
chain: &Arc<BeaconChain<T>>,
notify_execution_layer: NotifyExecutionLayer,
) -> Result<Self, BlockError> {
if block_root
== Hash256::from_str("2db899881ed8546476d0b92c6aa9110bea9a4cd0dbeb5519eb0ea69575f1f359")
.expect("valid hash")
{
return Err(BlockError::KnownInvalidExecutionPayload(block_root));
}

chain
.observed_slashable
.write()
Expand Down
4 changes: 4 additions & 0 deletions beacon_node/beacon_chain/src/chain_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ pub struct ChainConfig {
/// The delay in milliseconds applied by the node between sending each blob or data column batch.
/// This doesn't apply if the node is the block proposer.
pub blob_publication_batch_interval: Duration,
pub disable_attesting: bool,
pub sync_tolerance_epochs: u64,
}

impl Default for ChainConfig {
Expand Down Expand Up @@ -129,6 +131,8 @@ impl Default for ChainConfig {
enable_sampling: false,
blob_publication_batches: 4,
blob_publication_batch_interval: Duration::from_millis(300),
disable_attesting: false,
sync_tolerance_epochs: 16,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/http_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ tree_hash = { workspace = true }
types = { workspace = true }
warp = { workspace = true }
warp_utils = { workspace = true }
proto_array = { workspace = true }

[dev-dependencies]
genesis = { workspace = true }
logging = { workspace = true }
proto_array = { workspace = true }
serde_json = { workspace = true }

[[test]]
Expand Down
Loading