Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 47 additions & 27 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ optimism = [
"reth-optimism-chainspec",
"reth-optimism-forks",
"reth-optimism-primitives",
"reth-optimism-txpool",
"reth-optimism-rpc",
"reth-optimism-consensus",
"reth-optimism-evm",
"reth-node-builder/op",
"reth-payload-util",
"reth-optimism-cli",
Expand All @@ -79,7 +83,6 @@ test-utils = [
"nanoid",
"tokio/full",
"alloy-genesis",
"rand",
"reth-ipc",
"reth-ethereum/test-utils",
"reth-optimism-rpc/client",
Expand Down Expand Up @@ -112,51 +115,68 @@ jsonrpsee = "0.26.0"
parking_lot = "0.12"
metrics = "0.24.0"
priority-queue = "2.0.0"

rand = { version = "0.9"}

# Alloy dependencies
alloy-origin = { version = "1.0.37", package = "alloy", features = [
alloy-origin = { version = "1.0.41", package = "alloy", features = [
"k256",
"rpc-types-mev",
] }
alloy-evm = "0.21.2"
alloy-serde = "1.0.37"
alloy-evm = "0.23.0"
alloy-serde = "1.0.41"

# Reth dependencies
reth-origin = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", package = "reth" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-rpc-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", features = [
reth-origin = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", package = "reth" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-cli-commands = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-rpc-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", features = [
"node",
"evm",
] }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-ipc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-payload-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-metrics = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-ipc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true }
reth-tracing-otlp = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-eth-wire-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-network = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-node-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }

# Revm dependencies
revm-database = "9.0"

# Reth-optimism dependencies (optional)
op-alloy = { version = "0.20.0", features = ["full"], optional = true }
reth-optimism-node = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
reth-optimism-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
reth-optimism-forks = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
reth-payload-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
reth-optimism-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", optional = true }
op-alloy = { version = "0.22.0", features = ["full"], optional = true }
reth-optimism-node = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true }
reth-optimism-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true }
reth-optimism-forks = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true }
reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true }
reth-optimism-txpool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true }
reth-optimism-consensus = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true }
reth-optimism-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true }
reth-payload-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true }
reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true }
reth-optimism-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3", optional = true }

# test-utils
rblib-tests-macros = { path = "src/test_utils/macros", optional = true }
jsonrpsee-core = { version = "0.26.0", optional = true, features = ["client"] }
nanoid = { version = "0.4", optional = true }
alloy-genesis = { version = "1.0", default-features = false, optional = true }
rand = { version = "0.9", optional = true }
ctor = { version = "0.5", optional = true }
tracing-subscriber = { version = "0.3", features = [
tracing-subscriber = { version = "0.3.20", features = [
"env-filter",
"json",
], optional = true }
Expand Down
66 changes: 66 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,16 @@ pub mod test_utils;
pub mod reth {
pub use reth_origin::*;

pub mod chainspec {
pub use reth_chainspec::*;
}

pub mod cli {
pub use {reth_cli::*, reth_origin::cli::*};

pub mod commands {
pub use reth_cli_commands::*;
}
}

pub mod evm {
Expand All @@ -49,6 +57,10 @@ pub mod reth {
pub use reth_errors::*;
}

pub mod metrics {
pub use reth_metrics::*;
}

pub mod payload {
pub use ::reth_origin::payload::*;
pub mod builder {
Expand All @@ -59,13 +71,21 @@ pub mod reth {
};
}

pub mod primitives {
pub use reth_payload_primitives::*;
}

#[cfg(feature = "optimism")]
pub mod util {
pub use reth_payload_util::*;
}
}

pub mod node {
pub mod api {
pub use reth_node_api::*;
}

pub mod builder {
pub use reth_node_builder::*;
}
Expand All @@ -75,6 +95,34 @@ pub mod reth {
}
}

pub mod provider {
pub use reth_provider::*;
}

pub mod rpc_eth_types {
pub use reth_rpc_eth_types::*;
}

pub mod tracing_otlp {
pub use reth_tracing_otlp::*;
}

pub mod db {
pub use reth_db::*;
}

pub mod eth_wire_types {
pub use reth_eth_wire_types::*;
}

pub mod network {
pub use reth_network::*;
}

pub mod node_types {
pub use reth_node_types::*;
}

pub mod ethereum {
pub use reth_ethereum::*;
}
Expand All @@ -96,6 +144,24 @@ pub mod reth {
pub mod primitives {
pub use reth_optimism_primitives::*;
}
pub mod txpool {
pub use reth_optimism_txpool::*;
}
pub mod rpc {
pub use reth_optimism_rpc::*;
}
pub mod consensus {
pub use reth_optimism_consensus::*;
}
pub mod evm {
pub use reth_optimism_evm::*;
}
}
}

pub mod revm {
pub mod database {
pub use revm_database::*;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/orderpool2/prioritized_pool/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ where
B: Bundle<P>,
P: Platform,
{
fn new(bundle: B) -> Self {
pub fn new(bundle: B) -> Self {
let txs = bundle.transactions();
let mut nonces = Vec::with_capacity(txs.len());
for tx in txs {
Expand Down
12 changes: 6 additions & 6 deletions src/platform/ethereum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ where
.map_err(PayloadBuilderError::other)?;

let mut cumulative_gas_used = 0;
let block_gas_limit: u64 = builder.evm_mut().block().gas_limit;
let base_fee = builder.evm_mut().block().basefee;
let block_gas_limit: u64 = builder.evm_mut().block().gas_limit();
let base_fee = builder.evm_mut().block().basefee();

let mut best_txs = best_txs(BestTransactionsAttributes::new(
base_fee,
Expand Down Expand Up @@ -272,10 +272,10 @@ where
if is_osaka && estimated_block_size_with_tx > MAX_RLP_BLOCK_SIZE {
best_txs.mark_invalid(
&pool_tx,
InvalidPoolTransactionError::OversizedData(
estimated_block_size_with_tx,
MAX_RLP_BLOCK_SIZE,
),
InvalidPoolTransactionError::OversizedData {
size: estimated_block_size_with_tx,
limit: MAX_RLP_BLOCK_SIZE,
},
);
continue;
}
Expand Down
45 changes: 31 additions & 14 deletions src/platform/optimism/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ use {
chainspec::EthChainSpec,
optimism::{
forks::OpHardforks,
node::{payload::builder::*, txpool::OpPooledTransaction, *},
node::{
payload::{
builder::*,
config::{OpBuilderConfig, OpGasLimitConfig},
},
txpool::OpPooledTransaction,
*,
},
},
payload::{builder::*, util::PayloadTransactionsFixed},
primitives::Recovered,
Expand Down Expand Up @@ -54,8 +61,25 @@ impl Platform for Optimism {
where
P: traits::PlatformExecBounds<Self>,
{
let timestamp = attributes.payload_attributes.timestamp;
let extra_data = if chainspec.is_jovian_active_at_timestamp(timestamp) {
attributes
.get_jovian_extra_data(
chainspec.base_fee_params_at_timestamp(timestamp),
)
.unwrap_or_default()
} else if chainspec.is_holocene_active_at_timestamp(timestamp) {
attributes
.get_holocene_extra_data(
chainspec.base_fee_params_at_timestamp(timestamp),
)
.unwrap_or_default()
} else {
Bytes::default()
};

OpNextBlockEnvAttributes {
timestamp: attributes.payload_attributes.timestamp,
timestamp,
suggested_fee_recipient: attributes
.payload_attributes
.suggested_fee_recipient,
Expand All @@ -64,17 +88,7 @@ impl Platform for Optimism {
parent_beacon_block_root: attributes
.payload_attributes
.parent_beacon_block_root,
extra_data: if chainspec.is_holocene_active_at_timestamp(
attributes.payload_attributes.timestamp,
) {
attributes
.get_holocene_extra_data(chainspec.base_fee_params_at_timestamp(
attributes.payload_attributes.timestamp,
))
.unwrap_or_default()
} else {
Bytes::default()
},
extra_data,
}
}

Expand Down Expand Up @@ -102,7 +116,10 @@ impl Platform for Optimism {

let context = OpPayloadBuilderCtx {
evm_config: block.evm_config(),
da_config: OpDAConfig::default(),
builder_config: OpBuilderConfig::new(
OpDAConfig::default(),
OpGasLimitConfig::default(),
),
chain_spec: block.chainspec().clone(),
config: PayloadConfig::<types::PayloadBuilderAttributes<P>, _>::new(
block.parent().clone().into(),
Expand Down
24 changes: 2 additions & 22 deletions src/test_utils/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use {
core::ops::RangeBounds,
reth::{
chainspec::{ChainInfo, ChainSpecProvider, EthChainSpec},
ethereum::primitives::AlloyBlockHeader,
primitives::{Account, Bytecode, SealedHeader},
providers::*,
revm::db::BundleState,
Expand Down Expand Up @@ -236,9 +235,9 @@ impl<P: Platform> HeaderProvider for GenesisProviderFactory<P> {
/// Get header by block hash
fn header(
&self,
block_hash: &BlockHash,
block_hash: BlockHash,
) -> ProviderResult<Option<Self::Header>> {
if block_hash == &self.chainspec.genesis_hash() {
if block_hash == self.chainspec.genesis_hash() {
return Ok(Some(self.chainspec.genesis_header().clone()));
}
Ok(None)
Expand All @@ -252,25 +251,6 @@ impl<P: Platform> HeaderProvider for GenesisProviderFactory<P> {
Ok(None)
}

/// Get total difficulty by block hash.
fn header_td(&self, hash: &BlockHash) -> ProviderResult<Option<U256>> {
if hash == &self.chainspec.genesis_hash() {
return Ok(Some(self.chainspec.genesis_header().difficulty()));
}
Ok(None)
}

/// Get total difficulty by block number.
fn header_td_by_number(
&self,
number: BlockNumber,
) -> ProviderResult<Option<U256>> {
if number == 0 {
return Ok(Some(self.chainspec.genesis_header().difficulty()));
}
Ok(None)
}

/// Get headers in range of block numbers
fn headers_range(
&self,
Expand Down
1 change: 1 addition & 0 deletions src/test_utils/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ where
TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056.into(),
]),
gas_limit: Some(BASE_MAINNET_MAX_GAS_LIMIT),
min_base_fee: Some(0),
..Default::default()
};

Expand Down