Skip to content

Commit afe59af

Browse files
committed
Ensure difficulty/hash/epoch overrides change the ChainSpec (#2798)
* Unify loading of eth2_network_config * Apply overrides at lighthouse binary level * Remove duplicate override values * Add merge values to existing net configs * Make override flags global * Add merge fields to testing config * Add one to TTD * Fix failing engine tests * Fix test compile error * Remove TTD flags * Move get_eth2_network_config * Fix warn * Address review comments
1 parent 47db682 commit afe59af

File tree

25 files changed

+391
-267
lines changed

25 files changed

+391
-267
lines changed

Cargo.lock

Lines changed: 144 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2893,7 +2893,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
28932893
let parent_hash;
28942894
if !is_merge_complete(&state) {
28952895
let terminal_pow_block_hash = execution_layer
2896-
.block_on(|execution_layer| execution_layer.get_terminal_pow_block_hash())
2896+
.block_on(|execution_layer| {
2897+
execution_layer.get_terminal_pow_block_hash(&self.spec)
2898+
})
28972899
.map_err(BlockProductionError::TerminalPoWBlockLookupFailed)?;
28982900

28992901
if let Some(terminal_pow_block_hash) = terminal_pow_block_hash {

beacon_node/beacon_chain/src/block_verification.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,10 @@ impl<'a, T: BeaconChainTypes> FullyVerifiedBlock<'a, T> {
11191119

11201120
let is_valid_terminal_pow_block = execution_layer
11211121
.block_on(|execution_layer| {
1122-
execution_layer.is_valid_terminal_pow_block_hash(execution_payload.parent_hash)
1122+
execution_layer.is_valid_terminal_pow_block_hash(
1123+
execution_payload.parent_hash,
1124+
&chain.spec,
1125+
)
11231126
})
11241127
.map_err(ExecutionPayloadError::from)?;
11251128

beacon_node/beacon_chain/src/test_utils.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ where
330330
}
331331

332332
pub fn execution_layer(mut self, urls: &[&str]) -> Self {
333-
let spec = self.spec.clone().expect("cannot build without spec");
334333
assert!(
335334
self.execution_layer.is_none(),
336335
"execution layer already defined"
@@ -345,8 +344,6 @@ where
345344
.unwrap();
346345
let execution_layer = ExecutionLayer::from_urls(
347346
urls,
348-
spec.terminal_total_difficulty,
349-
spec.terminal_block_hash,
350347
Some(Address::repeat_byte(42)),
351348
el_runtime.task_executor.clone(),
352349
el_runtime.log.clone(),
@@ -364,6 +361,7 @@ where
364361
spec.terminal_total_difficulty,
365362
DEFAULT_TERMINAL_BLOCK,
366363
spec.terminal_block_hash,
364+
spec.terminal_block_hash_activation_epoch,
367365
);
368366
self.execution_layer = Some(mock.el.clone());
369367
self.mock_execution_layer = Some(mock);

beacon_node/client/src/builder.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,10 @@ where
148148
None
149149
};
150150

151-
let terminal_total_difficulty = config
152-
.terminal_total_difficulty_override
153-
.unwrap_or(spec.terminal_total_difficulty);
154-
let terminal_block_hash = config
155-
.terminal_block_hash_override
156-
.unwrap_or(spec.terminal_block_hash);
157-
158151
let execution_layer = if let Some(execution_endpoints) = config.execution_endpoints {
159152
let context = runtime_context.service_context("exec".into());
160153
let execution_layer = ExecutionLayer::from_urls(
161154
execution_endpoints,
162-
terminal_total_difficulty,
163-
terminal_block_hash,
164155
config.fee_recipient,
165156
context.executor.clone(),
166157
context.log().clone(),

0 commit comments

Comments
 (0)