From 575a28d19fe4ba24fe3de102331f6867adb75580 Mon Sep 17 00:00:00 2001 From: librelois <c@elo.tf> Date: Mon, 2 May 2022 00:45:19 +0200 Subject: [PATCH] =?UTF-8?q?fix:=C2=A0ensure=20storage=20deposits=20are=20c?= =?UTF-8?q?onsistent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/common/src/constants.rs | 7 +++++-- runtime/common/src/pallets_config.rs | 4 ++++ runtime/g1/src/parameters.rs | 2 -- runtime/gdev/src/parameters.rs | 2 -- runtime/gtest/src/parameters.rs | 2 -- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/runtime/common/src/constants.rs b/runtime/common/src/constants.rs index 4c618dfb1..8fb63da0f 100644 --- a/runtime/common/src/constants.rs +++ b/runtime/common/src/constants.rs @@ -57,7 +57,10 @@ pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration = allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryVRFSlots, }; -// 1 unit per item + 1 cent per byte +pub const DEPOSIT_PER_BYTE: Balance = 1; +pub const DEPOSIT_PER_ITEM: Balance = 100; + +// Compute storage deposit per items and bytes pub const fn deposit(items: u32, bytes: u32) -> Balance { - items as Balance * 100 + (bytes as Balance) + items as Balance * DEPOSIT_PER_ITEM + (bytes as Balance * DEPOSIT_PER_BYTE) } diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs index 7b78f62db..04426b32b 100644 --- a/runtime/common/src/pallets_config.rs +++ b/runtime/common/src/pallets_config.rs @@ -311,6 +311,10 @@ macro_rules! pallets_config { type WeightInfo = pallet_proxy::weights::SubstrateWeight<Self>; } + parameter_types! { + pub const DepositBase: Balance = DEPOSIT_PER_ITEM; + pub const DepositFactor: Balance = DEPOSIT_PER_BYTE * 32; + } impl pallet_multisig::Config for Runtime { type Event = Event; type Call = Call; diff --git a/runtime/g1/src/parameters.rs b/runtime/g1/src/parameters.rs index e1c7a0827..3558989c1 100644 --- a/runtime/g1/src/parameters.rs +++ b/runtime/g1/src/parameters.rs @@ -153,7 +153,5 @@ parameter_types! { // Multisig parameter_types! { - pub const DepositBase: Balance = 1000; - pub const DepositFactor: Balance = 10; pub const MaxSignatories: u16 = 5; } diff --git a/runtime/gdev/src/parameters.rs b/runtime/gdev/src/parameters.rs index df48d06d0..8a69036c3 100644 --- a/runtime/gdev/src/parameters.rs +++ b/runtime/gdev/src/parameters.rs @@ -87,7 +87,5 @@ parameter_types! { // Multisig parameter_types! { - pub const DepositBase: Balance = 1000; - pub const DepositFactor: Balance = 10; pub const MaxSignatories: u16 = 5; } diff --git a/runtime/gtest/src/parameters.rs b/runtime/gtest/src/parameters.rs index 86442e54f..3fc4cfcce 100644 --- a/runtime/gtest/src/parameters.rs +++ b/runtime/gtest/src/parameters.rs @@ -151,7 +151,5 @@ parameter_types! { // Multisig parameter_types! { - pub const DepositBase: Balance = 1000; - pub const DepositFactor: Balance = 10; pub const MaxSignatories: u16 = 5; } -- GitLab