diff --git a/Cargo.lock b/Cargo.lock index e94df23bd2..9ed1f84b90 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,7 +67,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", - "getrandom 0.2.10", "once_cell", "version_check", ] @@ -174,20 +173,6 @@ version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" -[[package]] -name = "aquamarine" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df752953c49ce90719c7bf1fc587bc8227aed04732ea0c0f85e5397d7fdbd1a1" -dependencies = [ - "include_dir", - "itertools 0.10.5", - "proc-macro-error", - "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 1.0.109", -] - [[package]] name = "arbitrary" version = "1.3.0" @@ -3068,25 +3053,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "include_dir" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" -dependencies = [ - "include_dir_macros", -] - -[[package]] -name = "include_dir_macros" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", -] - [[package]] name = "indenter" version = "0.3.3" @@ -3399,20 +3365,6 @@ dependencies = [ "jsonrpsee-types", ] -[[package]] -name = "jsonwebtoken" -version = "8.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" -dependencies = [ - "base64 0.21.2", - "pem", - "ring", - "serde", - "serde_json", - "simple_asn1", -] - [[package]] name = "k256" version = "0.13.1" @@ -4221,15 +4173,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" -[[package]] -name = "pem" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" -dependencies = [ - "base64 0.13.1", -] - [[package]] name = "percent-encoding" version = "2.3.0" @@ -4956,30 +4899,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" -[[package]] -name = "reth-beacon-consensus" -version = "0.1.0-alpha.4" -source = "git+https://github.com/paradigmxyz/reth?rev=4ab924c5d361bbfdcdad9f997d16d67b4a1730b7#4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" -dependencies = [ - "futures", - "reth-consensus-common", - "reth-db", - "reth-interfaces", - "reth-metrics", - "reth-payload-builder", - "reth-primitives", - "reth-provider", - "reth-prune", - "reth-rpc-types", - "reth-stages", - "reth-tasks", - "schnellru", - "thiserror", - "tokio", - "tokio-stream", - "tracing", -] - [[package]] name = "reth-codecs" version = "0.1.0-alpha.4" @@ -5177,26 +5096,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "reth-payload-builder" -version = "0.1.0-alpha.4" -source = "git+https://github.com/paradigmxyz/reth?rev=4ab924c5d361bbfdcdad9f997d16d67b4a1730b7#4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" -dependencies = [ - "futures-util", - "reth-interfaces", - "reth-metrics", - "reth-primitives", - "reth-revm-primitives", - "reth-rlp", - "reth-rpc-types", - "revm-primitives", - "sha2 0.10.7", - "thiserror", - "tokio", - "tokio-stream", - "tracing", -] - [[package]] name = "reth-primitives" version = "0.1.0-alpha.4" @@ -5251,28 +5150,12 @@ dependencies = [ "reth-interfaces", "reth-primitives", "reth-revm-primitives", - "reth-rlp", "reth-trie", "tokio", "tokio-stream", "tracing", ] -[[package]] -name = "reth-prune" -version = "0.1.0-alpha.4" -source = "git+https://github.com/paradigmxyz/reth?rev=4ab924c5d361bbfdcdad9f997d16d67b4a1730b7#4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" -dependencies = [ - "itertools 0.10.5", - "rayon", - "reth-db", - "reth-interfaces", - "reth-primitives", - "reth-provider", - "thiserror", - "tracing", -] - [[package]] name = "reth-revm" version = "0.1.0-alpha.4" @@ -5338,84 +5221,6 @@ dependencies = [ "syn 2.0.28", ] -[[package]] -name = "reth-rpc" -version = "0.1.0-alpha.4" -source = "git+https://github.com/paradigmxyz/reth?rev=4ab924c5d361bbfdcdad9f997d16d67b4a1730b7#4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" -dependencies = [ - "async-trait", - "bytes", - "ethers-core", - "futures", - "hex", - "http", - "http-body", - "hyper", - "jsonrpsee", - "jsonwebtoken", - "pin-project", - "rand 0.8.5", - "rayon", - "reth-consensus-common", - "reth-interfaces", - "reth-metrics", - "reth-network-api", - "reth-primitives", - "reth-provider", - "reth-revm", - "reth-rlp", - "reth-rpc-api", - "reth-rpc-engine-api", - "reth-rpc-types", - "reth-tasks", - "reth-transaction-pool", - "revm", - "revm-primitives", - "schnellru", - "secp256k1", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-stream", - "tokio-util", - "tower", - "tracing", - "tracing-futures", -] - -[[package]] -name = "reth-rpc-api" -version = "0.1.0-alpha.4" -source = "git+https://github.com/paradigmxyz/reth?rev=4ab924c5d361bbfdcdad9f997d16d67b4a1730b7#4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" -dependencies = [ - "jsonrpsee", - "reth-primitives", - "reth-rpc-types", - "serde_json", -] - -[[package]] -name = "reth-rpc-engine-api" -version = "0.1.0-alpha.4" -source = "git+https://github.com/paradigmxyz/reth?rev=4ab924c5d361bbfdcdad9f997d16d67b4a1730b7#4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" -dependencies = [ - "async-trait", - "jsonrpsee-core", - "jsonrpsee-types", - "reth-beacon-consensus", - "reth-interfaces", - "reth-payload-builder", - "reth-primitives", - "reth-provider", - "reth-rpc-api", - "reth-rpc-types", - "reth-tasks", - "thiserror", - "tokio", - "tracing", -] - [[package]] name = "reth-rpc-types" version = "0.1.0-alpha.4" @@ -5429,73 +5234,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "reth-stages" -version = "0.1.0-alpha.4" -source = "git+https://github.com/paradigmxyz/reth?rev=4ab924c5d361bbfdcdad9f997d16d67b4a1730b7#4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" -dependencies = [ - "aquamarine", - "async-trait", - "futures-util", - "itertools 0.10.5", - "num-traits", - "pin-project", - "rayon", - "reth-codecs", - "reth-db", - "reth-interfaces", - "reth-metrics", - "reth-primitives", - "reth-provider", - "reth-trie", - "serde", - "thiserror", - "tokio", - "tokio-stream", - "tracing", -] - -[[package]] -name = "reth-tasks" -version = "0.1.0-alpha.4" -source = "git+https://github.com/paradigmxyz/reth?rev=4ab924c5d361bbfdcdad9f997d16d67b4a1730b7#4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" -dependencies = [ - "dyn-clone", - "futures-util", - "reth-metrics", - "thiserror", - "tokio", - "tracing", - "tracing-futures", -] - -[[package]] -name = "reth-transaction-pool" -version = "0.1.0-alpha.4" -source = "git+https://github.com/paradigmxyz/reth?rev=4ab924c5d361bbfdcdad9f997d16d67b4a1730b7#4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" -dependencies = [ - "aquamarine", - "async-trait", - "auto_impl", - "bitflags 1.3.2", - "fnv", - "futures-util", - "parking_lot 0.12.1", - "paste", - "rand 0.8.5", - "reth-interfaces", - "reth-metrics", - "reth-primitives", - "reth-provider", - "reth-rlp", - "reth-tasks", - "serde", - "thiserror", - "tokio", - "tokio-stream", - "tracing", -] - [[package]] name = "reth-trie" version = "0.1.0-alpha.4" @@ -6018,17 +5756,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "schnellru" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" -dependencies = [ - "ahash 0.8.3", - "cfg-if", - "hashbrown 0.13.2", -] - [[package]] name = "scopeguard" version = "1.2.0" @@ -6366,18 +6093,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "simple_asn1" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" -dependencies = [ - "num-bigint 0.4.3", - "num-traits", - "thiserror", - "time", -] - [[package]] name = "siphasher" version = "0.3.10" @@ -6725,7 +6440,6 @@ dependencies = [ "ethers", "jsonrpsee", "reth-primitives", - "reth-rpc", "reth-rpc-types", "serde_json", "sov-celestia-adapter", @@ -6753,10 +6467,8 @@ dependencies = [ "hex", "jsonrpsee", "lazy_static", - "primitive-types", "reth-primitives", "reth-revm", - "reth-rpc", "reth-rpc-types", "revm", "schemars", diff --git a/Cargo.toml b/Cargo.toml index f9b19288de..f79bfda3cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,9 +92,11 @@ jsonrpsee = { version = "0.18.2", features = ["jsonrpsee-types"] } schemars = { version = "0.8.12", features = ["derive"] } tempfile = "3.5" tokio = { version = "1", features = ["full"] } +lazy_static = "1.4.0" # EVM dependencies +ethereum-types = "0.14.1" ethers = "=2.0.8" ethers-core = "=2.0.8" ethers-contract = "=2.0.8" @@ -104,7 +106,6 @@ ethers-middleware = "=2.0.8" reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" } reth-rpc-types = { git = "https://github.com/paradigmxyz/reth", rev = "4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" } -reth-rpc = { git = "https://github.com/paradigmxyz/reth", rev = "4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" } reth-revm = { git = "https://github.com/paradigmxyz/reth", rev = "4ab924c5d361bbfdcdad9f997d16d67b4a1730b7" } revm = { git = "https://github.com/bluealloy/revm/", branch = "release/v25" } diff --git a/examples/demo-rollup/Cargo.toml b/examples/demo-rollup/Cargo.toml index 92f5d3f7cb..1e3c32766c 100644 --- a/examples/demo-rollup/Cargo.toml +++ b/examples/demo-rollup/Cargo.toml @@ -58,7 +58,7 @@ prometheus = "0.11.0" prettytable-rs = "^0.10" criterion = "0.5.1" -ethereum-types = "0.14.1" +ethereum-types = { workspace = true } ethers-core = { workspace = true } ethers-contract = { workspace = true } ethers-middleware = { workspace = true } @@ -70,7 +70,7 @@ revm = { workspace = true } [features] default = [] -experimental = ["sov-ethereum/experimental", "reth-primitives", "secp256k1"] +experimental = ["sov-ethereum/experimental", "reth-primitives", "secp256k1", "demo-stf/experimental"] [[bench]] name = "rollup_bench" diff --git a/full-node/sov-ethereum/Cargo.toml b/full-node/sov-ethereum/Cargo.toml index 96f4ce655c..427b6494c4 100644 --- a/full-node/sov-ethereum/Cargo.toml +++ b/full-node/sov-ethereum/Cargo.toml @@ -26,7 +26,6 @@ serde_json = { workspace = true } reth-primitives = { workspace = true } reth-rpc-types = { workspace = true } -reth-rpc = { workspace = true } ethers = { workspace = true } diff --git a/full-node/sov-ethereum/src/lib.rs b/full-node/sov-ethereum/src/lib.rs index aa2bda5c1e..a59ecc307a 100644 --- a/full-node/sov-ethereum/src/lib.rs +++ b/full-node/sov-ethereum/src/lib.rs @@ -19,7 +19,6 @@ pub mod experimental { use reth_primitives::{ Address as RethAddress, TransactionSignedNoHash as RethTransactionSignedNoHash, }; - use reth_rpc::eth::error::EthApiError; use sov_evm::call::CallMessage; use sov_evm::evm::RlpEvmTransaction; use sov_modules_api::transaction::Transaction; @@ -82,13 +81,12 @@ pub mod experimental { &self, raw_tx: RlpEvmTransaction, ) -> Result<(H256, Vec), jsonrpsee::core::Error> { - let signed_transaction: RethTransactionSignedNoHash = - raw_tx.clone().try_into().map_err(EthApiError::from)?; + let signed_transaction: RethTransactionSignedNoHash = raw_tx.clone().try_into()?; let tx_hash = signed_transaction.hash(); - let sender = signed_transaction - .recover_signer() - .ok_or(EthApiError::InvalidTransactionSignature)?; + let sender = signed_transaction.recover_signer().ok_or( + sov_evm::evm::primitive_types::RawEvmTxConversionError::FailedToRecoverSigner, + )?; let mut nonces = self.nonces.lock().unwrap(); let nonce = *nonces.entry(sender).and_modify(|n| *n += 1).or_insert(0); diff --git a/module-system/module-implementations/sov-evm/Cargo.toml b/module-system/module-implementations/sov-evm/Cargo.toml index a1b9a15c0b..db902c5aed 100644 --- a/module-system/module-implementations/sov-evm/Cargo.toml +++ b/module-system/module-implementations/sov-evm/Cargo.toml @@ -32,23 +32,21 @@ derive_more = { workspace = true } lazy_static = "1.4.0" -ethereum-types = "0.14.1" +ethereum-types = { workspace = true } ethers-core = { workspace = true } ethers-contract = { workspace = true } ethers-middleware = { workspace = true } ethers-signers = { workspace = true } ethers = { workspace = true } -revm = { workspace = true } +revm = { workspace = true, features = ["optional_block_gas_limit", "optional_eip3607", "optional_no_base_fee"] } reth-primitives = { workspace = true } reth-rpc-types = { workspace = true } -reth-rpc = { workspace = true } reth-revm = { workspace = true } secp256k1 = { workspace = true } [dev-dependencies] sov-evm = { path = ".", features = ["smart_contracts"] } -primitive-types = "0.12.1" tokio = { workspace = true } tempfile = { workspace = true } bytes = { workspace = true } diff --git a/module-system/module-implementations/sov-evm/src/call.rs b/module-system/module-implementations/sov-evm/src/call.rs index 97cb9d00f8..5f7d42c6f4 100644 --- a/module-system/module-implementations/sov-evm/src/call.rs +++ b/module-system/module-implementations/sov-evm/src/call.rs @@ -7,7 +7,7 @@ use sov_state::WorkingSet; use crate::evm::db::EvmDb; use crate::evm::executor::{self}; -use crate::evm::transaction::{BlockEnv, Receipt, TransactionSignedAndRecovered}; +use crate::evm::primitive_types::{BlockEnv, Receipt, TransactionSignedAndRecovered}; use crate::evm::{EvmChainConfig, RlpEvmTransaction}; use crate::experimental::PendingTransaction; use crate::Evm; diff --git a/module-system/module-implementations/sov-evm/src/evm/conversions.rs b/module-system/module-implementations/sov-evm/src/evm/conversions.rs index 2b214f1e0b..a57f6a3527 100644 --- a/module-system/module-implementations/sov-evm/src/evm/conversions.rs +++ b/module-system/module-implementations/sov-evm/src/evm/conversions.rs @@ -2,15 +2,15 @@ use bytes::Bytes; use reth_primitives::{ Bytes as RethBytes, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, }; -use reth_rpc::eth::error::EthApiError; use reth_rpc_types::CallRequest; use revm::primitives::{ AccountInfo as ReVmAccountInfo, BlockEnv as ReVmBlockEnv, Bytecode, CreateScheme, TransactTo, TxEnv, U256, }; -use thiserror::Error; -use super::transaction::{BlockEnv, RlpEvmTransaction, TransactionSignedAndRecovered}; +use super::primitive_types::{ + BlockEnv, RawEvmTxConversionError, RlpEvmTransaction, TransactionSignedAndRecovered, +}; use super::AccountInfo; impl From for ReVmAccountInfo { @@ -70,27 +70,6 @@ pub(crate) fn create_tx_env(tx: &TransactionSignedEcRecovered) -> TxEnv { } } -#[derive(Error, Debug)] -pub enum RawEvmTxConversionError { - #[error("Empty raw transaction data")] - EmptyRawTransactionData, - #[error("Failed to decode signed transaction")] - FailedToDecodeSignedTransaction, -} - -impl From for EthApiError { - fn from(e: RawEvmTxConversionError) -> Self { - match e { - RawEvmTxConversionError::EmptyRawTransactionData => { - EthApiError::EmptyRawTransactionData - } - RawEvmTxConversionError::FailedToDecodeSignedTransaction => { - EthApiError::FailedToDecodeSignedTransaction - } - } - } -} - impl TryFrom for TransactionSignedNoHash { type Error = RawEvmTxConversionError; diff --git a/module-system/module-implementations/sov-evm/src/evm/executor.rs b/module-system/module-implementations/sov-evm/src/evm/executor.rs index 8be4dc46d4..7221bce853 100644 --- a/module-system/module-implementations/sov-evm/src/evm/executor.rs +++ b/module-system/module-implementations/sov-evm/src/evm/executor.rs @@ -6,7 +6,7 @@ use revm::primitives::{CfgEnv, EVMError, Env, ExecutionResult, ResultAndState, T use revm::{self, Database, DatabaseCommit}; use super::conversions::create_tx_env; -use super::transaction::BlockEnv; +use super::primitive_types::BlockEnv; pub(crate) fn execute_tx + DatabaseCommit>( db: DB, diff --git a/module-system/module-implementations/sov-evm/src/evm/mod.rs b/module-system/module-implementations/sov-evm/src/evm/mod.rs index f9350be8c0..15f0f05cc7 100644 --- a/module-system/module-implementations/sov-evm/src/evm/mod.rs +++ b/module-system/module-implementations/sov-evm/src/evm/mod.rs @@ -8,13 +8,13 @@ pub(crate) mod db; mod db_commit; pub(crate) mod db_init; pub(crate) mod executor; +pub mod primitive_types; #[cfg(test)] mod tests; -pub(crate) mod transaction; pub use conversions::prepare_call_env; +pub use primitive_types::RlpEvmTransaction; use sov_state::codec::BcsCodec; -pub use transaction::RlpEvmTransaction; // Stores information about an EVM account #[derive(Deserialize, Serialize, Debug, PartialEq, Clone, Default)] diff --git a/module-system/module-implementations/sov-evm/src/evm/transaction.rs b/module-system/module-implementations/sov-evm/src/evm/primitive_types.rs similarity index 80% rename from module-system/module-implementations/sov-evm/src/evm/transaction.rs rename to module-system/module-implementations/sov-evm/src/evm/primitive_types.rs index 39b14b13d1..232773151c 100644 --- a/module-system/module-implementations/sov-evm/src/evm/transaction.rs +++ b/module-system/module-implementations/sov-evm/src/evm/primitive_types.rs @@ -1,7 +1,9 @@ use std::ops::Range; +use jsonrpsee::types::ErrorObject; use reth_primitives::{Address, Header, SealedHeader, TransactionSigned, H256}; use revm::primitives::EVMError; +use thiserror::Error; #[derive(serde::Deserialize, serde::Serialize, Debug, PartialEq, Clone)] pub(crate) struct BlockEnv { @@ -104,3 +106,23 @@ pub(crate) struct Receipt { pub(crate) log_index_start: u64, pub(crate) error: Option>, } + +#[derive(Error, Debug)] +pub enum RawEvmTxConversionError { + #[error("Empty raw transaction data")] + EmptyRawTransactionData, + #[error("Failed to decode signed transaction")] + FailedToDecodeSignedTransaction, + #[error("Failed to recover signer")] + FailedToRecoverSigner, +} + +impl From for jsonrpsee::core::Error { + fn from(error: RawEvmTxConversionError) -> Self { + jsonrpsee::core::Error::Call(ErrorObject::owned::<&[u8]>( + jsonrpsee::types::error::INVALID_PARAMS_CODE, + error.to_string(), + None, + )) + } +} diff --git a/module-system/module-implementations/sov-evm/src/evm/tests.rs b/module-system/module-implementations/sov-evm/src/evm/tests.rs index 130b9b884d..361e385120 100644 --- a/module-system/module-implementations/sov-evm/src/evm/tests.rs +++ b/module-system/module-implementations/sov-evm/src/evm/tests.rs @@ -10,7 +10,7 @@ use sov_state::{ProverStorage, WorkingSet}; use super::db::EvmDb; use super::db_init::InitEvmDb; use super::executor; -use crate::evm::transaction::BlockEnv; +use crate::evm::primitive_types::BlockEnv; use crate::evm::AccountInfo; use crate::smart_contracts::SimpleStorageContract; use crate::tests::dev_signer::TestSigner; diff --git a/module-system/module-implementations/sov-evm/src/genesis.rs b/module-system/module-implementations/sov-evm/src/genesis.rs index bf1e8c6065..546dbe1326 100644 --- a/module-system/module-implementations/sov-evm/src/genesis.rs +++ b/module-system/module-implementations/sov-evm/src/genesis.rs @@ -5,7 +5,7 @@ use revm::primitives::SpecId; use sov_state::WorkingSet; use crate::evm::db_init::InitEvmDb; -use crate::evm::transaction::Block; +use crate::evm::primitive_types::Block; use crate::evm::{AccountInfo, EvmChainConfig}; use crate::Evm; diff --git a/module-system/module-implementations/sov-evm/src/hooks.rs b/module-system/module-implementations/sov-evm/src/hooks.rs index a60a440904..0c42a1003e 100644 --- a/module-system/module-implementations/sov-evm/src/hooks.rs +++ b/module-system/module-implementations/sov-evm/src/hooks.rs @@ -1,7 +1,7 @@ use reth_primitives::{Bloom, Bytes, U256}; use sov_state::{AccessoryWorkingSet, WorkingSet}; -use crate::evm::transaction::{Block, BlockEnv}; +use crate::evm::primitive_types::{Block, BlockEnv}; use crate::experimental::PendingTransaction; use crate::Evm; diff --git a/module-system/module-implementations/sov-evm/src/lib.rs b/module-system/module-implementations/sov-evm/src/lib.rs index 686c5857b8..a42c521ba0 100644 --- a/module-system/module-implementations/sov-evm/src/lib.rs +++ b/module-system/module-implementations/sov-evm/src/lib.rs @@ -32,9 +32,10 @@ mod experimental { use sov_state::WorkingSet; use super::evm::db::EvmDb; - use super::evm::transaction::BlockEnv; use super::evm::{DbAccount, EvmChainConfig}; - use crate::evm::transaction::{Block, Receipt, SealedBlock, TransactionSignedAndRecovered}; + use crate::evm::primitive_types::{ + Block, BlockEnv, Receipt, SealedBlock, TransactionSignedAndRecovered, + }; #[derive(Clone, Debug)] pub struct AccountData { pub address: Address, diff --git a/module-system/module-implementations/sov-evm/src/query.rs b/module-system/module-implementations/sov-evm/src/query.rs index cf727c58a9..cef2f2fa1b 100644 --- a/module-system/module-implementations/sov-evm/src/query.rs +++ b/module-system/module-implementations/sov-evm/src/query.rs @@ -9,7 +9,7 @@ use tracing::info; use crate::call::get_cfg_env; use crate::evm::db::EvmDb; -use crate::evm::transaction::{Receipt, SealedBlock, TransactionSignedAndRecovered}; +use crate::evm::primitive_types::{Receipt, SealedBlock, TransactionSignedAndRecovered}; use crate::evm::{executor, prepare_call_env}; use crate::Evm; diff --git a/module-system/module-implementations/sov-evm/src/signer/mod.rs b/module-system/module-implementations/sov-evm/src/signer/mod.rs index 368363c4b6..c98fde337e 100644 --- a/module-system/module-implementations/sov-evm/src/signer/mod.rs +++ b/module-system/module-implementations/sov-evm/src/signer/mod.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use reth_primitives::{sign_message, Address, Transaction, TransactionSigned, H256}; -use reth_rpc::eth::error::SignError; use secp256k1::{PublicKey, SecretKey}; /// Ethereum transaction signer. @@ -9,6 +8,22 @@ pub struct DevSigner { signers: HashMap, } +#[derive(Debug, thiserror::Error)] +pub enum SignError { + /// Error occured while trying to sign data. + #[error("Could not sign")] + CouldNotSign, + /// Signer for requested account not found. + #[error("Unknown account")] + NoAccount, + /// TypedData has invalid format. + #[error("Given typed data is not valid")] + TypedData, + /// No chainid + #[error("No chainid")] + NoChainId, +} + impl DevSigner { /// Creates a new DevSigner. pub fn new(secret_keys: Vec) -> Self { diff --git a/module-system/module-implementations/sov-evm/src/tests/call_tests.rs b/module-system/module-implementations/sov-evm/src/tests/call_tests.rs index 4ab68d00aa..d3f983eae0 100644 --- a/module-system/module-implementations/sov-evm/src/tests/call_tests.rs +++ b/module-system/module-implementations/sov-evm/src/tests/call_tests.rs @@ -5,7 +5,7 @@ use sov_modules_api::default_signature::private_key::DefaultPrivateKey; use sov_modules_api::{Context, Module, PrivateKey, PublicKey, Spec}; use crate::call::CallMessage; -use crate::evm::transaction::Receipt; +use crate::evm::primitive_types::Receipt; use crate::smart_contracts::SimpleStorageContract; use crate::tests::dev_signer::TestSigner; use crate::tests::genesis_tests::get_evm; diff --git a/module-system/module-implementations/sov-evm/src/tests/cfg_tests.rs b/module-system/module-implementations/sov-evm/src/tests/cfg_tests.rs index b33c5142db..263672d32f 100644 --- a/module-system/module-implementations/sov-evm/src/tests/cfg_tests.rs +++ b/module-system/module-implementations/sov-evm/src/tests/cfg_tests.rs @@ -1,7 +1,7 @@ use revm::primitives::{CfgEnv, SpecId, U256}; use crate::call::{get_cfg_env, get_spec_id}; -use crate::evm::transaction::BlockEnv; +use crate::evm::primitive_types::BlockEnv; use crate::evm::EvmChainConfig; #[test] diff --git a/module-system/module-implementations/sov-evm/src/tests/dev_signer.rs b/module-system/module-implementations/sov-evm/src/tests/dev_signer.rs index e7e92e6484..de031b6992 100644 --- a/module-system/module-implementations/sov-evm/src/tests/dev_signer.rs +++ b/module-system/module-implementations/sov-evm/src/tests/dev_signer.rs @@ -4,11 +4,10 @@ use reth_primitives::{ Address, Bytes as RethBytes, Transaction as RethTransaction, TransactionKind, TxEip1559 as RethTxEip1559, }; -use reth_rpc::eth::error::SignError; use secp256k1::{PublicKey, SecretKey}; use crate::evm::RlpEvmTransaction; -use crate::signer::DevSigner; +use crate::signer::{DevSigner, SignError}; /// ETH transactions signer used in tests. pub(crate) struct TestSigner { diff --git a/module-system/module-implementations/sov-evm/src/tests/genesis_tests.rs b/module-system/module-implementations/sov-evm/src/tests/genesis_tests.rs index f797a99f6d..bd86b11f6a 100644 --- a/module-system/module-implementations/sov-evm/src/tests/genesis_tests.rs +++ b/module-system/module-implementations/sov-evm/src/tests/genesis_tests.rs @@ -7,7 +7,7 @@ use sov_modules_api::default_context::DefaultContext; use sov_modules_api::Module; use sov_state::{DefaultStorageSpec, ProverStorage, WorkingSet}; -use crate::evm::transaction::{Block, SealedBlock}; +use crate::evm::primitive_types::{Block, SealedBlock}; // use crate::evm::db; use crate::{evm::EvmChainConfig, AccountData, Evm, EvmConfig}; type C = DefaultContext; diff --git a/module-system/module-implementations/sov-evm/src/tests/hooks_tests.rs b/module-system/module-implementations/sov-evm/src/tests/hooks_tests.rs index 5d7676026e..54863d5880 100644 --- a/module-system/module-implementations/sov-evm/src/tests/hooks_tests.rs +++ b/module-system/module-implementations/sov-evm/src/tests/hooks_tests.rs @@ -6,7 +6,7 @@ use reth_primitives::{ }; use super::genesis_tests::{get_evm, TEST_CONFIG}; -use crate::evm::transaction::{Block, BlockEnv, Receipt, TransactionSignedAndRecovered}; +use crate::evm::primitive_types::{Block, BlockEnv, Receipt, TransactionSignedAndRecovered}; use crate::experimental::PendingTransaction; use crate::tests::genesis_tests::{BENEFICIARY, GENESIS_HASH};