mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-26 23:58:46 -05:00
primitives: rm revm-primitives reexport (#11193)
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -6262,6 +6262,7 @@ dependencies = [
|
||||
"reth-tokio-util",
|
||||
"reth-transaction-pool",
|
||||
"reth-trie",
|
||||
"revm-primitives",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tracing",
|
||||
@@ -6639,6 +6640,7 @@ dependencies = [
|
||||
"reth-consensus",
|
||||
"reth-primitives",
|
||||
"reth-storage-api",
|
||||
"revm-primitives",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7257,6 +7259,7 @@ dependencies = [
|
||||
"reth-transaction-pool",
|
||||
"reth-trie",
|
||||
"revm",
|
||||
"revm-primitives",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@@ -8111,6 +8114,7 @@ dependencies = [
|
||||
"reth-transaction-pool",
|
||||
"reth-trie",
|
||||
"revm",
|
||||
"revm-primitives",
|
||||
"sha2 0.10.8",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
|
||||
@@ -33,6 +33,7 @@ reth-trie.workspace = true
|
||||
|
||||
# ethereum
|
||||
alloy-primitives.workspace = true
|
||||
revm-primitives.workspace = true
|
||||
|
||||
# async
|
||||
futures-util.workspace = true
|
||||
|
||||
@@ -25,13 +25,14 @@ use reth_execution_errors::{
|
||||
};
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_primitives::{
|
||||
eip4844::calculate_excess_blob_gas, proofs, Block, BlockBody, BlockHashOrNumber,
|
||||
BlockWithSenders, Header, Requests, SealedBlock, SealedHeader, TransactionSigned, Withdrawals,
|
||||
proofs, Block, BlockBody, BlockHashOrNumber, BlockWithSenders, Header, Requests, SealedBlock,
|
||||
SealedHeader, TransactionSigned, Withdrawals,
|
||||
};
|
||||
use reth_provider::{BlockReaderIdExt, StateProviderFactory, StateRootProvider};
|
||||
use reth_revm::database::StateProviderDatabase;
|
||||
use reth_transaction_pool::TransactionPool;
|
||||
use reth_trie::HashedPostState;
|
||||
use revm_primitives::calc_excess_blob_gas;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fmt::Debug,
|
||||
@@ -326,11 +327,8 @@ impl StorageInner {
|
||||
_ => (0, 0),
|
||||
};
|
||||
header.excess_blob_gas = Some(
|
||||
calculate_excess_blob_gas(
|
||||
parent_excess_blob_gas as u64,
|
||||
parent_blob_gas_used as u64,
|
||||
)
|
||||
.into(),
|
||||
calc_excess_blob_gas(parent_excess_blob_gas as u64, parent_blob_gas_used as u64)
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ reth-consensus.workspace = true
|
||||
|
||||
# ethereum
|
||||
alloy-primitives.workspace = true
|
||||
revm-primitives.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
reth-storage-api.workspace = true
|
||||
|
||||
@@ -7,9 +7,9 @@ use reth_primitives::{
|
||||
eip4844::{DATA_GAS_PER_BLOB, MAX_DATA_GAS_PER_BLOCK},
|
||||
MAXIMUM_EXTRA_DATA_SIZE,
|
||||
},
|
||||
eip4844::calculate_excess_blob_gas,
|
||||
EthereumHardfork, GotExpected, Header, SealedBlock, SealedHeader,
|
||||
};
|
||||
use revm_primitives::calc_excess_blob_gas;
|
||||
|
||||
/// Gas used needs to be less than gas limit. Gas used is going to be checked after execution.
|
||||
#[inline]
|
||||
@@ -166,7 +166,7 @@ pub fn validate_4844_header_standalone(header: &Header) -> Result<(), ConsensusE
|
||||
}
|
||||
|
||||
// `excess_blob_gas` must also be a multiple of `DATA_GAS_PER_BLOB`. This will be checked later
|
||||
// (via `calculate_excess_blob_gas`), but it doesn't hurt to catch the problem sooner.
|
||||
// (via `calc_excess_blob_gas`), but it doesn't hurt to catch the problem sooner.
|
||||
if excess_blob_gas as u64 % DATA_GAS_PER_BLOB != 0 {
|
||||
return Err(ConsensusError::ExcessBlobGasNotMultipleOfBlobGasPerBlob {
|
||||
excess_blob_gas: excess_blob_gas as u64,
|
||||
@@ -276,7 +276,7 @@ pub fn validate_against_parent_4844(
|
||||
// > For the first post-fork block, both parent.blob_gas_used and parent.excess_blob_gas
|
||||
// > are evaluated as 0.
|
||||
//
|
||||
// This means in the first post-fork block, calculate_excess_blob_gas will return 0.
|
||||
// This means in the first post-fork block, calc_excess_blob_gas will return 0.
|
||||
let parent_blob_gas_used = parent.blob_gas_used.unwrap_or(0) as u64;
|
||||
let parent_excess_blob_gas = parent.excess_blob_gas.unwrap_or(0) as u64;
|
||||
|
||||
@@ -287,7 +287,7 @@ pub fn validate_against_parent_4844(
|
||||
header.excess_blob_gas.ok_or(ConsensusError::ExcessBlobGasMissing)? as u64;
|
||||
|
||||
let expected_excess_blob_gas =
|
||||
calculate_excess_blob_gas(parent_excess_blob_gas, parent_blob_gas_used);
|
||||
calc_excess_blob_gas(parent_excess_blob_gas, parent_blob_gas_used);
|
||||
if expected_excess_blob_gas != excess_blob_gas {
|
||||
return Err(ConsensusError::ExcessBlobGasDiff {
|
||||
diff: GotExpected { got: excess_blob_gas, expected: expected_excess_blob_gas },
|
||||
|
||||
@@ -9,9 +9,7 @@ use reth_errors::{BlockExecutionError, BlockValidationError, RethError, RethResu
|
||||
use reth_ethereum_forks::EthereumHardforks;
|
||||
use reth_evm::{system_calls::apply_beacon_root_contract_call, ConfigureEvm};
|
||||
use reth_payload_validator::ExecutionPayloadValidator;
|
||||
use reth_primitives::{
|
||||
eip4844::calculate_excess_blob_gas, proofs, Block, BlockBody, Header, Receipt, Receipts,
|
||||
};
|
||||
use reth_primitives::{proofs, Block, BlockBody, Header, Receipt, Receipts};
|
||||
use reth_provider::{BlockReader, ExecutionOutcome, ProviderError, StateProviderFactory};
|
||||
use reth_revm::{
|
||||
database::StateProviderDatabase,
|
||||
@@ -25,7 +23,9 @@ use reth_rpc_types::{
|
||||
};
|
||||
use reth_rpc_types_compat::engine::payload::block_to_payload;
|
||||
use reth_trie::HashedPostState;
|
||||
use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, EVMError, EnvWithHandlerCfg};
|
||||
use revm_primitives::{
|
||||
calc_excess_blob_gas, BlockEnv, CfgEnvWithHandlerCfg, EVMError, EnvWithHandlerCfg,
|
||||
};
|
||||
use std::{
|
||||
collections::VecDeque,
|
||||
future::Future,
|
||||
@@ -371,7 +371,7 @@ where
|
||||
if chain_spec.is_cancun_active_at_timestamp(reorg_target.timestamp) {
|
||||
(
|
||||
Some(sum_blob_gas_used),
|
||||
Some(calculate_excess_blob_gas(
|
||||
Some(calc_excess_blob_gas(
|
||||
reorg_target_parent.excess_blob_gas.unwrap_or_default() as u64,
|
||||
reorg_target_parent.blob_gas_used.unwrap_or_default() as u64,
|
||||
)),
|
||||
|
||||
@@ -30,6 +30,7 @@ reth-chainspec.workspace = true
|
||||
|
||||
# ethereum
|
||||
revm.workspace = true
|
||||
revm-primitives.workspace = true
|
||||
|
||||
# alloy
|
||||
alloy-primitives.workspace = true
|
||||
|
||||
@@ -31,7 +31,6 @@ use reth_payload_builder::{EthBuiltPayload, EthPayloadBuilderAttributes};
|
||||
use reth_payload_primitives::{PayloadBuilderAttributes, PayloadBuilderError};
|
||||
use reth_primitives::{
|
||||
constants::{eip4844::MAX_DATA_GAS_PER_BLOCK, BEACON_NONCE},
|
||||
eip4844::calculate_excess_blob_gas,
|
||||
proofs::{self, calculate_requests_root},
|
||||
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
|
||||
Block, BlockBody, EthereumHardforks, Header, IntoRecoveredTransaction, Receipt,
|
||||
@@ -48,6 +47,7 @@ use revm::{
|
||||
primitives::{EVMError, EnvWithHandlerCfg, InvalidTransaction, ResultAndState},
|
||||
DatabaseCommit, State,
|
||||
};
|
||||
use revm_primitives::calc_excess_blob_gas;
|
||||
use std::sync::Arc;
|
||||
use tracing::{debug, trace, warn};
|
||||
|
||||
@@ -391,14 +391,11 @@ where
|
||||
excess_blob_gas = if chain_spec.is_cancun_active_at_timestamp(parent_block.timestamp) {
|
||||
let parent_excess_blob_gas = parent_block.excess_blob_gas.unwrap_or_default();
|
||||
let parent_blob_gas_used = parent_block.blob_gas_used.unwrap_or_default();
|
||||
Some(calculate_excess_blob_gas(
|
||||
parent_excess_blob_gas as u64,
|
||||
parent_blob_gas_used as u64,
|
||||
))
|
||||
Some(calc_excess_blob_gas(parent_excess_blob_gas as u64, parent_blob_gas_used as u64))
|
||||
} else {
|
||||
// for the first post-fork block, both parent.blob_gas_used and
|
||||
// parent.excess_blob_gas are evaluated as 0
|
||||
Some(calculate_excess_blob_gas(0, 0))
|
||||
Some(calc_excess_blob_gas(0, 0))
|
||||
};
|
||||
|
||||
blob_gas_used = Some(sum_blob_gas_used);
|
||||
|
||||
@@ -37,6 +37,7 @@ revm.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
alloy-rlp.workspace = true
|
||||
op-alloy-rpc-types-engine.workspace = true
|
||||
revm-primitives.workspace = true
|
||||
|
||||
# misc
|
||||
tracing.workspace = true
|
||||
|
||||
@@ -15,7 +15,6 @@ use reth_optimism_forks::OptimismHardfork;
|
||||
use reth_payload_primitives::{PayloadBuilderAttributes, PayloadBuilderError};
|
||||
use reth_primitives::{
|
||||
constants::BEACON_NONCE,
|
||||
eip4844::calculate_excess_blob_gas,
|
||||
proofs,
|
||||
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
|
||||
Block, BlockBody, Header, IntoRecoveredTransaction, Receipt, TxType, EMPTY_OMMER_ROOT_HASH,
|
||||
@@ -31,6 +30,7 @@ use revm::{
|
||||
primitives::{EVMError, EnvWithHandlerCfg, InvalidTransaction, ResultAndState},
|
||||
DatabaseCommit, State,
|
||||
};
|
||||
use revm_primitives::calc_excess_blob_gas;
|
||||
use tracing::{debug, trace, warn};
|
||||
|
||||
use crate::{
|
||||
@@ -477,14 +477,11 @@ where
|
||||
excess_blob_gas = if chain_spec.is_cancun_active_at_timestamp(parent_block.timestamp) {
|
||||
let parent_excess_blob_gas = parent_block.excess_blob_gas.unwrap_or_default();
|
||||
let parent_blob_gas_used = parent_block.blob_gas_used.unwrap_or_default();
|
||||
Some(calculate_excess_blob_gas(
|
||||
parent_excess_blob_gas as u64,
|
||||
parent_blob_gas_used as u64,
|
||||
))
|
||||
Some(calc_excess_blob_gas(parent_excess_blob_gas as u64, parent_blob_gas_used as u64))
|
||||
} else {
|
||||
// for the first post-fork block, both parent.blob_gas_used and
|
||||
// parent.excess_blob_gas are evaluated as 0
|
||||
Some(calculate_excess_blob_gas(0, 0))
|
||||
Some(calc_excess_blob_gas(0, 0))
|
||||
};
|
||||
|
||||
blob_gas_used = Some(0);
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
//! Helpers for working with EIP-4844 blob fee.
|
||||
|
||||
// re-exports from revm for calculating blob fee
|
||||
pub use crate::revm_primitives::{
|
||||
calc_blob_gasprice, calc_excess_blob_gas as calculate_excess_blob_gas,
|
||||
};
|
||||
@@ -27,7 +27,6 @@ mod block;
|
||||
#[cfg(feature = "reth-codec")]
|
||||
mod compression;
|
||||
pub mod constants;
|
||||
pub mod eip4844;
|
||||
pub mod proofs;
|
||||
mod receipt;
|
||||
pub use reth_static_file_types as static_file;
|
||||
|
||||
@@ -16,11 +16,9 @@ use futures::{
|
||||
use metrics::atomics::AtomicU64;
|
||||
use reth_chain_state::CanonStateNotification;
|
||||
use reth_chainspec::{ChainSpecProvider, EthChainSpec};
|
||||
use reth_primitives::{
|
||||
eip4844::{calc_blob_gasprice, calculate_excess_blob_gas},
|
||||
Receipt, SealedBlock, TransactionSigned,
|
||||
};
|
||||
use reth_primitives::{Receipt, SealedBlock, TransactionSigned};
|
||||
use reth_storage_api::BlockReaderIdExt;
|
||||
use revm_primitives::{calc_blob_gasprice, calc_excess_blob_gas};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::trace;
|
||||
|
||||
@@ -399,6 +397,6 @@ impl FeeHistoryEntry {
|
||||
///
|
||||
/// Returns a `None` if no excess blob gas is set, no EIP-4844 support
|
||||
pub fn next_block_excess_blob_gas(&self) -> Option<u64> {
|
||||
Some(calculate_excess_blob_gas(self.excess_blob_gas?, self.blob_gas_used?))
|
||||
Some(calc_excess_blob_gas(self.excess_blob_gas?, self.blob_gas_used?))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user