Skip to content

Commit

Permalink
add proper consideration to pallet preimage
Browse files Browse the repository at this point in the history
  • Loading branch information
gianfra-t committed Dec 11, 2024
1 parent 3125b5c commit 452dc62
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
13 changes: 10 additions & 3 deletions runtime/amplitude/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ use frame_support::{
dispatch::DispatchClass,
parameter_types,
traits::{
fungible::Credit, ConstBool, ConstU32, Contains, Currency as FrameCurrency,
fungible::{HoldConsideration, Credit}, ConstBool, ConstU32, Contains, Currency as FrameCurrency,
EitherOfDiverse, EqualPrivilegeOnly, Imbalance, InstanceFilter, OnUnbalanced,
WithdrawReasons, tokens::{PayFromAccount,UnityAssetBalanceConversion},
WithdrawReasons, tokens::{PayFromAccount,UnityAssetBalanceConversion}, LinearStoragePrice

},
weights::{
Expand Down Expand Up @@ -719,14 +719,21 @@ parameter_types! {
pub const PreimageBaseDeposit: Balance = UNIT;
// One cent: $10,000 / MB
pub const PreimageByteDeposit: Balance = 10 * MILLIUNIT;
pub const PreimageHoldReason: RuntimeHoldReason =
RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type Consideration = ();
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}

parameter_types! {
Expand Down
12 changes: 10 additions & 2 deletions runtime/foucoco/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ use spacewalk_primitives::{

use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};

use frame_support::traits::InstanceFilter;
use frame_support::traits::{InstanceFilter, LinearStoragePrice};
use frame_support::traits::fungible::HoldConsideration;
use sp_std::vec::Vec;

use runtime_common::asset_registry::StringLimit;
Expand Down Expand Up @@ -702,14 +703,21 @@ parameter_types! {
pub const PreimageBaseDeposit: Balance = UNIT;
// One cent: $10,000 / MB
pub const PreimageByteDeposit: Balance = 10 * MILLIUNIT;
pub const PreimageHoldReason: RuntimeHoldReason =
RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type Consideration = ();
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}

parameter_types! {
Expand Down
11 changes: 10 additions & 1 deletion runtime/pendulum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ pub use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};

pub use dia_oracle::dia::AssetId;
use dia_oracle::DiaOracle;
use frame_support::traits::fungible::HoldConsideration;
use frame_support::traits::LinearStoragePrice;
pub use issue::{Event as IssueEvent, IssueRequest};
pub use nomination::Event as NominationEvent;
use oracle::dia::DiaOracleAdapter;
Expand Down Expand Up @@ -719,14 +721,21 @@ parameter_types! {
pub const PreimageBaseDeposit: Balance = UNIT;
// One cent: $10,000 / MB
pub const PreimageByteDeposit: Balance = 10 * MILLIUNIT;
pub const PreimageHoldReason: RuntimeHoldReason =
RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type Consideration = ();
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}

parameter_types! {
Expand Down

0 comments on commit 452dc62

Please sign in to comment.