mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 17:26:04 +00:00
Remove use of ethers_core::RlpStream
This commit is contained in:
58
Cargo.lock
generated
58
Cargo.lock
generated
@@ -268,6 +268,19 @@ dependencies = [
|
|||||||
"syn 2.0.49",
|
"syn 2.0.49",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "alloy-rpc-types"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://github.com/alloy-rs/alloy.git#e127fed9118b53c9f6776ce7aed412788827e9a5"
|
||||||
|
dependencies = [
|
||||||
|
"alloy-primitives",
|
||||||
|
"alloy-rlp",
|
||||||
|
"itertools 0.12.1",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "amcl"
|
name = "amcl"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@@ -348,7 +361,7 @@ dependencies = [
|
|||||||
"ark-std 0.4.0",
|
"ark-std 0.4.0",
|
||||||
"derivative",
|
"derivative",
|
||||||
"digest 0.10.7",
|
"digest 0.10.7",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"paste",
|
"paste",
|
||||||
@@ -900,7 +913,7 @@ dependencies = [
|
|||||||
"genesis",
|
"genesis",
|
||||||
"hex",
|
"hex",
|
||||||
"int_to_bytes",
|
"int_to_bytes",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"kzg",
|
"kzg",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lighthouse_metrics",
|
"lighthouse_metrics",
|
||||||
@@ -983,7 +996,7 @@ dependencies = [
|
|||||||
"fnv",
|
"fnv",
|
||||||
"futures",
|
"futures",
|
||||||
"hex",
|
"hex",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lighthouse_metrics",
|
"lighthouse_metrics",
|
||||||
"lighthouse_network",
|
"lighthouse_network",
|
||||||
@@ -1540,7 +1553,7 @@ name = "compare_fields"
|
|||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"compare_fields_derive",
|
"compare_fields_derive",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1645,7 +1658,7 @@ dependencies = [
|
|||||||
"clap",
|
"clap",
|
||||||
"criterion-plot",
|
"criterion-plot",
|
||||||
"csv",
|
"csv",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"oorandom",
|
"oorandom",
|
||||||
@@ -1667,7 +1680,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876"
|
checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cast",
|
"cast",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2783,7 +2796,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "e61ffea29f26e8249d35128a82ec8d3bd4fbc80179ea5f5e5e3daafef6a80fcb"
|
checksum = "e61ffea29f26e8249d35128a82ec8d3bd4fbc80179ea5f5e5e3daafef6a80fcb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethereum-types 0.14.1",
|
"ethereum-types 0.14.1",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3010,7 +3023,9 @@ name = "execution_layer"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alloy-consensus",
|
"alloy-consensus",
|
||||||
|
"alloy-primitives",
|
||||||
"alloy-rlp",
|
"alloy-rlp",
|
||||||
|
"alloy-rpc-types",
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"builder_client",
|
"builder_client",
|
||||||
@@ -4357,6 +4372,15 @@ dependencies = [
|
|||||||
"either",
|
"either",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itertools"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.10"
|
version = "1.0.10"
|
||||||
@@ -5471,7 +5495,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "37cb4045d5677b7da537f8cb5d0730d5b6414e3cc81c61e4b50e1f0cbdc73909"
|
checksum = "37cb4045d5677b7da537f8cb5d0730d5b6414e3cc81c61e4b50e1f0cbdc73909"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@@ -5743,7 +5767,7 @@ dependencies = [
|
|||||||
"hex",
|
"hex",
|
||||||
"if-addrs 0.6.7",
|
"if-addrs 0.6.7",
|
||||||
"igd-next",
|
"igd-next",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lighthouse_metrics",
|
"lighthouse_metrics",
|
||||||
"lighthouse_network",
|
"lighthouse_network",
|
||||||
@@ -6060,7 +6084,7 @@ dependencies = [
|
|||||||
"derivative",
|
"derivative",
|
||||||
"ethereum_ssz",
|
"ethereum_ssz",
|
||||||
"ethereum_ssz_derive",
|
"ethereum_ssz_derive",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lighthouse_metrics",
|
"lighthouse_metrics",
|
||||||
"maplit",
|
"maplit",
|
||||||
@@ -8128,7 +8152,7 @@ dependencies = [
|
|||||||
"derivative",
|
"derivative",
|
||||||
"ethereum_serde_utils",
|
"ethereum_serde_utils",
|
||||||
"ethereum_ssz",
|
"ethereum_ssz",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@@ -8150,7 +8174,7 @@ dependencies = [
|
|||||||
"ethereum_ssz_derive",
|
"ethereum_ssz_derive",
|
||||||
"int_to_bytes",
|
"int_to_bytes",
|
||||||
"integer-sqrt",
|
"integer-sqrt",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lighthouse_metrics",
|
"lighthouse_metrics",
|
||||||
"merkle_proof",
|
"merkle_proof",
|
||||||
@@ -8190,7 +8214,7 @@ dependencies = [
|
|||||||
"directory",
|
"directory",
|
||||||
"ethereum_ssz",
|
"ethereum_ssz",
|
||||||
"ethereum_ssz_derive",
|
"ethereum_ssz_derive",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"leveldb",
|
"leveldb",
|
||||||
"lighthouse_metrics",
|
"lighthouse_metrics",
|
||||||
@@ -8263,7 +8287,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "75b9e5728aa1a87141cefd4e7509903fc01fa0dcb108022b1e841a67c5159fc5"
|
checksum = "75b9e5728aa1a87141cefd4e7509903fc01fa0dcb108022b1e841a67c5159fc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@@ -8976,6 +9000,8 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
|||||||
name = "types"
|
name = "types"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"alloy-primitives",
|
||||||
|
"alloy-rlp",
|
||||||
"arbitrary",
|
"arbitrary",
|
||||||
"beacon_chain",
|
"beacon_chain",
|
||||||
"bls",
|
"bls",
|
||||||
@@ -8992,7 +9018,7 @@ dependencies = [
|
|||||||
"ethereum_ssz_derive",
|
"ethereum_ssz_derive",
|
||||||
"hex",
|
"hex",
|
||||||
"int_to_bytes",
|
"int_to_bytes",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"kzg",
|
"kzg",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log",
|
"log",
|
||||||
@@ -9212,7 +9238,7 @@ dependencies = [
|
|||||||
"futures",
|
"futures",
|
||||||
"hex",
|
"hex",
|
||||||
"hyper 1.1.0",
|
"hyper 1.1.0",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libsecp256k1",
|
"libsecp256k1",
|
||||||
"lighthouse_metrics",
|
"lighthouse_metrics",
|
||||||
|
|||||||
@@ -51,5 +51,7 @@ hash-db = "0.15.2"
|
|||||||
pretty_reqwest_error = { workspace = true }
|
pretty_reqwest_error = { workspace = true }
|
||||||
arc-swap = "1.6.0"
|
arc-swap = "1.6.0"
|
||||||
eth2_network_config = { workspace = true }
|
eth2_network_config = { workspace = true }
|
||||||
alloy-rlp = "0.3"
|
alloy-rlp = "0.3.4"
|
||||||
alloy-consensus = { git = "https://github.com/alloy-rs/alloy.git", rev = "974d488bab5e21e9f17452a39a4bfa56677367b2" }
|
alloy-consensus = { git = "https://github.com/alloy-rs/alloy.git", rev = "974d488bab5e21e9f17452a39a4bfa56677367b2" }
|
||||||
|
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git" }
|
||||||
|
alloy-primitives = "0.6.2"
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
json_structures::JsonWithdrawal,
|
json_structures::{EncodableJsonWithdrawal, JsonWithdrawal},
|
||||||
keccak::{keccak256, KeccakHasher},
|
keccak::{keccak256, KeccakHasher},
|
||||||
};
|
};
|
||||||
use ethers_core::utils::rlp::RlpStream;
|
use alloy_rlp::Encodable;
|
||||||
use keccak_hash::KECCAK_EMPTY_LIST_RLP;
|
use keccak_hash::KECCAK_EMPTY_LIST_RLP;
|
||||||
use triehash::ordered_trie_root;
|
use triehash::ordered_trie_root;
|
||||||
use types::{
|
use types::{
|
||||||
map_execution_block_header_fields_base, Address, EthSpec, ExecutionBlockHash,
|
EncodableExecutionBlockHeader, EthSpec, ExecutionBlockHash, ExecutionBlockHeader,
|
||||||
ExecutionBlockHeader, ExecutionPayloadRef, Hash256, Hash64, Uint256,
|
ExecutionPayloadRef, Hash256
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Calculate the block hash of an execution block.
|
/// Calculate the block hash of an execution block.
|
||||||
@@ -60,36 +60,22 @@ pub fn calculate_execution_block_hash<T: EthSpec>(
|
|||||||
|
|
||||||
/// RLP encode a withdrawal.
|
/// RLP encode a withdrawal.
|
||||||
pub fn rlp_encode_withdrawal(withdrawal: &JsonWithdrawal) -> Vec<u8> {
|
pub fn rlp_encode_withdrawal(withdrawal: &JsonWithdrawal) -> Vec<u8> {
|
||||||
let mut rlp_stream = RlpStream::new();
|
let mut out: Vec<u8> = vec![];
|
||||||
rlp_stream.begin_list(4);
|
EncodableJsonWithdrawal::from(withdrawal).encode(&mut out);
|
||||||
rlp_stream.append(&withdrawal.index);
|
// rlp_stream.begin_list(4);
|
||||||
rlp_stream.append(&withdrawal.validator_index);
|
// rlp_stream.append(&withdrawal.index);
|
||||||
rlp_stream.append(&withdrawal.address);
|
// rlp_stream.append(&withdrawal.validator_index);
|
||||||
rlp_stream.append(&withdrawal.amount);
|
// rlp_stream.append(&withdrawal.address);
|
||||||
rlp_stream.out().into()
|
// rlp_stream.append(&withdrawal.amount);
|
||||||
|
// rlp_stream.out().into()
|
||||||
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RLP encode an execution block header.
|
/// RLP encode an execution block header.
|
||||||
pub fn rlp_encode_block_header(header: &ExecutionBlockHeader) -> Vec<u8> {
|
pub fn rlp_encode_block_header(header: &ExecutionBlockHeader) -> Vec<u8> {
|
||||||
let mut rlp_header_stream = RlpStream::new();
|
let mut out: Vec<u8> = vec![];
|
||||||
rlp_header_stream.begin_unbounded_list();
|
EncodableExecutionBlockHeader::from(header).encode(&mut out);
|
||||||
map_execution_block_header_fields_base!(&header, |_, field| {
|
out
|
||||||
rlp_header_stream.append(field);
|
|
||||||
});
|
|
||||||
if let Some(withdrawals_root) = &header.withdrawals_root {
|
|
||||||
rlp_header_stream.append(withdrawals_root);
|
|
||||||
}
|
|
||||||
if let Some(blob_gas_used) = &header.blob_gas_used {
|
|
||||||
rlp_header_stream.append(blob_gas_used);
|
|
||||||
}
|
|
||||||
if let Some(excess_blob_gas) = &header.excess_blob_gas {
|
|
||||||
rlp_header_stream.append(excess_blob_gas);
|
|
||||||
}
|
|
||||||
if let Some(parent_beacon_block_root) = &header.parent_beacon_block_root {
|
|
||||||
rlp_header_stream.append(parent_beacon_block_root);
|
|
||||||
}
|
|
||||||
rlp_header_stream.finalize_unbounded_list();
|
|
||||||
rlp_header_stream.out().into()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -97,6 +83,7 @@ mod test {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use hex::FromHex;
|
use hex::FromHex;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
use types::{Address, Hash256, Hash64};
|
||||||
|
|
||||||
fn test_rlp_encoding(
|
fn test_rlp_encoding(
|
||||||
header: &ExecutionBlockHeader,
|
header: &ExecutionBlockHeader,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
use alloy_rlp::RlpEncodable;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use strum::EnumString;
|
use strum::EnumString;
|
||||||
use superstruct::superstruct;
|
use superstruct::superstruct;
|
||||||
@@ -362,6 +363,24 @@ impl From<JsonWithdrawal> for Withdrawal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[derive(Debug, PartialEq, Clone, RlpEncodable)]
|
||||||
|
pub struct EncodableJsonWithdrawal<'a> {
|
||||||
|
pub index: u64,
|
||||||
|
pub validator_index: u64,
|
||||||
|
pub address: &'a [u8],
|
||||||
|
pub amount: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> From<&'a JsonWithdrawal> for EncodableJsonWithdrawal<'a> {
|
||||||
|
fn from(json_withdrawal: &'a JsonWithdrawal) -> Self {
|
||||||
|
Self {
|
||||||
|
index: json_withdrawal.index,
|
||||||
|
validator_index: json_withdrawal.validator_index,
|
||||||
|
address: json_withdrawal.address.as_bytes(),
|
||||||
|
amount: json_withdrawal.amount,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[superstruct(
|
#[superstruct(
|
||||||
variants(V1, V2, V3),
|
variants(V1, V2, V3),
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ use hash_db::Hasher;
|
|||||||
use types::Hash256;
|
use types::Hash256;
|
||||||
|
|
||||||
pub fn keccak256(bytes: &[u8]) -> Hash256 {
|
pub fn keccak256(bytes: &[u8]) -> Hash256 {
|
||||||
Hash256::from(ethers_core::utils::keccak256(bytes))
|
let hash: [u8; 32] = alloy_primitives::utils::keccak256(bytes).into();
|
||||||
|
Hash256::from(hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Keccak hasher.
|
/// Keccak hasher.
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ serde_json = { workspace = true }
|
|||||||
smallvec = { workspace = true }
|
smallvec = { workspace = true }
|
||||||
maplit = { workspace = true }
|
maplit = { workspace = true }
|
||||||
strum = { workspace = true }
|
strum = { workspace = true }
|
||||||
|
alloy-rlp = { version = "0.3.4", features = ["derive"] }
|
||||||
|
alloy-primitives = "0.6.2"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = { workspace = true }
|
criterion = { workspace = true }
|
||||||
@@ -68,4 +70,4 @@ sqlite = []
|
|||||||
# The `arbitrary-fuzz` feature is a no-op provided for backwards compatibility.
|
# The `arbitrary-fuzz` feature is a no-op provided for backwards compatibility.
|
||||||
# For simplicity `Arbitrary` is now derived regardless of the feature's presence.
|
# For simplicity `Arbitrary` is now derived regardless of the feature's presence.
|
||||||
arbitrary-fuzz = []
|
arbitrary-fuzz = []
|
||||||
portable = ["bls/supranational-portable"]
|
portable = ["bls/supranational-portable"]
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
use crate::{Address, EthSpec, ExecutionPayloadRef, Hash256, Hash64, Uint256};
|
use crate::{Address, EthSpec, ExecutionPayloadRef, Hash256, Hash64, Uint256};
|
||||||
|
use alloy_rlp::RlpEncodable;
|
||||||
use metastruct::metastruct;
|
use metastruct::metastruct;
|
||||||
|
|
||||||
/// Execution block header as used for RLP encoding and Keccak hashing.
|
/// Execution block header as used for RLP encoding and Keccak hashing.
|
||||||
@@ -89,3 +90,62 @@ impl ExecutionBlockHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq, RlpEncodable)]
|
||||||
|
#[rlp(trailing)]
|
||||||
|
pub struct EncodableExecutionBlockHeader<'a> {
|
||||||
|
pub parent_hash: &'a [u8],
|
||||||
|
pub ommers_hash: &'a [u8],
|
||||||
|
pub beneficiary: &'a [u8],
|
||||||
|
pub state_root: &'a [u8],
|
||||||
|
pub transactions_root: &'a [u8],
|
||||||
|
pub receipts_root: &'a [u8],
|
||||||
|
pub logs_bloom: &'a [u8],
|
||||||
|
pub difficulty: u64,
|
||||||
|
pub number: u64,
|
||||||
|
pub gas_limit: u64,
|
||||||
|
pub gas_used: u64,
|
||||||
|
pub timestamp: u64,
|
||||||
|
pub extra_data: &'a [u8],
|
||||||
|
pub mix_hash: &'a [u8],
|
||||||
|
pub nonce: &'a [u8],
|
||||||
|
pub base_fee_per_gas: u64,
|
||||||
|
pub withdrawals_root: Option<&'a [u8]>,
|
||||||
|
pub blob_gas_used: Option<u64>,
|
||||||
|
pub excess_blob_gas: Option<u64>,
|
||||||
|
pub parent_beacon_block_root: Option<&'a [u8]>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> From<&'a ExecutionBlockHeader> for EncodableExecutionBlockHeader<'a> {
|
||||||
|
fn from(header: &'a ExecutionBlockHeader) -> Self {
|
||||||
|
let mut encodable = Self {
|
||||||
|
parent_hash: header.parent_hash.as_bytes(),
|
||||||
|
ommers_hash: header.ommers_hash.as_bytes(),
|
||||||
|
beneficiary: header.beneficiary.as_bytes(),
|
||||||
|
state_root: header.state_root.as_bytes(),
|
||||||
|
transactions_root: header.transactions_root.as_bytes(),
|
||||||
|
receipts_root: header.receipts_root.as_bytes(),
|
||||||
|
logs_bloom: header.logs_bloom.as_slice(),
|
||||||
|
difficulty: header.difficulty.as_u64(), // TODO this might panic
|
||||||
|
number: header.number.as_u64(), // TODO this might panic
|
||||||
|
gas_limit: header.gas_limit.as_u64(), // TODO this might panic
|
||||||
|
gas_used: header.gas_used.as_u64(), // TODO this might panic
|
||||||
|
timestamp: header.timestamp,
|
||||||
|
extra_data: header.extra_data.as_slice(),
|
||||||
|
mix_hash: header.mix_hash.as_bytes(),
|
||||||
|
nonce: header.nonce.as_bytes(),
|
||||||
|
base_fee_per_gas: header.base_fee_per_gas.as_u64(), // TODO this might panic
|
||||||
|
withdrawals_root: None,
|
||||||
|
blob_gas_used: header.blob_gas_used,
|
||||||
|
excess_blob_gas: header.excess_blob_gas,
|
||||||
|
parent_beacon_block_root: None,
|
||||||
|
};
|
||||||
|
if let Some(withdrawals_root) = &header.withdrawals_root {
|
||||||
|
encodable.withdrawals_root = Some(withdrawals_root.as_bytes());
|
||||||
|
}
|
||||||
|
if let Some(parent_beacon_block_root) = &header.parent_beacon_block_root {
|
||||||
|
encodable.parent_beacon_block_root = Some(parent_beacon_block_root.as_bytes())
|
||||||
|
}
|
||||||
|
encodable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
0
consensus/types/src/execution_transaction.rs
Normal file
0
consensus/types/src/execution_transaction.rs
Normal file
@@ -135,7 +135,7 @@ pub use crate::enr_fork_id::EnrForkId;
|
|||||||
pub use crate::eth1_data::Eth1Data;
|
pub use crate::eth1_data::Eth1Data;
|
||||||
pub use crate::eth_spec::EthSpecId;
|
pub use crate::eth_spec::EthSpecId;
|
||||||
pub use crate::execution_block_hash::ExecutionBlockHash;
|
pub use crate::execution_block_hash::ExecutionBlockHash;
|
||||||
pub use crate::execution_block_header::ExecutionBlockHeader;
|
pub use crate::execution_block_header::{EncodableExecutionBlockHeader, ExecutionBlockHeader};
|
||||||
pub use crate::execution_payload::{
|
pub use crate::execution_payload::{
|
||||||
ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadMerge,
|
ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadMerge,
|
||||||
ExecutionPayloadRef, Transaction, Transactions, Withdrawals,
|
ExecutionPayloadRef, Transaction, Transactions, Withdrawals,
|
||||||
|
|||||||
Reference in New Issue
Block a user