Skip to content

Commit

Permalink
refactor: batch executor factory (gnosischain#26)
Browse files Browse the repository at this point in the history
* refactor lib rs

* refactor using latest commit

* version bump

---------

Co-authored-by: debjit <[email protected]>
  • Loading branch information
SkandaBhat and debjit-bw authored Nov 3, 2024
1 parent 5edb203 commit a4374e6
Show file tree
Hide file tree
Showing 8 changed files with 1,299 additions and 1,418 deletions.
1,613 changes: 901 additions & 712 deletions Cargo.lock

Large diffs are not rendered by default.

73 changes: 39 additions & 34 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,47 @@ name = "reth"
path = "src/main.rs"

[dependencies]
reth = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-engine-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-ethereum-consensus = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-consensus = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-auto-seal-consensus = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-prune-types = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-ethereum-engine-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70", features = ["test-utils"] }
reth-errors = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-db = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-db-api = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-stages = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-stages-api = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-stages-types = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", rev = "9a732f6b7813f9ecb5f28b379d3062c287a78e70" }
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"
clap = { version = "4.5.6", features = ["derive"] }
alloy-sol-macro = "0.8.5"
alloy-sol-types = "0.8.5"

# revm
revm = { version = "14.0.3", features = [
revm = { version = "17.0.0", features = [
"std",
"secp256k1",
"blst",
], default-features = false }
revm-inspectors = "0.8.1"
revm-primitives = { version = "10.0.0", features = [
revm-inspectors = "0.10.0"
revm-primitives = { version = "13.0.0", features = [
"std",
], default-features = false }

serde_json = "1.0.117"
serde_json = "1.0.94"
serde = { version = "1.0", default-features = false }
serde_with = "3.3.0"
hex = "0.4.3"
Expand All @@ -63,17 +63,22 @@ 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.4", default-features = false }
alloy-serde = { version = "0.4.0", default-features = false }
alloy-primitives = { version = "0.8.9", default-features = false }
alloy-rlp = "0.3.4"
alloy-trie = { version = "0.6", default-features = false }
alloy-sol-types = "0.8.0"
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-sol-macro = "0.8.9"
alloy-serde = { version = "0.5.4", default-features = false }
rayon = "1.7"

tracing = "0.1.0"

[target.'cfg(unix)'.dependencies]
tikv-jemallocator = { version = "0.6", optional = true }
tikv-jemalloc-ctl = "0.6"
tikv-jemallocator = { version = "0.6", optional = true }
libc = "0.2"

[features]
Expand Down
132 changes: 0 additions & 132 deletions src/ethereum.rs

This file was deleted.

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

/// Reward beneficiary with gas fee.
#[inline]
Expand Down Expand Up @@ -122,6 +123,7 @@ impl ConfigureEvm for GnosisEvmConfig {

impl ConfigureEvmEnv for GnosisEvmConfig {
type Header = Header;
type Error = Infallible;

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

Expand Down Expand Up @@ -240,6 +242,6 @@ impl ConfigureEvmEnv for GnosisEvmConfig {
};
}

(cfg_with_handler_cfg, block_env)
Ok((cfg_with_handler_cfg, block_env))
}
}
Loading

0 comments on commit a4374e6

Please sign in to comment.