mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
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:
@@ -83,7 +83,7 @@ pub enum ExecutePayloadResponseStatus {
|
||||
pub struct ExecutePayloadResponse {
|
||||
pub status: ExecutePayloadResponseStatus,
|
||||
pub latest_valid_hash: Option<Hash256>,
|
||||
pub message: Option<String>,
|
||||
pub validation_error: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize)]
|
||||
@@ -107,7 +107,7 @@ pub struct ExecutionBlock {
|
||||
pub struct PayloadAttributes {
|
||||
pub timestamp: u64,
|
||||
pub random: Hash256,
|
||||
pub fee_recipient: Address,
|
||||
pub suggested_fee_recipient: Address,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
|
||||
@@ -289,9 +289,9 @@ mod test {
|
||||
> {
|
||||
let mut json = json!({
|
||||
"parentHash": HASH_00,
|
||||
"coinbase": ADDRESS_01,
|
||||
"feeRecipient": ADDRESS_01,
|
||||
"stateRoot": HASH_01,
|
||||
"receiptRoot": HASH_00,
|
||||
"receiptsRoot": HASH_00,
|
||||
"logsBloom": LOGS_BLOOM_01,
|
||||
"random": HASH_01,
|
||||
"blockNumber": "0x0",
|
||||
@@ -445,7 +445,7 @@ mod test {
|
||||
Some(PayloadAttributes {
|
||||
timestamp: 5,
|
||||
random: Hash256::zero(),
|
||||
fee_recipient: Address::repeat_byte(0),
|
||||
suggested_fee_recipient: Address::repeat_byte(0),
|
||||
}),
|
||||
)
|
||||
.await;
|
||||
@@ -462,7 +462,7 @@ mod test {
|
||||
{
|
||||
"timestamp":"0x5",
|
||||
"random": HASH_00,
|
||||
"feeRecipient": ADDRESS_00
|
||||
"suggestedFeeRecipient": ADDRESS_00
|
||||
}]
|
||||
}),
|
||||
)
|
||||
@@ -494,7 +494,7 @@ mod test {
|
||||
let _ = client
|
||||
.execute_payload_v1::<MainnetEthSpec>(ExecutionPayload {
|
||||
parent_hash: Hash256::repeat_byte(0),
|
||||
coinbase: Address::repeat_byte(1),
|
||||
fee_recipient: Address::repeat_byte(1),
|
||||
state_root: Hash256::repeat_byte(1),
|
||||
receipt_root: Hash256::repeat_byte(0),
|
||||
logs_bloom: vec![1; 256].into(),
|
||||
@@ -516,9 +516,9 @@ mod test {
|
||||
"method": ENGINE_EXECUTE_PAYLOAD_V1,
|
||||
"params": [{
|
||||
"parentHash": HASH_00,
|
||||
"coinbase": ADDRESS_01,
|
||||
"feeRecipient": ADDRESS_01,
|
||||
"stateRoot": HASH_01,
|
||||
"receiptRoot": HASH_00,
|
||||
"receiptsRoot": HASH_00,
|
||||
"logsBloom": LOGS_BLOOM_01,
|
||||
"random": HASH_01,
|
||||
"blockNumber": "0x0",
|
||||
@@ -600,7 +600,7 @@ mod test {
|
||||
Some(PayloadAttributes {
|
||||
timestamp: 5,
|
||||
random: Hash256::zero(),
|
||||
fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
|
||||
suggested_fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
|
||||
})
|
||||
)
|
||||
.await;
|
||||
@@ -617,7 +617,7 @@ mod test {
|
||||
{
|
||||
"timestamp":"0x5",
|
||||
"random": HASH_00,
|
||||
"feeRecipient":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
|
||||
"suggestedFeeRecipient":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b"
|
||||
}]
|
||||
})
|
||||
)
|
||||
@@ -643,7 +643,7 @@ mod test {
|
||||
Some(PayloadAttributes {
|
||||
timestamp: 5,
|
||||
random: Hash256::zero(),
|
||||
fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
|
||||
suggested_fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
|
||||
})
|
||||
)
|
||||
.await
|
||||
@@ -678,9 +678,9 @@ mod test {
|
||||
"id":STATIC_ID,
|
||||
"result":{
|
||||
"parentHash":"0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a",
|
||||
"coinbase":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"feeRecipient":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"stateRoot":"0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45",
|
||||
"receiptRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"logsBloom": LOGS_BLOOM_00,
|
||||
"random": HASH_00,
|
||||
"blockNumber":"0x1",
|
||||
@@ -701,7 +701,7 @@ mod test {
|
||||
|
||||
let expected = ExecutionPayload {
|
||||
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(),
|
||||
receipt_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
||||
logs_bloom: vec![0; 256].into(),
|
||||
@@ -726,7 +726,7 @@ mod test {
|
||||
let _ = client
|
||||
.execute_payload_v1::<MainnetEthSpec>(ExecutionPayload {
|
||||
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(),
|
||||
receipt_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
||||
logs_bloom: vec![0; 256].into(),
|
||||
@@ -748,9 +748,9 @@ mod test {
|
||||
"method": ENGINE_EXECUTE_PAYLOAD_V1,
|
||||
"params": [{
|
||||
"parentHash":"0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a",
|
||||
"coinbase":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"feeRecipient":"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"stateRoot":"0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45",
|
||||
"receiptRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"logsBloom": LOGS_BLOOM_00,
|
||||
"random": HASH_00,
|
||||
"blockNumber":"0x1",
|
||||
@@ -785,7 +785,7 @@ mod test {
|
||||
ExecutePayloadResponse {
|
||||
status: ExecutePayloadResponseStatus::Valid,
|
||||
latest_valid_hash: Some(Hash256::from_str("0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858").unwrap()),
|
||||
message: None
|
||||
validation_error: None
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
@@ -59,9 +59,9 @@ pub struct JsonPayloadIdResponse {
|
||||
#[serde(bound = "T: EthSpec", rename_all = "camelCase")]
|
||||
pub struct JsonExecutionPayloadV1<T: EthSpec> {
|
||||
pub parent_hash: Hash256,
|
||||
pub coinbase: Address,
|
||||
pub fee_recipient: Address,
|
||||
pub state_root: Hash256,
|
||||
pub receipt_root: Hash256,
|
||||
pub receipts_root: Hash256,
|
||||
#[serde(with = "serde_logs_bloom")]
|
||||
pub logs_bloom: FixedVector<u8, T::BytesPerLogsBloom>,
|
||||
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.
|
||||
let ExecutionPayload {
|
||||
parent_hash,
|
||||
coinbase,
|
||||
fee_recipient,
|
||||
state_root,
|
||||
receipt_root,
|
||||
logs_bloom,
|
||||
@@ -104,9 +104,9 @@ impl<T: EthSpec> From<ExecutionPayload<T>> for JsonExecutionPayloadV1<T> {
|
||||
|
||||
Self {
|
||||
parent_hash,
|
||||
coinbase,
|
||||
fee_recipient,
|
||||
state_root,
|
||||
receipt_root,
|
||||
receipts_root: receipt_root,
|
||||
logs_bloom,
|
||||
random,
|
||||
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.
|
||||
let JsonExecutionPayloadV1 {
|
||||
parent_hash,
|
||||
coinbase,
|
||||
fee_recipient,
|
||||
state_root,
|
||||
receipt_root,
|
||||
receipts_root,
|
||||
logs_bloom,
|
||||
random,
|
||||
block_number,
|
||||
@@ -143,9 +143,9 @@ impl<T: EthSpec> From<JsonExecutionPayloadV1<T>> for ExecutionPayload<T> {
|
||||
|
||||
Self {
|
||||
parent_hash,
|
||||
coinbase,
|
||||
fee_recipient,
|
||||
state_root,
|
||||
receipt_root,
|
||||
receipt_root: receipts_root,
|
||||
logs_bloom,
|
||||
random,
|
||||
block_number,
|
||||
@@ -166,7 +166,7 @@ pub struct JsonPayloadAttributesV1 {
|
||||
#[serde(with = "eth2_serde_utils::u64_hex_be")]
|
||||
pub timestamp: u64,
|
||||
pub random: Hash256,
|
||||
pub fee_recipient: Address,
|
||||
pub suggested_fee_recipient: Address,
|
||||
}
|
||||
|
||||
impl From<PayloadAttributes> for JsonPayloadAttributesV1 {
|
||||
@@ -175,13 +175,13 @@ impl From<PayloadAttributes> for JsonPayloadAttributesV1 {
|
||||
let PayloadAttributes {
|
||||
timestamp,
|
||||
random,
|
||||
fee_recipient,
|
||||
suggested_fee_recipient,
|
||||
} = p;
|
||||
|
||||
Self {
|
||||
timestamp,
|
||||
random,
|
||||
fee_recipient,
|
||||
suggested_fee_recipient,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,13 +192,13 @@ impl From<JsonPayloadAttributesV1> for PayloadAttributes {
|
||||
let JsonPayloadAttributesV1 {
|
||||
timestamp,
|
||||
random,
|
||||
fee_recipient,
|
||||
suggested_fee_recipient,
|
||||
} = j;
|
||||
|
||||
Self {
|
||||
timestamp,
|
||||
random,
|
||||
fee_recipient,
|
||||
suggested_fee_recipient,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,7 +258,7 @@ pub enum JsonExecutePayloadV1ResponseStatus {
|
||||
pub struct JsonExecutePayloadV1Response {
|
||||
pub status: JsonExecutePayloadV1ResponseStatus,
|
||||
pub latest_valid_hash: Option<Hash256>,
|
||||
pub message: Option<String>,
|
||||
pub validation_error: Option<String>,
|
||||
}
|
||||
|
||||
impl From<ExecutePayloadResponseStatus> for JsonExecutePayloadV1ResponseStatus {
|
||||
@@ -286,13 +286,13 @@ impl From<ExecutePayloadResponse> for JsonExecutePayloadV1Response {
|
||||
let ExecutePayloadResponse {
|
||||
status,
|
||||
latest_valid_hash,
|
||||
message,
|
||||
validation_error,
|
||||
} = e;
|
||||
|
||||
Self {
|
||||
status: status.into(),
|
||||
latest_valid_hash,
|
||||
message,
|
||||
validation_error,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -303,13 +303,13 @@ impl From<JsonExecutePayloadV1Response> for ExecutePayloadResponse {
|
||||
let JsonExecutePayloadV1Response {
|
||||
status,
|
||||
latest_valid_hash,
|
||||
message,
|
||||
validation_error,
|
||||
} = j;
|
||||
|
||||
Self {
|
||||
status: status.into(),
|
||||
latest_valid_hash,
|
||||
message,
|
||||
validation_error,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ struct PayloadIdCacheKey {
|
||||
pub head_block_hash: Hash256,
|
||||
pub timestamp: u64,
|
||||
pub random: Hash256,
|
||||
pub fee_recipient: Address,
|
||||
pub suggested_fee_recipient: Address,
|
||||
}
|
||||
|
||||
/// An execution engine.
|
||||
@@ -76,7 +76,7 @@ impl<T> Engine<T> {
|
||||
head_block_hash: Hash256,
|
||||
timestamp: u64,
|
||||
random: Hash256,
|
||||
fee_recipient: Address,
|
||||
suggested_fee_recipient: Address,
|
||||
) -> Option<PayloadId> {
|
||||
self.payload_id_cache
|
||||
.lock()
|
||||
@@ -85,7 +85,7 @@ impl<T> Engine<T> {
|
||||
head_block_hash,
|
||||
timestamp,
|
||||
random,
|
||||
fee_recipient,
|
||||
suggested_fee_recipient,
|
||||
})
|
||||
.cloned()
|
||||
}
|
||||
@@ -392,7 +392,7 @@ impl PayloadIdCacheKey {
|
||||
head_block_hash: state.head_block_hash,
|
||||
timestamp: attributes.timestamp,
|
||||
random: attributes.random,
|
||||
fee_recipient: attributes.fee_recipient,
|
||||
suggested_fee_recipient: attributes.suggested_fee_recipient,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ impl From<ApiError> for Error {
|
||||
|
||||
struct Inner {
|
||||
engines: Engines<HttpJsonRpc>,
|
||||
fee_recipient: Option<Address>,
|
||||
suggested_fee_recipient: Option<Address>,
|
||||
execution_blocks: Mutex<LruCache<Hash256, ExecutionBlock>>,
|
||||
executor: TaskExecutor,
|
||||
log: Logger,
|
||||
@@ -72,7 +72,7 @@ impl ExecutionLayer {
|
||||
/// Instantiate `Self` with `urls.len()` engines, all using the JSON-RPC via HTTP.
|
||||
pub fn from_urls(
|
||||
urls: Vec<SensitiveUrl>,
|
||||
fee_recipient: Option<Address>,
|
||||
suggested_fee_recipient: Option<Address>,
|
||||
executor: TaskExecutor,
|
||||
log: Logger,
|
||||
) -> Result<Self, Error> {
|
||||
@@ -95,7 +95,7 @@ impl ExecutionLayer {
|
||||
latest_forkchoice_state: <_>::default(),
|
||||
log: log.clone(),
|
||||
},
|
||||
fee_recipient,
|
||||
suggested_fee_recipient,
|
||||
execution_blocks: Mutex::new(LruCache::new(EXECUTION_BLOCKS_LRU_CACHE_SIZE)),
|
||||
executor,
|
||||
log,
|
||||
@@ -116,9 +116,9 @@ impl ExecutionLayer {
|
||||
&self.inner.executor
|
||||
}
|
||||
|
||||
fn fee_recipient(&self) -> Result<Address, Error> {
|
||||
fn suggested_fee_recipient(&self) -> Result<Address, Error> {
|
||||
self.inner
|
||||
.fee_recipient
|
||||
.suggested_fee_recipient
|
||||
.ok_or(Error::FeeRecipientUnspecified)
|
||||
}
|
||||
|
||||
@@ -255,11 +255,11 @@ impl ExecutionLayer {
|
||||
random: Hash256,
|
||||
finalized_block_hash: Hash256,
|
||||
) -> Result<ExecutionPayload<T>, Error> {
|
||||
let fee_recipient = self.fee_recipient()?;
|
||||
let suggested_fee_recipient = self.suggested_fee_recipient()?;
|
||||
debug!(
|
||||
self.log(),
|
||||
"Issuing engine_getPayload";
|
||||
"fee_recipient" => ?fee_recipient,
|
||||
"suggested_fee_recipient" => ?suggested_fee_recipient,
|
||||
"random" => ?random,
|
||||
"timestamp" => timestamp,
|
||||
"parent_hash" => ?parent_hash,
|
||||
@@ -267,7 +267,7 @@ impl ExecutionLayer {
|
||||
self.engines()
|
||||
.first_success(|engine| async move {
|
||||
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
|
||||
{
|
||||
// The payload id has been cached for this engine.
|
||||
@@ -287,7 +287,7 @@ impl ExecutionLayer {
|
||||
let payload_attributes = PayloadAttributes {
|
||||
timestamp,
|
||||
random,
|
||||
fee_recipient,
|
||||
suggested_fee_recipient,
|
||||
};
|
||||
|
||||
engine
|
||||
@@ -521,13 +521,6 @@ impl ExecutionLayer {
|
||||
|
||||
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 {
|
||||
let block_reached_ttd = block.total_difficulty >= spec.terminal_total_difficulty;
|
||||
if block_reached_ttd {
|
||||
|
||||
@@ -242,7 +242,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
|
||||
return ExecutePayloadResponse {
|
||||
status: ExecutePayloadResponseStatus::Syncing,
|
||||
latest_valid_hash: None,
|
||||
message: None,
|
||||
validation_error: None,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -250,7 +250,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
|
||||
return ExecutePayloadResponse {
|
||||
status: ExecutePayloadResponseStatus::Invalid,
|
||||
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 {
|
||||
status: ExecutePayloadResponseStatus::Valid,
|
||||
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 {
|
||||
parent_hash: forkchoice_state.head_block_hash,
|
||||
coinbase: attributes.fee_recipient,
|
||||
fee_recipient: attributes.suggested_fee_recipient,
|
||||
receipt_root: Hash256::repeat_byte(42),
|
||||
state_root: Hash256::repeat_byte(43),
|
||||
logs_bloom: vec![0; 256].into(),
|
||||
|
||||
@@ -62,12 +62,12 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
ExecutePayloadResponseStatus::Valid => ExecutePayloadResponse {
|
||||
status,
|
||||
latest_valid_hash: Some(request.block_hash),
|
||||
message: None,
|
||||
validation_error: None,
|
||||
},
|
||||
ExecutePayloadResponseStatus::Syncing => ExecutePayloadResponse {
|
||||
status,
|
||||
latest_valid_hash: None,
|
||||
message: None,
|
||||
validation_error: None,
|
||||
},
|
||||
_ => unimplemented!("invalid static executePayloadResponse"),
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ impl<T: EthSpec> MockExecutionLayer<T> {
|
||||
Some(PayloadAttributes {
|
||||
timestamp,
|
||||
random,
|
||||
fee_recipient: Address::repeat_byte(42),
|
||||
suggested_fee_recipient: Address::repeat_byte(42),
|
||||
}),
|
||||
)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user