mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-01 05:37:05 +00:00
Resolve merge conflicts
This commit is contained in:
@@ -35,7 +35,6 @@ pub const ENGINE_NEW_PAYLOAD_V1: &str = "engine_newPayloadV1";
|
||||
pub const ENGINE_NEW_PAYLOAD_V2: &str = "engine_newPayloadV2";
|
||||
pub const ENGINE_NEW_PAYLOAD_V3: &str = "engine_newPayloadV3";
|
||||
pub const ENGINE_NEW_PAYLOAD_V4: &str = "engine_newPayloadV4";
|
||||
pub const ENGINE_NEW_PAYLOAD_V5: &str = "engine_newPayloadV5";
|
||||
pub const ENGINE_NEW_PAYLOAD_TIMEOUT: Duration = Duration::from_secs(8);
|
||||
|
||||
pub const ENGINE_GET_PAYLOAD_V1: &str = "engine_getPayloadV1";
|
||||
@@ -78,7 +77,6 @@ pub static LIGHTHOUSE_CAPABILITIES: &[&str] = &[
|
||||
ENGINE_NEW_PAYLOAD_V2,
|
||||
ENGINE_NEW_PAYLOAD_V3,
|
||||
ENGINE_NEW_PAYLOAD_V4,
|
||||
ENGINE_NEW_PAYLOAD_V5,
|
||||
ENGINE_GET_PAYLOAD_V1,
|
||||
ENGINE_GET_PAYLOAD_V2,
|
||||
ENGINE_GET_PAYLOAD_V3,
|
||||
@@ -109,9 +107,10 @@ pub static LIGHTHOUSE_JSON_CLIENT_VERSION: LazyLock<JsonClientVersionV1> =
|
||||
|
||||
/// Contains methods to convert arbitrary bytes to an ETH2 deposit contract object.
|
||||
pub mod deposit_log {
|
||||
use bls::{PublicKeyBytes, SignatureBytes};
|
||||
use ssz::Decode;
|
||||
use state_processing::per_block_processing::signature_sets::deposit_pubkey_signature_message;
|
||||
use types::{ChainSpec, DepositData, Hash256, PublicKeyBytes, SignatureBytes};
|
||||
use types::{ChainSpec, DepositData, Hash256};
|
||||
|
||||
pub use eth2::lighthouse::DepositLog;
|
||||
|
||||
@@ -230,7 +229,7 @@ pub mod deposit_methods {
|
||||
use super::Log;
|
||||
use crate::HttpJsonRpc;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{json, Value};
|
||||
use serde_json::{Value, json};
|
||||
use std::fmt;
|
||||
use std::ops::Range;
|
||||
use std::str::FromStr;
|
||||
@@ -658,7 +657,7 @@ impl HttpJsonRpc {
|
||||
|
||||
let mut request = self
|
||||
.client
|
||||
.post(self.url.full.clone())
|
||||
.post(self.url.expose_full().clone())
|
||||
.timeout(timeout)
|
||||
.header(CONTENT_TYPE, "application/json")
|
||||
.json(&body);
|
||||
@@ -731,7 +730,7 @@ impl HttpJsonRpc {
|
||||
pub async fn get_blobs_v2<E: EthSpec>(
|
||||
&self,
|
||||
versioned_hashes: Vec<Hash256>,
|
||||
) -> Result<Vec<Option<BlobAndProofV2<E>>>, Error> {
|
||||
) -> Result<Option<Vec<BlobAndProofV2<E>>>, Error> {
|
||||
let params = json!([versioned_hashes]);
|
||||
|
||||
self.rpc_request(
|
||||
@@ -790,7 +789,7 @@ impl HttpJsonRpc {
|
||||
&self,
|
||||
execution_payload: ExecutionPayload<E>,
|
||||
) -> Result<PayloadStatusV1, Error> {
|
||||
let params = json!([JsonExecutionPayload::from(execution_payload)]);
|
||||
let params = json!([JsonExecutionPayload::try_from(execution_payload)?]);
|
||||
|
||||
let response: JsonPayloadStatusV1 = self
|
||||
.rpc_request(
|
||||
@@ -807,7 +806,7 @@ impl HttpJsonRpc {
|
||||
&self,
|
||||
execution_payload: ExecutionPayload<E>,
|
||||
) -> Result<PayloadStatusV1, Error> {
|
||||
let params = json!([JsonExecutionPayload::from(execution_payload)]);
|
||||
let params = json!([JsonExecutionPayload::try_from(execution_payload)?]);
|
||||
|
||||
let response: JsonPayloadStatusV1 = self
|
||||
.rpc_request(
|
||||
@@ -825,7 +824,12 @@ impl HttpJsonRpc {
|
||||
new_payload_request_deneb: NewPayloadRequestDeneb<'_, E>,
|
||||
) -> Result<PayloadStatusV1, Error> {
|
||||
let params = json!([
|
||||
JsonExecutionPayload::V3(new_payload_request_deneb.execution_payload.clone().into()),
|
||||
JsonExecutionPayload::Deneb(
|
||||
new_payload_request_deneb
|
||||
.execution_payload
|
||||
.clone()
|
||||
.try_into()?
|
||||
),
|
||||
new_payload_request_deneb.versioned_hashes,
|
||||
new_payload_request_deneb.parent_beacon_block_root,
|
||||
]);
|
||||
@@ -846,7 +850,12 @@ impl HttpJsonRpc {
|
||||
new_payload_request_electra: NewPayloadRequestElectra<'_, E>,
|
||||
) -> Result<PayloadStatusV1, Error> {
|
||||
let params = json!([
|
||||
JsonExecutionPayload::V4(new_payload_request_electra.execution_payload.clone().into()),
|
||||
JsonExecutionPayload::Electra(
|
||||
new_payload_request_electra
|
||||
.execution_payload
|
||||
.clone()
|
||||
.try_into()?
|
||||
),
|
||||
new_payload_request_electra.versioned_hashes,
|
||||
new_payload_request_electra.parent_beacon_block_root,
|
||||
new_payload_request_electra
|
||||
@@ -865,7 +874,37 @@ impl HttpJsonRpc {
|
||||
Ok(response.into())
|
||||
}
|
||||
|
||||
pub async fn new_payload_v5_eip7805<E: EthSpec>(
|
||||
pub async fn new_payload_v4_fulu<E: EthSpec>(
|
||||
&self,
|
||||
new_payload_request_fulu: NewPayloadRequestFulu<'_, E>,
|
||||
) -> Result<PayloadStatusV1, Error> {
|
||||
let params = json!([
|
||||
JsonExecutionPayload::Fulu(
|
||||
new_payload_request_fulu
|
||||
.execution_payload
|
||||
.clone()
|
||||
.try_into()?
|
||||
),
|
||||
new_payload_request_fulu.versioned_hashes,
|
||||
new_payload_request_fulu.parent_beacon_block_root,
|
||||
new_payload_request_fulu
|
||||
.execution_requests
|
||||
.get_execution_requests_list(),
|
||||
]);
|
||||
|
||||
let response: JsonPayloadStatusV1 = self
|
||||
.rpc_request(
|
||||
ENGINE_NEW_PAYLOAD_V4,
|
||||
params,
|
||||
ENGINE_NEW_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(response.into())
|
||||
}
|
||||
|
||||
// TODO(EIP7805) fix new payload if needed
|
||||
pub async fn new_payload_v4_eip7805<E: EthSpec>(
|
||||
&self,
|
||||
new_payload_request_eip7805: NewPayloadRequestEip7805<'_, E>,
|
||||
) -> Result<PayloadStatusV1, Error> {
|
||||
@@ -879,7 +918,12 @@ impl HttpJsonRpc {
|
||||
.collect();
|
||||
|
||||
let params = json!([
|
||||
JsonExecutionPayload::V5(new_payload_request_eip7805.execution_payload.clone().into()),
|
||||
JsonExecutionPayload::Eip7805(
|
||||
new_payload_request_eip7805
|
||||
.execution_payload
|
||||
.clone()
|
||||
.try_into()?
|
||||
),
|
||||
new_payload_request_eip7805.versioned_hashes,
|
||||
new_payload_request_eip7805.parent_beacon_block_root,
|
||||
new_payload_request_eip7805
|
||||
@@ -888,9 +932,10 @@ impl HttpJsonRpc {
|
||||
il_transactions
|
||||
]);
|
||||
|
||||
// TODO(eip7805) should be v5 i think
|
||||
let response: JsonPayloadStatusV1 = self
|
||||
.rpc_request(
|
||||
ENGINE_NEW_PAYLOAD_V5,
|
||||
ENGINE_NEW_PAYLOAD_V4,
|
||||
params,
|
||||
ENGINE_NEW_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
@@ -899,38 +944,33 @@ impl HttpJsonRpc {
|
||||
Ok(response.into())
|
||||
}
|
||||
|
||||
pub async fn new_payload_v5_fulu<E: EthSpec>(
|
||||
pub async fn new_payload_v4_gloas<E: EthSpec>(
|
||||
&self,
|
||||
_new_payload_request_fulu: NewPayloadRequestFulu<'_, E>,
|
||||
new_payload_request_gloas: NewPayloadRequestGloas<'_, E>,
|
||||
) -> Result<PayloadStatusV1, Error> {
|
||||
unreachable!("new payload fulu");
|
||||
// // TODO(focil) clean this up?
|
||||
// let mut il_transactions = vec![];
|
||||
// for transaction in new_payload_request_fulu.il_transactions {
|
||||
// if let Ok(hex_tx) = String::from_utf8(transaction.into()).map(|v| format!("0x{}", v)) {
|
||||
// il_transactions.push(hex_tx);
|
||||
// }
|
||||
// }
|
||||
let params = json!([
|
||||
JsonExecutionPayload::Gloas(
|
||||
new_payload_request_gloas
|
||||
.execution_payload
|
||||
.clone()
|
||||
.try_into()?
|
||||
),
|
||||
new_payload_request_gloas.versioned_hashes,
|
||||
new_payload_request_gloas.parent_beacon_block_root,
|
||||
new_payload_request_gloas
|
||||
.execution_requests
|
||||
.get_execution_requests_list(),
|
||||
]);
|
||||
|
||||
// let params = json!([
|
||||
// JsonExecutionPayload::V5(new_payload_request_fulu.execution_payload.clone().into()),
|
||||
// new_payload_request_fulu.versioned_hashes,
|
||||
// new_payload_request_fulu.parent_beacon_block_root,
|
||||
// new_payload_request_fulu
|
||||
// .execution_requests
|
||||
// .get_execution_requests_list(),
|
||||
// il_transactions
|
||||
// ]);
|
||||
let response: JsonPayloadStatusV1 = self
|
||||
.rpc_request(
|
||||
ENGINE_NEW_PAYLOAD_V4,
|
||||
params,
|
||||
ENGINE_NEW_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
.await?;
|
||||
|
||||
// let response: JsonPayloadStatusV1 = self
|
||||
// .rpc_request(
|
||||
// ENGINE_NEW_PAYLOAD_V5,
|
||||
// params,
|
||||
// ENGINE_NEW_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
// )
|
||||
// .await?;
|
||||
|
||||
// Ok(response.into())
|
||||
Ok(response.into())
|
||||
}
|
||||
|
||||
pub async fn get_payload_v1<E: EthSpec>(
|
||||
@@ -939,7 +979,7 @@ impl HttpJsonRpc {
|
||||
) -> Result<GetPayloadResponse<E>, Error> {
|
||||
let params = json!([JsonPayloadIdRequest::from(payload_id)]);
|
||||
|
||||
let payload_v1: JsonExecutionPayloadV1<E> = self
|
||||
let payload_v1: JsonExecutionPayloadBellatrix<E> = self
|
||||
.rpc_request(
|
||||
ENGINE_GET_PAYLOAD_V1,
|
||||
params,
|
||||
@@ -965,26 +1005,26 @@ impl HttpJsonRpc {
|
||||
|
||||
match fork_name {
|
||||
ForkName::Bellatrix => {
|
||||
let response: JsonGetPayloadResponseV1<E> = self
|
||||
let response: JsonGetPayloadResponseBellatrix<E> = self
|
||||
.rpc_request(
|
||||
ENGINE_GET_PAYLOAD_V2,
|
||||
params,
|
||||
ENGINE_GET_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
.await?;
|
||||
JsonGetPayloadResponse::V1(response)
|
||||
JsonGetPayloadResponse::Bellatrix(response)
|
||||
.try_into()
|
||||
.map_err(Error::BadResponse)
|
||||
}
|
||||
ForkName::Capella => {
|
||||
let response: JsonGetPayloadResponseV2<E> = self
|
||||
let response: JsonGetPayloadResponseCapella<E> = self
|
||||
.rpc_request(
|
||||
ENGINE_GET_PAYLOAD_V2,
|
||||
params,
|
||||
ENGINE_GET_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
.await?;
|
||||
JsonGetPayloadResponse::V2(response)
|
||||
JsonGetPayloadResponse::Capella(response)
|
||||
.try_into()
|
||||
.map_err(Error::BadResponse)
|
||||
}
|
||||
@@ -1004,14 +1044,14 @@ impl HttpJsonRpc {
|
||||
|
||||
match fork_name {
|
||||
ForkName::Deneb => {
|
||||
let response: JsonGetPayloadResponseV3<E> = self
|
||||
let response: JsonGetPayloadResponseDeneb<E> = self
|
||||
.rpc_request(
|
||||
ENGINE_GET_PAYLOAD_V3,
|
||||
params,
|
||||
ENGINE_GET_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
.await?;
|
||||
JsonGetPayloadResponse::V3(response)
|
||||
JsonGetPayloadResponse::Deneb(response)
|
||||
.try_into()
|
||||
.map_err(Error::BadResponse)
|
||||
}
|
||||
@@ -1031,19 +1071,19 @@ impl HttpJsonRpc {
|
||||
|
||||
match fork_name {
|
||||
ForkName::Electra => {
|
||||
let response: JsonGetPayloadResponseV4<E> = self
|
||||
let response: JsonGetPayloadResponseElectra<E> = self
|
||||
.rpc_request(
|
||||
ENGINE_GET_PAYLOAD_V4,
|
||||
params,
|
||||
ENGINE_GET_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
.await?;
|
||||
JsonGetPayloadResponse::V4(response)
|
||||
JsonGetPayloadResponse::Electra(response)
|
||||
.try_into()
|
||||
.map_err(Error::BadResponse)
|
||||
}
|
||||
ForkName::Eip7805 => {
|
||||
let response: JsonGetPayloadResponseV5<E> = self
|
||||
let response: JsonGetPayloadResponseEip7805<E> = self
|
||||
.rpc_request(
|
||||
ENGINE_GET_PAYLOAD_V4,
|
||||
params,
|
||||
@@ -1051,7 +1091,7 @@ impl HttpJsonRpc {
|
||||
)
|
||||
.await?;
|
||||
|
||||
JsonGetPayloadResponse::V5(response)
|
||||
JsonGetPayloadResponse::Eip7805(response)
|
||||
.try_into()
|
||||
.map_err(Error::BadResponse)
|
||||
}
|
||||
@@ -1070,15 +1110,39 @@ impl HttpJsonRpc {
|
||||
let params = json!([JsonPayloadIdRequest::from(payload_id)]);
|
||||
|
||||
match fork_name {
|
||||
ForkName::Fulu | ForkName::Eip7805 => {
|
||||
let response: JsonGetPayloadResponseV5<E> = self
|
||||
ForkName::Fulu => {
|
||||
let response: JsonGetPayloadResponseFulu<E> = self
|
||||
.rpc_request(
|
||||
ENGINE_GET_PAYLOAD_V5,
|
||||
params,
|
||||
ENGINE_GET_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
.await?;
|
||||
JsonGetPayloadResponse::V5(response)
|
||||
JsonGetPayloadResponse::Fulu(response)
|
||||
.try_into()
|
||||
.map_err(Error::BadResponse)
|
||||
}
|
||||
ForkName::Eip7805 => {
|
||||
let response: JsonGetPayloadResponseEip7805<E> = self
|
||||
.rpc_request(
|
||||
ENGINE_GET_PAYLOAD_V5,
|
||||
params,
|
||||
ENGINE_GET_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
.await?;
|
||||
JsonGetPayloadResponse::Eip7805(response)
|
||||
.try_into()
|
||||
.map_err(Error::BadResponse)
|
||||
}
|
||||
ForkName::Gloas => {
|
||||
let response: JsonGetPayloadResponseGloas<E> = self
|
||||
.rpc_request(
|
||||
ENGINE_GET_PAYLOAD_V5,
|
||||
params,
|
||||
ENGINE_GET_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
.await?;
|
||||
JsonGetPayloadResponse::Gloas(response)
|
||||
.try_into()
|
||||
.map_err(Error::BadResponse)
|
||||
}
|
||||
@@ -1166,10 +1230,14 @@ impl HttpJsonRpc {
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(response
|
||||
response
|
||||
.into_iter()
|
||||
.map(|opt_json| opt_json.map(From::from))
|
||||
.collect())
|
||||
.map(|opt_json| {
|
||||
opt_json
|
||||
.map(|json| json.try_into().map_err(Error::from))
|
||||
.transpose()
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
}
|
||||
|
||||
pub async fn get_payload_bodies_by_range_v1<E: EthSpec>(
|
||||
@@ -1190,10 +1258,14 @@ impl HttpJsonRpc {
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(response
|
||||
response
|
||||
.into_iter()
|
||||
.map(|opt_json| opt_json.map(From::from))
|
||||
.collect())
|
||||
.map(|opt_json| {
|
||||
opt_json
|
||||
.map(|json| json.try_into().map_err(Error::from))
|
||||
.transpose()
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
}
|
||||
|
||||
pub async fn exchange_capabilities(&self) -> Result<EngineCapabilities, Error> {
|
||||
@@ -1212,7 +1284,6 @@ impl HttpJsonRpc {
|
||||
new_payload_v2: capabilities.contains(ENGINE_NEW_PAYLOAD_V2),
|
||||
new_payload_v3: capabilities.contains(ENGINE_NEW_PAYLOAD_V3),
|
||||
new_payload_v4: capabilities.contains(ENGINE_NEW_PAYLOAD_V4),
|
||||
new_payload_v5: capabilities.contains(ENGINE_NEW_PAYLOAD_V5),
|
||||
forkchoice_updated_v1: capabilities.contains(ENGINE_FORKCHOICE_UPDATED_V1),
|
||||
forkchoice_updated_v2: capabilities.contains(ENGINE_FORKCHOICE_UPDATED_V2),
|
||||
forkchoice_updated_v3: capabilities.contains(ENGINE_FORKCHOICE_UPDATED_V3),
|
||||
@@ -1319,6 +1390,10 @@ impl HttpJsonRpc {
|
||||
} else {
|
||||
let engine_version = self.get_client_version_v1().await?;
|
||||
*lock = Some(CachedResponse::new(engine_version.clone()));
|
||||
if !engine_version.is_empty() {
|
||||
// reset metric gauge when there's a fresh fetch
|
||||
crate::metrics::reset_execution_layer_info_gauge();
|
||||
}
|
||||
Ok(engine_version)
|
||||
}
|
||||
}
|
||||
@@ -1357,19 +1432,27 @@ impl HttpJsonRpc {
|
||||
Err(Error::RequiredMethodUnsupported("engine_newPayloadV4"))
|
||||
}
|
||||
}
|
||||
NewPayloadRequest::Eip7805(new_payload_request_eip7805) => {
|
||||
if engine_capabilities.new_payload_v5 {
|
||||
self.new_payload_v5_eip7805(new_payload_request_eip7805)
|
||||
.await
|
||||
NewPayloadRequest::Fulu(new_payload_request_fulu) => {
|
||||
if engine_capabilities.new_payload_v4 {
|
||||
self.new_payload_v4_fulu(new_payload_request_fulu).await
|
||||
} else {
|
||||
Err(Error::RequiredMethodUnsupported("engine_newPayloadV5"))
|
||||
Err(Error::RequiredMethodUnsupported("engine_newPayloadV4"))
|
||||
}
|
||||
}
|
||||
NewPayloadRequest::Fulu(new_payload_request_fulu) => {
|
||||
if engine_capabilities.new_payload_v5 {
|
||||
self.new_payload_v5_fulu(new_payload_request_fulu).await
|
||||
// TODO(EIP7805) engine capabilties should be v5?
|
||||
NewPayloadRequest::Eip7805(new_payload_request_eip7805) => {
|
||||
if engine_capabilities.new_payload_v4 {
|
||||
self.new_payload_v4_eip7805(new_payload_request_eip7805)
|
||||
.await
|
||||
} else {
|
||||
Err(Error::RequiredMethodUnsupported("engine_newPayloadV5"))
|
||||
Err(Error::RequiredMethodUnsupported("engine_newPayloadV4"))
|
||||
}
|
||||
}
|
||||
NewPayloadRequest::Gloas(new_payload_request_gloas) => {
|
||||
if engine_capabilities.new_payload_v4 {
|
||||
self.new_payload_v4_gloas(new_payload_request_gloas).await
|
||||
} else {
|
||||
Err(Error::RequiredMethodUnsupported("engine_newPayloadV4"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1421,6 +1504,13 @@ impl HttpJsonRpc {
|
||||
Err(Error::RequiredMethodUnsupported("engine_getPayloadv5"))
|
||||
}
|
||||
}
|
||||
ForkName::Gloas => {
|
||||
if engine_capabilities.get_payload_v5 {
|
||||
self.get_payload_v5(fork_name, payload_id).await
|
||||
} else {
|
||||
Err(Error::RequiredMethodUnsupported("engine_getPayloadv5"))
|
||||
}
|
||||
}
|
||||
ForkName::Base | ForkName::Altair => Err(Error::UnsupportedForkVariant(format!(
|
||||
"called get_payload with {}",
|
||||
fork_name
|
||||
@@ -1479,11 +1569,14 @@ impl HttpJsonRpc {
|
||||
mod test {
|
||||
use super::auth::JwtKey;
|
||||
use super::*;
|
||||
use crate::test_utils::{MockServer, DEFAULT_JWT_SECRET};
|
||||
use crate::test_utils::{DEFAULT_JWT_SECRET, MockServer};
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use ssz_types::VariableList;
|
||||
use std::future::Future;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use types::{FixedBytesExtended, MainnetEthSpec, Unsigned};
|
||||
use typenum::Unsigned;
|
||||
use types::MainnetEthSpec;
|
||||
|
||||
struct Tester {
|
||||
server: MockServer<MainnetEthSpec>,
|
||||
@@ -1493,8 +1586,7 @@ mod test {
|
||||
|
||||
impl Tester {
|
||||
pub fn new(with_auth: bool) -> Self {
|
||||
let spec = Arc::new(MainnetEthSpec::default_spec());
|
||||
let server = MockServer::unit_testing(spec);
|
||||
let server = MockServer::unit_testing();
|
||||
|
||||
let rpc_url = SensitiveUrl::parse(&server.url()).unwrap();
|
||||
let echo_url = SensitiveUrl::parse(&format!("{}/echo", server.url())).unwrap();
|
||||
@@ -1590,10 +1682,11 @@ mod test {
|
||||
fn encode_transactions<E: EthSpec>(
|
||||
transactions: Transactions<E>,
|
||||
) -> Result<serde_json::Value, serde_json::Error> {
|
||||
let ep: JsonExecutionPayload<E> = JsonExecutionPayload::V1(JsonExecutionPayloadV1 {
|
||||
transactions,
|
||||
..<_>::default()
|
||||
});
|
||||
let ep: JsonExecutionPayload<E> =
|
||||
JsonExecutionPayload::Bellatrix(JsonExecutionPayloadBellatrix {
|
||||
transactions,
|
||||
..<_>::default()
|
||||
});
|
||||
let json = serde_json::to_value(ep)?;
|
||||
Ok(json.get("transactions").unwrap().clone())
|
||||
}
|
||||
@@ -1853,16 +1946,16 @@ mod test {
|
||||
fee_recipient: Address::repeat_byte(1),
|
||||
state_root: Hash256::repeat_byte(1),
|
||||
receipts_root: Hash256::repeat_byte(0),
|
||||
logs_bloom: vec![1; 256].into(),
|
||||
logs_bloom: vec![1; 256].try_into().unwrap(),
|
||||
prev_randao: Hash256::repeat_byte(1),
|
||||
block_number: 0,
|
||||
gas_limit: 1,
|
||||
gas_used: 2,
|
||||
timestamp: 42,
|
||||
extra_data: vec![].into(),
|
||||
extra_data: vec![].try_into().unwrap(),
|
||||
base_fee_per_gas: Uint256::from(1),
|
||||
block_hash: ExecutionBlockHash::repeat_byte(1),
|
||||
transactions: vec![].into(),
|
||||
transactions: vec![].try_into().unwrap(),
|
||||
},
|
||||
))
|
||||
.await;
|
||||
@@ -1900,16 +1993,16 @@ mod test {
|
||||
fee_recipient: Address::repeat_byte(1),
|
||||
state_root: Hash256::repeat_byte(1),
|
||||
receipts_root: Hash256::repeat_byte(0),
|
||||
logs_bloom: vec![1; 256].into(),
|
||||
logs_bloom: vec![1; 256].try_into().unwrap(),
|
||||
prev_randao: Hash256::repeat_byte(1),
|
||||
block_number: 0,
|
||||
gas_limit: 1,
|
||||
gas_used: 2,
|
||||
timestamp: 42,
|
||||
extra_data: vec![].into(),
|
||||
extra_data: vec![].try_into().unwrap(),
|
||||
base_fee_per_gas: Uint256::from(1),
|
||||
block_hash: ExecutionBlockHash::repeat_byte(1),
|
||||
transactions: vec![].into(),
|
||||
transactions: vec![].try_into().unwrap(),
|
||||
},
|
||||
))
|
||||
.await
|
||||
@@ -2110,16 +2203,16 @@ mod test {
|
||||
fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
|
||||
state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(),
|
||||
receipts_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
||||
logs_bloom: vec![0; 256].into(),
|
||||
logs_bloom: vec![0; 256].try_into().unwrap(),
|
||||
prev_randao: Hash256::zero(),
|
||||
block_number: 1,
|
||||
gas_limit: u64::from_str_radix("1c95111",16).unwrap(),
|
||||
gas_used: 0,
|
||||
timestamp: 5,
|
||||
extra_data: vec![].into(),
|
||||
extra_data: vec![].try_into().unwrap(),
|
||||
base_fee_per_gas: Uint256::from(7),
|
||||
block_hash: ExecutionBlockHash::from_str("0x6359b8381a370e2f54072a5784ddd78b6ed024991558c511d4452eb4f6ac898c").unwrap(),
|
||||
transactions: vec![].into(),
|
||||
transactions: vec![].try_into().unwrap(),
|
||||
});
|
||||
|
||||
assert_eq!(payload, expected);
|
||||
@@ -2135,16 +2228,16 @@ mod test {
|
||||
fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
|
||||
state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(),
|
||||
receipts_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
||||
logs_bloom: vec![0; 256].into(),
|
||||
logs_bloom: vec![0; 256].try_into().unwrap(),
|
||||
prev_randao: Hash256::zero(),
|
||||
block_number: 1,
|
||||
gas_limit: u64::from_str_radix("1c9c380",16).unwrap(),
|
||||
gas_used: 0,
|
||||
timestamp: 5,
|
||||
extra_data: vec![].into(),
|
||||
extra_data: vec![].try_into().unwrap(),
|
||||
base_fee_per_gas: Uint256::from(7),
|
||||
block_hash: ExecutionBlockHash::from_str("0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858").unwrap(),
|
||||
transactions: vec![].into(),
|
||||
transactions: vec![].try_into().unwrap(),
|
||||
}))
|
||||
.await;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user