git.delta.rocks / unique-network / refs/commits / 74f532ac28dc

difftreelog

fix(runtime) add missing config keys

Daniel Shiposha2022-08-12parent: #85515e5.patch.diff
in: master

6 files changed

modifiedruntime/common/config/substrate.rsdiffbeforeafterboth
--- a/runtime/common/config/substrate.rs
+++ b/runtime/common/config/substrate.rs
@@ -154,6 +154,7 @@
 }
 
 impl pallet_transaction_payment::Config for Runtime {
+	type Event = Event;
 	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;
 	type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
 	type OperationalFeeMultiplier = OperationalFeeMultiplier;
modifiedruntime/common/construct_runtime/mod.rsdiffbeforeafterboth
--- a/runtime/common/construct_runtime/mod.rs
+++ b/runtime/common/construct_runtime/mod.rs
@@ -27,6 +27,8 @@
                 NodeBlock = opaque::Block,
                 UncheckedExtrinsic = UncheckedExtrinsic
             {
+                System: frame_system = 0,
+
                 ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,
                 ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,
 
@@ -36,10 +38,9 @@
                 Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,
                 RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,
                 Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,
-                TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,
+                TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>} = 33,
                 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,
                 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,
-                System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,
                 Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,
                 // Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,
                 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -48,7 +48,7 @@
 	spec_version: 924012,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
-	transaction_version: 1,
+	transaction_version: 2,
 	state_version: 0,
 };
 
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -48,7 +48,7 @@
 	spec_version: 924012,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
-	transaction_version: 1,
+	transaction_version: 2,
 	state_version: 0,
 };
 
modifiedruntime/tests/src/lib.rsdiffbeforeafterboth
before · runtime/tests/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![allow(clippy::from_over_into)]1819use sp_core::{H160, H256, U256};20use frame_support::{21	parameter_types,22	traits::{Everything, ConstU32, ConstU64},23	weights::IdentityFee,24};25use sp_runtime::{26	traits::{BlakeTwo256, IdentityLookup},27	testing::Header,28};29use pallet_transaction_payment::{CurrencyAdapter};30use frame_system as system;31use pallet_evm::{32	AddressMapping, account::CrossAccountId, EnsureAddressNever, SubstrateBlockHashMapping,33};34use fp_evm_mapping::EvmBackwardsAddressMapping;35use parity_scale_codec::{Encode, Decode, MaxEncodedLen};36use scale_info::TypeInfo;3738use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};3940#[path = "../../common/dispatch.rs"]41mod dispatch;4243use dispatch::CollectionDispatchT;4445#[path = "../../common/weights.rs"]46mod weights;4748use weights::CommonWeights;4950type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;51type Block = frame_system::mocking::MockBlock<Test>;5253#[cfg(test)]54mod tests;5556// Configure a mock runtime to test the pallet.57frame_support::construct_runtime!(58	pub enum Test where59		Block = Block,60		NodeBlock = Block,61		UncheckedExtrinsic = UncheckedExtrinsic,62	{63		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},64		Unique: pallet_unique::{Pallet, Call, Storage},65		Balances: pallet_balances::{Pallet, Call, Storage},66		Common: pallet_common::{Pallet, Storage, Event<T>},67		Fungible: pallet_fungible::{Pallet, Storage},68		Refungible: pallet_refungible::{Pallet, Storage},69		Nonfungible: pallet_nonfungible::{Pallet, Storage},70		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>},71	}72);7374parameter_types! {75	pub const BlockHashCount: u64 = 250;76	pub const SS58Prefix: u8 = 42;77}7879impl system::Config for Test {80	type BaseCallFilter = Everything;81	type BlockWeights = ();82	type BlockLength = ();83	type DbWeight = ();84	type Origin = Origin;85	type Call = Call;86	type Index = u64;87	type BlockNumber = u64;88	type Hash = H256;89	type Hashing = BlakeTwo256;90	type AccountId = u64;91	type Lookup = IdentityLookup<Self::AccountId>;92	type Header = Header;93	type Event = ();94	type BlockHashCount = BlockHashCount;95	type Version = ();96	type PalletInfo = PalletInfo;97	type AccountData = pallet_balances::AccountData<u64>;98	type OnNewAccount = ();99	type OnKilledAccount = ();100	type SystemWeightInfo = ();101	type SS58Prefix = SS58Prefix;102	type OnSetCode = ();103	type MaxConsumers = ConstU32<16>;104}105106parameter_types! {107	pub const ExistentialDeposit: u64 = 1;108	pub const MaxLocks: u32 = 50;109}110//frame_system::Module<Test>;111impl pallet_balances::Config for Test {112	type AccountStore = System;113	type Balance = u64;114	type DustRemoval = ();115	type Event = ();116	type ExistentialDeposit = ExistentialDeposit;117	type WeightInfo = ();118	type MaxLocks = MaxLocks;119	type MaxReserves = ();120	type ReserveIdentifier = [u8; 8];121}122123parameter_types! {124	pub const OperationalFeeMultiplier: u8 = 5;125}126127impl pallet_transaction_payment::Config for Test {128	type OnChargeTransaction = CurrencyAdapter<pallet_balances::Pallet<Test>, ()>;129	type LengthToFee = IdentityFee<u64>;130	type WeightToFee = IdentityFee<u64>;131	type FeeMultiplierUpdate = ();132	type OperationalFeeMultiplier = OperationalFeeMultiplier;133}134135parameter_types! {136	pub const MinimumPeriod: u64 = 1;137}138impl pallet_timestamp::Config for Test {139	type Moment = u64;140	type OnTimestampSet = ();141	type MinimumPeriod = MinimumPeriod;142	type WeightInfo = ();143}144145parameter_types! {146	pub const CollectionCreationPrice: u32 = 100;147	pub TreasuryAccountId: u64 = 1234;148	pub EthereumChainId: u32 = 1111;149}150151pub struct TestEvmAddressMapping;152impl AddressMapping<u64> for TestEvmAddressMapping {153	fn into_account_id(_addr: sp_core::H160) -> u64 {154		unimplemented!()155	}156}157158pub struct TestEvmBackwardsAddressMapping;159impl EvmBackwardsAddressMapping<u64> for TestEvmBackwardsAddressMapping {160	fn from_account_id(_account_id: u64) -> sp_core::H160 {161		unimplemented!()162	}163}164165#[derive(Encode, Decode, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, TypeInfo, MaxEncodedLen)]166pub struct TestCrossAccountId(u64, sp_core::H160);167impl CrossAccountId<u64> for TestCrossAccountId {168	fn as_sub(&self) -> &u64 {169		&self.0170	}171	fn as_eth(&self) -> &sp_core::H160 {172		&self.1173	}174	fn from_sub(sub: u64) -> Self {175		let mut eth = [0; 20];176		eth[12..20].copy_from_slice(&sub.to_be_bytes());177		Self(sub, sp_core::H160(eth))178	}179	fn from_eth(eth: sp_core::H160) -> Self {180		let mut sub_raw = [0; 8];181		sub_raw.copy_from_slice(&eth.0[0..8]);182		let sub = u64::from_be_bytes(sub_raw);183		Self(sub, eth)184	}185	fn conv_eq(&self, other: &Self) -> bool {186		self.as_sub() == other.as_sub()187	}188}189190impl Default for TestCrossAccountId {191	fn default() -> Self {192		Self::from_sub(0)193	}194}195196parameter_types! {197	pub BlockGasLimit: U256 = 0u32.into();198}199200impl pallet_evm::Config for Test {201	type Event = ();202	type FeeCalculator = ();203	type GasWeightMapping = ();204	type CallOrigin = EnsureAddressNever<Self::CrossAccountId>;205	type WithdrawOrigin = EnsureAddressNever<Self::CrossAccountId>;206	type AddressMapping = TestEvmAddressMapping;207	type Currency = Balances;208	type PrecompilesType = ();209	type PrecompilesValue = ();210	type Runner = pallet_evm::runner::stack::Runner<Self>;211	type ChainId = ConstU64<0>;212	type BlockGasLimit = BlockGasLimit;213	type OnMethodCall = ();214	type OnCreate = ();215	type OnChargeTransaction = ();216	type FindAuthor = ();217	type BlockHashMapping = SubstrateBlockHashMapping<Self>;218	type TransactionValidityHack = ();219}220impl pallet_evm_coder_substrate::Config for Test {}221222impl pallet_common::Config for Test {223	type WeightInfo = ();224	type Event = ();225	type Currency = Balances;226	type CollectionCreationPrice = CollectionCreationPrice;227	type TreasuryAccountId = TreasuryAccountId;228229	type CollectionDispatch = CollectionDispatchT<Self>;230	type EvmTokenAddressMapping = EvmTokenAddressMapping;231	type CrossTokenAddressMapping = CrossTokenAddressMapping<Self::AccountId>;232	type ContractAddress = EvmCollectionHelpersAddress;233}234235impl pallet_evm::account::Config for Test {236	type CrossAccountId = TestCrossAccountId;237	type EvmAddressMapping = TestEvmAddressMapping;238	type EvmBackwardsAddressMapping = TestEvmBackwardsAddressMapping;239}240241impl pallet_structure::Config for Test {242	type WeightInfo = ();243	type Event = ();244	type Call = Call;245}246impl pallet_fungible::Config for Test {247	type WeightInfo = ();248}249impl pallet_refungible::Config for Test {250	type WeightInfo = ();251}252impl pallet_nonfungible::Config for Test {253	type WeightInfo = ();254}255256parameter_types! {257	// 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f258	pub const EvmCollectionHelpersAddress: H160 = H160([259		0x6c, 0x4e, 0x9f, 0xe1, 0xae, 0x37, 0xa4, 0x1e, 0x93, 0xce, 0xe4, 0x29, 0xe8, 0xe1, 0x88, 0x1a, 0xbd, 0xcb, 0xb5, 0x4f,260	]);261}262263impl pallet_unique::Config for Test {264	type Event = ();265	type WeightInfo = ();266	type CommonWeightInfo = CommonWeights<Self>;267	type RefungibleExtensionsWeightInfo = CommonWeights<Self>;268}269270// Build genesis storage according to the mock runtime.271pub fn new_test_ext() -> sp_io::TestExternalities {272	system::GenesisConfig::default()273		.build_storage::<Test>()274		.unwrap()275		.into()276}
after · runtime/tests/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![allow(clippy::from_over_into)]1819use sp_core::{H160, H256, U256};20use frame_support::{21	parameter_types,22	traits::{Everything, ConstU32, ConstU64},23	weights::IdentityFee,24};25use sp_runtime::{26	traits::{BlakeTwo256, IdentityLookup},27	testing::Header,28};29use pallet_transaction_payment::{CurrencyAdapter};30use frame_system as system;31use pallet_evm::{32	AddressMapping, account::CrossAccountId, EnsureAddressNever, SubstrateBlockHashMapping,33};34use fp_evm_mapping::EvmBackwardsAddressMapping;35use parity_scale_codec::{Encode, Decode, MaxEncodedLen};36use scale_info::TypeInfo;3738use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};3940#[path = "../../common/dispatch.rs"]41mod dispatch;4243use dispatch::CollectionDispatchT;4445#[path = "../../common/weights.rs"]46mod weights;4748use weights::CommonWeights;4950type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;51type Block = frame_system::mocking::MockBlock<Test>;5253#[cfg(test)]54mod tests;5556// Configure a mock runtime to test the pallet.57frame_support::construct_runtime!(58	pub enum Test where59		Block = Block,60		NodeBlock = Block,61		UncheckedExtrinsic = UncheckedExtrinsic,62	{63		System: frame_system,64		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>},65		Balances: pallet_balances::{Pallet, Call, Storage, Event<T>},66		Common: pallet_common::{Pallet, Storage, Event<T>},67		Fungible: pallet_fungible::{Pallet, Storage},68		Refungible: pallet_refungible::{Pallet, Storage},69		Nonfungible: pallet_nonfungible::{Pallet, Storage},70		Structure: pallet_structure::{Pallet, Storage, Event<T>},71		TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>},72		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin},73		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>},74	}75);7677parameter_types! {78	pub const BlockHashCount: u64 = 250;79	pub const SS58Prefix: u8 = 42;80}8182impl system::Config for Test {83	type Event = Event;84	type BaseCallFilter = Everything;85	type BlockWeights = ();86	type BlockLength = ();87	type DbWeight = ();88	type Origin = Origin;89	type Call = Call;90	type Index = u64;91	type BlockNumber = u64;92	type Hash = H256;93	type Hashing = BlakeTwo256;94	type AccountId = u64;95	type Lookup = IdentityLookup<Self::AccountId>;96	type Header = Header;97	type BlockHashCount = BlockHashCount;98	type Version = ();99	type PalletInfo = PalletInfo;100	type AccountData = pallet_balances::AccountData<u64>;101	type OnNewAccount = ();102	type OnKilledAccount = ();103	type SystemWeightInfo = ();104	type SS58Prefix = SS58Prefix;105	type OnSetCode = ();106	type MaxConsumers = ConstU32<16>;107}108109parameter_types! {110	pub const ExistentialDeposit: u64 = 1;111	pub const MaxLocks: u32 = 50;112}113//frame_system::Module<Test>;114impl pallet_balances::Config for Test {115	type Event = Event;116	type AccountStore = System;117	type Balance = u64;118	type DustRemoval = ();119	type ExistentialDeposit = ExistentialDeposit;120	type WeightInfo = ();121	type MaxLocks = MaxLocks;122	type MaxReserves = ();123	type ReserveIdentifier = [u8; 8];124}125126parameter_types! {127	pub const OperationalFeeMultiplier: u8 = 5;128}129130impl pallet_transaction_payment::Config for Test {131	type Event = Event;132	type OnChargeTransaction = CurrencyAdapter<pallet_balances::Pallet<Test>, ()>;133	type LengthToFee = IdentityFee<u64>;134	type WeightToFee = IdentityFee<u64>;135	type FeeMultiplierUpdate = ();136	type OperationalFeeMultiplier = OperationalFeeMultiplier;137}138139parameter_types! {140	pub const MinimumPeriod: u64 = 1;141}142impl pallet_timestamp::Config for Test {143	type Moment = u64;144	type OnTimestampSet = ();145	type MinimumPeriod = MinimumPeriod;146	type WeightInfo = ();147}148149parameter_types! {150	pub const CollectionCreationPrice: u32 = 100;151	pub TreasuryAccountId: u64 = 1234;152	pub EthereumChainId: u32 = 1111;153}154155pub struct TestEvmAddressMapping;156impl AddressMapping<u64> for TestEvmAddressMapping {157	fn into_account_id(_addr: sp_core::H160) -> u64 {158		unimplemented!()159	}160}161162pub struct TestEvmBackwardsAddressMapping;163impl EvmBackwardsAddressMapping<u64> for TestEvmBackwardsAddressMapping {164	fn from_account_id(_account_id: u64) -> sp_core::H160 {165		unimplemented!()166	}167}168169#[derive(Encode, Decode, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, TypeInfo, MaxEncodedLen)]170pub struct TestCrossAccountId(u64, sp_core::H160);171impl CrossAccountId<u64> for TestCrossAccountId {172	fn as_sub(&self) -> &u64 {173		&self.0174	}175	fn as_eth(&self) -> &sp_core::H160 {176		&self.1177	}178	fn from_sub(sub: u64) -> Self {179		let mut eth = [0; 20];180		eth[12..20].copy_from_slice(&sub.to_be_bytes());181		Self(sub, sp_core::H160(eth))182	}183	fn from_eth(eth: sp_core::H160) -> Self {184		let mut sub_raw = [0; 8];185		sub_raw.copy_from_slice(&eth.0[0..8]);186		let sub = u64::from_be_bytes(sub_raw);187		Self(sub, eth)188	}189	fn conv_eq(&self, other: &Self) -> bool {190		self.as_sub() == other.as_sub()191	}192}193194impl Default for TestCrossAccountId {195	fn default() -> Self {196		Self::from_sub(0)197	}198}199200parameter_types! {201	pub BlockGasLimit: U256 = 0u32.into();202}203204impl pallet_ethereum::Config for Test {205	type Event = Event;206	type StateRoot = pallet_ethereum::IntermediateStateRoot<Self>;207}208209impl pallet_evm::Config for Test {210	type Event = Event;211	type FeeCalculator = ();212	type GasWeightMapping = ();213	type CallOrigin = EnsureAddressNever<Self::CrossAccountId>;214	type WithdrawOrigin = EnsureAddressNever<Self::CrossAccountId>;215	type AddressMapping = TestEvmAddressMapping;216	type Currency = Balances;217	type PrecompilesType = ();218	type PrecompilesValue = ();219	type Runner = pallet_evm::runner::stack::Runner<Self>;220	type ChainId = ConstU64<0>;221	type BlockGasLimit = BlockGasLimit;222	type OnMethodCall = ();223	type OnCreate = ();224	type OnChargeTransaction = ();225	type FindAuthor = ();226	type BlockHashMapping = SubstrateBlockHashMapping<Self>;227	type TransactionValidityHack = ();228}229impl pallet_evm_coder_substrate::Config for Test {}230231impl pallet_common::Config for Test {232	type WeightInfo = ();233	type Event = Event;234	type Currency = Balances;235	type CollectionCreationPrice = CollectionCreationPrice;236	type TreasuryAccountId = TreasuryAccountId;237238	type CollectionDispatch = CollectionDispatchT<Self>;239	type EvmTokenAddressMapping = EvmTokenAddressMapping;240	type CrossTokenAddressMapping = CrossTokenAddressMapping<Self::AccountId>;241	type ContractAddress = EvmCollectionHelpersAddress;242}243244impl pallet_evm::account::Config for Test {245	type CrossAccountId = TestCrossAccountId;246	type EvmAddressMapping = TestEvmAddressMapping;247	type EvmBackwardsAddressMapping = TestEvmBackwardsAddressMapping;248}249250impl pallet_structure::Config for Test {251	type WeightInfo = ();252	type Event = Event;253	type Call = Call;254}255impl pallet_fungible::Config for Test {256	type WeightInfo = ();257}258impl pallet_refungible::Config for Test {259	type WeightInfo = ();260}261impl pallet_nonfungible::Config for Test {262	type WeightInfo = ();263}264265parameter_types! {266	// 0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f267	pub const EvmCollectionHelpersAddress: H160 = H160([268		0x6c, 0x4e, 0x9f, 0xe1, 0xae, 0x37, 0xa4, 0x1e, 0x93, 0xce, 0xe4, 0x29, 0xe8, 0xe1, 0x88, 0x1a, 0xbd, 0xcb, 0xb5, 0x4f,269	]);270}271272impl pallet_unique::Config for Test {273	type Event = ();274	type WeightInfo = ();275	type CommonWeightInfo = CommonWeights<Self>;276	type RefungibleExtensionsWeightInfo = CommonWeights<Self>;277}278279// Build genesis storage according to the mock runtime.280pub fn new_test_ext() -> sp_io::TestExternalities {281	system::GenesisConfig::default()282		.build_storage::<Test>()283		.unwrap()284		.into()285}
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -48,7 +48,7 @@
 	spec_version: 924012,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
-	transaction_version: 1,
+	transaction_version: 2,
 	state_version: 0,
 };