From 27ca2d039cf97f4089afdb06eb717dd25d011e57 Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 20 Jan 2025 14:50:45 +1000 Subject: [PATCH] Rename pallet_evm_nonce_tracker to pallet-evm-tracker --- Cargo.lock | 30 +++++++++---------- crates/sp-domains/src/lib.rs | 6 ++-- .../Cargo.toml | 2 +- .../src/check_nonce.rs | 0 .../src/lib.rs | 0 domains/runtime/evm/Cargo.toml | 4 +-- domains/runtime/evm/src/lib.rs | 12 ++++---- domains/test/runtime/evm/Cargo.toml | 4 +-- domains/test/runtime/evm/src/lib.rs | 8 ++--- 9 files changed, 33 insertions(+), 33 deletions(-) rename domains/pallets/{evm_nonce_tracker => evm-tracker}/Cargo.toml (97%) rename domains/pallets/{evm_nonce_tracker => evm-tracker}/src/check_nonce.rs (100%) rename domains/pallets/{evm_nonce_tracker => evm-tracker}/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 9f7c9770c4..e3322e8479 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3255,10 +3255,10 @@ dependencies = [ "pallet-ethereum", "pallet-evm", "pallet-evm-chain-id", - "pallet-evm-nonce-tracker", "pallet-evm-precompile-modexp", "pallet-evm-precompile-sha3fips", "pallet-evm-precompile-simple", + "pallet-evm-tracker", "pallet-messenger", "pallet-timestamp", "pallet-transaction-payment", @@ -3312,10 +3312,10 @@ dependencies = [ "pallet-ethereum", "pallet-evm", "pallet-evm-chain-id", - "pallet-evm-nonce-tracker", "pallet-evm-precompile-modexp", "pallet-evm-precompile-sha3fips", "pallet-evm-precompile-simple", + "pallet-evm-tracker", "pallet-messenger", "pallet-timestamp", "pallet-transaction-payment", @@ -7768,19 +7768,6 @@ dependencies = [ "scale-info", ] -[[package]] -name = "pallet-evm-nonce-tracker" -version = "0.1.0" -dependencies = [ - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-domains", - "sp-runtime", -] - [[package]] name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" @@ -7809,6 +7796,19 @@ dependencies = [ "sp-io", ] +[[package]] +name = "pallet-evm-tracker" +version = "0.1.0" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-domains", + "sp-runtime", +] + [[package]] name = "pallet-messenger" version = "0.1.0" diff --git a/crates/sp-domains/src/lib.rs b/crates/sp-domains/src/lib.rs index 2a58743fb3..a132f68c5e 100644 --- a/crates/sp-domains/src/lib.rs +++ b/crates/sp-domains/src/lib.rs @@ -1074,10 +1074,10 @@ pub(crate) fn evm_chain_id_storage_key() -> StorageKey { pub(crate) fn evm_contract_creation_allowed_by_storage_key() -> StorageKey { StorageKey( storage_prefix( - // This is the name used for `pallet_evm_nonce_tracker` in the `construct_runtime` macro - // i.e. `EVMNoncetracker: pallet_evm_nonce_tracker = 84,` + // This is the name used for `pallet_evm_tracker` in the `construct_runtime` macro + // i.e. `EVMNoncetracker: pallet_evm_tracker = 84,` "EVMNoncetracker".as_bytes(), - // This is the storage item name used inside `pallet_evm_nonce_tracker` + // This is the storage item name used inside `pallet_evm_tracker` "ContractCreationAllowedBy".as_bytes(), ) .to_vec(), diff --git a/domains/pallets/evm_nonce_tracker/Cargo.toml b/domains/pallets/evm-tracker/Cargo.toml similarity index 97% rename from domains/pallets/evm_nonce_tracker/Cargo.toml rename to domains/pallets/evm-tracker/Cargo.toml index 2ba104e25f..98aa4bd251 100644 --- a/domains/pallets/evm_nonce_tracker/Cargo.toml +++ b/domains/pallets/evm-tracker/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pallet-evm-nonce-tracker" +name = "pallet-evm-tracker" version = "0.1.0" authors = ["Subspace Labs "] edition = "2021" diff --git a/domains/pallets/evm_nonce_tracker/src/check_nonce.rs b/domains/pallets/evm-tracker/src/check_nonce.rs similarity index 100% rename from domains/pallets/evm_nonce_tracker/src/check_nonce.rs rename to domains/pallets/evm-tracker/src/check_nonce.rs diff --git a/domains/pallets/evm_nonce_tracker/src/lib.rs b/domains/pallets/evm-tracker/src/lib.rs similarity index 100% rename from domains/pallets/evm_nonce_tracker/src/lib.rs rename to domains/pallets/evm-tracker/src/lib.rs diff --git a/domains/runtime/evm/Cargo.toml b/domains/runtime/evm/Cargo.toml index 6fecb2f63f..5040adb3c0 100644 --- a/domains/runtime/evm/Cargo.toml +++ b/domains/runtime/evm/Cargo.toml @@ -37,7 +37,7 @@ pallet-domain-sudo = { version = "0.1.0", path = "../../pallets/domain-sudo", de pallet-ethereum = { default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } pallet-evm = { version = "6.0.0-dev", default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } pallet-evm-chain-id = { version = "1.0.0-dev", default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } -pallet-evm-nonce-tracker = { version = "0.1.0", path = "../../pallets/evm_nonce_tracker", default-features = false } +pallet-evm-tracker = { version = "0.1.0", path = "../../pallets/evm-tracker", default-features = false } pallet-evm-precompile-modexp = { version = "2.0.0-dev", default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } pallet-evm-precompile-sha3fips = { version = "2.0.0-dev", default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } pallet-evm-precompile-simple = { version = "2.0.0-dev", default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } @@ -99,7 +99,7 @@ std = [ "pallet-ethereum/std", "pallet-evm/std", "pallet-evm-chain-id/std", - "pallet-evm-nonce-tracker/std", + "pallet-evm-tracker/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-sha3fips/std", "pallet-evm-precompile-simple/std", diff --git a/domains/runtime/evm/src/lib.rs b/domains/runtime/evm/src/lib.rs index f675d9398c..19f735b292 100644 --- a/domains/runtime/evm/src/lib.rs +++ b/domains/runtime/evm/src/lib.rs @@ -126,7 +126,7 @@ type CustomSignedExtra = ( frame_system::CheckTxVersion, frame_system::CheckGenesis, frame_system::CheckMortality, - pallet_evm_nonce_tracker::CheckNonce, + pallet_evm_tracker::CheckNonce, domain_check_weight::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, CheckContractCreation, @@ -155,7 +155,7 @@ const MAX_CONTRACT_RECURSION_DEPTH: u16 = 5; /// Otherwise, returns true. pub fn is_create_contract_allowed(call: &RuntimeCall, signer: &AccountId) -> bool { // Only enter recursive code if this account can't create contracts - if !pallet_evm_nonce_tracker::Pallet::::is_allowed_to_create_contracts(signer) + if !pallet_evm_tracker::Pallet::::is_allowed_to_create_contracts(signer) && is_create_contract(call, MAX_CONTRACT_RECURSION_DEPTH) { return false; @@ -170,7 +170,7 @@ pub fn is_create_contract_allowed(call: &RuntimeCall, signer: &AccountId) -> boo /// list. Otherwise, returns true. pub fn is_create_unsigned_contract_allowed(call: &RuntimeCall) -> bool { // Only enter recursive code if unsigned contracts can't be created - if !pallet_evm_nonce_tracker::Pallet::::is_allowed_to_create_unsigned_contracts() + if !pallet_evm_tracker::Pallet::::is_allowed_to_create_unsigned_contracts() && is_create_contract(call, MAX_CONTRACT_RECURSION_DEPTH) { return false; @@ -835,7 +835,7 @@ impl pallet_evm::Config for Runtime { type WeightInfo = pallet_evm::weights::SubstrateWeight; } -impl pallet_evm_nonce_tracker::Config for Runtime {} +impl pallet_evm_tracker::Config for Runtime {} parameter_types! { pub const PostOnlyBlockHash: PostLogContent = PostLogContent::OnlyBlockHash; @@ -933,7 +933,7 @@ construct_runtime!( EVM: pallet_evm = 81, EVMChainId: pallet_evm_chain_id = 82, BaseFee: pallet_base_fee = 83, - EVMNoncetracker: pallet_evm_nonce_tracker = 84, + EVMNoncetracker: pallet_evm_tracker = 84, // domain instance stuff SelfDomainId: pallet_domain_id = 90, @@ -1156,7 +1156,7 @@ fn check_transaction_and_do_pre_dispatch_inner( extra.2, extra.3, extra.4, - pallet_evm_nonce_tracker::CheckNonce::from(extra.5 .0), + pallet_evm_tracker::CheckNonce::from(extra.5 .0), extra.6, extra.7, extra.8, diff --git a/domains/test/runtime/evm/Cargo.toml b/domains/test/runtime/evm/Cargo.toml index 2f26410460..ce8a6e8fb9 100644 --- a/domains/test/runtime/evm/Cargo.toml +++ b/domains/test/runtime/evm/Cargo.toml @@ -36,7 +36,7 @@ pallet-domain-sudo = { version = "0.1.0", path = "../../../pallets/domain-sudo", pallet-ethereum = { default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } pallet-evm = { version = "6.0.0-dev", default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } pallet-evm-chain-id = { version = "1.0.0-dev", default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } -pallet-evm-nonce-tracker = { version = "0.1.0", path = "../../../pallets/evm_nonce_tracker", default-features = false } +pallet-evm-tracker = { version = "0.1.0", path = "../../../pallets/evm-tracker", default-features = false } pallet-evm-precompile-modexp = { version = "2.0.0-dev", default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } pallet-evm-precompile-sha3fips = { version = "2.0.0-dev", default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } pallet-evm-precompile-simple = { version = "2.0.0-dev", default-features = false, git = "https://github.com/autonomys/frontier", rev = "f80f9e2bad338f3bf3854b256b3c4edea23e5968" } @@ -93,7 +93,7 @@ std = [ "pallet-ethereum/std", "pallet-evm/std", "pallet-evm-chain-id/std", - "pallet-evm-nonce-tracker/std", + "pallet-evm-tracker/std", "pallet-evm-precompile-modexp/std", "pallet-evm-precompile-sha3fips/std", "pallet-evm-precompile-simple/std", diff --git a/domains/test/runtime/evm/src/lib.rs b/domains/test/runtime/evm/src/lib.rs index a46ad36a43..bc93dddb52 100644 --- a/domains/test/runtime/evm/src/lib.rs +++ b/domains/test/runtime/evm/src/lib.rs @@ -130,7 +130,7 @@ type CustomSignedExtra = ( frame_system::CheckTxVersion, frame_system::CheckGenesis, frame_system::CheckMortality, - pallet_evm_nonce_tracker::CheckNonce, + pallet_evm_tracker::CheckNonce, domain_check_weight::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, ); @@ -645,7 +645,7 @@ impl pallet_evm::OnChargeEVMTransaction for EVMCurrencyAdapter { } } -impl pallet_evm_nonce_tracker::Config for Runtime {} +impl pallet_evm_tracker::Config for Runtime {} impl pallet_evm::Config for Runtime { type FeeCalculator = BaseFee; @@ -756,7 +756,7 @@ construct_runtime!( EVM: pallet_evm = 81, EVMChainId: pallet_evm_chain_id = 82, BaseFee: pallet_base_fee = 83, - EVMNoncetracker: pallet_evm_nonce_tracker = 84, + EVMNoncetracker: pallet_evm_tracker = 84, // domain instance stuff SelfDomainId: pallet_domain_id = 90, @@ -969,7 +969,7 @@ fn check_transaction_and_do_pre_dispatch_inner( extra.2, extra.3, extra.4, - pallet_evm_nonce_tracker::CheckNonce::from(extra.5 .0), + pallet_evm_tracker::CheckNonce::from(extra.5 .0), extra.6, extra.7, );