mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-05 17:51:41 +00:00
Migrate from ethereum-types to alloy-primitives (#6078)
* Remove use of ethers_core::RlpStream
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into remove_use_of_ethers_core
* Remove old code
* Simplify keccak call
* Remove unused package
* Merge branch 'unstable' of https://github.com/ethDreamer/lighthouse into remove_use_of_ethers_core
* Merge branch 'unstable' into remove_use_of_ethers_core
* Run clippy
* Merge branch 'remove_use_of_ethers_core' of https://github.com/dospore/lighthouse into remove_use_of_ethers_core
* Check all cargo fmt
* migrate to alloy primitives init
* fix deps
* integrate alloy-primitives
* resolve dep issues
* more changes based on dep changes
* add TODOs
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into remove_use_of_ethers_core
* Revert lock
* Add BeaconBlocksByRange v3
* continue migration
* Revert "Add BeaconBlocksByRange v3"
This reverts commit e3ce7fc5ea.
* impl hash256 extended trait
* revert some uneeded diffs
* merge conflict resolved
* fix subnet id rshift calc
* rename to FixedBytesExtended
* debugging
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into migrate-to-alloy-primitives
* fix failed test
* fixing more tests
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into remove_use_of_ethers_core
* introduce a shim to convert between the two u256 types
* move alloy to wrokspace
* align alloy versions
* update
* update web3signer test certs
* refactor
* resolve failing tests
* linting
* fix graffiti string test
* fmt
* fix ef test
* resolve merge conflicts
* remove udep and revert cert
* cargo patch
* cyclic dep
* fix build error
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into migrate-to-alloy-primitives
* resolve conflicts, update deps
* merge unstable
* fmt
* fix deps
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into migrate-to-alloy-primitives
* resolve merge conflicts
* resolve conflicts, make necessary changes
* Remove patch
* fmt
* remove file
* merge conflicts
* sneaking in a smol change
* bump versions
* Merge remote-tracking branch 'origin/unstable' into migrate-to-alloy-primitives
* Updates for peerDAS
* Update ethereum_hashing to prevent dupe
* updated alloy-consensus, removed TODOs
* cargo update
* endianess fix
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into migrate-to-alloy-primitives
* fmt
* fix merge
* fix test
* fixed_bytes crate
* minor fixes
* convert u256 to i64
* panic free mixin to_low_u64_le
* from_str_radix
* computbe_subnet api and ensuring we use big-endian
* Merge branch 'unstable' of https://github.com/sigp/lighthouse into migrate-to-alloy-primitives
* fix test
* Simplify subnet_id test
* Simplify some more tests
* Add tests to fixed_bytes crate
* Merge branch 'unstable' into migrate-to-alloy-primitives
This commit is contained in:
@@ -77,7 +77,7 @@ mod test {
|
||||
use super::*;
|
||||
use hex::FromHex;
|
||||
use std::str::FromStr;
|
||||
use types::{Address, Hash256, Hash64};
|
||||
use types::{Address, Hash256, Hash64, Uint256};
|
||||
|
||||
fn test_rlp_encoding(
|
||||
header: &ExecutionBlockHeader,
|
||||
@@ -105,15 +105,15 @@ mod test {
|
||||
transactions_root: Hash256::from_str("50f738580ed699f0469702c7ccc63ed2e51bc034be9479b7bff4e68dee84accf").unwrap(),
|
||||
receipts_root: Hash256::from_str("29b0562f7140574dd0d50dee8a271b22e1a0a7b78fca58f7c60370d8317ba2a9").unwrap(),
|
||||
logs_bloom: <[u8; 256]>::from_hex("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap().into(),
|
||||
difficulty: 0x020000.into(),
|
||||
number: 0x01_u64.into(),
|
||||
gas_limit: 0x016345785d8a0000_u64.into(),
|
||||
gas_used: 0x015534_u64.into(),
|
||||
difficulty: Uint256::from(0x020000),
|
||||
number: Uint256::from(0x01_u64),
|
||||
gas_limit: Uint256::from(0x016345785d8a0000_u64),
|
||||
gas_used: Uint256::from(0x015534_u64),
|
||||
timestamp: 0x079e,
|
||||
extra_data: vec![0x42],
|
||||
mix_hash: Hash256::from_str("0000000000000000000000000000000000000000000000000000000000000000").unwrap(),
|
||||
nonce: Hash64::zero(),
|
||||
base_fee_per_gas: 0x036b_u64.into(),
|
||||
nonce: Hash64::ZERO,
|
||||
base_fee_per_gas: Uint256::from(0x036b_u64),
|
||||
withdrawals_root: None,
|
||||
blob_gas_used: None,
|
||||
excess_blob_gas: None,
|
||||
@@ -136,15 +136,15 @@ mod test {
|
||||
transactions_root: Hash256::from_str("50f738580ed699f0469702c7ccc63ed2e51bc034be9479b7bff4e68dee84accf").unwrap(),
|
||||
receipts_root: Hash256::from_str("29b0562f7140574dd0d50dee8a271b22e1a0a7b78fca58f7c60370d8317ba2a9").unwrap(),
|
||||
logs_bloom: <[u8; 256]>::from_hex("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap().into(),
|
||||
difficulty: 0x00.into(),
|
||||
number: 0x01_u64.into(),
|
||||
gas_limit: 0x016345785d8a0000_u64.into(),
|
||||
gas_used: 0x015534_u64.into(),
|
||||
difficulty: Uint256::from(0x00),
|
||||
number: Uint256::from(0x01_u64),
|
||||
gas_limit: Uint256::from(0x016345785d8a0000_u64),
|
||||
gas_used: Uint256::from(0x015534_u64),
|
||||
timestamp: 0x079e,
|
||||
extra_data: vec![0x42],
|
||||
mix_hash: Hash256::from_str("0000000000000000000000000000000000000000000000000000000000020000").unwrap(),
|
||||
nonce: Hash64::zero(),
|
||||
base_fee_per_gas: 0x036b_u64.into(),
|
||||
nonce: Hash64::ZERO,
|
||||
base_fee_per_gas: Uint256::from(0x036b_u64),
|
||||
withdrawals_root: None,
|
||||
blob_gas_used: None,
|
||||
excess_blob_gas: None,
|
||||
@@ -168,15 +168,15 @@ mod test {
|
||||
transactions_root: Hash256::from_str("0223f0cb35f184d2ac409e89dc0768ad738f777bd1c85d3302ca50f307180c94").unwrap(),
|
||||
receipts_root: Hash256::from_str("371c76821b1cc21232574604eac5349d51647eb530e2a45d4f6fe2c501351aa5").unwrap(),
|
||||
logs_bloom: <[u8; 256]>::from_hex("1a2c559955848d2662a0634cb40c7a6192a1524f11061203689bcbcdec901b054084d4f4d688009d24c10918e0089b48e72fe2d7abafb903889d10c3827c6901096612d259801b1b7ba1663a4201f5f88f416a9997c55bcc2c54785280143b057a008764c606182e324216822a2d5913e797a05c16cc1468d001acf3783b18e00e0203033e43106178db554029e83ca46402dc49d929d7882a04a0e7215041bdabf7430bd10ef4bb658a40f064c63c4816660241c2480862f26742fdf9ca41637731350301c344e439428182a03e384484e6d65d0c8a10117c6739ca201b60974519a1ae6b0c3966c0f650b449d10eae065dab2c83ab4edbab5efdea50bbc801").unwrap().into(),
|
||||
difficulty: 0.into(),
|
||||
number: 16182891.into(),
|
||||
gas_limit: 0x1c9c380.into(),
|
||||
gas_used: 0xe9b752.into(),
|
||||
difficulty: Uint256::ZERO,
|
||||
number: Uint256::from(16182891),
|
||||
gas_limit: Uint256::from(0x1c9c380),
|
||||
gas_used: Uint256::from(0xe9b752),
|
||||
timestamp: 0x6399bf63,
|
||||
extra_data: hex::decode("496c6c756d696e61746520446d6f63726174697a6520447374726962757465").unwrap(),
|
||||
mix_hash: Hash256::from_str("bf5289894b2ceab3549f92f063febbac896b280ddb18129a57cff13113c11b13").unwrap(),
|
||||
nonce: Hash64::zero(),
|
||||
base_fee_per_gas: 0x34187b238_u64.into(),
|
||||
nonce: Hash64::ZERO,
|
||||
base_fee_per_gas: Uint256::from(0x34187b238_u64),
|
||||
withdrawals_root: None,
|
||||
blob_gas_used: None,
|
||||
excess_blob_gas: None,
|
||||
@@ -198,15 +198,15 @@ mod test {
|
||||
transactions_root: Hash256::from_str("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
||||
receipts_root: Hash256::from_str("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
||||
logs_bloom:<[u8; 256]>::from_hex("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap().into(),
|
||||
difficulty: 0.into(),
|
||||
number: 97.into(),
|
||||
gas_limit: 27482534.into(),
|
||||
gas_used: 0.into(),
|
||||
difficulty: Uint256::ZERO,
|
||||
number: Uint256::from(97),
|
||||
gas_limit: Uint256::from(27482534),
|
||||
gas_used: Uint256::ZERO,
|
||||
timestamp: 1692132829u64,
|
||||
extra_data: hex::decode("d883010d00846765746888676f312e32302e37856c696e7578").unwrap(),
|
||||
mix_hash: Hash256::from_str("0b493c22d2ad4ca76c77ae6ad916af429b42b1dc98fdcb8e5ddbd049bbc5d623").unwrap(),
|
||||
nonce: Hash64::zero(),
|
||||
base_fee_per_gas: 2374u64.into(),
|
||||
nonce: Hash64::ZERO,
|
||||
base_fee_per_gas: Uint256::from(2374u64),
|
||||
withdrawals_root: Some(Hash256::from_str("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap()),
|
||||
blob_gas_used: Some(0x0u64),
|
||||
excess_blob_gas: Some(0x0u64),
|
||||
@@ -228,15 +228,15 @@ mod test {
|
||||
transactions_root: Hash256::from_str("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
||||
receipts_root: Hash256::from_str("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
||||
logs_bloom:<[u8; 256]>::from_hex("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").unwrap().into(),
|
||||
difficulty: 0.into(),
|
||||
number: 97.into(),
|
||||
gas_limit: 27482534.into(),
|
||||
gas_used: 0.into(),
|
||||
difficulty: Uint256::ZERO,
|
||||
number: Uint256::from(97),
|
||||
gas_limit: Uint256::from(27482534),
|
||||
gas_used: Uint256::ZERO,
|
||||
timestamp: 1692132829u64,
|
||||
extra_data: hex::decode("d883010d00846765746888676f312e32302e37856c696e7578").unwrap(),
|
||||
mix_hash: Hash256::from_str("0b493c22d2ad4ca76c77ae6ad916af429b42b1dc98fdcb8e5ddbd049bbc5d623").unwrap(),
|
||||
nonce: Hash64::zero(),
|
||||
base_fee_per_gas: 2374u64.into(),
|
||||
nonce: Hash64::ZERO,
|
||||
base_fee_per_gas: Uint256::from(2374u64),
|
||||
withdrawals_root: Some(Hash256::from_str("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap()),
|
||||
blob_gas_used: Some(0x0u64),
|
||||
excess_blob_gas: Some(0x0u64),
|
||||
|
||||
@@ -154,6 +154,7 @@ pub struct ExecutionBlock {
|
||||
pub block_hash: ExecutionBlockHash,
|
||||
#[serde(rename = "number", with = "serde_utils::u64_hex_be")]
|
||||
pub block_number: u64,
|
||||
|
||||
pub parent_hash: ExecutionBlockHash,
|
||||
pub total_difficulty: Uint256,
|
||||
#[serde(with = "serde_utils::u64_hex_be")]
|
||||
@@ -175,6 +176,7 @@ pub struct ExecutionBlock {
|
||||
pub struct ExecutionBlockWithTransactions<E: EthSpec> {
|
||||
pub parent_hash: ExecutionBlockHash,
|
||||
#[serde(alias = "miner")]
|
||||
#[serde(with = "serde_utils::address_hex")]
|
||||
pub fee_recipient: Address,
|
||||
pub state_root: Hash256,
|
||||
pub receipts_root: Hash256,
|
||||
|
||||
@@ -877,7 +877,7 @@ impl HttpJsonRpc {
|
||||
// Set the V1 payload values from the EE to be zero. This simulates
|
||||
// the pre-block-value functionality of always choosing the builder
|
||||
// block.
|
||||
block_value: Uint256::zero(),
|
||||
block_value: Uint256::ZERO,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1414,7 +1414,7 @@ mod test {
|
||||
use std::future::Future;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use types::{MainnetEthSpec, Unsigned};
|
||||
use types::{FixedBytesExtended, MainnetEthSpec, Unsigned};
|
||||
|
||||
struct Tester {
|
||||
server: MockServer<MainnetEthSpec>,
|
||||
|
||||
@@ -73,6 +73,7 @@ pub struct JsonPayloadIdResponse {
|
||||
#[serde(bound = "E: EthSpec", rename_all = "camelCase", untagged)]
|
||||
pub struct JsonExecutionPayload<E: EthSpec> {
|
||||
pub parent_hash: ExecutionBlockHash,
|
||||
#[serde(with = "serde_utils::address_hex")]
|
||||
pub fee_recipient: Address,
|
||||
pub state_root: Hash256,
|
||||
pub receipts_root: Hash256,
|
||||
@@ -91,6 +92,7 @@ pub struct JsonExecutionPayload<E: EthSpec> {
|
||||
pub extra_data: VariableList<u8, E::MaxExtraDataBytes>,
|
||||
#[serde(with = "serde_utils::u256_hex_be")]
|
||||
pub base_fee_per_gas: Uint256,
|
||||
|
||||
pub block_hash: ExecutionBlockHash,
|
||||
#[serde(with = "ssz_types::serde_utils::list_of_hex_var_list")]
|
||||
pub transactions: Transactions<E>,
|
||||
@@ -449,6 +451,7 @@ pub struct JsonWithdrawal {
|
||||
pub index: u64,
|
||||
#[serde(with = "serde_utils::u64_hex_be")]
|
||||
pub validator_index: u64,
|
||||
#[serde(with = "serde_utils::address_hex")]
|
||||
pub address: Address,
|
||||
#[serde(with = "serde_utils::u64_hex_be")]
|
||||
pub amount: u64,
|
||||
@@ -488,7 +491,7 @@ impl<'a> From<&'a JsonWithdrawal> for EncodableJsonWithdrawal<'a> {
|
||||
Self {
|
||||
index: json_withdrawal.index,
|
||||
validator_index: json_withdrawal.validator_index,
|
||||
address: json_withdrawal.address.as_bytes(),
|
||||
address: json_withdrawal.address.as_slice(),
|
||||
amount: json_withdrawal.amount,
|
||||
}
|
||||
}
|
||||
@@ -509,6 +512,7 @@ pub struct JsonPayloadAttributes {
|
||||
#[serde(with = "serde_utils::u64_hex_be")]
|
||||
pub timestamp: u64,
|
||||
pub prev_randao: Hash256,
|
||||
#[serde(with = "serde_utils::address_hex")]
|
||||
pub suggested_fee_recipient: Address,
|
||||
#[superstruct(only(V2, V3))]
|
||||
pub withdrawals: Vec<JsonWithdrawal>,
|
||||
@@ -598,7 +602,9 @@ impl<E: EthSpec> From<JsonBlobsBundleV1<E>> for BlobsBundle<E> {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct JsonForkchoiceStateV1 {
|
||||
pub head_block_hash: ExecutionBlockHash,
|
||||
|
||||
pub safe_block_hash: ExecutionBlockHash,
|
||||
|
||||
pub finalized_block_hash: ExecutionBlockHash,
|
||||
}
|
||||
|
||||
@@ -823,6 +829,7 @@ impl<E: EthSpec> From<JsonExecutionPayloadBody<E>> for ExecutionPayloadBody<E> {
|
||||
pub struct TransitionConfigurationV1 {
|
||||
#[serde(with = "serde_utils::u256_hex_be")]
|
||||
pub terminal_total_difficulty: Uint256,
|
||||
|
||||
pub terminal_block_hash: ExecutionBlockHash,
|
||||
#[serde(with = "serde_utils::u64_hex_be")]
|
||||
pub terminal_block_number: u64,
|
||||
|
||||
@@ -18,6 +18,7 @@ pub use engines::{EngineState, ForkchoiceState};
|
||||
use eth2::types::FullPayloadContents;
|
||||
use eth2::types::{builder_bid::SignedBuilderBid, BlobsBundle, ForkVersionedResponse};
|
||||
use ethers_core::types::Transaction as EthersTransaction;
|
||||
use fixed_bytes::UintExtended;
|
||||
use fork_choice::ForkchoiceUpdateParameters;
|
||||
use lru::LruCache;
|
||||
use payload_status::process_payload_status;
|
||||
@@ -1132,9 +1133,8 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
let relay_value = *relay.data.message.value();
|
||||
|
||||
let boosted_relay_value = match builder_boost_factor {
|
||||
Some(builder_boost_factor) => {
|
||||
(relay_value / 100).saturating_mul(builder_boost_factor.into())
|
||||
}
|
||||
Some(builder_boost_factor) => (relay_value / Uint256::from(100))
|
||||
.saturating_mul(Uint256::from(builder_boost_factor)),
|
||||
None => relay_value,
|
||||
};
|
||||
|
||||
@@ -2196,15 +2196,11 @@ fn verify_builder_bid<E: EthSpec>(
|
||||
let is_signature_valid = bid.data.verify_signature(spec);
|
||||
let header = &bid.data.message.header();
|
||||
|
||||
// Avoid logging values that we can't represent with our Prometheus library.
|
||||
let payload_value_gwei = bid.data.message.value() / 1_000_000_000;
|
||||
if payload_value_gwei <= Uint256::from(i64::MAX) {
|
||||
metrics::set_gauge_vec(
|
||||
&metrics::EXECUTION_LAYER_PAYLOAD_BIDS,
|
||||
&[metrics::BUILDER],
|
||||
payload_value_gwei.low_u64() as i64,
|
||||
);
|
||||
}
|
||||
metrics::set_gauge_vec(
|
||||
&metrics::EXECUTION_LAYER_PAYLOAD_BIDS,
|
||||
&[metrics::BUILDER],
|
||||
bid.data.message.value().to_i64(),
|
||||
);
|
||||
|
||||
let expected_withdrawals_root = payload_attributes
|
||||
.withdrawals()
|
||||
|
||||
@@ -23,7 +23,8 @@ use tree_hash_derive::TreeHash;
|
||||
use types::{
|
||||
Blob, ChainSpec, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadBellatrix,
|
||||
ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra,
|
||||
ExecutionPayloadHeader, ForkName, Hash256, Transaction, Transactions, Uint256,
|
||||
ExecutionPayloadHeader, FixedBytesExtended, ForkName, Hash256, Transaction, Transactions,
|
||||
Uint256,
|
||||
};
|
||||
|
||||
use super::DEFAULT_TERMINAL_BLOCK;
|
||||
@@ -107,7 +108,9 @@ impl<E: EthSpec> Block<E> {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PoWBlock {
|
||||
pub block_number: u64,
|
||||
|
||||
pub block_hash: ExecutionBlockHash,
|
||||
|
||||
pub parent_hash: ExecutionBlockHash,
|
||||
pub total_difficulty: Uint256,
|
||||
pub timestamp: u64,
|
||||
@@ -581,7 +584,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
|
||||
gas_used: GAS_USED,
|
||||
timestamp: pa.timestamp,
|
||||
extra_data: "block gen was here".as_bytes().to_vec().into(),
|
||||
base_fee_per_gas: Uint256::one(),
|
||||
base_fee_per_gas: Uint256::from(1u64),
|
||||
block_hash: ExecutionBlockHash::zero(),
|
||||
transactions: vec![].into(),
|
||||
}),
|
||||
@@ -598,7 +601,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
|
||||
gas_used: GAS_USED,
|
||||
timestamp: pa.timestamp,
|
||||
extra_data: "block gen was here".as_bytes().to_vec().into(),
|
||||
base_fee_per_gas: Uint256::one(),
|
||||
base_fee_per_gas: Uint256::from(1u64),
|
||||
block_hash: ExecutionBlockHash::zero(),
|
||||
transactions: vec![].into(),
|
||||
}),
|
||||
@@ -614,7 +617,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
|
||||
gas_used: GAS_USED,
|
||||
timestamp: pa.timestamp,
|
||||
extra_data: "block gen was here".as_bytes().to_vec().into(),
|
||||
base_fee_per_gas: Uint256::one(),
|
||||
base_fee_per_gas: Uint256::from(1u64),
|
||||
block_hash: ExecutionBlockHash::zero(),
|
||||
transactions: vec![].into(),
|
||||
withdrawals: pa.withdrawals.clone().into(),
|
||||
@@ -634,7 +637,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
|
||||
gas_used: GAS_USED,
|
||||
timestamp: pa.timestamp,
|
||||
extra_data: "block gen was here".as_bytes().to_vec().into(),
|
||||
base_fee_per_gas: Uint256::one(),
|
||||
base_fee_per_gas: Uint256::from(1u64),
|
||||
block_hash: ExecutionBlockHash::zero(),
|
||||
transactions: vec![].into(),
|
||||
withdrawals: pa.withdrawals.clone().into(),
|
||||
@@ -653,7 +656,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
|
||||
gas_used: GAS_USED,
|
||||
timestamp: pa.timestamp,
|
||||
extra_data: "block gen was here".as_bytes().to_vec().into(),
|
||||
base_fee_per_gas: Uint256::one(),
|
||||
base_fee_per_gas: Uint256::from(1u64),
|
||||
block_hash: ExecutionBlockHash::zero(),
|
||||
transactions: vec![].into(),
|
||||
withdrawals: pa.withdrawals.clone().into(),
|
||||
@@ -880,7 +883,7 @@ mod test {
|
||||
const DIFFICULTY_INCREMENT: u64 = 1;
|
||||
|
||||
let mut generator: ExecutionBlockGenerator<MainnetEthSpec> = ExecutionBlockGenerator::new(
|
||||
TERMINAL_DIFFICULTY.into(),
|
||||
Uint256::from(TERMINAL_DIFFICULTY),
|
||||
TERMINAL_BLOCK,
|
||||
ExecutionBlockHash::zero(),
|
||||
None,
|
||||
@@ -909,7 +912,7 @@ mod test {
|
||||
|
||||
assert_eq!(
|
||||
block.total_difficulty().unwrap(),
|
||||
(i * DIFFICULTY_INCREMENT).into()
|
||||
Uint256::from(i * DIFFICULTY_INCREMENT)
|
||||
);
|
||||
|
||||
assert_eq!(generator.block_by_hash(block.block_hash()).unwrap(), block);
|
||||
|
||||
@@ -330,14 +330,14 @@ pub async fn handle_rpc<E: EthSpec>(
|
||||
JsonExecutionPayload::V1(execution_payload) => {
|
||||
serde_json::to_value(JsonGetPayloadResponseV1 {
|
||||
execution_payload,
|
||||
block_value: DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI.into(),
|
||||
block_value: Uint256::from(DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI),
|
||||
})
|
||||
.unwrap()
|
||||
}
|
||||
JsonExecutionPayload::V2(execution_payload) => {
|
||||
serde_json::to_value(JsonGetPayloadResponseV2 {
|
||||
execution_payload,
|
||||
block_value: DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI.into(),
|
||||
block_value: Uint256::from(DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI),
|
||||
})
|
||||
.unwrap()
|
||||
}
|
||||
@@ -350,7 +350,7 @@ pub async fn handle_rpc<E: EthSpec>(
|
||||
JsonExecutionPayload::V3(execution_payload) => {
|
||||
serde_json::to_value(JsonGetPayloadResponseV3 {
|
||||
execution_payload,
|
||||
block_value: DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI.into(),
|
||||
block_value: Uint256::from(DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI),
|
||||
blobs_bundle: maybe_blobs
|
||||
.ok_or((
|
||||
"No blobs returned despite V3 Payload".to_string(),
|
||||
@@ -367,7 +367,7 @@ pub async fn handle_rpc<E: EthSpec>(
|
||||
JsonExecutionPayload::V4(execution_payload) => {
|
||||
serde_json::to_value(JsonGetPayloadResponseV4 {
|
||||
execution_payload,
|
||||
block_value: DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI.into(),
|
||||
block_value: Uint256::from(DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI),
|
||||
blobs_bundle: maybe_blobs
|
||||
.ok_or((
|
||||
"No blobs returned despite V4 Payload".to_string(),
|
||||
|
||||
@@ -20,9 +20,9 @@ use types::builder_bid::{
|
||||
};
|
||||
use types::{
|
||||
Address, BeaconState, ChainSpec, EthSpec, ExecPayload, ExecutionPayload,
|
||||
ExecutionPayloadHeaderRefMut, ForkName, ForkVersionedResponse, Hash256, PublicKeyBytes,
|
||||
Signature, SignedBlindedBeaconBlock, SignedRoot, SignedValidatorRegistrationData, Slot,
|
||||
Uint256,
|
||||
ExecutionPayloadHeaderRefMut, FixedBytesExtended, ForkName, ForkVersionedResponse, Hash256,
|
||||
PublicKeyBytes, Signature, SignedBlindedBeaconBlock, SignedRoot,
|
||||
SignedValidatorRegistrationData, Slot, Uint256,
|
||||
};
|
||||
use types::{ExecutionBlockHash, SecretKey};
|
||||
use warp::{Filter, Rejection};
|
||||
|
||||
@@ -4,10 +4,10 @@ use crate::{
|
||||
},
|
||||
*,
|
||||
};
|
||||
use keccak_hash::H256;
|
||||
use alloy_primitives::B256 as H256;
|
||||
use kzg::Kzg;
|
||||
use tempfile::NamedTempFile;
|
||||
use types::MainnetEthSpec;
|
||||
use types::{FixedBytesExtended, MainnetEthSpec};
|
||||
|
||||
pub struct MockExecutionLayer<E: EthSpec> {
|
||||
pub server: MockServer<E>,
|
||||
@@ -19,7 +19,7 @@ pub struct MockExecutionLayer<E: EthSpec> {
|
||||
impl<E: EthSpec> MockExecutionLayer<E> {
|
||||
pub fn default_params(executor: TaskExecutor) -> Self {
|
||||
let mut spec = MainnetEthSpec::default_spec();
|
||||
spec.terminal_total_difficulty = DEFAULT_TERMINAL_DIFFICULTY.into();
|
||||
spec.terminal_total_difficulty = Uint256::from(DEFAULT_TERMINAL_DIFFICULTY);
|
||||
spec.terminal_block_hash = ExecutionBlockHash::zero();
|
||||
spec.terminal_block_hash_activation_epoch = Epoch::new(0);
|
||||
Self::new(
|
||||
|
||||
@@ -88,7 +88,7 @@ impl Default for MockExecutionConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
jwt_key: JwtKey::random(),
|
||||
terminal_difficulty: DEFAULT_TERMINAL_DIFFICULTY.into(),
|
||||
terminal_difficulty: Uint256::from(DEFAULT_TERMINAL_DIFFICULTY),
|
||||
terminal_block: DEFAULT_TERMINAL_BLOCK,
|
||||
terminal_block_hash: ExecutionBlockHash::zero(),
|
||||
server_config: Config::default(),
|
||||
@@ -111,7 +111,7 @@ impl<E: EthSpec> MockServer<E> {
|
||||
Self::new(
|
||||
&runtime::Handle::current(),
|
||||
JwtKey::from_slice(&DEFAULT_JWT_SECRET).unwrap(),
|
||||
DEFAULT_TERMINAL_DIFFICULTY.into(),
|
||||
Uint256::from(DEFAULT_TERMINAL_DIFFICULTY),
|
||||
DEFAULT_TERMINAL_BLOCK,
|
||||
ExecutionBlockHash::zero(),
|
||||
None, // FIXME(capella): should this be the default?
|
||||
|
||||
Reference in New Issue
Block a user