diff --git a/Cargo.lock b/Cargo.lock index 3bd3a906a6..92bf5da0ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2072,6 +2072,7 @@ dependencies = [ "environment", "eth1", "eth2_serde_utils 0.1.0", + "eth2_ssz_types", "futures", "hex", "reqwest", diff --git a/beacon_node/execution_layer/Cargo.toml b/beacon_node/execution_layer/Cargo.toml index d04f7a7296..e9de26e833 100644 --- a/beacon_node/execution_layer/Cargo.toml +++ b/beacon_node/execution_layer/Cargo.toml @@ -22,3 +22,4 @@ environment = { path = "../../lighthouse/environment" } bytes = "1.1.0" task_executor = { path = "../../common/task_executor" } hex = "0.4.2" +eth2_ssz_types = { path = "../../consensus/ssz_types"} diff --git a/beacon_node/execution_layer/src/engine_api/http.rs b/beacon_node/execution_layer/src/engine_api/http.rs index 8c7cec59f6..976cca2102 100644 --- a/beacon_node/execution_layer/src/engine_api/http.rs +++ b/beacon_node/execution_layer/src/engine_api/http.rs @@ -2,13 +2,14 @@ use super::*; use async_trait::async_trait; use eth1::http::EIP155_ERROR_STR; use reqwest::header::CONTENT_TYPE; -pub use reqwest::Client; use sensitive_url::SensitiveUrl; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::json; use std::time::Duration; use types::{EthSpec, FixedVector, Transaction, Unsigned, VariableList}; +pub use reqwest::Client; + const STATIC_ID: u32 = 1; const JSONRPC_VERSION: &str = "2.0"; @@ -238,8 +239,10 @@ pub struct JsonExecutionPayload { pub gas_used: u64, #[serde(with = "eth2_serde_utils::u64_hex_be")] pub timestamp: u64, + // FIXME(paul): check serialization + #[serde(with = "ssz_types::serde_utils::hex_var_list")] + pub extra_data: VariableList, pub base_fee_per_gas: Hash256, - // FIXME(paul): add extraData pub block_hash: Hash256, // FIXME(paul): add transaction parsing. #[serde(default)] @@ -259,6 +262,7 @@ impl From> for JsonExecutionPayload { gas_limit: e.gas_limit, gas_used: e.gas_used, timestamp: e.timestamp, + extra_data: e.extra_data, base_fee_per_gas: e.base_fee_per_gas, block_hash: e.block_hash, transactions: e.transactions, @@ -279,6 +283,7 @@ impl From> for ExecutionPayload { gas_limit: e.gas_limit, gas_used: e.gas_used, timestamp: e.timestamp, + extra_data: e.extra_data, base_fee_per_gas: e.base_fee_per_gas, block_hash: e.block_hash, transactions: e.transactions, @@ -449,6 +454,7 @@ mod test { gas_limit: 1, gas_used: 2, timestamp: 42, + extra_data: vec![].into(), base_fee_per_gas: Hash256::repeat_byte(0), block_hash: Hash256::repeat_byte(1), transactions: vec![].into(), @@ -470,6 +476,7 @@ mod test { "gasLimit": "0x1", "gasUsed": "0x2", "timestamp": "0x2a", + "extraData": [], "baseFeePerGas": HASH_00, "blockHash": HASH_01, "transactions": [],