diff --git a/beacon_node/beacon_chain/src/block_verification.rs b/beacon_node/beacon_chain/src/block_verification.rs index 3b80ca0764..d500845222 100644 --- a/beacon_node/beacon_chain/src/block_verification.rs +++ b/beacon_node/beacon_chain/src/block_verification.rs @@ -1785,8 +1785,11 @@ pub fn check_block_is_finalized_checkpoint_or_descendant< // If we have a split block newer than finalization then we also ban blocks which are not // descended from that split block. let split = chain.store.get_split_info(); + let is_descendant_from_split_block = + split.slot == 0 || fork_choice.is_descendant(split.block_root, block.parent_root()); + if fork_choice.is_finalized_checkpoint_or_descendant(block.parent_root()) - && fork_choice.is_descendant(split.block_root, block.parent_root()) + && is_descendant_from_split_block { Ok(block) } else { diff --git a/beacon_node/http_api/Cargo.toml b/beacon_node/http_api/Cargo.toml index 27e5932ae0..2fb3ec06bf 100644 --- a/beacon_node/http_api/Cargo.toml +++ b/beacon_node/http_api/Cargo.toml @@ -28,7 +28,6 @@ metrics = { workspace = true } network = { workspace = true } operation_pool = { workspace = true } parking_lot = { workspace = true } -proto_array = { workspace = true } rand = { workspace = true } safe_arith = { workspace = true } sensitive_url = { workspace = true } @@ -51,6 +50,7 @@ warp_utils = { workspace = true } [dev-dependencies] genesis = { workspace = true } logging = { workspace = true } +proto_array = { workspace = true } serde_json = { workspace = true } [[test]] diff --git a/beacon_node/http_api/src/lib.rs b/beacon_node/http_api/src/lib.rs index 53eead4855..58208d5b79 100644 --- a/beacon_node/http_api/src/lib.rs +++ b/beacon_node/http_api/src/lib.rs @@ -4603,34 +4603,6 @@ pub fn serve( }, ); - let post_lighthouse_fork_choice_invalidate = warp::path("lighthouse") - .and(warp::path("fork_choice")) - .and(warp::path("invalidate")) - .and(warp::path::end()) - .and(task_spawner_filter.clone()) - .and(chain_filter.clone()) - .and(warp_utils::json::json()) - .then( - |task_spawner: TaskSpawner, - chain: Arc>, - block_root: Hash256| { - task_spawner.blocking_json_task(Priority::P0, move || { - let invalidation = - proto_array::InvalidationOperation::InvalidateOne { block_root }; - chain - .canonical_head - .fork_choice_write_lock() - .on_invalid_execution_payload(&invalidation) - .map_err(|e| { - warp_utils::reject::custom_server_error(format!( - "not invalidated due to error: {e:?}" - )) - })?; - Ok("invalidated") - }) - }, - ); - // GET lighthouse/analysis/block_rewards let get_lighthouse_block_rewards = warp::path("lighthouse") .and(warp::path("analysis")) @@ -4992,7 +4964,6 @@ pub fn serve( .uor(post_validator_liveness_epoch) .uor(post_lighthouse_liveness) .uor(post_lighthouse_database_reconstruct) - .uor(post_lighthouse_fork_choice_invalidate) .uor(post_lighthouse_block_rewards) .uor(post_lighthouse_ui_validator_metrics) .uor(post_lighthouse_ui_validator_info) diff --git a/beacon_node/store/src/hot_cold_store.rs b/beacon_node/store/src/hot_cold_store.rs index bcc06d95f5..1a27c36bed 100644 --- a/beacon_node/store/src/hot_cold_store.rs +++ b/beacon_node/store/src/hot_cold_store.rs @@ -1541,9 +1541,10 @@ impl, Cold: ItemStore> HotColdDB let state_from_disk = self.load_hot_state(state_root, update_cache)?; if let Some((mut state, block_root)) = state_from_disk { + state.update_tree_hash_cache()?; + state.build_all_caches(&self.spec)?; + if update_cache { - state.update_tree_hash_cache()?; - state.build_all_caches(&self.spec)?; self.state_cache .lock() .put_state(*state_root, block_root, &state)?; diff --git a/book/src/help_bn.md b/book/src/help_bn.md index 79c8d8ead8..3100260cdc 100644 --- a/book/src/help_bn.md +++ b/book/src/help_bn.md @@ -80,6 +80,9 @@ Options: Specifies the verbosity level used when emitting logs to the terminal. [default: info] [possible values: info, debug, trace, warn, error, crit] + --disable-attesting + Turn off attestation related APIs so that we have some hope of + producing blocks --discovery-port The UDP port that discovery will listen on. Defaults to `port` --discovery-port6 @@ -385,12 +388,18 @@ Options: Number of validators per chunk stored on disk. --slots-per-restore-point DEPRECATED. This flag has no effect. + --state-cache-headroom + Minimum number of states to cull from the state cache when it gets + full [default: 1] --state-cache-size - Specifies the size of the state cache [default: 128] + Specifies the size of the state cache [default: 32] --suggested-fee-recipient Emergency fallback fee recipient for use in case the validator client does not have one configured. You should set this flag on the validator client instead of (or in addition to) setting it here. + --sync-tolerance-epochs + If the beacon node is within this many epochs from the head, we + declare it to be synced regardless of the network sync state -t, --testnet-dir Path to directory containing eth2_testnet specs. Defaults to a hard-coded Lighthouse testnet. Only effective if there is no existing diff --git a/book/src/help_vc.md b/book/src/help_vc.md index 948a09f44d..9c784fc031 100644 --- a/book/src/help_vc.md +++ b/book/src/help_vc.md @@ -175,6 +175,8 @@ Flags: If this flag is set, Lighthouse will query the Beacon Node for only block headers during proposals and will sign over headers. Useful for outsourcing execution payload construction during proposals. + --disable-attesting + Disable everything except block proposals --disable-auto-discover If present, do not attempt to discover new validators in the validators-dir. Validators will need to be manually added to the diff --git a/consensus/proto_array/src/proto_array.rs b/consensus/proto_array/src/proto_array.rs index 25332f4ea6..5d0bee4c85 100644 --- a/consensus/proto_array/src/proto_array.rs +++ b/consensus/proto_array/src/proto_array.rs @@ -531,7 +531,15 @@ impl ProtoArray { || latest_valid_ancestor_is_descendant { match &node.execution_status { - ExecutionStatus::Valid(hash) | ExecutionStatus::Optimistic(hash) => { + // It's illegal for an execution client to declare that some previously-valid block + // is now invalid. This is a consensus failure on their behalf. + ExecutionStatus::Valid(hash) => { + return Err(Error::ValidExecutionStatusBecameInvalid { + block_root: node.root, + payload_block_hash: *hash, + }) + } + ExecutionStatus::Optimistic(hash) => { invalidated_indices.insert(index); node.execution_status = ExecutionStatus::Invalid(*hash); @@ -589,9 +597,13 @@ impl ProtoArray { if let Some(parent_index) = node.parent { if invalidated_indices.contains(&parent_index) { match &node.execution_status { - ExecutionStatus::Valid(hash) - | ExecutionStatus::Optimistic(hash) - | ExecutionStatus::Invalid(hash) => { + ExecutionStatus::Valid(hash) => { + return Err(Error::ValidExecutionStatusBecameInvalid { + block_root: node.root, + payload_block_hash: *hash, + }) + } + ExecutionStatus::Optimistic(hash) | ExecutionStatus::Invalid(hash) => { node.execution_status = ExecutionStatus::Invalid(*hash) } ExecutionStatus::Irrelevant(_) => {