Skip to content

Commit

Permalink
chore: bump reth (#115)
Browse files Browse the repository at this point in the history
fix new breaking changes
  • Loading branch information
mattsse authored Dec 19, 2024
1 parent e725ea1 commit 986ee57
Show file tree
Hide file tree
Showing 9 changed files with 1,051 additions and 1,415 deletions.
2,313 changes: 967 additions & 1,346 deletions Cargo.lock

Large diffs are not rendered by default.

88 changes: 45 additions & 43 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,76 +141,78 @@ odyssey-node = { path = "crates/node" }
odyssey-wallet = { path = "crates/wallet" }
odyssey-walltime = { path = "crates/walltime" }

alloy = { version = "0.6.4", features = [
alloy = { version = "0.8", features = [
"contract",
"providers",
"provider-http",
"signers",
"reqwest-rustls-tls",
], default-features = false }
alloy-consensus = { version = "0.6.4", default-features = false }
alloy-eips = { version = "0.6.4", default-features = false }
alloy-network = { version = "0.6.4", default-features = false }
alloy-primitives = { version = "0.8.11", default-features = false }
alloy-provider = { version = "0.6.4", default-features = false }
alloy-rpc-client = { version = "0.6.4", default-features = false }
alloy-rpc-types = { version = "0.6.4", default-features = false }
alloy-rpc-types-eth = { version = "0.6.4", default-features = false }
alloy-signer-local = { version = "0.6.4", features = ["mnemonic"] }
alloy-transport = { version = "0.6.4", default-features = false }
alloy-transport-http = { version = "0.6.4", default-features = false, features = [
alloy-consensus = { version = "0.8", default-features = false }
alloy-eips = { version = "0.8", default-features = false }
alloy-network = { version = "0.8", default-features = false }
alloy-primitives = { version = "0.8", default-features = false }
alloy-provider = { version = "0.8", default-features = false }
alloy-rpc-client = { version = "0.8", default-features = false }
alloy-rpc-types = { version = "0.8", default-features = false }
alloy-rpc-types-eth = { version = "0.8", default-features = false }
alloy-signer-local = { version = "0.8", features = ["mnemonic"] }
alloy-transport = { version = "0.8", default-features = false }
alloy-transport-http = { version = "0.8", default-features = false, features = [
"reqwest",
"reqwest-rustls-tls",
] }
reqwest = { version = "0.12.9", default-features = false, features = [
"rustls-tls",
] }

op-alloy-consensus = { version = "0.8", default-features = false }

# tokio
tokio = { version = "1.21", default-features = false }

reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-cli = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-errors = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-evm = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-rpc-eth-api = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9", features = [
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-cli = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-errors = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-evm = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-rpc-eth-api = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9", features = [
"optimism",
] }
reth-optimism-node = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9", features = [
reth-optimism-node = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9", features = [
"optimism",
] }
reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9", features = [
reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9", features = [
"optimism",
] }
reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9", features = [
reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9", features = [
"optimism",
] }
reth-optimism-primitives = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-optimism-forks = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-optimism-chainspec = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9", features = [
reth-optimism-primitives = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-optimism-forks = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-optimism-chainspec = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9", features = [
"optimism",
] }
reth-primitives-traits = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-provider = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9", features = [
reth-primitives-traits = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-provider = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9", features = [
"optimism",
] }
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-tracing = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-trie-common = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-trie-db = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-network = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-network-types = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth.git", rev = "38cf6c9" }
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-tracing = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-trie-common = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-trie-db = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-network = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-network-types = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth.git", rev = "320a0b9" }
revm-primitives = { version = "14.0.0" }
revm-precompile = { version = "15.0.0", features = ["secp256r1"] }

Expand All @@ -227,7 +229,7 @@ eyre = "0.6.12"
tracing = "0.1.0"
serde = "1"
serde_json = "1"
thiserror = "1"
thiserror = "2"
futures = "0.3"
url = "2.5"

Expand Down
6 changes: 4 additions & 2 deletions bin/odyssey/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use odyssey_wallet::{OdysseyWallet, OdysseyWalletApiServer, RethUpstream};
use odyssey_walltime::{OdysseyWallTime, OdysseyWallTimeRpcApiServer};
use reth_node_builder::{engine_tree_config::TreeConfig, EngineNodeLauncher, NodeComponents};
use reth_optimism_cli::Cli;
use reth_optimism_node::{args::RollupArgs, node::OpAddOns};
use reth_optimism_node::{args::RollupArgs, node::OpAddOnsBuilder};
use reth_provider::{providers::BlockchainProvider2, CanonStateSubscriptions};
use tracing::{info, warn};

Expand All @@ -63,7 +63,9 @@ fn main() {
let node = builder
.with_types_and_provider::<OdysseyNode, BlockchainProvider2<_>>()
.with_components(OdysseyNode::components(&rollup_args))
.with_add_ons(OpAddOns::new(rollup_args.sequencer_http))
.with_add_ons(
OpAddOnsBuilder::default().with_sequencer(rollup_args.sequencer_http).build(),
)
.on_component_initialized(move |ctx| {
if let Some(address) = address {
ctx.task_executor.spawn(async move {
Expand Down
3 changes: 2 additions & 1 deletion crates/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ reth-evm.workspace = true
reth-revm.workspace = true
reth-rpc-eth-api.workspace = true
reth-rpc-eth-types.workspace = true
reth-rpc-types-compat.workspace = true
reth-transaction-pool.workspace = true
reth-trie-common.workspace = true
reth-trie-db.workspace = true
Expand All @@ -43,6 +42,8 @@ alloy-primitives.workspace = true
alloy-rpc-types.workspace = true
alloy-rpc-types-eth.workspace = true

op-alloy-consensus.workspace = true


serde_json.workspace = true
tokio.workspace = true
Expand Down
7 changes: 4 additions & 3 deletions crates/node/src/broadcaster.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Sponsor periodic broadcaster
use alloy_primitives::Address;
use reth_network::transactions::TransactionsHandle;
use reth_network::{transactions::TransactionsHandle, NetworkPrimitives};
use reth_transaction_pool::TransactionPool;
use std::time::Duration;

Expand All @@ -10,12 +10,13 @@ use std::time::Duration;
/// `p2p` broadcasting can potentially be flaky, and due to the p2p rules, some txs may never make
/// it to the sequencer, this can happen if a message is dropped internally when channel bounds are
/// enforced for example. So, we re-broadcast them every 10 minutes.
pub async fn periodic_broadcaster<P>(
pub async fn periodic_broadcaster<P, N>(
address: Address,
pool: P,
transactions_handle: TransactionsHandle,
transactions_handle: TransactionsHandle<N>,
) where
P: TransactionPool,
N: NetworkPrimitives,
{
let mut interval_timer = tokio::time::interval(Duration::from_secs(60));

Expand Down
6 changes: 1 addition & 5 deletions crates/node/src/chainspec.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//! Odyssey chainspec parsing logic.
use std::sync::LazyLock;

use alloy_eips::eip1559::ETHEREUM_BLOCK_GAS_LIMIT;
use alloy_primitives::{b256, U256};
use reth_chainspec::{
once_cell_set, BaseFeeParams, BaseFeeParamsKind, Chain, ChainHardforks, ChainSpec,
Expand All @@ -10,7 +7,7 @@ use reth_chainspec::{
use reth_cli::chainspec::{parse_genesis, ChainSpecParser};
use reth_optimism_chainspec::OpChainSpec;
use reth_optimism_forks::OpHardfork;
use std::sync::Arc;
use std::sync::{Arc, LazyLock};

/// Odyssey forks.
pub static ODYSSEY_FORKS: LazyLock<ChainHardforks> = LazyLock::new(|| {
Expand Down Expand Up @@ -75,7 +72,6 @@ pub static ODYSSEY_MAINNET: LazyLock<Arc<OpChainSpec>> = LazyLock::new(|| {
]
.into(),
),
max_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT,
prune_delete_limit: 10000,
..Default::default()
})
Expand Down
12 changes: 8 additions & 4 deletions crates/node/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
use alloy_consensus::Header;
use alloy_primitives::{Address, Bytes, TxKind, U256};
use op_alloy_consensus::EIP1559ParamError;
use reth_chainspec::{ChainSpec, EthereumHardfork, Head};
use reth_evm::env::EvmEnv;
use reth_node_api::{ConfigureEvm, ConfigureEvmEnv, NextBlockEnvAttributes};
use reth_optimism_chainspec::{DecodeError, OpChainSpec};
use reth_optimism_chainspec::OpChainSpec;
use reth_optimism_forks::OpHardfork;
use reth_primitives::{transaction::FillTxEnv, TransactionSigned};
use reth_revm::{
Expand Down Expand Up @@ -81,7 +83,8 @@ impl OdysseyEvmConfig {

impl ConfigureEvmEnv for OdysseyEvmConfig {
type Header = Header;
type Error = DecodeError;
type Transaction = TransactionSigned;
type Error = EIP1559ParamError;

fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
transaction.fill_tx_env(tx_env, sender);
Expand Down Expand Up @@ -180,7 +183,7 @@ impl ConfigureEvmEnv for OdysseyEvmConfig {
&self,
parent: &Self::Header,
attributes: NextBlockEnvAttributes,
) -> Result<(CfgEnvWithHandlerCfg, BlockEnv), Self::Error> {
) -> Result<EvmEnv, Self::Error> {
// configure evm env based on parent block
let cfg_env = CfgEnv::default().with_chain_id(self.chain_spec.chain().id());

Expand Down Expand Up @@ -226,7 +229,8 @@ impl ConfigureEvmEnv for OdysseyEvmConfig {
handler_cfg: HandlerCfg { spec_id, is_optimism: true },
},
block_env,
))
)
.into())
}
}

Expand Down
28 changes: 19 additions & 9 deletions crates/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
//! required for the optimism engine API.
use crate::evm::OdysseyEvmConfig;
use alloy_consensus::transaction::PooledTransaction;
use reth_evm::execute::BasicBlockExecutorProvider;
use reth_network::{
transactions::{TransactionPropagationMode, TransactionsManagerConfig},
NetworkHandle, NetworkManager, PeersInfo,
};
use reth_network_types::ReputationChangeWeights;
use reth_node_api::{FullNodeTypes, NodeTypesWithEngine};
use reth_node_api::{FullNodeTypes, NodeTypesWithEngine, TxTy};
use reth_node_builder::{
components::{
ComponentsBuilder, ExecutorBuilder, NetworkBuilder, PayloadServiceBuilder,
Expand All @@ -24,11 +25,13 @@ use reth_optimism_node::{
node::{
OpAddOns, OpConsensusBuilder, OpNetworkBuilder, OpPayloadBuilder, OpPoolBuilder, OpStorage,
},
OpEngineTypes, OpExecutionStrategyFactory,
OpEngineTypes, OpExecutionStrategyFactory, OpNetworkPrimitives,
};
use reth_optimism_primitives::OpPrimitives;
use reth_payload_builder::PayloadBuilderHandle;
use reth_transaction_pool::{SubPoolLimit, TransactionPool, TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER};
use reth_transaction_pool::{
PoolTransaction, SubPoolLimit, TransactionPool, TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER,
};
use reth_trie_db::MerklePatriciaTrie;
use std::time::Duration;
use tracing::info;
Expand Down Expand Up @@ -128,7 +131,7 @@ where
}

fn add_ons(&self) -> Self::AddOns {
OpAddOns::new(self.args.sequencer_http.clone())
Self::AddOns::builder().with_sequencer(self.args.sequencer_http.clone()).build()
}
}

Expand All @@ -139,7 +142,7 @@ pub struct OdysseyExecutorBuilder;

impl<Node> ExecutorBuilder<Node> for OdysseyExecutorBuilder
where
Node: FullNodeTypes<Types: NodeTypes<ChainSpec = OpChainSpec>>,
Node: FullNodeTypes<Types: NodeTypes<ChainSpec = OpChainSpec, Primitives = OpPrimitives>>,
{
type EVM = OdysseyEvmConfig;
type Executor = BasicBlockExecutorProvider<OpExecutionStrategyFactory<Self::EVM>>;
Expand Down Expand Up @@ -170,7 +173,7 @@ pub struct OdysseyPayloadBuilder {

impl OdysseyPayloadBuilder {
/// Create a new instance with the given `compute_pending_block` flag.
pub const fn new(compute_pending_block: bool) -> Self {
pub fn new(compute_pending_block: bool) -> Self {
Self { inner: OpPayloadBuilder::new(compute_pending_block) }
}
}
Expand All @@ -184,7 +187,9 @@ where
Primitives = OpPrimitives,
>,
>,
Pool: TransactionPool + Unpin + 'static,
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
+ Unpin
+ 'static,
{
async fn spawn_payload_service(
self,
Expand All @@ -211,13 +216,18 @@ impl OdysseyNetworkBuilder {
impl<Node, Pool> NetworkBuilder<Node, Pool> for OdysseyNetworkBuilder
where
Node: FullNodeTypes<Types: NodeTypes<ChainSpec = OpChainSpec, Primitives = OpPrimitives>>,
Pool: TransactionPool + Unpin + 'static,
Pool: TransactionPool<
Transaction: PoolTransaction<Consensus = TxTy<Node::Types>, Pooled = PooledTransaction>,
> + Unpin
+ 'static,
{
type Primitives = OpNetworkPrimitives;

async fn build_network(
self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> eyre::Result<NetworkHandle> {
) -> eyre::Result<NetworkHandle<OpNetworkPrimitives>> {
let mut network_config = self.inner.network_config(ctx)?;
// this is rolled with limited trusted peers and we want ignore any reputation slashing
network_config.peers_config.reputation_weights = ReputationChangeWeights::zero();
Expand Down
3 changes: 1 addition & 2 deletions crates/node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use reth_rpc_eth_api::{
FromEthApiError,
};
use reth_rpc_eth_types::EthApiError;
use reth_rpc_types_compat::proof::from_primitive_account_proof;
use reth_trie_common::AccountProof;
use tracing::trace;

Expand Down Expand Up @@ -96,7 +95,7 @@ where
.map_err(EthApiError::Internal)?,
..Default::default()
};
Ok(from_primitive_account_proof(account_proof, keys))
Ok(account_proof.into_eip1186_response(keys))
})
.await
.map_err(Into::into);
Expand Down

0 comments on commit 986ee57

Please sign in to comment.