Merge devnet 3 (#2859)

## Issue Addressed

N/A

## Proposed Changes

Changes required for the `merge-devnet-3`. Added some more non substantive renames on top of @realbigsean 's commit. 
Note: this doesn't include the proposer boosting changes in kintsugi v3.

This devnet isn't running with the proposer boosting fork choice changes so if we are looking to merge https://github.com/sigp/lighthouse/pull/2822 into `unstable`, then I think we should just maintain this branch for the devnet temporarily. 


Co-authored-by: realbigsean <seananderson33@gmail.com>
Co-authored-by: Paul Hauner <paul@paulhauner.com>
This commit is contained in:
Pawan Dhananjay 2021-12-12 09:04:21 +00:00
parent 62d11e886e
commit e391b32858
20 changed files with 112 additions and 94 deletions

View File

@ -66,7 +66,7 @@ use ssz::Encode;
use state_processing::{ use state_processing::{
common::get_indexed_attestation, common::get_indexed_attestation,
per_block_processing, per_block_processing,
per_block_processing::{errors::AttestationValidationError, is_merge_complete}, per_block_processing::{errors::AttestationValidationError, is_merge_transition_complete},
per_slot_processing, per_slot_processing,
state_advance::{complete_state_advance, partial_state_advance}, state_advance::{complete_state_advance, partial_state_advance},
BlockSignatureStrategy, SigVerifiedOp, BlockSignatureStrategy, SigVerifiedOp,
@ -195,7 +195,7 @@ pub struct HeadInfo {
pub genesis_time: u64, pub genesis_time: u64,
pub genesis_validators_root: Hash256, pub genesis_validators_root: Hash256,
pub proposer_shuffling_decision_root: Hash256, pub proposer_shuffling_decision_root: Hash256,
pub is_merge_complete: bool, pub is_merge_transition_complete: bool,
pub execution_payload_block_hash: Option<Hash256>, pub execution_payload_block_hash: Option<Hash256>,
} }
@ -1023,7 +1023,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
genesis_time: head.beacon_state.genesis_time(), genesis_time: head.beacon_state.genesis_time(),
genesis_validators_root: head.beacon_state.genesis_validators_root(), genesis_validators_root: head.beacon_state.genesis_validators_root(),
proposer_shuffling_decision_root, proposer_shuffling_decision_root,
is_merge_complete: is_merge_complete(&head.beacon_state), is_merge_transition_complete: is_merge_transition_complete(&head.beacon_state),
execution_payload_block_hash: head execution_payload_block_hash: head
.beacon_block .beacon_block
.message() .message()
@ -3153,7 +3153,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.body() .body()
.execution_payload() .execution_payload()
.map(|ep| ep.block_hash); .map(|ep| ep.block_hash);
let is_merge_complete = is_merge_complete(&new_head.beacon_state); let is_merge_transition_complete = is_merge_transition_complete(&new_head.beacon_state);
drop(lag_timer); drop(lag_timer);
@ -3387,7 +3387,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
// If this is a post-merge block, update the execution layer. // If this is a post-merge block, update the execution layer.
if let Some(new_head_execution_block_hash) = new_head_execution_block_hash_opt { if let Some(new_head_execution_block_hash) = new_head_execution_block_hash_opt {
if is_merge_complete { if is_merge_transition_complete {
let execution_layer = self let execution_layer = self
.execution_layer .execution_layer
.clone() .clone()

View File

@ -60,7 +60,7 @@ use safe_arith::ArithError;
use slog::{debug, error, Logger}; use slog::{debug, error, Logger};
use slot_clock::SlotClock; use slot_clock::SlotClock;
use ssz::Encode; use ssz::Encode;
use state_processing::per_block_processing::is_merge_block; use state_processing::per_block_processing::is_merge_transition_block;
use state_processing::{ use state_processing::{
block_signature_verifier::{BlockSignatureVerifier, Error as BlockSignatureVerifierError}, block_signature_verifier::{BlockSignatureVerifier, Error as BlockSignatureVerifierError},
per_block_processing, per_slot_processing, per_block_processing, per_slot_processing,
@ -1114,7 +1114,7 @@ impl<'a, T: BeaconChainTypes> FullyVerifiedBlock<'a, T> {
// early. // early.
// - Doing the check here means we can keep our fork-choice implementation "pure". I.e., no // - Doing the check here means we can keep our fork-choice implementation "pure". I.e., no
// calls to remote servers. // calls to remote servers.
if is_merge_block(&state, block.message().body()) { if is_merge_transition_block(&state, block.message().body()) {
validate_merge_block(chain, block.message())? validate_merge_block(chain, block.message())?
} }

View File

@ -17,7 +17,7 @@ use proto_array::{Block as ProtoBlock, ExecutionStatus};
use slog::debug; use slog::debug;
use slot_clock::SlotClock; use slot_clock::SlotClock;
use state_processing::per_block_processing::{ use state_processing::per_block_processing::{
compute_timestamp_at_slot, is_execution_enabled, is_merge_complete, compute_timestamp_at_slot, is_execution_enabled, is_merge_transition_complete,
partially_verify_execution_payload, partially_verify_execution_payload,
}; };
use types::*; use types::*;
@ -150,7 +150,7 @@ pub fn validate_execution_payload_for_gossip<T: BeaconChainTypes>(
// This logic should match `is_execution_enabled`. We use only the execution block hash of // This logic should match `is_execution_enabled`. We use only the execution block hash of
// the parent here in order to avoid loading the parent state during gossip verification. // the parent here in order to avoid loading the parent state during gossip verification.
let is_merge_complete = match parent_block.execution_status { let is_merge_transition_complete = match parent_block.execution_status {
// Optimistically declare that an "unknown" status block has completed the merge. // Optimistically declare that an "unknown" status block has completed the merge.
ExecutionStatus::Valid(_) | ExecutionStatus::Unknown(_) => true, ExecutionStatus::Valid(_) | ExecutionStatus::Unknown(_) => true,
// It's impossible for an irrelevant block to have completed the merge. It is pre-merge // It's impossible for an irrelevant block to have completed the merge. It is pre-merge
@ -165,7 +165,7 @@ pub fn validate_execution_payload_for_gossip<T: BeaconChainTypes>(
} }
}; };
if is_merge_complete || execution_payload != &<_>::default() { if is_merge_transition_complete || execution_payload != &<_>::default() {
let expected_timestamp = chain let expected_timestamp = chain
.slot_clock .slot_clock
.start_of(block.slot()) .start_of(block.slot())
@ -247,7 +247,7 @@ pub async fn prepare_execution_payload<T: BeaconChainTypes>(
.as_ref() .as_ref()
.ok_or(BlockProductionError::ExecutionLayerMissing)?; .ok_or(BlockProductionError::ExecutionLayerMissing)?;
let parent_hash = if !is_merge_complete(state) { let parent_hash = if !is_merge_transition_complete(state) {
let is_terminal_block_hash_set = spec.terminal_block_hash != Hash256::zero(); let is_terminal_block_hash_set = spec.terminal_block_hash != Hash256::zero();
let is_activation_epoch_reached = let is_activation_epoch_reached =
state.current_epoch() >= spec.terminal_block_hash_activation_epoch; state.current_epoch() >= spec.terminal_block_hash_activation_epoch;
@ -292,7 +292,7 @@ pub async fn prepare_execution_payload<T: BeaconChainTypes>(
.map(|ep| ep.block_hash) .map(|ep| ep.block_hash)
}; };
// Note: the fee_recipient is stored in the `execution_layer`, it will add this parameter. // Note: the suggested_fee_recipient is stored in the `execution_layer`, it will add this parameter.
let execution_payload = execution_layer let execution_payload = execution_layer
.get_payload( .get_payload(
parent_hash, parent_hash,

View File

@ -152,7 +152,7 @@ where
let context = runtime_context.service_context("exec".into()); let context = runtime_context.service_context("exec".into());
let execution_layer = ExecutionLayer::from_urls( let execution_layer = ExecutionLayer::from_urls(
execution_endpoints, execution_endpoints,
config.fee_recipient, config.suggested_fee_recipient,
context.executor.clone(), context.executor.clone(),
context.log().clone(), context.log().clone(),
) )

View File

@ -75,7 +75,7 @@ pub struct Config {
pub chain: beacon_chain::ChainConfig, pub chain: beacon_chain::ChainConfig,
pub eth1: eth1::Config, pub eth1: eth1::Config,
pub execution_endpoints: Option<Vec<SensitiveUrl>>, pub execution_endpoints: Option<Vec<SensitiveUrl>>,
pub fee_recipient: Option<Address>, pub suggested_fee_recipient: Option<Address>,
pub http_api: http_api::Config, pub http_api: http_api::Config,
pub http_metrics: http_metrics::Config, pub http_metrics: http_metrics::Config,
pub monitoring_api: Option<monitoring_api::Config>, pub monitoring_api: Option<monitoring_api::Config>,
@ -97,7 +97,7 @@ impl Default for Config {
sync_eth1_chain: false, sync_eth1_chain: false,
eth1: <_>::default(), eth1: <_>::default(),
execution_endpoints: None, execution_endpoints: None,
fee_recipient: None, suggested_fee_recipient: None,
disabled_forks: Vec::new(), disabled_forks: Vec::new(),
graffiti: Graffiti::default(), graffiti: Graffiti::default(),
http_api: <_>::default(), http_api: <_>::default(),

View File

@ -83,7 +83,7 @@ pub enum ExecutePayloadResponseStatus {
pub struct ExecutePayloadResponse { pub struct ExecutePayloadResponse {
pub status: ExecutePayloadResponseStatus, pub status: ExecutePayloadResponseStatus,
pub latest_valid_hash: Option<Hash256>, pub latest_valid_hash: Option<Hash256>,
pub message: Option<String>, pub validation_error: Option<String>,
} }
#[derive(Clone, Copy, Debug, PartialEq, Serialize)] #[derive(Clone, Copy, Debug, PartialEq, Serialize)]
@ -107,7 +107,7 @@ pub struct ExecutionBlock {
pub struct PayloadAttributes { pub struct PayloadAttributes {
pub timestamp: u64, pub timestamp: u64,
pub random: Hash256, pub random: Hash256,
pub fee_recipient: Address, pub suggested_fee_recipient: Address,
} }
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(Clone, Copy, Debug, PartialEq)]

View File

@ -289,9 +289,9 @@ mod test {
> { > {
let mut json = json!({ let mut json = json!({
"parentHash": HASH_00, "parentHash": HASH_00,
"coinbase": ADDRESS_01, "feeRecipient": ADDRESS_01,
"stateRoot": HASH_01, "stateRoot": HASH_01,
"receiptRoot": HASH_00, "receiptsRoot": HASH_00,
"logsBloom": LOGS_BLOOM_01, "logsBloom": LOGS_BLOOM_01,
"random": HASH_01, "random": HASH_01,
"blockNumber": "0x0", "blockNumber": "0x0",
@ -445,7 +445,7 @@ mod test {
Some(PayloadAttributes { Some(PayloadAttributes {
timestamp: 5, timestamp: 5,
random: Hash256::zero(), random: Hash256::zero(),
fee_recipient: Address::repeat_byte(0), suggested_fee_recipient: Address::repeat_byte(0),
}), }),
) )
.await; .await;
@ -462,7 +462,7 @@ mod test {
{ {
"timestamp":"0x5", "timestamp":"0x5",
"random": HASH_00, "random": HASH_00,
"feeRecipient": ADDRESS_00 "suggestedFeeRecipient": ADDRESS_00
}] }]
}), }),
) )
@ -494,7 +494,7 @@ mod test {
let _ = client let _ = client
.execute_payload_v1::<MainnetEthSpec>(ExecutionPayload { .execute_payload_v1::<MainnetEthSpec>(ExecutionPayload {
parent_hash: Hash256::repeat_byte(0), parent_hash: Hash256::repeat_byte(0),
coinbase: Address::repeat_byte(1), fee_recipient: Address::repeat_byte(1),
state_root: Hash256::repeat_byte(1), state_root: Hash256::repeat_byte(1),
receipt_root: Hash256::repeat_byte(0), receipt_root: Hash256::repeat_byte(0),
logs_bloom: vec![1; 256].into(), logs_bloom: vec![1; 256].into(),
@ -516,9 +516,9 @@ mod test {
"method": ENGINE_EXECUTE_PAYLOAD_V1, "method": ENGINE_EXECUTE_PAYLOAD_V1,
"params": [{ "params": [{
"parentHash": HASH_00, "parentHash": HASH_00,
"coinbase": ADDRESS_01, "feeRecipient": ADDRESS_01,
"stateRoot": HASH_01, "stateRoot": HASH_01,
"receiptRoot": HASH_00, "receiptsRoot": HASH_00,
"logsBloom": LOGS_BLOOM_01, "logsBloom": LOGS_BLOOM_01,
"random": HASH_01, "random": HASH_01,
"blockNumber": "0x0", "blockNumber": "0x0",
@ -600,7 +600,7 @@ mod test {
Some(PayloadAttributes { Some(PayloadAttributes {
timestamp: 5, timestamp: 5,
random: Hash256::zero(), random: Hash256::zero(),
fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(), suggested_fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
}) })
) )
.await; .await;
@ -617,7 +617,7 @@ mod test {
{ {
"timestamp":"0x5", "timestamp":"0x5",
"random": HASH_00, "random": HASH_00,
"feeRecipient":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" "suggestedFeeRecipient":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
}] }]
}) })
) )
@ -643,7 +643,7 @@ mod test {
Some(PayloadAttributes { Some(PayloadAttributes {
timestamp: 5, timestamp: 5,
random: Hash256::zero(), random: Hash256::zero(),
fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(), suggested_fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
}) })
) )
.await .await
@ -678,9 +678,9 @@ mod test {
"id":STATIC_ID, "id":STATIC_ID,
"result":{ "result":{
"parentHash":"0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a", "parentHash":"0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a",
"coinbase":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "feeRecipient":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"stateRoot":"0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45", "stateRoot":"0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45",
"receiptRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"logsBloom": LOGS_BLOOM_00, "logsBloom": LOGS_BLOOM_00,
"random": HASH_00, "random": HASH_00,
"blockNumber":"0x1", "blockNumber":"0x1",
@ -701,7 +701,7 @@ mod test {
let expected = ExecutionPayload { let expected = ExecutionPayload {
parent_hash: Hash256::from_str("0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a").unwrap(), parent_hash: Hash256::from_str("0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a").unwrap(),
coinbase: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(), fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(), state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(),
receipt_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(), receipt_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
logs_bloom: vec![0; 256].into(), logs_bloom: vec![0; 256].into(),
@ -726,7 +726,7 @@ mod test {
let _ = client let _ = client
.execute_payload_v1::<MainnetEthSpec>(ExecutionPayload { .execute_payload_v1::<MainnetEthSpec>(ExecutionPayload {
parent_hash: Hash256::from_str("0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a").unwrap(), parent_hash: Hash256::from_str("0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a").unwrap(),
coinbase: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(), fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(), state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(),
receipt_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(), receipt_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
logs_bloom: vec![0; 256].into(), logs_bloom: vec![0; 256].into(),
@ -748,9 +748,9 @@ mod test {
"method": ENGINE_EXECUTE_PAYLOAD_V1, "method": ENGINE_EXECUTE_PAYLOAD_V1,
"params": [{ "params": [{
"parentHash":"0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a", "parentHash":"0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a",
"coinbase":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "feeRecipient":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"stateRoot":"0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45", "stateRoot":"0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45",
"receiptRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"logsBloom": LOGS_BLOOM_00, "logsBloom": LOGS_BLOOM_00,
"random": HASH_00, "random": HASH_00,
"blockNumber":"0x1", "blockNumber":"0x1",
@ -785,7 +785,7 @@ mod test {
ExecutePayloadResponse { ExecutePayloadResponse {
status: ExecutePayloadResponseStatus::Valid, status: ExecutePayloadResponseStatus::Valid,
latest_valid_hash: Some(Hash256::from_str("0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858").unwrap()), latest_valid_hash: Some(Hash256::from_str("0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858").unwrap()),
message: None validation_error: None
} }
); );
}, },

View File

@ -59,9 +59,9 @@ pub struct JsonPayloadIdResponse {
#[serde(bound = "T: EthSpec", rename_all = "camelCase")] #[serde(bound = "T: EthSpec", rename_all = "camelCase")]
pub struct JsonExecutionPayloadV1<T: EthSpec> { pub struct JsonExecutionPayloadV1<T: EthSpec> {
pub parent_hash: Hash256, pub parent_hash: Hash256,
pub coinbase: Address, pub fee_recipient: Address,
pub state_root: Hash256, pub state_root: Hash256,
pub receipt_root: Hash256, pub receipts_root: Hash256,
#[serde(with = "serde_logs_bloom")] #[serde(with = "serde_logs_bloom")]
pub logs_bloom: FixedVector<u8, T::BytesPerLogsBloom>, pub logs_bloom: FixedVector<u8, T::BytesPerLogsBloom>,
pub random: Hash256, pub random: Hash256,
@ -87,7 +87,7 @@ impl<T: EthSpec> From<ExecutionPayload<T>> for JsonExecutionPayloadV1<T> {
// Use this verbose deconstruction pattern to ensure no field is left unused. // Use this verbose deconstruction pattern to ensure no field is left unused.
let ExecutionPayload { let ExecutionPayload {
parent_hash, parent_hash,
coinbase, fee_recipient,
state_root, state_root,
receipt_root, receipt_root,
logs_bloom, logs_bloom,
@ -104,9 +104,9 @@ impl<T: EthSpec> From<ExecutionPayload<T>> for JsonExecutionPayloadV1<T> {
Self { Self {
parent_hash, parent_hash,
coinbase, fee_recipient,
state_root, state_root,
receipt_root, receipts_root: receipt_root,
logs_bloom, logs_bloom,
random, random,
block_number, block_number,
@ -126,9 +126,9 @@ impl<T: EthSpec> From<JsonExecutionPayloadV1<T>> for ExecutionPayload<T> {
// Use this verbose deconstruction pattern to ensure no field is left unused. // Use this verbose deconstruction pattern to ensure no field is left unused.
let JsonExecutionPayloadV1 { let JsonExecutionPayloadV1 {
parent_hash, parent_hash,
coinbase, fee_recipient,
state_root, state_root,
receipt_root, receipts_root,
logs_bloom, logs_bloom,
random, random,
block_number, block_number,
@ -143,9 +143,9 @@ impl<T: EthSpec> From<JsonExecutionPayloadV1<T>> for ExecutionPayload<T> {
Self { Self {
parent_hash, parent_hash,
coinbase, fee_recipient,
state_root, state_root,
receipt_root, receipt_root: receipts_root,
logs_bloom, logs_bloom,
random, random,
block_number, block_number,
@ -166,7 +166,7 @@ pub struct JsonPayloadAttributesV1 {
#[serde(with = "eth2_serde_utils::u64_hex_be")] #[serde(with = "eth2_serde_utils::u64_hex_be")]
pub timestamp: u64, pub timestamp: u64,
pub random: Hash256, pub random: Hash256,
pub fee_recipient: Address, pub suggested_fee_recipient: Address,
} }
impl From<PayloadAttributes> for JsonPayloadAttributesV1 { impl From<PayloadAttributes> for JsonPayloadAttributesV1 {
@ -175,13 +175,13 @@ impl From<PayloadAttributes> for JsonPayloadAttributesV1 {
let PayloadAttributes { let PayloadAttributes {
timestamp, timestamp,
random, random,
fee_recipient, suggested_fee_recipient,
} = p; } = p;
Self { Self {
timestamp, timestamp,
random, random,
fee_recipient, suggested_fee_recipient,
} }
} }
} }
@ -192,13 +192,13 @@ impl From<JsonPayloadAttributesV1> for PayloadAttributes {
let JsonPayloadAttributesV1 { let JsonPayloadAttributesV1 {
timestamp, timestamp,
random, random,
fee_recipient, suggested_fee_recipient,
} = j; } = j;
Self { Self {
timestamp, timestamp,
random, random,
fee_recipient, suggested_fee_recipient,
} }
} }
} }
@ -258,7 +258,7 @@ pub enum JsonExecutePayloadV1ResponseStatus {
pub struct JsonExecutePayloadV1Response { pub struct JsonExecutePayloadV1Response {
pub status: JsonExecutePayloadV1ResponseStatus, pub status: JsonExecutePayloadV1ResponseStatus,
pub latest_valid_hash: Option<Hash256>, pub latest_valid_hash: Option<Hash256>,
pub message: Option<String>, pub validation_error: Option<String>,
} }
impl From<ExecutePayloadResponseStatus> for JsonExecutePayloadV1ResponseStatus { impl From<ExecutePayloadResponseStatus> for JsonExecutePayloadV1ResponseStatus {
@ -286,13 +286,13 @@ impl From<ExecutePayloadResponse> for JsonExecutePayloadV1Response {
let ExecutePayloadResponse { let ExecutePayloadResponse {
status, status,
latest_valid_hash, latest_valid_hash,
message, validation_error,
} = e; } = e;
Self { Self {
status: status.into(), status: status.into(),
latest_valid_hash, latest_valid_hash,
message, validation_error,
} }
} }
} }
@ -303,13 +303,13 @@ impl From<JsonExecutePayloadV1Response> for ExecutePayloadResponse {
let JsonExecutePayloadV1Response { let JsonExecutePayloadV1Response {
status, status,
latest_valid_hash, latest_valid_hash,
message, validation_error,
} = j; } = j;
Self { Self {
status: status.into(), status: status.into(),
latest_valid_hash, latest_valid_hash,
message, validation_error,
} }
} }
} }

View File

@ -49,7 +49,7 @@ struct PayloadIdCacheKey {
pub head_block_hash: Hash256, pub head_block_hash: Hash256,
pub timestamp: u64, pub timestamp: u64,
pub random: Hash256, pub random: Hash256,
pub fee_recipient: Address, pub suggested_fee_recipient: Address,
} }
/// An execution engine. /// An execution engine.
@ -76,7 +76,7 @@ impl<T> Engine<T> {
head_block_hash: Hash256, head_block_hash: Hash256,
timestamp: u64, timestamp: u64,
random: Hash256, random: Hash256,
fee_recipient: Address, suggested_fee_recipient: Address,
) -> Option<PayloadId> { ) -> Option<PayloadId> {
self.payload_id_cache self.payload_id_cache
.lock() .lock()
@ -85,7 +85,7 @@ impl<T> Engine<T> {
head_block_hash, head_block_hash,
timestamp, timestamp,
random, random,
fee_recipient, suggested_fee_recipient,
}) })
.cloned() .cloned()
} }
@ -392,7 +392,7 @@ impl PayloadIdCacheKey {
head_block_hash: state.head_block_hash, head_block_hash: state.head_block_hash,
timestamp: attributes.timestamp, timestamp: attributes.timestamp,
random: attributes.random, random: attributes.random,
fee_recipient: attributes.fee_recipient, suggested_fee_recipient: attributes.suggested_fee_recipient,
} }
} }
} }

View File

@ -48,7 +48,7 @@ impl From<ApiError> for Error {
struct Inner { struct Inner {
engines: Engines<HttpJsonRpc>, engines: Engines<HttpJsonRpc>,
fee_recipient: Option<Address>, suggested_fee_recipient: Option<Address>,
execution_blocks: Mutex<LruCache<Hash256, ExecutionBlock>>, execution_blocks: Mutex<LruCache<Hash256, ExecutionBlock>>,
executor: TaskExecutor, executor: TaskExecutor,
log: Logger, log: Logger,
@ -72,7 +72,7 @@ impl ExecutionLayer {
/// Instantiate `Self` with `urls.len()` engines, all using the JSON-RPC via HTTP. /// Instantiate `Self` with `urls.len()` engines, all using the JSON-RPC via HTTP.
pub fn from_urls( pub fn from_urls(
urls: Vec<SensitiveUrl>, urls: Vec<SensitiveUrl>,
fee_recipient: Option<Address>, suggested_fee_recipient: Option<Address>,
executor: TaskExecutor, executor: TaskExecutor,
log: Logger, log: Logger,
) -> Result<Self, Error> { ) -> Result<Self, Error> {
@ -95,7 +95,7 @@ impl ExecutionLayer {
latest_forkchoice_state: <_>::default(), latest_forkchoice_state: <_>::default(),
log: log.clone(), log: log.clone(),
}, },
fee_recipient, suggested_fee_recipient,
execution_blocks: Mutex::new(LruCache::new(EXECUTION_BLOCKS_LRU_CACHE_SIZE)), execution_blocks: Mutex::new(LruCache::new(EXECUTION_BLOCKS_LRU_CACHE_SIZE)),
executor, executor,
log, log,
@ -116,9 +116,9 @@ impl ExecutionLayer {
&self.inner.executor &self.inner.executor
} }
fn fee_recipient(&self) -> Result<Address, Error> { fn suggested_fee_recipient(&self) -> Result<Address, Error> {
self.inner self.inner
.fee_recipient .suggested_fee_recipient
.ok_or(Error::FeeRecipientUnspecified) .ok_or(Error::FeeRecipientUnspecified)
} }
@ -255,11 +255,11 @@ impl ExecutionLayer {
random: Hash256, random: Hash256,
finalized_block_hash: Hash256, finalized_block_hash: Hash256,
) -> Result<ExecutionPayload<T>, Error> { ) -> Result<ExecutionPayload<T>, Error> {
let fee_recipient = self.fee_recipient()?; let suggested_fee_recipient = self.suggested_fee_recipient()?;
debug!( debug!(
self.log(), self.log(),
"Issuing engine_getPayload"; "Issuing engine_getPayload";
"fee_recipient" => ?fee_recipient, "suggested_fee_recipient" => ?suggested_fee_recipient,
"random" => ?random, "random" => ?random,
"timestamp" => timestamp, "timestamp" => timestamp,
"parent_hash" => ?parent_hash, "parent_hash" => ?parent_hash,
@ -267,7 +267,7 @@ impl ExecutionLayer {
self.engines() self.engines()
.first_success(|engine| async move { .first_success(|engine| async move {
let payload_id = if let Some(id) = engine let payload_id = if let Some(id) = engine
.get_payload_id(parent_hash, timestamp, random, fee_recipient) .get_payload_id(parent_hash, timestamp, random, suggested_fee_recipient)
.await .await
{ {
// The payload id has been cached for this engine. // The payload id has been cached for this engine.
@ -287,7 +287,7 @@ impl ExecutionLayer {
let payload_attributes = PayloadAttributes { let payload_attributes = PayloadAttributes {
timestamp, timestamp,
random, random,
fee_recipient, suggested_fee_recipient,
}; };
engine engine
@ -521,13 +521,6 @@ impl ExecutionLayer {
self.execution_blocks().await.put(block.block_hash, block); self.execution_blocks().await.put(block.block_hash, block);
// TODO(merge): This implementation adheres to the following PR in the `dev` branch:
//
// https://github.com/ethereum/consensus-specs/pull/2719
//
// Therefore this implementation is not strictly v1.1.5, it is more lenient to some
// edge-cases during EL genesis. We should revisit this prior to the merge to ensure that
// this implementation becomes canonical.
loop { loop {
let block_reached_ttd = block.total_difficulty >= spec.terminal_total_difficulty; let block_reached_ttd = block.total_difficulty >= spec.terminal_total_difficulty;
if block_reached_ttd { if block_reached_ttd {

View File

@ -242,7 +242,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
return ExecutePayloadResponse { return ExecutePayloadResponse {
status: ExecutePayloadResponseStatus::Syncing, status: ExecutePayloadResponseStatus::Syncing,
latest_valid_hash: None, latest_valid_hash: None,
message: None, validation_error: None,
}; };
}; };
@ -250,7 +250,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
return ExecutePayloadResponse { return ExecutePayloadResponse {
status: ExecutePayloadResponseStatus::Invalid, status: ExecutePayloadResponseStatus::Invalid,
latest_valid_hash: Some(parent.block_hash()), latest_valid_hash: Some(parent.block_hash()),
message: Some("invalid block number".to_string()), validation_error: Some("invalid block number".to_string()),
}; };
} }
@ -260,7 +260,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
ExecutePayloadResponse { ExecutePayloadResponse {
status: ExecutePayloadResponseStatus::Valid, status: ExecutePayloadResponseStatus::Valid,
latest_valid_hash: Some(valid_hash), latest_valid_hash: Some(valid_hash),
message: None, validation_error: None,
} }
} }
@ -324,7 +324,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
let mut execution_payload = ExecutionPayload { let mut execution_payload = ExecutionPayload {
parent_hash: forkchoice_state.head_block_hash, parent_hash: forkchoice_state.head_block_hash,
coinbase: attributes.fee_recipient, fee_recipient: attributes.suggested_fee_recipient,
receipt_root: Hash256::repeat_byte(42), receipt_root: Hash256::repeat_byte(42),
state_root: Hash256::repeat_byte(43), state_root: Hash256::repeat_byte(43),
logs_bloom: vec![0; 256].into(), logs_bloom: vec![0; 256].into(),

View File

@ -62,12 +62,12 @@ pub async fn handle_rpc<T: EthSpec>(
ExecutePayloadResponseStatus::Valid => ExecutePayloadResponse { ExecutePayloadResponseStatus::Valid => ExecutePayloadResponse {
status, status,
latest_valid_hash: Some(request.block_hash), latest_valid_hash: Some(request.block_hash),
message: None, validation_error: None,
}, },
ExecutePayloadResponseStatus::Syncing => ExecutePayloadResponse { ExecutePayloadResponseStatus::Syncing => ExecutePayloadResponse {
status, status,
latest_valid_hash: None, latest_valid_hash: None,
message: None, validation_error: None,
}, },
_ => unimplemented!("invalid static executePayloadResponse"), _ => unimplemented!("invalid static executePayloadResponse"),
} }

View File

@ -121,7 +121,7 @@ impl<T: EthSpec> MockExecutionLayer<T> {
Some(PayloadAttributes { Some(PayloadAttributes {
timestamp, timestamp,
random, random,
fee_recipient: Address::repeat_byte(42), suggested_fee_recipient: Address::repeat_byte(42),
}), }),
) )
.await .await

View File

@ -18,7 +18,7 @@ use types::{Address, Checkpoint, Epoch, EthSpec, Hash256, PublicKeyBytes, GRAFFI
// TODO(merge): remove this default value. It's just there to make life easy during // TODO(merge): remove this default value. It's just there to make life easy during
// early testnets. // early testnets.
const DEFAULT_FEE_RECIPIENT: [u8; 20] = const DEFAULT_SUGGESTED_FEE_RECIPIENT: [u8; 20] =
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]; [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1];
/// Gets the fully-initialized global client. /// Gets the fully-initialized global client.
@ -253,11 +253,11 @@ pub fn get_config<E: EthSpec>(
client_config.execution_endpoints = Some(client_config.eth1.endpoints.clone()); client_config.execution_endpoints = Some(client_config.eth1.endpoints.clone());
} }
client_config.fee_recipient = Some( client_config.suggested_fee_recipient = Some(
clap_utils::parse_optional(cli_args, "fee-recipient")? clap_utils::parse_optional(cli_args, "fee-recipient")?
// TODO(merge): remove this default value. It's just there to make life easy during // TODO(merge): remove this default value. It's just there to make life easy during
// early testnets. // early testnets.
.unwrap_or_else(|| Address::from(DEFAULT_FEE_RECIPIENT)), .unwrap_or_else(|| Address::from(DEFAULT_SUGGESTED_FEE_RECIPIENT)),
); );
if let Some(freezer_dir) = cli_args.value_of("freezer-dir") { if let Some(freezer_dir) = cli_args.value_of("freezer-dir") {

View File

@ -310,7 +310,7 @@ pub fn partially_verify_execution_payload<T: EthSpec>(
payload: &ExecutionPayload<T>, payload: &ExecutionPayload<T>,
spec: &ChainSpec, spec: &ChainSpec,
) -> Result<(), BlockProcessingError> { ) -> Result<(), BlockProcessingError> {
if is_merge_complete(state) { if is_merge_transition_complete(state) {
block_verify!( block_verify!(
payload.parent_hash == state.latest_execution_payload_header()?.block_hash, payload.parent_hash == state.latest_execution_payload_header()?.block_hash,
BlockProcessingError::ExecutionHashChainIncontiguous { BlockProcessingError::ExecutionHashChainIncontiguous {
@ -355,7 +355,7 @@ pub fn process_execution_payload<T: EthSpec>(
*state.latest_execution_payload_header_mut()? = ExecutionPayloadHeader { *state.latest_execution_payload_header_mut()? = ExecutionPayloadHeader {
parent_hash: payload.parent_hash, parent_hash: payload.parent_hash,
coinbase: payload.coinbase, fee_recipient: payload.fee_recipient,
state_root: payload.state_root, state_root: payload.state_root,
receipt_root: payload.receipt_root, receipt_root: payload.receipt_root,
logs_bloom: payload.logs_bloom.clone(), logs_bloom: payload.logs_bloom.clone(),
@ -377,17 +377,22 @@ pub fn process_execution_payload<T: EthSpec>(
/// the merge has happened or if we're on the transition block. Thus we don't want to propagate /// the merge has happened or if we're on the transition block. Thus we don't want to propagate
/// errors from the `BeaconState` being an earlier variant than `BeaconStateMerge` as we'd have to /// errors from the `BeaconState` being an earlier variant than `BeaconStateMerge` as we'd have to
/// repeaetedly write code to treat these errors as false. /// repeaetedly write code to treat these errors as false.
/// https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/beacon-chain.md#is_merge_complete /// https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/beacon-chain.md#is_merge_transition_complete
pub fn is_merge_complete<T: EthSpec>(state: &BeaconState<T>) -> bool { pub fn is_merge_transition_complete<T: EthSpec>(state: &BeaconState<T>) -> bool {
state state
.latest_execution_payload_header() .latest_execution_payload_header()
.map(|header| *header != <ExecutionPayloadHeader<T>>::default()) .map(|header| *header != <ExecutionPayloadHeader<T>>::default())
.unwrap_or(false) .unwrap_or(false)
} }
/// https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/beacon-chain.md#is_merge_block /// https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/beacon-chain.md#is_merge_transition_block
pub fn is_merge_block<T: EthSpec>(state: &BeaconState<T>, body: BeaconBlockBodyRef<T>) -> bool { pub fn is_merge_transition_block<T: EthSpec>(
state: &BeaconState<T>,
body: BeaconBlockBodyRef<T>,
) -> bool {
body.execution_payload() body.execution_payload()
.map(|payload| !is_merge_complete(state) && *payload != <ExecutionPayload<T>>::default()) .map(|payload| {
!is_merge_transition_complete(state) && *payload != <ExecutionPayload<T>>::default()
})
.unwrap_or(false) .unwrap_or(false)
} }
/// https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/beacon-chain.md#is_execution_enabled /// https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/beacon-chain.md#is_execution_enabled
@ -395,7 +400,7 @@ pub fn is_execution_enabled<T: EthSpec>(
state: &BeaconState<T>, state: &BeaconState<T>,
body: BeaconBlockBodyRef<T>, body: BeaconBlockBodyRef<T>,
) -> bool { ) -> bool {
is_merge_block(state, body) || is_merge_complete(state) is_merge_transition_block(state, body) || is_merge_transition_complete(state)
} }
/// https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/beacon-chain.md#compute_timestamp_at_slot /// https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/beacon-chain.md#compute_timestamp_at_slot

View File

@ -14,7 +14,7 @@ pub type Transaction<T> = VariableList<u8, T>;
#[serde(bound = "T: EthSpec")] #[serde(bound = "T: EthSpec")]
pub struct ExecutionPayload<T: EthSpec> { pub struct ExecutionPayload<T: EthSpec> {
pub parent_hash: Hash256, pub parent_hash: Hash256,
pub coinbase: Address, pub fee_recipient: Address,
pub state_root: Hash256, pub state_root: Hash256,
pub receipt_root: Hash256, pub receipt_root: Hash256,
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")] #[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]

View File

@ -10,7 +10,7 @@ use tree_hash_derive::TreeHash;
)] )]
pub struct ExecutionPayloadHeader<T: EthSpec> { pub struct ExecutionPayloadHeader<T: EthSpec> {
pub parent_hash: Hash256, pub parent_hash: Hash256,
pub coinbase: Address, pub fee_recipient: Address,
pub state_root: Hash256, pub state_root: Hash256,
pub receipt_root: Hash256, pub receipt_root: Hash256,
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")] #[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]

View File

@ -1,4 +1,4 @@
TESTS_TAG := v1.1.5 TESTS_TAG := v1.1.6
TESTS = general minimal mainnet TESTS = general minimal mainnet
TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS)) TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS))

View File

@ -39,6 +39,19 @@ excluded_paths = [
"tests/minimal/altair/merkle/single_proof", "tests/minimal/altair/merkle/single_proof",
"tests/mainnet/merge/merkle/single_proof", "tests/mainnet/merge/merkle/single_proof",
"tests/minimal/merge/merkle/single_proof", "tests/minimal/merge/merkle/single_proof",
# Temporarily disabled due to addition of proposer boosting.
#
# These tests will be reintroduced in:
# https://github.com/sigp/lighthouse/pull/2822
"tests/minimal/phase0/fork_choice",
"tests/minimal/altair/fork_choice",
"tests/minimal/merge/fork_choice",
"tests/mainnet/phase0/fork_choice",
"tests/mainnet/altair/fork_choice",
"tests/mainnet/merge/fork_choice",
# Tests yet to be implemented.
"tests/mainnet/merge/transition",
"tests/minimal/merge/transition",
] ]
def normalize_path(path): def normalize_path(path):

View File

@ -411,6 +411,12 @@ fn finality() {
FinalityHandler::<MainnetEthSpec>::default().run(); FinalityHandler::<MainnetEthSpec>::default().run();
} }
/*
* Temporarily disabled due to addition of proposer boosting.
*
* These tests will be reintroduced in:
* https://github.com/sigp/lighthouse/pull/2822
*
#[test] #[test]
fn fork_choice_get_head() { fn fork_choice_get_head() {
ForkChoiceGetHeadHandler::<MinimalEthSpec>::default().run(); ForkChoiceGetHeadHandler::<MinimalEthSpec>::default().run();
@ -428,6 +434,7 @@ fn fork_choice_on_merge_block() {
ForkChoiceOnMergeBlockHandler::<MinimalEthSpec>::default().run(); ForkChoiceOnMergeBlockHandler::<MinimalEthSpec>::default().run();
ForkChoiceOnMergeBlockHandler::<MainnetEthSpec>::default().run(); ForkChoiceOnMergeBlockHandler::<MainnetEthSpec>::default().run();
} }
*/
#[test] #[test]
fn genesis_initialization() { fn genesis_initialization() {