Skip to content

Commit

Permalink
skip check nonce and valid when enable the tracing feature
Browse files Browse the repository at this point in the history
  • Loading branch information
zjb0807 committed Jul 23, 2024
1 parent 33c1601 commit 0b69378
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion runtime/acala/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 2 additions & 0 deletions runtime/acala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,4 @@ wasm-bench = [
runtime-benchmarks = [
"orml-oracle/runtime-benchmarks"
]
tracing = []
4 changes: 4 additions & 0 deletions runtime/common/src/check_nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ where
let evm_nonce = module_evm::Accounts::<T>::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
Expand Down Expand Up @@ -155,6 +157,8 @@ where
let evm_nonce = module_evm::Accounts::<T>::get(address)
.map(|x| x.nonce)
.unwrap_or_default();

#[cfg(not(feature = "tracing"))]
if self.nonce < evm_nonce {
return InvalidTransaction::Stale.into();
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/karura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 2 additions & 0 deletions runtime/karura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/mandala/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 2 additions & 0 deletions runtime/mandala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 0b69378

Please sign in to comment.