From 0b69378d543df389f9f1c0ad7f53c6c1e61bc31c Mon Sep 17 00:00:00 2001 From: zjb0807 Date: Tue, 23 Jul 2024 11:57:03 +0800 Subject: [PATCH] skip check nonce and valid when enable the tracing feature --- runtime/acala/Cargo.toml | 2 +- runtime/acala/src/lib.rs | 2 ++ runtime/common/Cargo.toml | 1 + runtime/common/src/check_nonce.rs | 4 ++++ runtime/karura/Cargo.toml | 2 +- runtime/karura/src/lib.rs | 2 ++ runtime/mandala/Cargo.toml | 2 +- runtime/mandala/src/lib.rs | 2 ++ 8 files changed, 14 insertions(+), 3 deletions(-) diff --git a/runtime/acala/Cargo.toml b/runtime/acala/Cargo.toml index 801da328fe..deb2a93a8f 100644 --- a/runtime/acala/Cargo.toml +++ b/runtime/acala/Cargo.toml @@ -415,4 +415,4 @@ no-metadata-docs = ["frame-support/no-metadata-docs"] # more types in the metadata. full-metadata-docs = ["frame-support/full-metadata-docs"] -tracing = ["module-evm/tracing", "module-evm-rpc-runtime-api/tracing"] +tracing = ["module-evm/tracing", "module-evm-rpc-runtime-api/tracing", "runtime-common/tracing"] diff --git a/runtime/acala/src/lib.rs b/runtime/acala/src/lib.rs index 145c9788e1..5aaa09fd8d 100644 --- a/runtime/acala/src/lib.rs +++ b/runtime/acala/src/lib.rs @@ -2534,6 +2534,7 @@ impl Convert<(RuntimeCall, SignedExtra), Result<(EthereumTransactionMessage, Sig access_list, valid_until, }) => { + #[cfg(not(feature = "tracing"))] if System::block_number() > valid_until { return Err(InvalidTransaction::Stale); } @@ -2579,6 +2580,7 @@ impl Convert<(RuntimeCall, SignedExtra), Result<(EthereumTransactionMessage, Sig let (tip, valid_until) = decode_gas_price(gas_price, gas_limit, TxFeePerGasV2::get()).ok_or(InvalidTransaction::Stale)?; + #[cfg(not(feature = "tracing"))] if System::block_number() > valid_until { return Err(InvalidTransaction::Stale); } diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index c0c5fe923a..719f4eb157 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -179,3 +179,4 @@ wasm-bench = [ runtime-benchmarks = [ "orml-oracle/runtime-benchmarks" ] +tracing = [] diff --git a/runtime/common/src/check_nonce.rs b/runtime/common/src/check_nonce.rs index 9e3b4d922c..b65d1e7898 100644 --- a/runtime/common/src/check_nonce.rs +++ b/runtime/common/src/check_nonce.rs @@ -120,6 +120,8 @@ where let evm_nonce = module_evm::Accounts::::get(address) .map(|x| x.nonce) .unwrap_or_default(); + + #[cfg(not(feature = "tracing"))] if self.nonce != evm_nonce { return Err(if self.nonce < evm_nonce { InvalidTransaction::Stale @@ -155,6 +157,8 @@ where let evm_nonce = module_evm::Accounts::::get(address) .map(|x| x.nonce) .unwrap_or_default(); + + #[cfg(not(feature = "tracing"))] if self.nonce < evm_nonce { return InvalidTransaction::Stale.into(); } diff --git a/runtime/karura/Cargo.toml b/runtime/karura/Cargo.toml index 7d11c175ce..4c26403e31 100644 --- a/runtime/karura/Cargo.toml +++ b/runtime/karura/Cargo.toml @@ -423,4 +423,4 @@ no-metadata-docs = ["frame-support/no-metadata-docs"] # more types in the metadata. full-metadata-docs = ["frame-support/full-metadata-docs"] -tracing = ["module-evm/tracing", "module-evm-rpc-runtime-api/tracing"] +tracing = ["module-evm/tracing", "module-evm-rpc-runtime-api/tracing", "runtime-common/tracing"] diff --git a/runtime/karura/src/lib.rs b/runtime/karura/src/lib.rs index 3b1ca0b5ef..ef64893447 100644 --- a/runtime/karura/src/lib.rs +++ b/runtime/karura/src/lib.rs @@ -2560,6 +2560,7 @@ impl Convert<(RuntimeCall, SignedExtra), Result<(EthereumTransactionMessage, Sig access_list, valid_until, }) => { + #[cfg(not(feature = "tracing"))] if System::block_number() > valid_until { return Err(InvalidTransaction::Stale); } @@ -2605,6 +2606,7 @@ impl Convert<(RuntimeCall, SignedExtra), Result<(EthereumTransactionMessage, Sig let (tip, valid_until) = decode_gas_price(gas_price, gas_limit, TxFeePerGasV2::get()).ok_or(InvalidTransaction::Stale)?; + #[cfg(not(feature = "tracing"))] if System::block_number() > valid_until { return Err(InvalidTransaction::Stale); } diff --git a/runtime/mandala/Cargo.toml b/runtime/mandala/Cargo.toml index 2034b973e7..776918b1f4 100644 --- a/runtime/mandala/Cargo.toml +++ b/runtime/mandala/Cargo.toml @@ -447,4 +447,4 @@ no-metadata-docs = ["frame-support/no-metadata-docs"] # more types in the metadata. full-metadata-docs = ["frame-support/full-metadata-docs"] -tracing = ["module-evm/tracing", "module-evm-rpc-runtime-api/tracing"] +tracing = ["module-evm/tracing", "module-evm-rpc-runtime-api/tracing", "runtime-common/tracing"] diff --git a/runtime/mandala/src/lib.rs b/runtime/mandala/src/lib.rs index ef30dd6d41..f00bc183db 100644 --- a/runtime/mandala/src/lib.rs +++ b/runtime/mandala/src/lib.rs @@ -1919,6 +1919,7 @@ impl Convert<(RuntimeCall, SignedExtra), Result<(EthereumTransactionMessage, Sig access_list, valid_until, }) => { + #[cfg(not(feature = "tracing"))] if System::block_number() > valid_until { return Err(InvalidTransaction::Stale); } @@ -1964,6 +1965,7 @@ impl Convert<(RuntimeCall, SignedExtra), Result<(EthereumTransactionMessage, Sig let (tip, valid_until) = decode_gas_price(gas_price, gas_limit, TxFeePerGasV2::get()).ok_or(InvalidTransaction::Stale)?; + #[cfg(not(feature = "tracing"))] if System::block_number() > valid_until { return Err(InvalidTransaction::Stale); }