Skip to content

Commit 1b52bac

Browse files
TarekkMAdnjscksdn98
authored andcommitted
Add DecodeWithMemTracking where it's missing (polkadot-evm#1740)
1 parent b697799 commit 1b52bac

File tree

6 files changed

+32
-8
lines changed

6 files changed

+32
-8
lines changed

frame/dynamic-fee/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub mod pallet {
105105
#[pallet::storage]
106106
pub type TargetMinGasPrice<T: Config> = StorageValue<_, U256>;
107107

108-
#[derive(Encode, Decode, RuntimeDebug, PartialEq)]
108+
#[derive(Encode, Decode, DecodeWithMemTracking, RuntimeDebug, PartialEq)]
109109
pub enum InherentError {
110110
/// The target gas price is too high compared to the current gas price.
111111
TargetGasPriceTooHigh,

frame/evm/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub use evm::{
7575
};
7676
use hash_db::Hasher;
7777
use impl_trait_for_tuples::impl_for_tuples;
78-
use scale_codec::{Decode, Encode, MaxEncodedLen};
78+
use scale_codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
7979
use scale_info::TypeInfo;
8080
// Substrate
8181
use frame_support::{
@@ -705,6 +705,7 @@ type NegativeImbalanceOf<C, T> = <C as Currency<AccountIdOf<T>>>::NegativeImbala
705705
PartialEq,
706706
Encode,
707707
Decode,
708+
DecodeWithMemTracking,
708709
TypeInfo,
709710
MaxEncodedLen
710711
)]

precompiles/src/testing/account.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ impl sp_runtime::traits::Convert<H160, MockAccount> for MockAccount {
105105
Clone,
106106
Encode,
107107
Decode,
108+
DecodeWithMemTracking,
108109
sp_core::RuntimeDebug,
109110
TypeInfo,
110111
Serialize,
@@ -168,6 +169,7 @@ impl sp_runtime::traits::Verify for MockSignature {
168169
Clone,
169170
Encode,
170171
Decode,
172+
DecodeWithMemTracking,
171173
sp_core::RuntimeDebug,
172174
TypeInfo
173175
)]

primitives/consensus/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
extern crate alloc;
2323

2424
use alloc::vec::Vec;
25-
use scale_codec::{Decode, Encode};
25+
use scale_codec::{Decode, DecodeWithMemTracking, Encode};
2626
use sp_core::H256;
2727
use sp_runtime::{
2828
generic::{Digest, OpaqueDigestItemId},
@@ -56,7 +56,7 @@ pub enum PostLog {
5656
BlockHash(H256),
5757
}
5858

59-
#[derive(Decode, Encode, Clone, PartialEq, Eq)]
59+
#[derive(Decode, DecodeWithMemTracking, Encode, Clone, PartialEq, Eq)]
6060
pub struct Hashes {
6161
/// Ethereum block hash.
6262
pub block_hash: H256,

primitives/evm/src/lib.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mod validation;
2727

2828
use alloc::{collections::BTreeMap, vec::Vec};
2929
use frame_support::weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight};
30-
use scale_codec::{Decode, Encode};
30+
use scale_codec::{Decode, DecodeWithMemTracking, Encode};
3131
use scale_info::TypeInfo;
3232
#[cfg(feature = "serde")]
3333
use serde::{Deserialize, Serialize};
@@ -81,7 +81,18 @@ pub enum AccessedStorage {
8181
AccountStorages((H160, H256)),
8282
}
8383

84-
#[derive(Clone, Copy, Eq, PartialEq, Debug, Encode, Decode, Default, TypeInfo)]
84+
#[derive(
85+
Clone,
86+
Copy,
87+
Eq,
88+
PartialEq,
89+
Debug,
90+
Encode,
91+
Decode,
92+
DecodeWithMemTracking,
93+
Default,
94+
TypeInfo
95+
)]
8596
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
8697
pub struct WeightInfo {
8798
pub ref_time_limit: Option<u64>,

primitives/rpc/src/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern crate alloc;
2424
use alloc::vec::Vec;
2525
use ethereum::{AuthorizationList, Log};
2626
use ethereum_types::{Address, Bloom};
27-
use scale_codec::{Decode, Encode};
27+
use scale_codec::{Decode, DecodeWithMemTracking, Encode};
2828
use scale_info::TypeInfo;
2929
// Substrate
3030
use sp_core::{H256, U256};
@@ -34,7 +34,17 @@ use sp_runtime::{
3434
};
3535
use sp_state_machine::OverlayedChanges;
3636

37-
#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode, TypeInfo)]
37+
#[derive(
38+
Clone,
39+
Eq,
40+
PartialEq,
41+
Default,
42+
RuntimeDebug,
43+
Encode,
44+
Decode,
45+
DecodeWithMemTracking,
46+
TypeInfo
47+
)]
3848
pub struct TransactionStatus {
3949
pub transaction_hash: H256,
4050
pub transaction_index: u32,

0 commit comments

Comments
 (0)