mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-16 13:11:15 +00:00
Contract storage limit (#3126)
* srml-contracts: Remove hard-coded code hashes from tests. This makes it easier to update existing and add new test Wasm modules. * Test maximum contract storage write size. * Implement storage value limit for contracts. * Bump node runtime spec version.
This commit is contained in:
committed by
Sergei Pepyakin
parent
95061beb79
commit
768eb1af4d
@@ -310,6 +310,8 @@ parameter_types! {
|
||||
pub const DefaultCreateBaseFee: u32 = 1000;
|
||||
/// A resonable default value for [`Trait::MaxDepth`].
|
||||
pub const DefaultMaxDepth: u32 = 1024;
|
||||
/// A resonable default value for [`Trait::MaxValueSize`].
|
||||
pub const DefaultMaxValueSize: u32 = 16_384;
|
||||
/// A resonable default value for [`Trait::BlockGasLimit`].
|
||||
pub const DefaultBlockGasLimit: u32 = 10_000_000;
|
||||
}
|
||||
@@ -391,6 +393,9 @@ pub trait Trait: timestamp::Trait {
|
||||
/// The maximum nesting level of a call/create stack.
|
||||
type MaxDepth: Get<u32>;
|
||||
|
||||
/// The maximum size of a storage value in bytes.
|
||||
type MaxValueSize: Get<u32>;
|
||||
|
||||
/// The maximum amount of gas that could be expended per block.
|
||||
type BlockGasLimit: Get<Gas>;
|
||||
}
|
||||
@@ -490,6 +495,9 @@ decl_module! {
|
||||
/// value is 100.
|
||||
const MaxDepth: u32 = T::MaxDepth::get();
|
||||
|
||||
/// The maximum size of a storage value in bytes. A reasonable default is 16 KiB.
|
||||
const MaxValueSize: u32 = T::MaxValueSize::get();
|
||||
|
||||
/// The maximum amount of gas that could be expended per block. A reasonable
|
||||
/// default value is 10_000_000.
|
||||
const BlockGasLimit: Gas = T::BlockGasLimit::get();
|
||||
@@ -831,6 +839,7 @@ pub struct Config<T: Trait> {
|
||||
pub schedule: Schedule,
|
||||
pub existential_deposit: BalanceOf<T>,
|
||||
pub max_depth: u32,
|
||||
pub max_value_size: u32,
|
||||
pub contract_account_instantiate_fee: BalanceOf<T>,
|
||||
pub account_create_fee: BalanceOf<T>,
|
||||
pub transfer_fee: BalanceOf<T>,
|
||||
@@ -842,6 +851,7 @@ impl<T: Trait> Config<T> {
|
||||
schedule: <Module<T>>::current_schedule(),
|
||||
existential_deposit: T::Currency::minimum_balance(),
|
||||
max_depth: T::MaxDepth::get(),
|
||||
max_value_size: T::MaxValueSize::get(),
|
||||
contract_account_instantiate_fee: T::ContractFee::get(),
|
||||
account_create_fee: T::CreationFee::get(),
|
||||
transfer_fee: T::TransferFee::get(),
|
||||
|
||||
Reference in New Issue
Block a user