mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-23 16:41:06 +00:00
Define ss58 prefix inside the runtime (#7810)
* Add SS58Prefix type to the frame_system config trait * Remove unused chain_id runtime interface
This commit is contained in:
committed by
GitHub
parent
bd48ff310d
commit
ec2c70396e
@@ -16,6 +16,7 @@ impl_outer_origin! {
|
|||||||
pub struct Test;
|
pub struct Test;
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const BlockHashCount: u64 = 250;
|
pub const BlockHashCount: u64 = 250;
|
||||||
|
pub const SS58Prefix: u8 = 42;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl system::Config for Test {
|
impl system::Config for Test {
|
||||||
@@ -40,6 +41,7 @@ impl system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = SS58Prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config for Test {
|
impl Config for Test {
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ parameter_types! {
|
|||||||
::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
|
::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
|
||||||
pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
|
pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
|
||||||
::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
|
::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
|
||||||
|
pub const SS58Prefix: u8 = 42;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure FRAME pallets to include in runtime.
|
// Configure FRAME pallets to include in runtime.
|
||||||
@@ -185,6 +186,8 @@ impl frame_system::Config for Runtime {
|
|||||||
type AccountData = pallet_balances::AccountData<Balance>;
|
type AccountData = pallet_balances::AccountData<Balance>;
|
||||||
/// Weight information for the extrinsics of this pallet.
|
/// Weight information for the extrinsics of this pallet.
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
|
||||||
|
type SS58Prefix = SS58Prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_aura::Config for Runtime {
|
impl pallet_aura::Config for Runtime {
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ parameter_types! {
|
|||||||
})
|
})
|
||||||
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
|
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
|
||||||
.build_or_panic();
|
.build_or_panic();
|
||||||
|
pub const SS58Prefix: u8 = 42;
|
||||||
}
|
}
|
||||||
|
|
||||||
const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct());
|
const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct());
|
||||||
@@ -202,6 +203,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = frame_system::weights::SubstrateWeight<Runtime>;
|
type SystemWeightInfo = frame_system::weights::SubstrateWeight<Runtime>;
|
||||||
|
type SS58Prefix = SS58Prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_utility::Config for Runtime {
|
impl pallet_utility::Config for Runtime {
|
||||||
|
|||||||
@@ -952,6 +952,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_timestamp::Config for Test {
|
impl pallet_timestamp::Config for Test {
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_outer_origin! {
|
impl_outer_origin! {
|
||||||
|
|||||||
@@ -438,6 +438,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
|
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TransactionByteFee: u64 = 1;
|
pub const TransactionByteFee: u64 = 1;
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = Module<Test>;
|
type OnKilledAccount = Module<Test>;
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TransactionByteFee: u64 = 1;
|
pub const TransactionByteFee: u64 = 1;
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config for Test {
|
impl Config for Test {
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -996,6 +996,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
impl Config<Instance1> for Test {
|
impl Config<Instance1> for Test {
|
||||||
type Origin = Origin;
|
type Origin = Origin;
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
impl pallet_balances::Config for Test {
|
impl pallet_balances::Config for Test {
|
||||||
type MaxLocks = ();
|
type MaxLocks = ();
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;
|
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;
|
||||||
|
|||||||
@@ -1099,6 +1099,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
type Extrinsic = TestXt<Call<Test>, ()>;
|
type Extrinsic = TestXt<Call<Test>, ()>;
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -764,6 +764,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -618,6 +618,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
type Balance = u64;
|
type Balance = u64;
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
|
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -321,6 +321,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
ord_parameter_types! {
|
ord_parameter_types! {
|
||||||
pub const One: u64 = 1;
|
pub const One: u64 = 1;
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config for Test {
|
impl Config for Test {
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -283,6 +283,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -472,6 +472,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ord_parameter_types! {
|
ord_parameter_types! {
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = (Balances,);
|
type OnKilledAccount = (Balances,);
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: Balance = 10;
|
pub const ExistentialDeposit: Balance = 10;
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
type System = frame_system::Module<Test>;
|
type System = frame_system::Module<Test>;
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -837,6 +837,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
impl logger::Config for Test {
|
impl logger::Config for Test {
|
||||||
type Event = ();
|
type Event = ();
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_balances::Config for Test {
|
impl pallet_balances::Config for Test {
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = Balances;
|
type OnKilledAccount = Balances;
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: Balance = 10;
|
pub const ExistentialDeposit: Balance = 10;
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_timestamp::Config for Test {
|
impl pallet_timestamp::Config for Test {
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type AccountData = pallet_balances::AccountData<u64>;
|
type AccountData = pallet_balances::AccountData<u64>;
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_balances::Config for Test {
|
impl pallet_balances::Config for Test {
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = (Balances,);
|
type OnKilledAccount = (Balances,);
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: Balance = 10;
|
pub const ExistentialDeposit: Balance = 10;
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
impl pallet_balances::Config for Test {
|
impl pallet_balances::Config for Test {
|
||||||
type MaxLocks = MaxLocks;
|
type MaxLocks = MaxLocks;
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implement the logger module's `Config` on the Test runtime.
|
// Implement the logger module's `Config` on the Test runtime.
|
||||||
|
|||||||
@@ -364,6 +364,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
impl pallet::Config for Runtime {
|
impl pallet::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
impl pallet::Config for Runtime {
|
impl pallet::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
impl pallet::Config for Runtime {
|
impl pallet::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
impl pallet::Config for Runtime {
|
impl pallet::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_support::construct_runtime!(
|
frame_support::construct_runtime!(
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_test::Trait for Runtime {
|
impl pallet_test::Trait for Runtime {
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ impl system::Config for Runtime {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl module::Config for Runtime {
|
impl module::Config for Runtime {
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl crate::Config for Test {}
|
impl crate::Config for Test {}
|
||||||
|
|||||||
@@ -257,6 +257,13 @@ pub trait Config: 'static + Eq + Clone {
|
|||||||
type OnKilledAccount: OnKilledAccount<Self::AccountId>;
|
type OnKilledAccount: OnKilledAccount<Self::AccountId>;
|
||||||
|
|
||||||
type SystemWeightInfo: WeightInfo;
|
type SystemWeightInfo: WeightInfo;
|
||||||
|
|
||||||
|
/// The designated SS85 prefix of this chain.
|
||||||
|
///
|
||||||
|
/// This replaces the "ss58Format" property declared in the chain spec. Reason is
|
||||||
|
/// that the runtime should know about the prefix in order to make use of it as
|
||||||
|
/// an identifier of the chain.
|
||||||
|
type SS58Prefix: Get<u8>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type DigestOf<T> = generic::Digest<<T as Config>::Hash>;
|
pub type DigestOf<T> = generic::Digest<<T as Config>::Hash>;
|
||||||
@@ -516,6 +523,13 @@ decl_module! {
|
|||||||
/// The weight configuration (limits & base values) for each class of extrinsics and block.
|
/// The weight configuration (limits & base values) for each class of extrinsics and block.
|
||||||
const BlockWeights: limits::BlockWeights = T::BlockWeights::get();
|
const BlockWeights: limits::BlockWeights = T::BlockWeights::get();
|
||||||
|
|
||||||
|
/// The designated SS85 prefix of this chain.
|
||||||
|
///
|
||||||
|
/// This replaces the "ss58Format" property declared in the chain spec. Reason is
|
||||||
|
/// that the runtime should know about the prefix in order to make use of it as
|
||||||
|
/// an identifier of the chain.
|
||||||
|
const SS58Prefix: u8 = T::SS58Prefix::get();
|
||||||
|
|
||||||
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||||
if !UpgradedToU32RefCount::get() {
|
if !UpgradedToU32RefCount::get() {
|
||||||
Account::<T>::translate::<(T::Index, u8, T::AccountData), _>(|_key, (nonce, rc, data)|
|
Account::<T>::translate::<(T::Index, u8, T::AccountData), _>(|_key, (nonce, rc, data)|
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ impl Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = RecordKilled;
|
type OnKilledAccount = RecordKilled;
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type System = Module<Test>;
|
pub type System = Module<Test>;
|
||||||
|
|||||||
@@ -335,6 +335,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const MinimumPeriod: u64 = 5;
|
pub const MinimumPeriod: u64 = 5;
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
@@ -292,28 +293,28 @@ fn slash_tip_works() {
|
|||||||
System::set_block_number(1);
|
System::set_block_number(1);
|
||||||
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
||||||
assert_eq!(Treasury::pot(), 100);
|
assert_eq!(Treasury::pot(), 100);
|
||||||
|
|
||||||
assert_eq!(Balances::reserved_balance(0), 0);
|
assert_eq!(Balances::reserved_balance(0), 0);
|
||||||
assert_eq!(Balances::free_balance(0), 100);
|
assert_eq!(Balances::free_balance(0), 100);
|
||||||
|
|
||||||
assert_ok!(TipsModTestInst::report_awesome(Origin::signed(0), b"awesome.dot".to_vec(), 3));
|
assert_ok!(TipsModTestInst::report_awesome(Origin::signed(0), b"awesome.dot".to_vec(), 3));
|
||||||
|
|
||||||
assert_eq!(Balances::reserved_balance(0), 12);
|
assert_eq!(Balances::reserved_balance(0), 12);
|
||||||
assert_eq!(Balances::free_balance(0), 88);
|
assert_eq!(Balances::free_balance(0), 88);
|
||||||
|
|
||||||
let h = tip_hash();
|
let h = tip_hash();
|
||||||
assert_eq!(last_event(), RawEvent::NewTip(h));
|
assert_eq!(last_event(), RawEvent::NewTip(h));
|
||||||
|
|
||||||
// can't remove from any origin
|
// can't remove from any origin
|
||||||
assert_noop!(
|
assert_noop!(
|
||||||
TipsModTestInst::slash_tip(Origin::signed(0), h.clone()),
|
TipsModTestInst::slash_tip(Origin::signed(0), h.clone()),
|
||||||
BadOrigin,
|
BadOrigin,
|
||||||
);
|
);
|
||||||
|
|
||||||
// can remove from root.
|
// can remove from root.
|
||||||
assert_ok!(TipsModTestInst::slash_tip(Origin::root(), h.clone()));
|
assert_ok!(TipsModTestInst::slash_tip(Origin::root(), h.clone()));
|
||||||
assert_eq!(last_event(), RawEvent::TipSlashed(h, 0, 12));
|
assert_eq!(last_event(), RawEvent::TipSlashed(h, 0, 12));
|
||||||
|
|
||||||
// tipper slashed
|
// tipper slashed
|
||||||
assert_eq!(Balances::reserved_balance(0), 0);
|
assert_eq!(Balances::reserved_balance(0), 0);
|
||||||
assert_eq!(Balances::free_balance(0), 88);
|
assert_eq!(Balances::free_balance(0), 88);
|
||||||
|
|||||||
@@ -662,6 +662,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ impl frame_system::Config for Test {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u64 = 1;
|
pub const ExistentialDeposit: u64 = 1;
|
||||||
|
|||||||
@@ -433,6 +433,7 @@ mod tests {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const MaxLocks: u32 = 10;
|
pub const MaxLocks: u32 = 10;
|
||||||
|
|||||||
@@ -170,9 +170,6 @@ pub trait Externalities: ExtensionStore {
|
|||||||
value: Option<Vec<u8>>,
|
value: Option<Vec<u8>>,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Get the identity of the chain.
|
|
||||||
fn chain_id(&self) -> u64;
|
|
||||||
|
|
||||||
/// Get the trie root of the current storage map.
|
/// Get the trie root of the current storage map.
|
||||||
///
|
///
|
||||||
/// This will also update all child storage keys in the top-level storage map.
|
/// This will also update all child storage keys in the top-level storage map.
|
||||||
|
|||||||
@@ -388,11 +388,6 @@ pub trait Trie {
|
|||||||
/// Interface that provides miscellaneous functions for communicating between the runtime and the node.
|
/// Interface that provides miscellaneous functions for communicating between the runtime and the node.
|
||||||
#[runtime_interface]
|
#[runtime_interface]
|
||||||
pub trait Misc {
|
pub trait Misc {
|
||||||
/// The current relay chain identifier.
|
|
||||||
fn chain_id(&self) -> u64 {
|
|
||||||
sp_externalities::Externalities::chain_id(*self)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Print a number.
|
/// Print a number.
|
||||||
fn print_num(val: u64) {
|
fn print_num(val: u64) {
|
||||||
log::debug!(target: "runtime", "{}", val);
|
log::debug!(target: "runtime", "{}", val);
|
||||||
|
|||||||
@@ -263,8 +263,6 @@ impl Externalities for BasicExternalities {
|
|||||||
crate::ext::StorageAppend::new(current).append(value);
|
crate::ext::StorageAppend::new(current).append(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn chain_id(&self) -> u64 { 42 }
|
|
||||||
|
|
||||||
fn storage_root(&mut self) -> Vec<u8> {
|
fn storage_root(&mut self) -> Vec<u8> {
|
||||||
let mut top = self.inner.top.clone();
|
let mut top = self.inner.top.clone();
|
||||||
let prefixed_keys: Vec<_> = self.inner.children_default.iter().map(|(_k, v)| {
|
let prefixed_keys: Vec<_> = self.inner.children_default.iter().map(|(_k, v)| {
|
||||||
|
|||||||
@@ -507,10 +507,6 @@ where
|
|||||||
StorageAppend::new(current_value).append(value);
|
StorageAppend::new(current_value).append(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn chain_id(&self) -> u64 {
|
|
||||||
42
|
|
||||||
}
|
|
||||||
|
|
||||||
fn storage_root(&mut self) -> Vec<u8> {
|
fn storage_root(&mut self) -> Vec<u8> {
|
||||||
let _guard = guard();
|
let _guard = guard();
|
||||||
if let Some(ref root) = self.storage_transaction_cache.transaction_storage_root {
|
if let Some(ref root) = self.storage_transaction_cache.transaction_storage_root {
|
||||||
|
|||||||
@@ -156,8 +156,6 @@ impl<'a, H: Hasher, B: 'a + Backend<H>> Externalities for ReadOnlyExternalities<
|
|||||||
unimplemented!("storage_append is not supported in ReadOnlyExternalities")
|
unimplemented!("storage_append is not supported in ReadOnlyExternalities")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn chain_id(&self) -> u64 { 42 }
|
|
||||||
|
|
||||||
fn storage_root(&mut self) -> Vec<u8> {
|
fn storage_root(&mut self) -> Vec<u8> {
|
||||||
unimplemented!("storage_root is not supported in ReadOnlyExternalities")
|
unimplemented!("storage_root is not supported in ReadOnlyExternalities")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,8 +143,6 @@ impl Externalities for AsyncExternalities {
|
|||||||
panic!("`storage_append`: should not be used in async externalities!")
|
panic!("`storage_append`: should not be used in async externalities!")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn chain_id(&self) -> u64 { 42 }
|
|
||||||
|
|
||||||
fn storage_root(&mut self) -> Vec<u8> {
|
fn storage_root(&mut self) -> Vec<u8> {
|
||||||
panic!("`storage_root`: should not be used in async externalities!")
|
panic!("`storage_root`: should not be used in async externalities!")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -462,6 +462,7 @@ impl frame_system::Config for Runtime {
|
|||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
|
type SS58Prefix = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_timestamp::Config for Runtime {
|
impl pallet_timestamp::Config for Runtime {
|
||||||
|
|||||||
Reference in New Issue
Block a user