Skip to content

Commit

Permalink
regular dependency upgrade (#33)
Browse files Browse the repository at this point in the history
* regular dependency upgrade

* removed consensus and upgraded to newer

* fix

* cleanup
  • Loading branch information
debjit-bw authored Dec 4, 2024
1 parent 9baa4b6 commit 8b387bd
Show file tree
Hide file tree
Showing 8 changed files with 1,163 additions and 1,063 deletions.
1,798 changes: 930 additions & 868 deletions Cargo.lock

Large diffs are not rendered by default.

84 changes: 40 additions & 44 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,66 +12,62 @@ name = "reth"
path = "src/main.rs"

[dependencies]
reth = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-engine-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-ethereum-consensus = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-consensus = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-auto-seal-consensus = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-prune-types = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-ethereum-engine-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9", features = ["test-utils"] }
reth-errors = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-db = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-db-api = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-rpc = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-stages = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-stages-api = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-stages-types = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
reth-trie-db = { git = "https://github.com/paradigmxyz/reth", rev = "bd8c4eceb20c39c6e501d06cf906469329340bb9" }
eyre = "0.6.12"
reth = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-engine-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-ethereum-consensus = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-consensus = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
# reth-auto-seal-consensus = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-prune-types = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-ethereum-engine-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0", features = ["test-utils"] }
reth-errors = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-db = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-db-api = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-rpc = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-stages = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-stages-api = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-stages-types = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
reth-trie-db = { git = "https://github.com/paradigmxyz/reth", rev = "8f61af0136e1a20119832925081c341ae89b93f0" }
eyre = "0.6"
clap = { version = "4.5.6", features = ["derive"] }

# revm
revm = { version = "17.0.0", features = [
"std",
"secp256k1",
"blst",
], default-features = false }
revm-inspectors = "0.10.0"
revm-primitives = { version = "13.0.0", features = [
revm = { version = "18.0.0", features = ["std"], default-features = false }
revm-inspectors = "0.12.0"
revm-primitives = { version = "14.0.0", features = [
"std",
], default-features = false }

serde_json = "1.0.94"
serde = { version = "1.0", default-features = false }
serde_json = "1.0.94"
serde_with = "3.3.0"
hex = "0.4.3"
walkdir = "2.3.3"
thiserror = "1.0"
thiserror = { version = "2.0.0", default-features = false }
thiserror-no-std = { version = "2.0.2", default-features = false }

# eth
alloy-chains = "0.1.32"
alloy-dyn-abi = "0.8.0"
alloy-primitives = { version = "0.8.9", default-features = false }
alloy-rlp = "0.3.4"
alloy-sol-types = "0.8.0"
alloy-chains = { version = "0.1.32", default-features = false }
alloy-dyn-abi = "0.8.11"
alloy-primitives = { version = "0.8.11", default-features = false }
alloy-rlp = { version = "0.3.4", default-features = false }
alloy-sol-types = "0.8.11"
alloy-trie = { version = "0.7", default-features = false }

alloy-consensus = { version = "0.5.4", default-features = false }
alloy-eips = { version = "0.5.4", default-features = false }
alloy-consensus = { version = "0.7.2", default-features = false }
alloy-eips = { version = "0.7.2", default-features = false }
alloy-sol-macro = "0.8.9"
alloy-serde = { version = "0.5.4", default-features = false }
alloy-serde = { version = "0.7.2", default-features = false }
rayon = "1.7"

tracing = "0.1.0"
Expand Down
57 changes: 0 additions & 57 deletions src/consensus.rs

This file was deleted.

13 changes: 5 additions & 8 deletions src/evm_config.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
use alloy_consensus::Header;
use alloy_primitives::{Address, U256};
use reth::revm::{inspector_handle_register, Database, GetInspector};
use reth::revm::{Evm, EvmBuilder};
use reth_chainspec::ChainSpec;
use reth_chainspec::{ChainSpec, Head};
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
use reth_evm_ethereum::{revm_spec, revm_spec_by_timestamp_after_merge};
use reth_primitives::{
revm_primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv},
transaction::FillTxEnv,
Head, Header, TransactionSigned,
};
use reth_primitives::{transaction::FillTxEnv, TransactionSigned};
use revm::{
handler::mainnet::reward_beneficiary as reward_beneficiary_mainnet, interpreter::Gas, Context,
};
use revm_primitives::{
spec_to_generic, BlobExcessGasAndPrice, BlockEnv, Bytes, CfgEnv, EVMError, Env, HandlerCfg,
Spec, SpecId, TxKind,
spec_to_generic, AnalysisKind, BlobExcessGasAndPrice, BlockEnv, Bytes, CfgEnv,
CfgEnvWithHandlerCfg, EVMError, Env, HandlerCfg, Spec, SpecId, TxEnv, TxKind,
};
use std::{convert::Infallible, sync::Arc};

Expand Down
34 changes: 29 additions & 5 deletions src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ use crate::evm_config::GnosisEvmConfig;

use crate::gnosis::apply_post_block_system_calls;
use alloc::{boxed::Box, sync::Arc};
use alloy_consensus::Transaction as _;
use alloy_consensus::{Header, Transaction as _};
use alloy_eips::eip7685::Requests;
use alloy_primitives::Address;
use core::fmt::Display;
use reth_chainspec::ChainSpec;
use reth_chainspec::EthereumHardforks;
use reth_errors::ConsensusError;
use reth_ethereum_consensus::validate_block_post_execution;
use reth_evm::system_calls::OnStateHook;
use reth_evm::{
execute::{
BlockExecutionError, BlockExecutionStrategy, BlockExecutionStrategyFactory,
Expand All @@ -19,7 +22,8 @@ use reth_evm::{
};
use reth_evm_ethereum::eip6110::parse_deposits_from_receipts;
use reth_node_ethereum::BasicBlockExecutorProvider;
use reth_primitives::{BlockWithSenders, Header, Receipt};
use reth_primitives::EthPrimitives;
use reth_primitives::{BlockWithSenders, Receipt};
use revm::State;
use revm_primitives::{
db::{Database, DatabaseCommit},
Expand Down Expand Up @@ -76,6 +80,8 @@ where
.build();
GnosisExecutionStrategy::new(state, self.chain_spec.clone(), self.evm_config.clone())
}

type Primitives = EthPrimitives;
}

// Block execution strategy for Gnosis
Expand All @@ -101,7 +107,7 @@ where
EvmConfig: Clone,
{
pub fn new(state: State<DB>, chain_spec: Arc<ChainSpec>, evm_config: EvmConfig) -> Self {
let system_caller = SystemCaller::new(evm_config.clone(), (*chain_spec).clone());
let system_caller = SystemCaller::new(evm_config.clone(), chain_spec.clone());
let block_rewards_contract = chain_spec
.genesis()
.config
Expand Down Expand Up @@ -139,13 +145,18 @@ where
}
}

impl<DB, EvmConfig> BlockExecutionStrategy<DB> for GnosisExecutionStrategy<DB, EvmConfig>
impl<DB, EvmConfig> BlockExecutionStrategy for GnosisExecutionStrategy<DB, EvmConfig>
where
DB: Database<Error: Into<ProviderError> + Display>,
EvmConfig: ConfigureEvm<Header = alloy_consensus::Header>,
{
type DB = DB;
type Error = BlockExecutionError;

type Primitives = EthPrimitives;

fn init(&mut self, _tx_env_overrides: Box<dyn reth_evm::TxEnvOverrides>) {}

fn apply_pre_execution_changes(
&mut self,
block: &BlockWithSenders,
Expand Down Expand Up @@ -201,7 +212,7 @@ where
error: Box::new(new_err),
}
})?;
self.system_caller.on_state(&result_and_state);
self.system_caller.on_state(&result_and_state.state);
let ResultAndState { result, state } = result_and_state;
evm.db_mut().commit(state);

Expand Down Expand Up @@ -272,6 +283,19 @@ where
fn state_mut(&mut self) -> &mut State<DB> {
&mut self.state
}

fn with_state_hook(&mut self, hook: Option<Box<dyn OnStateHook>>) {
self.system_caller.with_state_hook(hook);
}

fn validate_block_post_execution(
&self,
block: &BlockWithSenders,
receipts: &[Receipt],
requests: &Requests,
) -> Result<(), ConsensusError> {
validate_block_post_execution(block, &self.chain_spec.clone(), receipts, requests)
}
}

/// Helper type with backwards compatible methods to obtain executor providers.
Expand Down
13 changes: 5 additions & 8 deletions src/gnosis.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
use std::collections::HashMap;

use crate::errors::GnosisBlockExecutionError;
use alloy_eips::eip4895::{Withdrawal, Withdrawals};
use alloy_primitives::{address, Address, U256};
use alloy_sol_macro::sol;
use alloy_sol_types::SolCall;
use reth::{
primitives::Withdrawal,
revm::{
interpreter::Host,
primitives::{ExecutionResult, Output, ResultAndState},
Database, DatabaseCommit, Evm, State,
},
use reth::revm::{
interpreter::Host,
primitives::{ExecutionResult, Output, ResultAndState},
Database, DatabaseCommit, Evm, State,
};
use reth_chainspec::ChainSpec;
use reth_chainspec::EthereumHardforks;
use reth_errors::BlockValidationError;
use reth_evm::{execute::BlockExecutionError, ConfigureEvm};
use reth_primitives::Withdrawals;
use reth_provider::ProviderError;
use revm_primitives::{
Account, AccountInfo, AccountStatus, BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg,
Expand Down
Loading

0 comments on commit 8b387bd

Please sign in to comment.