From f75c5cf82cb23a71cfa7fbc13cd12a5004c6fdb0 Mon Sep 17 00:00:00 2001 From: Bear Wang Date: Mon, 4 Mar 2024 19:14:37 +0800 Subject: [PATCH] Rename the runtime-transact (#1428) * Rename the runtime transact * Rename others * Update runtime files * Update TxPause list * Format --------- Co-authored-by: Xavier Lau --- Cargo.lock | 60 +++++++++---------- Cargo.toml | 2 +- .../Cargo.toml | 2 +- .../src/lib.rs | 28 ++++----- .../src/mock.rs | 6 +- .../src/tests/eip1559.rs | 28 ++++----- .../src/tests/eip2930.rs | 28 ++++----- .../src/tests/legacy.rs | 28 ++++----- .../src/tests/mod.rs | 0 pallet/staking/Cargo.toml | 8 +-- pallet/staking/src/lib.rs | 10 ++-- runtime/crab/Cargo.toml | 8 +-- runtime/crab/src/lib.rs | 2 +- runtime/crab/src/pallets.rs | 2 +- ...runtime_transact.rs => ethtx_forwarder.rs} | 4 +- runtime/crab/src/pallets/evm.rs | 2 +- runtime/crab/src/pallets/tx_pause.rs | 7 +-- runtime/darwinia/Cargo.toml | 8 +-- runtime/darwinia/src/lib.rs | 2 +- runtime/darwinia/src/pallets.rs | 2 +- ...runtime_transact.rs => ethtx_forwarder.rs} | 4 +- runtime/darwinia/src/pallets/evm.rs | 2 +- runtime/darwinia/src/pallets/tx_pause.rs | 7 +-- runtime/pangolin/Cargo.toml | 8 +-- runtime/pangolin/src/lib.rs | 2 +- runtime/pangolin/src/pallets.rs | 2 +- ...runtime_transact.rs => ethtx_forwarder.rs} | 4 +- runtime/pangolin/src/pallets/evm.rs | 2 +- runtime/pangolin/src/pallets/tx_pause.rs | 7 +-- 29 files changed, 130 insertions(+), 145 deletions(-) rename pallet/{runtime-transact => ethtx-forwarder}/Cargo.toml (97%) rename pallet/{runtime-transact => ethtx-forwarder}/src/lib.rs (90%) rename pallet/{runtime-transact => ethtx-forwarder}/src/mock.rs (98%) rename pallet/{runtime-transact => ethtx-forwarder}/src/tests/eip1559.rs (86%) rename pallet/{runtime-transact => ethtx-forwarder}/src/tests/eip2930.rs (86%) rename pallet/{runtime-transact => ethtx-forwarder}/src/tests/legacy.rs (85%) rename pallet/{runtime-transact => ethtx-forwarder}/src/tests/mod.rs (100%) rename runtime/crab/src/pallets/{runtime_transact.rs => ethtx_forwarder.rs} (86%) rename runtime/darwinia/src/pallets/{runtime_transact.rs => ethtx_forwarder.rs} (86%) rename runtime/pangolin/src/pallets/{runtime_transact.rs => ethtx_forwarder.rs} (86%) diff --git a/Cargo.lock b/Cargo.lock index 64c0a839d..4920ed127 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1645,12 +1645,12 @@ dependencies = [ "darwinia-account-migration", "darwinia-common-runtime", "darwinia-deposit", + "darwinia-ethtx-forwarder", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-deposit", "darwinia-precompile-staking", "darwinia-precompile-state-storage", - "darwinia-runtime-transact", "darwinia-staking", "dc-primitives", "fp-evm", @@ -2843,6 +2843,32 @@ dependencies = [ "sp-version", ] +[[package]] +name = "darwinia-ethtx-forwarder" +version = "6.6.0" +dependencies = [ + "array-bytes", + "ethereum", + "fp-ethereum", + "fp-evm", + "fp-self-contained", + "frame-support", + "frame-system", + "libsecp256k1", + "pallet-balances", + "pallet-ethereum", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "rlp", + "scale-info", + "sha3", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "darwinia-message-gadget" version = "6.6.0" @@ -2979,13 +3005,13 @@ dependencies = [ "darwinia-common-runtime", "darwinia-deposit", "darwinia-ecdsa-authority", + "darwinia-ethtx-forwarder", "darwinia-message-gadget", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-deposit", "darwinia-precompile-staking", "darwinia-precompile-state-storage", - "darwinia-runtime-transact", "darwinia-staking", "dc-inflation", "dc-primitives", @@ -3065,38 +3091,12 @@ dependencies = [ "xcm-primitives", ] -[[package]] -name = "darwinia-runtime-transact" -version = "6.6.0" -dependencies = [ - "array-bytes", - "ethereum", - "fp-ethereum", - "fp-evm", - "fp-self-contained", - "frame-support", - "frame-system", - "libsecp256k1", - "pallet-balances", - "pallet-ethereum", - "pallet-evm", - "pallet-timestamp", - "parity-scale-codec", - "rlp", - "scale-info", - "sha3", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - [[package]] name = "darwinia-staking" version = "6.6.0" dependencies = [ "darwinia-deposit", - "darwinia-runtime-transact", + "darwinia-ethtx-forwarder", "darwinia-staking-traits", "dc-inflation", "dc-types", @@ -8955,13 +8955,13 @@ dependencies = [ "darwinia-common-runtime", "darwinia-deposit", "darwinia-ecdsa-authority", + "darwinia-ethtx-forwarder", "darwinia-message-gadget", "darwinia-precompile-assets", "darwinia-precompile-bls12-381", "darwinia-precompile-deposit", "darwinia-precompile-staking", "darwinia-precompile-state-storage", - "darwinia-runtime-transact", "darwinia-staking", "dc-primitives", "fp-evm", diff --git a/Cargo.toml b/Cargo.toml index 70717181e..b2b7b65af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,6 +57,7 @@ darwinia-asset-limit = { path = "pallet/asset-limit", default-featu darwinia-common-runtime = { path = "runtime/common", default-features = false } darwinia-deposit = { path = "pallet/deposit", default-features = false } darwinia-ecdsa-authority = { path = "pallet/ecdsa-authority", default-features = false } +darwinia-ethtx-forwarder = { path = "pallet/ethtx-forwarder", default-features = false } darwinia-message-gadget = { path = "pallet/message-gadget", default-features = false } darwinia-precompile-assets = { path = "precompile/assets", default-features = false } darwinia-precompile-bls12-381 = { path = "precompile/bls12-381", default-features = false } @@ -64,7 +65,6 @@ darwinia-precompile-deposit = { path = "precompile/deposit", default-featu darwinia-precompile-staking = { path = "precompile/staking", default-features = false } darwinia-precompile-state-storage = { path = "precompile/state-storage", default-features = false } darwinia-runtime = { path = "runtime/darwinia" } -darwinia-runtime-transact = { path = "pallet/runtime-transact", default-features = false } darwinia-staking = { path = "pallet/staking", default-features = false } darwinia-staking-traits = { path = "pallet/staking/traits", default-features = false } dc-inflation = { path = "core/inflation", default-features = false } diff --git a/pallet/runtime-transact/Cargo.toml b/pallet/ethtx-forwarder/Cargo.toml similarity index 97% rename from pallet/runtime-transact/Cargo.toml rename to pallet/ethtx-forwarder/Cargo.toml index 31f814bfc..05016203a 100644 --- a/pallet/runtime-transact/Cargo.toml +++ b/pallet/ethtx-forwarder/Cargo.toml @@ -2,7 +2,7 @@ authors.workspace = true description = "EVM transaction from the runtime." edition.workspace = true -name = "darwinia-runtime-transact" +name = "darwinia-ethtx-forwarder" readme = "README.md" version.workspace = true diff --git a/pallet/runtime-transact/src/lib.rs b/pallet/ethtx-forwarder/src/lib.rs similarity index 90% rename from pallet/runtime-transact/src/lib.rs rename to pallet/ethtx-forwarder/src/lib.rs index 46c2e0976..4ee7eddd5 100644 --- a/pallet/runtime-transact/src/lib.rs +++ b/pallet/ethtx-forwarder/src/lib.rs @@ -44,22 +44,22 @@ use sp_std::boxed::Box; pub use pallet::*; #[derive(Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] -pub enum RuntimeEthOrigin { - RuntimeTransact(H160), +pub enum ForwardEthOrigin { + ForwardEth(H160), } -pub fn ensure_runtime_transact(o: OuterOrigin) -> Result +pub fn ensure_forward_transact(o: OuterOrigin) -> Result where - OuterOrigin: Into>, + OuterOrigin: Into>, { match o.into() { - Ok(RuntimeEthOrigin::RuntimeTransact(n)) => Ok(n), + Ok(ForwardEthOrigin::ForwardEth(n)) => Ok(n), _ => Err("bad origin: expected to be an runtime eth origin"), } } pub struct EnsureRuntimeEthOrigin; -impl> + From> EnsureOrigin +impl> + From> EnsureOrigin for EnsureRuntimeEthOrigin { type Success = H160; @@ -70,13 +70,13 @@ impl> + From> EnsureOrigin fn try_origin(o: O) -> Result { o.into().map(|o| match o { - RuntimeEthOrigin::RuntimeTransact(id) => id, + ForwardEthOrigin::ForwardEth(id) => id, }) } #[cfg(feature = "runtime-benchmarks")] fn try_successful_origin() -> Result { - Ok(O::from(RuntimeEthOrigin::RuntimeTransact(Default::default()))) + Ok(O::from(ForwardEthOrigin::ForwardEth(Default::default()))) } } @@ -90,14 +90,14 @@ pub mod pallet { pub struct Pallet(_); #[pallet::origin] - pub type Origin = RuntimeEthOrigin; + pub type Origin = ForwardEthOrigin; #[pallet::config] pub trait Config: frame_system::Config + pallet_evm::Config { /// Handler for applying an already validated transaction type ValidatedTransaction: ValidatedTransaction; - /// Origin for the runtime transact - type RuntimeEthOrigin: EnsureOrigin; + /// Origin for the forward eth transaction + type ForwardEthOrigin: EnsureOrigin; } #[pallet::error] @@ -109,7 +109,7 @@ pub mod pallet { #[pallet::call] impl Pallet where - OriginFor: Into>>, + OriginFor: Into>>, { //This call can only be used at runtime and is not available to EOA users. #[pallet::call_index(0)] @@ -119,11 +119,11 @@ pub mod pallet { transaction_data.gas_limit.unique_saturated_into() }, true) })] - pub fn runtime_transact( + pub fn forward_transact( origin: OriginFor, mut transaction: Box, ) -> DispatchResultWithPostInfo { - let source = ensure_runtime_transact(origin)?; + let source = ensure_forward_transact(origin)?; let (who, _) = pallet_evm::Pallet::::account_basic(&source); let base_fee = T::FeeCalculator::min_gas_price().0; diff --git a/pallet/runtime-transact/src/mock.rs b/pallet/ethtx-forwarder/src/mock.rs similarity index 98% rename from pallet/runtime-transact/src/mock.rs rename to pallet/ethtx-forwarder/src/mock.rs index 66956a69e..c8670f839 100644 --- a/pallet/runtime-transact/src/mock.rs +++ b/pallet/ethtx-forwarder/src/mock.rs @@ -18,7 +18,7 @@ //! Test utilities -pub use crate as darwinia_runtime_transact; +pub use crate as darwinia_ethtx_forwarder; // crates.io use sha3::Digest; @@ -131,7 +131,7 @@ impl pallet_ethereum::Config for Runtime { } impl crate::Config for Runtime { - type RuntimeEthOrigin = crate::EnsureRuntimeEthOrigin; + type ForwardEthOrigin = crate::EnsureRuntimeEthOrigin; type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; } @@ -142,7 +142,7 @@ frame_support::construct_runtime! { Balances: pallet_balances, EVM: pallet_evm, Ethereum: pallet_ethereum, - RuntimeTransact: darwinia_runtime_transact, + EthTxForwarder: darwinia_ethtx_forwarder, } } diff --git a/pallet/runtime-transact/src/tests/eip1559.rs b/pallet/ethtx-forwarder/src/tests/eip1559.rs similarity index 86% rename from pallet/runtime-transact/src/tests/eip1559.rs rename to pallet/ethtx-forwarder/src/tests/eip1559.rs index bc7b75131..6923fedda 100644 --- a/pallet/runtime-transact/src/tests/eip1559.rs +++ b/pallet/ethtx-forwarder/src/tests/eip1559.rs @@ -17,7 +17,7 @@ // along with Darwinia. If not, see . // darwinia -use crate::{mock::*, tests::*, RuntimeEthOrigin}; +use crate::{mock::*, tests::*, ForwardEthOrigin}; use ethereum::EIP1559Transaction; // frontier use fp_evm::FeeCalculator; @@ -48,8 +48,8 @@ fn test_eip1559_transaction_works() { .execute_with(|| { let unsigned_tx = eip1559_erc20_creation_unsigned_transaction(); let t = unsigned_tx.sign(&alice.private_key, None); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -70,8 +70,8 @@ fn test_eip1559_transaction_with_auto_nonce() { unsigned_tx.nonce = U256::MAX; let t = unsigned_tx.sign(&alice.private_key, None); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -93,8 +93,8 @@ fn test_eip1559_transaction_with_auto_gas_price() { ::FeeCalculator::min_gas_price().0 - 1; let t = unsigned_tx.sign(&alice.private_key, None); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -111,8 +111,8 @@ fn test_eip1559_transaction_with_sufficient_balance() { let t = unsigned_tx.sign(&alice.private_key, None); assert_err!( - RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t.clone()) ), DispatchError::Module(ModuleError { @@ -122,10 +122,10 @@ fn test_eip1559_transaction_with_sufficient_balance() { }) ); - let fee = RuntimeTransact::total_payment((&t).into()); + let fee = EthTxForwarder::total_payment((&t).into()); let _ = Balances::deposit_creating(&alice.address, fee.as_u64()); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -165,8 +165,8 @@ fn test_eip1559_transaction_with_valid_signature() { 213, 144, 24, 205, 4, 67, 173, 192, 144, 53, 144, 193, 107, 2, 176, ]), }; - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(Transaction::EIP1559(t)) )); diff --git a/pallet/runtime-transact/src/tests/eip2930.rs b/pallet/ethtx-forwarder/src/tests/eip2930.rs similarity index 86% rename from pallet/runtime-transact/src/tests/eip2930.rs rename to pallet/ethtx-forwarder/src/tests/eip2930.rs index 82658205b..b686dc93c 100644 --- a/pallet/runtime-transact/src/tests/eip2930.rs +++ b/pallet/ethtx-forwarder/src/tests/eip2930.rs @@ -17,7 +17,7 @@ // along with Darwinia. If not, see . // darwinia -use crate::{mock::*, tests::*, RuntimeEthOrigin}; +use crate::{mock::*, tests::*, ForwardEthOrigin}; use ethereum::EIP2930Transaction; // frontier use fp_evm::FeeCalculator; @@ -48,8 +48,8 @@ fn test_eip2930_transaction_works() { let unsigned_tx = eip2930_erc20_creation_unsigned_transaction(); let t = unsigned_tx.sign(&alice.private_key, None); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -70,8 +70,8 @@ fn test_eip2930_transaction_with_auto_nonce() { unsigned_tx.nonce = U256::MAX; let t = unsigned_tx.sign(&alice.private_key, None); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -92,8 +92,8 @@ fn test_eip2930_transaction_with_auto_gas_price() { unsigned_tx.gas_price = ::FeeCalculator::min_gas_price().0 - 1; let t = unsigned_tx.sign(&alice.private_key, None); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -110,8 +110,8 @@ fn test_eip2930_transaction_with_sufficient_balance() { let t = unsigned_tx.sign(&alice.private_key, None); assert_err!( - RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t.clone()) ), DispatchError::Module(ModuleError { @@ -121,10 +121,10 @@ fn test_eip2930_transaction_with_sufficient_balance() { }) ); - let fee = RuntimeTransact::total_payment((&t).into()); + let fee = EthTxForwarder::total_payment((&t).into()); let _ = Balances::deposit_creating(&alice.address, fee.as_u64()); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -163,8 +163,8 @@ fn test_eip2930_transaction_with_valid_signature() { 213, 144, 24, 205, 4, 67, 173, 192, 144, 53, 144, 193, 107, 2, 176, ]), }; - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(Transaction::EIP2930(t)) )); diff --git a/pallet/runtime-transact/src/tests/legacy.rs b/pallet/ethtx-forwarder/src/tests/legacy.rs similarity index 85% rename from pallet/runtime-transact/src/tests/legacy.rs rename to pallet/ethtx-forwarder/src/tests/legacy.rs index 4c2bf3556..2fe15ecdd 100644 --- a/pallet/runtime-transact/src/tests/legacy.rs +++ b/pallet/ethtx-forwarder/src/tests/legacy.rs @@ -17,7 +17,7 @@ // along with Darwinia. If not, see . // darwinia -use crate::{mock::*, tests::*, RuntimeEthOrigin}; +use crate::{mock::*, tests::*, ForwardEthOrigin}; use ethereum::LegacyTransaction; // frontier use fp_evm::FeeCalculator; @@ -46,8 +46,8 @@ fn test_legacy_transaction_works() { .execute_with(|| { let t = legacy_erc20_creation_unsigned_transaction().sign(&alice.private_key); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -67,8 +67,8 @@ fn test_legacy_transaction_with_auto_nonce() { unsigned_tx.nonce = U256::MAX; let t = unsigned_tx.sign(&alice.private_key); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -89,8 +89,8 @@ fn test_legacy_transaction_with_auto_gas_price() { ::FeeCalculator::min_gas_price().0 - 1; let t = unsigned_tx.sign(&alice.private_key); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -105,8 +105,8 @@ fn test_legacy_transaction_with_sufficient_balance() { ExtBuilder::default().build().execute_with(|| { let t = legacy_erc20_creation_unsigned_transaction().sign(&alice.private_key); assert_err!( - RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t.clone()) ), DispatchError::Module(ModuleError { @@ -116,10 +116,10 @@ fn test_legacy_transaction_with_sufficient_balance() { }) ); - let fee = RuntimeTransact::total_payment((&t).into()); + let fee = EthTxForwarder::total_payment((&t).into()); let _ = Balances::deposit_creating(&alice.address, fee.as_u64()); - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(t) )); assert!(System::events() @@ -155,8 +155,8 @@ fn test_legacy_transaction_with_valid_signature() { ) .unwrap(), }; - assert_ok!(RuntimeTransact::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(alice.address).into(), + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), Box::new(Transaction::Legacy(t)) )); diff --git a/pallet/runtime-transact/src/tests/mod.rs b/pallet/ethtx-forwarder/src/tests/mod.rs similarity index 100% rename from pallet/runtime-transact/src/tests/mod.rs rename to pallet/ethtx-forwarder/src/tests/mod.rs diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index 04e7dc00a..377ae2bdd 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -15,7 +15,7 @@ log = { workspace = true } scale-info = { workspace = true } # darwinia -darwinia-runtime-transact = { workspace = true } +darwinia-ethtx-forwarder = { workspace = true } darwinia-staking-traits = { workspace = true } dc-types = { workspace = true } # darwinia optional @@ -60,7 +60,7 @@ std = [ "scale-info/std", # darwinia - "darwinia-runtime-transact/std", + "darwinia-ethtx-forwarder/std", "darwinia-staking-traits/std", # darwinia optional "darwinia-deposit?/std", @@ -81,7 +81,7 @@ std = [ runtime-benchmarks = [ # darwinia "darwinia-deposit", - "darwinia-runtime-transact/runtime-benchmarks", + "darwinia-ethtx-forwarder/runtime-benchmarks", "darwinia-staking-traits/runtime-benchmarks", # substrate @@ -94,7 +94,7 @@ runtime-benchmarks = [ try-runtime = [ # darwinia - "darwinia-runtime-transact/try-runtime", + "darwinia-ethtx-forwarder/try-runtime", # substrate "frame-support/try-runtime", "frame-system/try-runtime", diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 25db14d10..d42b7167a 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -56,7 +56,7 @@ use ethereum::{ LegacyTransaction, TransactionAction, TransactionSignature, TransactionV2 as Transaction, }; // darwinia -use darwinia_runtime_transact::RuntimeEthOrigin; +use darwinia_ethtx_forwarder::ForwardEthOrigin; use dc_types::{Balance, Moment}; // substrate use frame_support::{ @@ -1278,8 +1278,8 @@ impl KtonStakerNotification for () {} pub struct KtonStakerNotifier(PhantomData); impl KtonStakerNotification for KtonStakerNotifier where - T: Config + darwinia_runtime_transact::Config, - T::RuntimeOrigin: Into> + From, + T: Config + darwinia_ethtx_forwarder::Config, + T::RuntimeOrigin: Into> + From, ::AccountId: Into, { fn notify(amount: Balance) { @@ -1331,8 +1331,8 @@ where let sender = H160([115, 99, 47, 107, 116, 115, 116, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); - if let Err(e) = >::runtime_transact( - RuntimeEthOrigin::RuntimeTransact(sender).into(), + if let Err(e) = >::forward_transact( + ForwardEthOrigin::ForwardEth(sender).into(), Box::new(Transaction::Legacy(notify_transaction)), ) { log::error!("[pallet::staking] failed to notify KTON staker contract due to {e:?}"); diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index ce499c8b4..f4732d267 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -37,12 +37,12 @@ cumulus-pallet-session-benchmarking = { workspace = true, optional = true } darwinia-account-migration = { workspace = true } darwinia-common-runtime = { workspace = true } darwinia-deposit = { workspace = true } +darwinia-ethtx-forwarder = { workspace = true } darwinia-precompile-assets = { workspace = true } darwinia-precompile-bls12-381 = { workspace = true } darwinia-precompile-deposit = { workspace = true } darwinia-precompile-staking = { workspace = true } darwinia-precompile-state-storage = { workspace = true } -darwinia-runtime-transact = { workspace = true } darwinia-staking = { workspace = true } dc-primitives = { workspace = true } @@ -150,12 +150,12 @@ std = [ "darwinia-account-migration/std", "darwinia-common-runtime/std", "darwinia-deposit/std", + "darwinia-ethtx-forwarder/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", "darwinia-precompile-deposit/std", "darwinia-precompile-staking/std", "darwinia-precompile-state-storage/std", - "darwinia-runtime-transact/std", "darwinia-staking/std", "dc-primitives/std", @@ -261,9 +261,9 @@ runtime-benchmarks = [ "darwinia-account-migration/runtime-benchmarks", "darwinia-common-runtime/runtime-benchmarks", "darwinia-deposit/runtime-benchmarks", + "darwinia-ethtx-forwarder/runtime-benchmarks", "darwinia-precompile-assets/runtime-benchmarks", "darwinia-precompile-staking/runtime-benchmarks", - "darwinia-runtime-transact/runtime-benchmarks", "darwinia-staking/runtime-benchmarks", # frontier @@ -318,7 +318,7 @@ try-runtime = [ # darwinia "darwinia-account-migration/try-runtime", "darwinia-deposit/try-runtime", - "darwinia-runtime-transact/try-runtime", + "darwinia-ethtx-forwarder/try-runtime", "darwinia-staking/try-runtime", # frontier diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index f8a28726f..d11558c51 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -159,7 +159,7 @@ frame_support::construct_runtime! { // EVM stuff. Ethereum: pallet_ethereum = 36, EVM: pallet_evm = 37, - RuntimeTransact: darwinia_runtime_transact = 38, + EthTxForwarder: darwinia_ethtx_forwarder = 38, // // Crab <> Darwinia // BridgePolkadotGrandpa: pallet_bridge_grandpa:: = 39, diff --git a/runtime/crab/src/pallets.rs b/runtime/crab/src/pallets.rs index af325567e..7b4336f93 100644 --- a/runtime/crab/src/pallets.rs +++ b/runtime/crab/src/pallets.rs @@ -93,4 +93,4 @@ mod ethereum; mod evm; pub use evm::*; -mod runtime_transact; +mod ethtx_forwarder; diff --git a/runtime/crab/src/pallets/runtime_transact.rs b/runtime/crab/src/pallets/ethtx_forwarder.rs similarity index 86% rename from runtime/crab/src/pallets/runtime_transact.rs rename to runtime/crab/src/pallets/ethtx_forwarder.rs index 0a7021e8e..6dca72ed0 100644 --- a/runtime/crab/src/pallets/runtime_transact.rs +++ b/runtime/crab/src/pallets/ethtx_forwarder.rs @@ -19,7 +19,7 @@ // darwinia use crate::*; -impl darwinia_runtime_transact::Config for Runtime { - type RuntimeEthOrigin = darwinia_runtime_transact::EnsureRuntimeEthOrigin; +impl darwinia_ethtx_forwarder::Config for Runtime { + type ForwardEthOrigin = darwinia_ethtx_forwarder::EnsureRuntimeEthOrigin; type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; } diff --git a/runtime/crab/src/pallets/evm.rs b/runtime/crab/src/pallets/evm.rs index 7dab8c4e5..03637cadd 100644 --- a/runtime/crab/src/pallets/evm.rs +++ b/runtime/crab/src/pallets/evm.rs @@ -200,7 +200,7 @@ impl DispatchValidateT for DarwiniaDispatchValidator { | RuntimeCall::Vesting(..) | RuntimeCall::Ethereum(..) | RuntimeCall::EVM(..) - | RuntimeCall::RuntimeTransact(..) + | RuntimeCall::EthTxForwarder(..) ) { Some(fp_evm::PrecompileFailure::Error { exit_status: ExitError::Other( diff --git a/runtime/crab/src/pallets/tx_pause.rs b/runtime/crab/src/pallets/tx_pause.rs index eca02b5d6..8ba9ef09a 100644 --- a/runtime/crab/src/pallets/tx_pause.rs +++ b/runtime/crab/src/pallets/tx_pause.rs @@ -43,12 +43,7 @@ impl frame_support::traits::Contains | b"Deposit" | b"AccountMigration" | b"DarwiniaStaking" | b"Ethereum" | b"EVM" - | b"RuntimeTransact" - | b"BridgePolkadotGrandpa" - | b"BridgePolkadotParachain" - | b"BridgeDarwiniaMessages" - | b"BridgeDarwiniaDispatch" - | b"DarwiniaFeeMarket" + | b"EthTxForwarder" ) } } diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 5108ec008..2df23fd47 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -45,7 +45,7 @@ darwinia-precompile-bls12-381 = { workspace = true } darwinia-precompile-deposit = { workspace = true } darwinia-precompile-staking = { workspace = true } darwinia-precompile-state-storage = { workspace = true } -darwinia-runtime-transact = { workspace = true } +darwinia-ethtx-forwarder = { workspace = true } darwinia-staking = { workspace = true } dc-inflation = { workspace = true } dc-primitives = { workspace = true } @@ -162,13 +162,13 @@ std = [ "darwinia-common-runtime/std", "darwinia-deposit/std", "darwinia-ecdsa-authority/std", + "darwinia-ethtx-forwarder/std", "darwinia-message-gadget/std", "darwinia-precompile-assets/std", "darwinia-precompile-bls12-381/std", "darwinia-precompile-deposit/std", "darwinia-precompile-staking/std", "darwinia-precompile-state-storage/std", - "darwinia-runtime-transact/std", "darwinia-staking/std", "dc-inflation/std", "dc-primitives/std", @@ -282,9 +282,9 @@ runtime-benchmarks = [ "darwinia-common-runtime/runtime-benchmarks", "darwinia-deposit/runtime-benchmarks", "darwinia-ecdsa-authority/runtime-benchmarks", + "darwinia-ethtx-forwarder/runtime-benchmarks", "darwinia-precompile-assets/runtime-benchmarks", "darwinia-precompile-staking/runtime-benchmarks", - "darwinia-runtime-transact/runtime-benchmarks", "darwinia-staking/runtime-benchmarks", # frontier @@ -346,8 +346,8 @@ try-runtime = [ "darwinia-asset-limit/try-runtime", "darwinia-deposit/try-runtime", "darwinia-ecdsa-authority/try-runtime", + "darwinia-ethtx-forwarder/try-runtime", "darwinia-message-gadget/try-runtime", - "darwinia-runtime-transact/try-runtime", "darwinia-staking/try-runtime", # frontier diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 217f47c9a..235f340f9 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -163,7 +163,7 @@ frame_support::construct_runtime! { // EVM stuff. Ethereum: pallet_ethereum = 36, EVM: pallet_evm = 37, - RuntimeTransact: darwinia_runtime_transact = 38, + EthTxForwarder: darwinia_ethtx_forwarder = 38, // // Darwinia <> Crab // BridgeKusamaGrandpa: pallet_bridge_grandpa:: = 39, diff --git a/runtime/darwinia/src/pallets.rs b/runtime/darwinia/src/pallets.rs index d18ef280a..f00825062 100644 --- a/runtime/darwinia/src/pallets.rs +++ b/runtime/darwinia/src/pallets.rs @@ -105,4 +105,4 @@ mod ethereum; mod evm; pub use evm::*; -mod runtime_transact; +mod ethtx_forwarder; diff --git a/runtime/darwinia/src/pallets/runtime_transact.rs b/runtime/darwinia/src/pallets/ethtx_forwarder.rs similarity index 86% rename from runtime/darwinia/src/pallets/runtime_transact.rs rename to runtime/darwinia/src/pallets/ethtx_forwarder.rs index 0a7021e8e..6dca72ed0 100644 --- a/runtime/darwinia/src/pallets/runtime_transact.rs +++ b/runtime/darwinia/src/pallets/ethtx_forwarder.rs @@ -19,7 +19,7 @@ // darwinia use crate::*; -impl darwinia_runtime_transact::Config for Runtime { - type RuntimeEthOrigin = darwinia_runtime_transact::EnsureRuntimeEthOrigin; +impl darwinia_ethtx_forwarder::Config for Runtime { + type ForwardEthOrigin = darwinia_ethtx_forwarder::EnsureRuntimeEthOrigin; type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; } diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 80e320dcd..9fac4301e 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -201,7 +201,7 @@ impl DispatchValidateT for DarwiniaDispatchValidator { | RuntimeCall::Vesting(..) | RuntimeCall::Ethereum(..) | RuntimeCall::EVM(..) - | RuntimeCall::RuntimeTransact(..) + | RuntimeCall::EthTxForwarder(..) ) { Some(fp_evm::PrecompileFailure::Error { exit_status: ExitError::Other( diff --git a/runtime/darwinia/src/pallets/tx_pause.rs b/runtime/darwinia/src/pallets/tx_pause.rs index eca02b5d6..8ba9ef09a 100644 --- a/runtime/darwinia/src/pallets/tx_pause.rs +++ b/runtime/darwinia/src/pallets/tx_pause.rs @@ -43,12 +43,7 @@ impl frame_support::traits::Contains | b"Deposit" | b"AccountMigration" | b"DarwiniaStaking" | b"Ethereum" | b"EVM" - | b"RuntimeTransact" - | b"BridgePolkadotGrandpa" - | b"BridgePolkadotParachain" - | b"BridgeDarwiniaMessages" - | b"BridgeDarwiniaDispatch" - | b"DarwiniaFeeMarket" + | b"EthTxForwarder" ) } } diff --git a/runtime/pangolin/Cargo.toml b/runtime/pangolin/Cargo.toml index 89bb3884c..675ff5173 100644 --- a/runtime/pangolin/Cargo.toml +++ b/runtime/pangolin/Cargo.toml @@ -44,7 +44,7 @@ darwinia-precompile-bls12-381 = { workspace = true } darwinia-precompile-deposit = { workspace = true } darwinia-precompile-staking = { workspace = true } darwinia-precompile-state-storage = { workspace = true } -darwinia-runtime-transact = { workspace = true } +darwinia-ethtx-forwarder = { workspace = true } darwinia-staking = { workspace = true } dc-primitives = { workspace = true } @@ -167,7 +167,7 @@ std = [ "darwinia-precompile-deposit/std", "darwinia-precompile-staking/std", "darwinia-precompile-state-storage/std", - "darwinia-runtime-transact/std", + "darwinia-ethtx-forwarder/std", "darwinia-staking/std", "dc-primitives/std", @@ -282,7 +282,7 @@ runtime-benchmarks = [ "darwinia-ecdsa-authority/runtime-benchmarks", "darwinia-precompile-assets/runtime-benchmarks", "darwinia-precompile-staking/runtime-benchmarks", - "darwinia-runtime-transact/runtime-benchmarks", + "darwinia-ethtx-forwarder/runtime-benchmarks", "darwinia-staking/runtime-benchmarks", # frontier @@ -345,7 +345,7 @@ try-runtime = [ "darwinia-deposit/try-runtime", "darwinia-ecdsa-authority/try-runtime", "darwinia-message-gadget/try-runtime", - "darwinia-runtime-transact/try-runtime", + "darwinia-ethtx-forwarder/try-runtime", "darwinia-staking/try-runtime", # moonbeam diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 927a0808d..8d79ca2fb 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -164,7 +164,7 @@ frame_support::construct_runtime! { // EVM stuff. Ethereum: pallet_ethereum = 36, EVM: pallet_evm = 37, - RuntimeTransact: darwinia_runtime_transact = 38, + EthTxForwarder: darwinia_ethtx_forwarder = 38, // // Pangolin <> Pangoro // BridgeMoonbaseGrandpa: pallet_bridge_grandpa:: = 39, diff --git a/runtime/pangolin/src/pallets.rs b/runtime/pangolin/src/pallets.rs index 5509ab8d2..40d1c6331 100644 --- a/runtime/pangolin/src/pallets.rs +++ b/runtime/pangolin/src/pallets.rs @@ -105,4 +105,4 @@ mod ethereum; mod evm; pub use evm::*; -mod runtime_transact; +mod ethtx_forwarder; diff --git a/runtime/pangolin/src/pallets/runtime_transact.rs b/runtime/pangolin/src/pallets/ethtx_forwarder.rs similarity index 86% rename from runtime/pangolin/src/pallets/runtime_transact.rs rename to runtime/pangolin/src/pallets/ethtx_forwarder.rs index 0a7021e8e..6dca72ed0 100644 --- a/runtime/pangolin/src/pallets/runtime_transact.rs +++ b/runtime/pangolin/src/pallets/ethtx_forwarder.rs @@ -19,7 +19,7 @@ // darwinia use crate::*; -impl darwinia_runtime_transact::Config for Runtime { - type RuntimeEthOrigin = darwinia_runtime_transact::EnsureRuntimeEthOrigin; +impl darwinia_ethtx_forwarder::Config for Runtime { + type ForwardEthOrigin = darwinia_ethtx_forwarder::EnsureRuntimeEthOrigin; type ValidatedTransaction = pallet_ethereum::ValidatedTransaction; } diff --git a/runtime/pangolin/src/pallets/evm.rs b/runtime/pangolin/src/pallets/evm.rs index cb1f36fc7..f49057d75 100644 --- a/runtime/pangolin/src/pallets/evm.rs +++ b/runtime/pangolin/src/pallets/evm.rs @@ -218,7 +218,7 @@ impl DispatchValidateT for DarwiniaDispatchValidator { RuntimeCall::Assets(..) | RuntimeCall::Ethereum(..) | RuntimeCall::EVM(..) - | RuntimeCall::RuntimeTransact(..) + | RuntimeCall::EthTxForwarder(..) ) { Some(fp_evm::PrecompileFailure::Error { exit_status: ExitError::Other( diff --git a/runtime/pangolin/src/pallets/tx_pause.rs b/runtime/pangolin/src/pallets/tx_pause.rs index eca02b5d6..8ba9ef09a 100644 --- a/runtime/pangolin/src/pallets/tx_pause.rs +++ b/runtime/pangolin/src/pallets/tx_pause.rs @@ -43,12 +43,7 @@ impl frame_support::traits::Contains | b"Deposit" | b"AccountMigration" | b"DarwiniaStaking" | b"Ethereum" | b"EVM" - | b"RuntimeTransact" - | b"BridgePolkadotGrandpa" - | b"BridgePolkadotParachain" - | b"BridgeDarwiniaMessages" - | b"BridgeDarwiniaDispatch" - | b"DarwiniaFeeMarket" + | b"EthTxForwarder" ) } }