Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pallets/author-inherent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

extern crate alloc;

use alloc::string::String;
use frame_support::traits::{FindAuthor, Get};
use nimbus_primitives::{
AccountLookup, CanAuthor, NimbusId, SlotBeacon, INHERENT_IDENTIFIER, NIMBUS_ENGINE_ID,
};
use parity_scale_codec::{Decode, Encode, FullCodec};
use sp_inherents::{InherentIdentifier, IsFatalError};
use sp_runtime::{ConsensusEngineId, RuntimeString};
use alloc::string::String;

pub use crate::weights::WeightInfo;
pub use exec::BlockExecutor;
Expand Down
14 changes: 9 additions & 5 deletions precompiles/assets-erc20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ mod mock;
#[cfg(test)]
mod tests;

/// System account size in bytes = Pallet_Name_Hash (16) + Storage_name_hash (16) +
/// Blake2_128Concat (16) + AccountId (20) + AccountInfo (4 + 12 + AccountData (4* 16)) = 148
pub const SYSTEM_ACCOUNT_SIZE: u64 = 148;

/// Solidity selector of the Transfer log, which is the Keccak of the Log signature.
pub const SELECTOR_LOG_TRANSFER: [u8; 32] = keccak256!("Transfer(address,address,uint256)");

Expand Down Expand Up @@ -257,7 +261,7 @@ where
id: asset_id.clone().into(),
delegate: Runtime::Lookup::unlookup(spender.clone()),
},
0,
0,
)?;
}
// Dispatch call (if enough gas).
Expand All @@ -269,7 +273,7 @@ where
delegate: Runtime::Lookup::unlookup(spender),
amount,
},
0,
0,
)?;

Ok(())
Expand Down Expand Up @@ -301,7 +305,7 @@ where
target: Runtime::Lookup::unlookup(to),
amount: value,
},
0,
SYSTEM_ACCOUNT_SIZE,
)?;
}

Expand Down Expand Up @@ -349,7 +353,7 @@ where
destination: Runtime::Lookup::unlookup(to),
amount: value,
},
0,
SYSTEM_ACCOUNT_SIZE,
)?;
} else {
// Dispatch call (if enough gas).
Expand All @@ -361,7 +365,7 @@ where
target: Runtime::Lookup::unlookup(to),
amount: value,
},
0,
SYSTEM_ACCOUNT_SIZE,
)?;
}
}
Expand Down
5 changes: 5 additions & 0 deletions precompiles/assets-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ parameter_types! {
let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64();
block_gas_limit.saturating_div(MAX_POV_SIZE)
};
pub GasLimitStorageGrowthRatio: u64 = {
let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64();
block_gas_limit.saturating_div(BLOCK_STORAGE_LIMIT)
};
}

impl pallet_evm::Config for Runtime {
Expand All @@ -190,6 +194,7 @@ impl pallet_evm::Config for Runtime {
type OnCreate = ();
type GasLimitPovSizeRatio = GasLimitPovSizeRatio;
type SuicideQuickClearLimit = ConstU32<0>;
type GasLimitStorageGrowthRatio = GasLimitStorageGrowthRatio;
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
}
Expand Down
10 changes: 7 additions & 3 deletions precompiles/balances-erc20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ mod mock;
#[cfg(test)]
mod tests;

/// System account size in bytes = Pallet_Name_Hash (16) + Storage_name_hash (16) +
/// Blake2_128Concat (16) + AccountId (20) + AccountInfo (4 + 12 + AccountData (4* 16)) = 148
pub const SYSTEM_ACCOUNT_SIZE: u64 = 148;

/// Solidity selector of the Transfer log, which is the Keccak of the Log signature.
pub const SELECTOR_LOG_TRANSFER: [u8; 32] = keccak256!("Transfer(address,address,uint256)");

Expand Down Expand Up @@ -288,7 +292,7 @@ where
dest: Runtime::Lookup::unlookup(to),
value: value,
},
0,
SYSTEM_ACCOUNT_SIZE,
)?;
}

Expand Down Expand Up @@ -354,7 +358,7 @@ where
dest: Runtime::Lookup::unlookup(to),
value: value,
},
0,
SYSTEM_ACCOUNT_SIZE,
)?;
}

Expand Down Expand Up @@ -416,7 +420,7 @@ where
dest: Runtime::Lookup::unlookup(caller),
value: amount,
},
0,
SYSTEM_ACCOUNT_SIZE,
)?;

log2(
Expand Down
5 changes: 5 additions & 0 deletions precompiles/balances-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ parameter_types! {
let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64();
block_gas_limit.saturating_div(MAX_POV_SIZE)
};
pub GasLimitStorageGrowthRatio: u64 = {
let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64();
block_gas_limit.saturating_div(BLOCK_STORAGE_LIMIT)
};
}

impl pallet_evm::Config for Runtime {
Expand All @@ -139,6 +143,7 @@ impl pallet_evm::Config for Runtime {
type OnCreate = ();
type GasLimitPovSizeRatio = GasLimitPovSizeRatio;
type SuicideQuickClearLimit = ConstU32<0>;
type GasLimitStorageGrowthRatio = GasLimitStorageGrowthRatio;
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
}
Expand Down
5 changes: 5 additions & 0 deletions precompiles/batch/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ parameter_types! {
let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64();
block_gas_limit.saturating_div(MAX_POV_SIZE)
};
pub GasLimitStorageGrowthRatio: u64 = {
let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64();
block_gas_limit.saturating_div(BLOCK_STORAGE_LIMIT)
};
}

impl pallet_evm::Config for Runtime {
Expand All @@ -154,6 +158,7 @@ impl pallet_evm::Config for Runtime {
type OnCreate = ();
type GasLimitPovSizeRatio = GasLimitPovSizeRatio;
type SuicideQuickClearLimit = ConstU32<0>;
type GasLimitStorageGrowthRatio = GasLimitStorageGrowthRatio;
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
}
Expand Down
1 change: 1 addition & 0 deletions precompiles/call-permit/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ impl pallet_evm::Config for Runtime {
type OnCreate = ();
type GasLimitPovSizeRatio = ();
type SuicideQuickClearLimit = SuicideQuickClearLimit;
type GasLimitStorageGrowthRatio = ();
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
}
Expand Down
1 change: 1 addition & 0 deletions precompiles/pallet-xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = ();
type OnCreate = ();
type GasLimitPovSizeRatio = GasLimitPovSizeRatio;
type GasLimitStorageGrowthRatio = GasLimitStorageGrowthRatio;
type SuicideQuickClearLimit = ConstU32<0>;
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
Expand Down
6 changes: 5 additions & 1 deletion precompiles/proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ mod mock;
#[cfg(test)]
mod tests;

/// System account size in bytes = Pallet_Name_Hash (16) + Storage_name_hash (16) +
/// Blake2_128Concat (16) + AccountId (20) + AccountInfo (4 + 12 + AccountData (4* 16)) = 148
pub const SYSTEM_ACCOUNT_SIZE: u64 = 148;

#[derive(Debug)]
pub struct OnlyIsProxy<Runtime>(PhantomData<Runtime>);

Expand Down Expand Up @@ -425,7 +429,7 @@ where
balance
},
},
0,
SYSTEM_ACCOUNT_SIZE,
)?;

Some(Transfer {
Expand Down
5 changes: 5 additions & 0 deletions precompiles/proxy/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ parameter_types! {
let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64();
block_gas_limit.saturating_div(MAX_POV_SIZE)
};
pub GasLimitStorageGrowthRatio: u64 = {
let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64();
block_gas_limit.saturating_div(BLOCK_STORAGE_LIMIT)
};
}
impl pallet_evm::Config for Runtime {
type AccountProvider = pallet_evm::FrameSystemAccountProvider<Self>;
Expand All @@ -179,6 +183,7 @@ impl pallet_evm::Config for Runtime {
type SuicideQuickClearLimit = ConstU32<0>;
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
type GasLimitStorageGrowthRatio = GasLimitStorageGrowthRatio;
}

parameter_types! {
Expand Down
5 changes: 5 additions & 0 deletions precompiles/xcm-utils/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ parameter_types! {
let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64();
block_gas_limit.saturating_div(MAX_POV_SIZE)
};
pub GasLimitStorageGrowthRatio: u64 = {
let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64();
block_gas_limit.saturating_div(BLOCK_STORAGE_LIMIT)
};
}

/// A mapping function that converts Ethereum gas to Substrate weight
Expand Down Expand Up @@ -288,6 +292,7 @@ impl pallet_evm::Config for Runtime {
type OnCreate = ();
type GasLimitPovSizeRatio = GasLimitPovSizeRatio;
type SuicideQuickClearLimit = ConstU32<0>;
type GasLimitStorageGrowthRatio = GasLimitStorageGrowthRatio;
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
}
Expand Down
Loading