fix: checked u64 downcast (#2122)

This commit is contained in:
Matthias Seitz
2023-04-05 12:31:07 +02:00
committed by GitHub
parent b5f4283f79
commit 10048a2dde
4 changed files with 12 additions and 4 deletions

1
Cargo.lock generated
View File

@ -4954,6 +4954,7 @@ dependencies = [
"reth-rlp",
"reth-rlp-derive",
"revm-primitives",
"ruint",
"secp256k1 0.26.0",
"serde",
"serde_json",

View File

@ -19,6 +19,7 @@ revm-primitives = { version = "1.1", features = ["serde"] }
ethers-core = { git = "https://github.com/gakonst/ethers-rs", default-features = false }
tiny-keccak = { version = "2.0", features = ["keccak"] }
crunchy = { version = "0.2.2", default-features = false, features = ["limit_256"] }
ruint = { version = "1.7.0", features = ["primitive-types", "rlp"] }
# Bloom
fixed-hash = { version = "0.8", default-features = false, features = [

View File

@ -103,7 +103,8 @@ pub use ethers_core::{
types::{BigEndianHash, H128, H64, U64},
utils as rpc_utils,
};
pub use revm_primitives::{ruint::aliases::U128, B160 as H160, B256 as H256, U256};
pub use revm_primitives::{B160 as H160, B256 as H256, U256};
pub use ruint::{aliases::U128, UintTryTo};
#[doc(hidden)]
mod __reexport {

View File

@ -1,7 +1,7 @@
use reth_primitives::{
proofs::{self, EMPTY_LIST_HASH},
Address, Block, Bloom, Bytes, Header, SealedBlock, TransactionSigned, Withdrawal, H256, U256,
U64,
Address, Block, Bloom, Bytes, Header, SealedBlock, TransactionSigned, UintTryTo, Withdrawal,
H256, U256, U64,
};
use reth_rlp::{Decodable, Encodable};
use serde::{Deserialize, Serialize};
@ -106,7 +106,12 @@ impl TryFrom<ExecutionPayload> for SealedBlock {
gas_used: payload.gas_used.as_u64(),
timestamp: payload.timestamp.as_u64(),
mix_hash: payload.prev_randao,
base_fee_per_gas: Some(payload.base_fee_per_gas.to::<u64>()),
base_fee_per_gas: Some(
payload
.base_fee_per_gas
.uint_try_to()
.map_err(|_| PayloadError::BaseFee(payload.base_fee_per_gas))?,
),
extra_data: payload.extra_data,
// Defaults
ommers_hash: EMPTY_LIST_HASH,