diff --git a/pallets/afloat/src/functions.rs b/pallets/afloat/src/functions.rs index 4c39a1ea..bf4ad3a7 100644 --- a/pallets/afloat/src/functions.rs +++ b/pallets/afloat/src/functions.rs @@ -8,7 +8,6 @@ use sp_runtime::{traits::StaticLookup, Permill}; // use frame_support::traits::OriginTrait; use core::convert::TryInto; use frame_support::{sp_io::hashing::blake2_256, traits::Time}; -use pallet_mapped_assets::DebitFlags; use pallet_rbac::types::{IdOrVec, RoleBasedAccessControl, RoleId}; use scale_info::prelude::vec; use sp_runtime::{ @@ -73,22 +72,22 @@ impl Pallet { CreateAsset::New { asset_id, min_balance } => { pallet_mapped_assets::Pallet::::create( RawOrigin::Signed(creator.clone()).into(), - asset_id, + asset_id.clone().into(), T::Lookup::unlookup(creator.clone()), min_balance, )?; - asset_id + asset_id.clone() }, CreateAsset::Existing { asset_id } => { ensure!( - pallet_mapped_assets::Pallet::::does_asset_exists(asset_id), + pallet_mapped_assets::Pallet::::does_asset_exist(&asset_id), Error::::AssetNotFound ); - asset_id + asset_id.clone() }, }; - AfloatAssetId::::put(asset_id.clone()); + AfloatAssetId::::put(asset_id); Ok(()) } /// This functions sets up the roles for the Afloat pallet. @@ -293,7 +292,6 @@ impl Pallet { ) -> DispatchResult { let authority = ensure_signed(origin.clone())?; let asset_id = AfloatAssetId::::get().expect("AfloatAssetId should be set"); - let debit_flags = DebitFlags { keep_alive: false, best_effort: true }; ensure!(UserInfo::::contains_key(user_address.clone()), Error::::UserNotFound); let current_balance = Self::do_get_afloat_balance(user_address.clone()); @@ -304,7 +302,6 @@ impl Pallet { &user_address.clone(), diff, Some(authority.clone()), - debit_flags, )?; } else if current_balance < amount { let diff = amount - current_balance; diff --git a/pallets/afloat/src/mock.rs b/pallets/afloat/src/mock.rs index afee5198..5134600a 100644 --- a/pallets/afloat/src/mock.rs +++ b/pallets/afloat/src/mock.rs @@ -1,13 +1,13 @@ use crate as pallet_afloat; use frame_support::{ parameter_types, - traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, Currency}, + traits::{AsEnsureOriginWithArg, ConstU128, ConstU32, ConstU64, Currency}, }; use frame_system as system; use sp_core::H256; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, }; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; @@ -25,12 +25,9 @@ parameter_types! { // Configure a mock runtime to test the pallet. frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, GatedMarketplace: pallet_gated_marketplace::{Pallet, Call, Storage, Event}, Uniques: pallet_uniques::{Pallet, Call, Storage, Event}, Fruniques: pallet_fruniques::{Pallet, Call, Storage, Event}, @@ -49,13 +46,12 @@ impl system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -157,21 +153,20 @@ impl pallet_uniques::Config for Test { type Locker = (); } -parameter_types! { - pub const ExistentialDeposit: u64 = 1; - pub const MaxReserves: u32 = 50; -} - impl pallet_balances::Config for Test { - type Balance = u64; + type Balance = u128; type DustRemoval = (); type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ExistentialDeposit; + type ExistentialDeposit = ConstU128<100>; type AccountStore = System; type WeightInfo = (); type MaxLocks = (); - type MaxReserves = MaxReserves; + type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; + type FreezeIdentifier = (); + type MaxFreezes = (); + type RuntimeHoldReason = (); + type MaxHolds = (); } parameter_types! { @@ -236,8 +231,6 @@ impl pallet_mapped_assets::Config for Test { type CallbackHandle = AssetsCallbackHandle; type Extra = (); type RemoveItemsLimit = ConstU32<5>; - type MaxReserves = MaxReserves; - type ReserveIdentifier = u32; type Rbac = RBAC; } @@ -245,7 +238,7 @@ impl pallet_mapped_assets::Config for Test { pub fn new_test_ext() -> sp_io::TestExternalities { // TODO: get initial conf? let mut t: sp_io::TestExternalities = - frame_system::GenesisConfig::default().build_storage::().unwrap().into(); + frame_system::GenesisConfig::::default().build_storage().unwrap().into(); t.execute_with(|| { Balances::make_free_balance_be(&1, 100); Balances::make_free_balance_be(&2, 100); diff --git a/pallets/bitcoin-vaults/src/functions.rs b/pallets/bitcoin-vaults/src/functions.rs index 52376e17..613af6a3 100644 --- a/pallets/bitcoin-vaults/src/functions.rs +++ b/pallets/bitcoin-vaults/src/functions.rs @@ -474,6 +474,7 @@ impl Pallet { fraction: 0, fraction_length: 0, exponent: 0, + negative: false, }; body.push(("threshold".chars().collect::>(), JsonValue::Number(threshold))); let vault_signers = vault.cosigners.clone().to_vec(); @@ -573,16 +574,18 @@ impl Pallet { let vault = >::get(proposal.vault_id.clone()) .ok_or(Self::build_offchain_err(false, "Vault not found"))?; let amount = NumberValue { - integer: proposal.amount.clone() as i64, + integer: proposal.amount.clone() as u64, fraction: 0, fraction_length: 0, exponent: 0, + negative: false, }; let fee = NumberValue { integer: proposal.fee_sat_per_vb.clone().into(), fraction: 0, fraction_length: 0, exponent: 0, + negative: false, }; let to_address = str::from_utf8(proposal.to_address.as_slice()) .map_err(|_| { diff --git a/pallets/bitcoin-vaults/src/lib.rs b/pallets/bitcoin-vaults/src/lib.rs index 5dfb6668..5a333275 100644 --- a/pallets/bitcoin-vaults/src/lib.rs +++ b/pallets/bitcoin-vaults/src/lib.rs @@ -39,20 +39,24 @@ pub mod pallet { /* --- Genesis Structs Section --- */ #[pallet::genesis_config] - #[derive(Default)] - pub struct GenesisConfig { + pub struct GenesisConfig { pub bdk_services_url: Vec, + #[serde(skip)] + pub _config: sp_std::marker::PhantomData, } #[cfg(feature = "std")] - impl Default for GenesisConfig { + impl Default for GenesisConfig { fn default() -> Self { - Self { bdk_services_url: b"https://bdk.hashed.systems".encode() } + Self { + bdk_services_url: b"https://bdk.hashed.systems".encode(), + _config: Default::default(), + } } } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { >::put( BoundedVec::>::try_from(self.bdk_services_url.clone()) @@ -275,7 +279,7 @@ pub mod pallet { /// Note that it's not guaranteed for offchain workers to run on EVERY block, there might /// be cases where some blocks are skipped, or for some the worker runs twice (re-orgs), /// so the code should be able to handle that. - fn offchain_worker(_block_number: T::BlockNumber) { + fn offchain_worker(_block_number: BlockNumberFor) { // check if the node has an account available, the offchain worker can't submit // transactions without it let signer = Signer::::any_account(); diff --git a/pallets/bitcoin-vaults/src/mock.rs b/pallets/bitcoin-vaults/src/mock.rs index 79c45d2e..d9b909f4 100644 --- a/pallets/bitcoin-vaults/src/mock.rs +++ b/pallets/bitcoin-vaults/src/mock.rs @@ -8,39 +8,40 @@ use frame_system::EnsureRoot; use pallet_balances; use sp_core::H256; //use sp_keystore::{testing::KeyStore, KeystoreExt, SyncCryptoStore}; +use sp_runtime::BuildStorage; use sp_runtime::{ - testing::{Header, TestXt}, + testing::TestXt, traits::{BlakeTwo256, Extrinsic as ExtrinsicT, IdentifyAccount, IdentityLookup, Verify}, //RuntimeAppPublic, }; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; //use sp_runtime::generic::SignedPayload; use sp_core::sr25519::Signature; // Configure a mock runtime to test the pallet. frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, BitcoinVaults: pallet_bitcoin_vaults::{Pallet, Call, Storage, Event, ValidateUnsigned}, Balances: pallet_balances::{Pallet, Call, Storage, Event}, } ); impl pallet_balances::Config for Test { - type MaxLocks = (); - type MaxReserves = (); - type ReserveIdentifier = [u8; 8]; type Balance = u64; - type RuntimeEvent = RuntimeEvent; type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ConstU64<1>; type AccountStore = System; type WeightInfo = (); + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type RuntimeHoldReason = (); + type FreezeIdentifier = (); + type MaxHolds = (); + type MaxFreezes = (); } parameter_types! { @@ -106,14 +107,13 @@ impl frame_system::Config for Test { type BlockWeights = (); type BlockLength = (); type RuntimeOrigin = RuntimeOrigin; - type Index = u64; - type BlockNumber = u64; type Hash = H256; type RuntimeCall = RuntimeCall; + type Nonce = u64; type Hashing = BlakeTwo256; type AccountId = sp_core::sr25519::Public; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type DbWeight = (); @@ -134,7 +134,7 @@ pub fn test_pub(n: u8) -> sp_core::sr25519::Public { // Build genesis storage according to the mock runtime. pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(test_pub(1), 10000), (test_pub(2), 1000), (test_pub(3), 1000)], } diff --git a/pallets/confidential-docs/src/mock.rs b/pallets/confidential-docs/src/mock.rs index 0cd5c614..ab7e1190 100644 --- a/pallets/confidential-docs/src/mock.rs +++ b/pallets/confidential-docs/src/mock.rs @@ -1,24 +1,19 @@ use crate as pallet_confidential_docs; -use frame_support::parameter_types; +use frame_support::{construct_runtime, parameter_types}; use frame_system as system; use frame_system::EnsureRoot; use sp_core::H256; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, }; - -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; // Configure a mock runtime to test the pallet. -frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, +construct_runtime!( + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, ConfidentialDocs: pallet_confidential_docs::{Pallet, Call, Storage, Event}, } ); @@ -35,13 +30,12 @@ impl system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -85,7 +79,7 @@ impl pallet_confidential_docs::Config for Test { // Build genesis storage according to the mock runtime. pub fn new_test_ext() -> sp_io::TestExternalities { - let storage = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let storage = frame_system::GenesisConfig::::default().build_storage().unwrap(); let mut ext: sp_io::TestExternalities = storage.into(); ext.execute_with(|| System::set_block_number(1)); ext diff --git a/pallets/fruniques/src/functions.rs b/pallets/fruniques/src/functions.rs index 4c6fde23..843fd403 100644 --- a/pallets/fruniques/src/functions.rs +++ b/pallets/fruniques/src/functions.rs @@ -68,7 +68,7 @@ impl Pallet { } pub fn admin_of(class_id: &T::CollectionId, instance_id: &T::ItemId) -> Option { - pallet_uniques::Pallet::::owner(*class_id, *instance_id) + pallet_uniques::Pallet::::owner(class_id.clone(), *instance_id) } pub fn is_frozen(collection_id: &T::CollectionId, instance_id: &T::ItemId) -> bool { @@ -79,14 +79,14 @@ impl Pallet { } pub fn collection_exists(class_id: &T::CollectionId) -> bool { - if let Some(_owner) = pallet_uniques::Pallet::::collection_owner(*class_id) { + if let Some(_owner) = pallet_uniques::Pallet::::collection_owner(class_id.clone()) { return true } false } pub fn instance_exists(class_id: &T::CollectionId, instance_id: &T::ItemId) -> bool { - if let Some(_owner) = pallet_uniques::Pallet::::owner(*class_id, *instance_id) { + if let Some(_owner) = pallet_uniques::Pallet::::owner(class_id.clone(), *instance_id) { return true } false @@ -164,7 +164,7 @@ impl Pallet { ) -> DispatchResult { pallet_uniques::Pallet::::set_attribute( origin, - *class_id.clone(), + class_id.clone(), Some(instance_id), key, value, @@ -247,7 +247,7 @@ impl Pallet { pallet_uniques::Pallet::::burn( origin, - *class_id, + class_id.clone(), instance_id, Some(Self::account_id_to_lookup_source(&admin.unwrap())), )?; @@ -372,7 +372,7 @@ impl Pallet { let child_percentage: Permill = parent_info.parent_weight * frunique_parent.weight; let parent_data: ParentInfo = ParentInfo { - collection_id: parent_info.collection_id, + collection_id: parent_info.collection_id.clone(), parent_id: parent_info.parent_id, parent_weight: child_percentage, is_hierarchical: parent_info.is_hierarchical, @@ -400,7 +400,7 @@ impl Pallet { }; >::try_mutate::<_, _, _, DispatchError, _>( - parent_info.collection_id, + parent_info.collection_id.clone(), parent_info.parent_id, |frunique_data| -> DispatchResult { let frunique = frunique_data.as_mut().ok_or(Error::::FruniqueNotFound)?; diff --git a/pallets/fruniques/src/mock.rs b/pallets/fruniques/src/mock.rs index a6d2bcb1..75f73bee 100644 --- a/pallets/fruniques/src/mock.rs +++ b/pallets/fruniques/src/mock.rs @@ -2,22 +2,18 @@ use crate as pallet_fruniques; use frame_support::{construct_runtime, parameter_types, traits::AsEnsureOriginWithArg}; use frame_system::{EnsureRoot, EnsureSigned}; use pallet_balances; -use sp_core::H256; +use sp_core::{ConstU64, H256}; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, }; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Uniques: pallet_uniques::{Pallet, Call, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Fruniques: pallet_fruniques::{Pallet, Call, Storage, Event}, @@ -36,13 +32,12 @@ impl frame_system::Config for Test { type BlockLength = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type DbWeight = (); @@ -97,21 +92,20 @@ impl pallet_uniques::Config for Test { type Locker = (); } -parameter_types! { - pub const ExistentialDeposit: u64 = 1; - pub const MaxReserves: u32 = 50; -} - impl pallet_balances::Config for Test { type Balance = u64; type DustRemoval = (); type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ExistentialDeposit; + type ExistentialDeposit = ConstU64<1>; type AccountStore = System; type WeightInfo = (); type MaxLocks = (); - type MaxReserves = MaxReserves; + type MaxReserves = (); type ReserveIdentifier = [u8; 8]; + type RuntimeHoldReason = (); + type FreezeIdentifier = (); + type MaxHolds = (); + type MaxFreezes = (); } parameter_types! { @@ -142,7 +136,7 @@ impl pallet_rbac::Config for Test { pub fn new_test_ext() -> sp_io::TestExternalities { let balance_amount = 1_000_000 as u64; - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(1, balance_amount), (2, balance_amount), (3, balance_amount)], } diff --git a/pallets/fruniques/src/tests.rs b/pallets/fruniques/src/tests.rs index 774848e9..f78281b2 100644 --- a/pallets/fruniques/src/tests.rs +++ b/pallets/fruniques/src/tests.rs @@ -1,9 +1,8 @@ -use crate::{mock::*, Error}; +use crate::{mock::*, types::ParentInfoCall, Error}; use codec::Encode; use core::convert::TryFrom; - -use crate::types::ParentInfoCall; use frame_support::{assert_noop, assert_ok, BoundedVec}; +use sp_runtime::BuildStorage; pub struct ExtBuilder; // helper function to set BoundedVec @@ -21,7 +20,7 @@ impl Default for ExtBuilder { impl ExtBuilder { pub fn build(self) -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(1, 100), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)], } diff --git a/pallets/fund-admin-records/src/mock.rs b/pallets/fund-admin-records/src/mock.rs index 0aff65bf..1d1d0692 100644 --- a/pallets/fund-admin-records/src/mock.rs +++ b/pallets/fund-admin-records/src/mock.rs @@ -3,22 +3,18 @@ use frame_support::parameter_types; use frame_system as system; use sp_core::H256; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, }; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; use frame_system::EnsureRoot; // Configure a mock runtime to test the pallet. frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, FundAdminRecords: pallet_fund_admin_records::{Pallet, Call, Storage, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, } @@ -36,13 +32,12 @@ impl system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -79,5 +74,5 @@ impl pallet_timestamp::Config for Test { // Build genesis storage according to the mock runtime. pub fn new_test_ext() -> sp_io::TestExternalities { - system::GenesisConfig::default().build_storage::().unwrap().into() + system::GenesisConfig::::default().build_storage().unwrap().into() } diff --git a/pallets/fund-admin/src/mock.rs b/pallets/fund-admin/src/mock.rs index 0b699cc2..fe0f7611 100644 --- a/pallets/fund-admin/src/mock.rs +++ b/pallets/fund-admin/src/mock.rs @@ -1,24 +1,20 @@ use crate as pallet_fund_admin; use frame_support::parameter_types; use frame_system as system; -use sp_core::H256; +use sp_core::{ConstU64, H256}; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, }; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; use frame_system::EnsureRoot; // Configure a mock runtime to test the pallet. frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, FundAdmin: pallet_fund_admin::{Pallet, Call, Storage, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, RBAC: pallet_rbac::{Pallet, Call, Storage, Event}, @@ -26,21 +22,20 @@ frame_support::construct_runtime!( } ); -parameter_types! { - pub const ExistentialDeposit: u64 = 1; - pub const MaxReserves: u32 = 50; -} - impl pallet_balances::Config for Test { type Balance = u64; type DustRemoval = (); type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ExistentialDeposit; + type ExistentialDeposit = ConstU64<1>; type AccountStore = System; type WeightInfo = (); type MaxLocks = (); - type MaxReserves = MaxReserves; + type MaxReserves = (); type ReserveIdentifier = [u8; 8]; + type RuntimeHoldReason = (); + type FreezeIdentifier = (); + type MaxHolds = (); + type MaxFreezes = (); } parameter_types! { @@ -55,13 +50,12 @@ impl system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -162,7 +156,7 @@ impl pallet_rbac::Config for Test { // Build genesis storage according to the mock runtime. pub fn new_test_ext() -> sp_io::TestExternalities { let balance_amount = InitialAdminBalance::get(); - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(1, balance_amount)] } .assimilate_storage(&mut t) .expect("assimilate_storage failed"); diff --git a/pallets/gated-marketplace/src/functions.rs b/pallets/gated-marketplace/src/functions.rs index f6924d9e..a97da208 100644 --- a/pallets/gated-marketplace/src/functions.rs +++ b/pallets/gated-marketplace/src/functions.rs @@ -335,7 +335,7 @@ impl Pallet { ensure!(>::contains_key(marketplace_id), Error::::MarketplaceNotFound); Self::is_authorized(authority.clone(), &marketplace_id, Permission::EnlistSellOffer)?; //ensure the collection exists - if let Some(a) = pallet_uniques::Pallet::::owner(collection_id, item_id) { + if let Some(a) = pallet_uniques::Pallet::::owner(collection_id.clone(), item_id) { ensure!(a == authority, Error::::NotOwner); } else { return Err(Error::::CollectionNotFound.into()) @@ -349,7 +349,7 @@ impl Pallet { Self::get_timestamp_in_milliseconds().ok_or(Error::::TimestampError)?; //create an offer_id - let offer_id = (marketplace_id, authority.clone(), collection_id, creation_date) + let offer_id = (marketplace_id, authority.clone(), collection_id.clone(), creation_date) .using_encoded(blake2_256); //create offer structure @@ -359,7 +359,7 @@ impl Pallet { let offer_data = OfferData:: { marketplace_id, - collection_id, + collection_id: collection_id.clone(), item_id, creator: authority.clone(), price, @@ -372,11 +372,13 @@ impl Pallet { }; //ensure there is no a previous sell offer for this item - Self::can_this_item_receive_sell_orders(collection_id, item_id, marketplace_id)?; + Self::can_this_item_receive_sell_orders(collection_id.clone(), item_id, marketplace_id)?; //insert in OffersByItem - >::try_mutate(collection_id, item_id, |offers| offers.try_push(offer_id)) - .map_err(|_| Error::::OfferStorageError)?; + >::try_mutate(collection_id.clone(), item_id, |offers| { + offers.try_push(offer_id) + }) + .map_err(|_| Error::::OfferStorageError)?; //insert in OffersByAccount >::try_mutate(authority, |offers| offers.try_push(offer_id)) @@ -411,7 +413,7 @@ impl Pallet { //ensure the collection exists //For this case user doesn't need to be the owner of the collection //but the owner of the item cannot create a buy offer for their own collection - if let Some(a) = pallet_uniques::Pallet::::owner(collection_id, item_id) { + if let Some(a) = pallet_uniques::Pallet::::owner(collection_id.clone(), item_id) { ensure!(a != authority, Error::::CannotCreateOffer); } else { return Err(Error::::CollectionNotFound.into()) @@ -444,7 +446,7 @@ impl Pallet { Self::get_timestamp_in_milliseconds().ok_or(Error::::TimestampError)?; //create an offer_id - let offer_id = (marketplace_id, authority.clone(), collection_id, creation_date) + let offer_id = (marketplace_id, authority.clone(), collection_id.clone(), creation_date) .using_encoded(blake2_256); //create offer structure @@ -452,7 +454,7 @@ impl Pallet { >::get(marketplace_id).ok_or(Error::::MarketplaceNotFound)?; let offer_data = OfferData:: { marketplace_id, - collection_id, + collection_id: collection_id.clone(), item_id, creator: authority.clone(), price, @@ -466,8 +468,10 @@ impl Pallet { //insert in OffersByItem //An item can receive multiple buy offers - >::try_mutate(collection_id, item_id, |offers| offers.try_push(offer_id)) - .map_err(|_| Error::::OfferStorageError)?; + >::try_mutate(collection_id.clone(), item_id, |offers| { + offers.try_push(offer_id) + }) + .map_err(|_| Error::::OfferStorageError)?; //insert in OffersByAccount >::try_mutate(authority, |offers| offers.try_push(offer_id)) @@ -500,16 +504,18 @@ impl Pallet { Self::is_authorized(buyer.clone(), &offer_data.marketplace_id, Permission::TakeSellOffer)?; //ensure the collection & owner exists - let owner_item = - pallet_uniques::Pallet::::owner(offer_data.collection_id, offer_data.item_id) - .ok_or(Error::::OwnerNotFound)?; + let owner_item = pallet_uniques::Pallet::::owner( + offer_data.collection_id.clone(), + offer_data.item_id, + ) + .ok_or(Error::::OwnerNotFound)?; //ensure owner is not the same as the buyer ensure!(owner_item != buyer, Error::::CannotTakeOffer); //ensure the offer_id exists in OffersByItem Self::does_exist_offer_id_for_this_item( - offer_data.collection_id, + offer_data.collection_id.clone(), offer_data.item_id, offer_id, )?; @@ -552,25 +558,25 @@ impl Pallet { if offer_data.percentage == Permill::from_percent(100) { //Use uniques transfer function to transfer the item to the buyer pallet_uniques::Pallet::::do_transfer( - offer_data.collection_id, + offer_data.collection_id.clone(), offer_data.item_id, buyer.clone(), |_, _| Ok(()), )?; } else { let parent_info = pallet_fruniques::types::ParentInfo { - collection_id: offer_data.collection_id, + collection_id: offer_data.collection_id.clone(), parent_id: offer_data.item_id, parent_weight: offer_data.percentage, is_hierarchical: true, }; let metadata = pallet_fruniques::Pallet::::get_nft_metadata( - offer_data.collection_id, + offer_data.collection_id.clone(), offer_data.item_id, ); pallet_fruniques::Pallet::::do_spawn( - offer_data.collection_id, + offer_data.collection_id.clone(), buyer.clone(), metadata, None, @@ -581,7 +587,7 @@ impl Pallet { //update offer status from all marketplaces Self::update_offers_status( buyer.clone(), - offer_data.collection_id, + offer_data.collection_id.clone(), offer_data.item_id, offer_data.marketplace_id, )?; @@ -608,9 +614,11 @@ impl Pallet { )?; //ensure the collection & owner exists - let owner_item = - pallet_uniques::Pallet::::owner(offer_data.collection_id, offer_data.item_id) - .ok_or(Error::::OwnerNotFound)?; + let owner_item = pallet_uniques::Pallet::::owner( + offer_data.collection_id.clone(), + offer_data.item_id, + ) + .ok_or(Error::::OwnerNotFound)?; //ensure only owner of the item can call the extrinsic ensure!(owner_item == authority, Error::::NotOwner); @@ -620,7 +628,7 @@ impl Pallet { //ensure the offer_id exists in OffersByItem Self::does_exist_offer_id_for_this_item( - offer_data.collection_id, + offer_data.collection_id.clone(), offer_data.item_id, offer_id, )?; @@ -668,30 +676,33 @@ impl Pallet { KeepAlive, )?; */ - pallet_fruniques::Pallet::::do_thaw(&offer_data.collection_id, offer_data.item_id)?; + pallet_fruniques::Pallet::::do_thaw( + &offer_data.collection_id.clone(), + offer_data.item_id, + )?; if offer_data.percentage == Permill::from_percent(100) { //Use uniques transfer function to transfer the item to the buyer pallet_uniques::Pallet::::do_transfer( - offer_data.collection_id, + offer_data.collection_id.clone(), offer_data.item_id, offer_data.creator.clone(), |_, _| Ok(()), )?; } else { let parent_info = pallet_fruniques::types::ParentInfo { - collection_id: offer_data.collection_id, + collection_id: offer_data.collection_id.clone(), parent_id: offer_data.item_id, parent_weight: offer_data.percentage, is_hierarchical: true, }; let metadata = pallet_fruniques::Pallet::::get_nft_metadata( - offer_data.collection_id, + offer_data.collection_id.clone(), offer_data.item_id, ); pallet_fruniques::Pallet::::do_spawn( - offer_data.collection_id, + offer_data.collection_id.clone(), offer_data.creator.clone(), metadata, None, @@ -702,7 +713,7 @@ impl Pallet { //update offer status from all marketplaces Self::update_offers_status( offer_data.creator.clone(), - offer_data.collection_id, + offer_data.collection_id.clone(), offer_data.item_id, offer_data.marketplace_id, )?; @@ -734,13 +745,16 @@ impl Pallet { //ensure the offer_id exists in OffersByItem Self::does_exist_offer_id_for_this_item( - offer_data.collection_id, + offer_data.collection_id.clone(), offer_data.item_id, offer_id, )?; if offer_data.offer_type == OfferType::SellOrder { - pallet_fruniques::Pallet::::do_thaw(&offer_data.collection_id, offer_data.item_id)?; + pallet_fruniques::Pallet::::do_thaw( + &offer_data.collection_id.clone(), + offer_data.item_id, + )?; } //remove the offer from OfferInfo @@ -1238,7 +1252,7 @@ impl Pallet { Self::is_authorized(buyer, marketplace_id, Permission::EnlistBuyOffer)?; //We need to check if the owner is in the marketplace - if let Some(owner) = pallet_uniques::Pallet::::owner(*class_id, *instance_id) { + if let Some(owner) = pallet_uniques::Pallet::::owner(class_id.clone(), *instance_id) { if Self::is_authorized(owner, marketplace_id, Permission::EnlistSellOffer).is_ok() { return Ok(()) } @@ -1251,9 +1265,12 @@ impl Pallet { item_id: T::ItemId, ) -> DispatchResult { //ensure the item has offers associated with it. - ensure!(>::contains_key(collection_id, item_id), Error::::OfferNotFound); + ensure!( + >::contains_key(collection_id.clone(), item_id), + Error::::OfferNotFound + ); - let offers_ids = >::take(collection_id, item_id); + let offers_ids = >::take(collection_id.clone(), item_id); //let mut remaining_offer_ids: Vec<[u8;32]> = Vec::new(); let mut buy_offer_ids: BoundedVec<[u8; 32], T::MaxOffersPerMarket> = BoundedVec::default(); @@ -1267,7 +1284,7 @@ impl Pallet { } //ensure we already took the entry from the storagemap, so we can insert it again. ensure!( - !>::contains_key(collection_id, item_id), + !>::contains_key(collection_id.clone(), item_id), Error::::OfferNotFound ); >::insert(collection_id, item_id, buy_offer_ids); @@ -1293,7 +1310,7 @@ impl Pallet { ensure!(>::contains_key(marketplace), Error::::MarketplaceNotFound); Self::is_authorized(who.clone(), &marketplace, Permission::AskForRedemption)?; //ensure the collection exists - if let Some(a) = pallet_uniques::Pallet::::owner(collection_id, item_id) { + if let Some(a) = pallet_uniques::Pallet::::owner(collection_id.clone(), item_id) { ensure!(a == who, Error::::NotOwner); } else { return Err(Error::::CollectionNotFound.into()) @@ -1355,7 +1372,7 @@ impl Pallet { redemption_data.redeemed_by = Some(who.clone()); Self::deposit_event(Event::RedemptionAccepted(marketplace, redemption_id, who)); pallet_fruniques::Pallet::::do_redeem( - redemption_data.collection_id, + redemption_data.collection_id.clone(), redemption_data.item_id, )?; diff --git a/pallets/gated-marketplace/src/mock.rs b/pallets/gated-marketplace/src/mock.rs index 788ebb90..0ae7a47c 100644 --- a/pallets/gated-marketplace/src/mock.rs +++ b/pallets/gated-marketplace/src/mock.rs @@ -1,37 +1,29 @@ use crate as pallet_gated_marketplace; use frame_support::{ parameter_types, - traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, GenesisBuild}, + traits::{AsEnsureOriginWithArg, ConstU32, ConstU64}, }; use frame_system as system; use sp_core::H256; -use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, IdentityLookup}, -}; +use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; /// Balance of an account. pub type Balance = u128; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; use frame_system::EnsureRoot; -use pallet_mapped_assets::DefaultCallback; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, Block as BlockT, IdentifyAccount, NumberFor, Verify}, transaction_validity::{TransactionSource, TransactionValidity}, - AccountId32, ApplyExtrinsicResult, MultiSignature, Percent, + AccountId32, ApplyExtrinsicResult, BuildStorage, MultiSignature, Percent, }; use system::EnsureSigned; type AccountId = u64; type AssetId = u32; // Configure a mock runtime to test the pallet. frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, GatedMarketplace: pallet_gated_marketplace::{Pallet, Call, Storage, Event}, Uniques: pallet_uniques::{Pallet, Call, Storage, Event}, Fruniques: pallet_fruniques::{Pallet, Call, Storage, Event}, @@ -54,13 +46,12 @@ impl system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -153,21 +144,20 @@ impl pallet_uniques::Config for Test { type Locker = (); } -parameter_types! { - pub const ExistentialDeposit: u64 = 1; - pub const MaxReserves: u32 = 50; -} - impl pallet_balances::Config for Test { type Balance = u64; type DustRemoval = (); type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ExistentialDeposit; + type ExistentialDeposit = ConstU64<1>; type AccountStore = System; type WeightInfo = (); type MaxLocks = (); - type MaxReserves = MaxReserves; + type MaxReserves = (); type ReserveIdentifier = [u8; 8]; + type RuntimeHoldReason = (); + type FreezeIdentifier = (); + type MaxHolds = (); + type MaxFreezes = (); } parameter_types! { @@ -195,7 +185,7 @@ impl pallet_rbac::Config for Test { pub fn new_test_ext() -> sp_io::TestExternalities { // TODO: get initial conf? let mut t: sp_io::TestExternalities = - frame_system::GenesisConfig::default().build_storage::().unwrap().into(); + frame_system::GenesisConfig::::default().build_storage().unwrap().into(); t.execute_with(|| { GatedMarketplace::do_initial_setup() .expect("Error on GatedMarketplace configuring initial setup"); @@ -217,19 +207,15 @@ parameter_types! { pub const RemoveItemsLimit: u32 = 1000; } -pub trait AssetsCallback { - /// Indicates that asset with `id` was successfully created by the `owner` - fn created(_id: &AssetId, _owner: &AccountId) {} - - /// Indicates that asset with `id` has just been destroyed - fn destroyed(_id: &AssetId) {} -} - pub struct AssetsCallbackHandle; impl pallet_mapped_assets::AssetsCallback for AssetsCallbackHandle { - fn created(_id: &AssetId, _owner: &u64) {} + fn created(_id: &AssetId, _owner: &u64) -> Result<(), ()> { + Ok(()) + } - fn destroyed(_id: &AssetId) {} + fn destroyed(_id: &AssetId) -> Result<(), ()> { + Ok(()) + } } impl pallet_mapped_assets::Config for Test { @@ -251,6 +237,5 @@ impl pallet_mapped_assets::Config for Test { type CallbackHandle = AssetsCallbackHandle; type Extra = (); type RemoveItemsLimit = ConstU32<5>; - type MaxReserves = MaxReserves; - type ReserveIdentifier = u32; + type Rbac = RBAC; } diff --git a/pallets/mapped-assets/src/functions.rs b/pallets/mapped-assets/src/functions.rs index 9289ddee..a86c518a 100644 --- a/pallets/mapped-assets/src/functions.rs +++ b/pallets/mapped-assets/src/functions.rs @@ -18,6 +18,7 @@ //! Functions for the Assets pallet. use super::*; +use codec::Encode; use frame_support::{defensive, sp_io::hashing::blake2_256, traits::Get, BoundedVec}; use pallet_rbac::types::{IdOrVec, RoleBasedAccessControl}; use scale_info::prelude::vec; @@ -35,6 +36,11 @@ use DeadConsequence::*; impl, I: 'static> Pallet { // Public immutables + /// Checks if the asset with `id` exists. + pub fn does_asset_exist(id: &T::AssetId) -> bool { + Asset::::contains_key(id) + } + /// Return the extra "sid-car" data for `id`/`who`, or `None` if the account doesn't exist. pub fn adjust_extra( id: T::AssetId, @@ -417,18 +423,15 @@ impl, I: 'static> Pallet { if let Some(check_issuer) = maybe_check_issuer { ensure!(check_issuer == details.issuer, Error::::NoPermission); } - debug_assert!( - T::Balance::max_value() - details.supply >= amount, - "checked in prep; qed" - ); + debug_assert!(details.supply.checked_add(&amount).is_some(), "checked in prep; qed"); + details.supply = details.supply.saturating_add(amount); + Ok(()) })?; - Self::deposit_event(Event::Issued { - asset_id: id, - owner: beneficiary.clone(), - total_supply: amount, - }); + + Self::deposit_event(Event::Issued { asset_id: id, owner: beneficiary.clone(), amount }); + Ok(()) } @@ -438,23 +441,16 @@ impl, I: 'static> Pallet { amount: T::Balance, maybe_check_issuer: Option, ) -> DispatchResult { - Self::increase_balance(id, beneficiary, amount, |details| -> DispatchResult { + Self::increase_balance(id.clone(), beneficiary, amount, |details| -> DispatchResult { if let Some(check_issuer) = maybe_check_issuer { let is_owner = Self::is_admin_or_owner(check_issuer)?; ensure!(is_owner, Error::::NoPermission); } - debug_assert!( - T::Balance::max_value() - details.supply >= amount, - "checked in prep; qed" - ); + debug_assert!(details.supply.checked_add(&amount).is_some(), "checked in prep; qed"); details.supply = details.supply.saturating_add(amount); Ok(()) })?; - Self::deposit_event(Event::Issued { - asset_id: id, - owner: beneficiary.clone(), - total_supply: amount, - }); + Self::deposit_event(Event::Issued { asset_id: id, owner: beneficiary.clone(), amount }); Ok(()) } @@ -559,15 +555,14 @@ impl, I: 'static> Pallet { target: &T::AccountId, amount: T::Balance, maybe_check_admin: Option, - f: DebitFlags, ) -> Result { - let d = Asset::::get(id).ok_or(Error::::Unknown)?; + let d = Asset::::get(id.clone()).ok_or(Error::::Unknown)?; ensure!( d.status == AssetStatus::Live || d.status == AssetStatus::Frozen, Error::::AssetNotLive ); - - let actual = Self::decrease_balance(id, target, amount, f, |actual, details| { + let f = DebitFlags { keep_alive: false, best_effort: true }; + let actual = Self::decrease_balance(id.clone(), target, amount, f, |actual, details| { // Check admin rights. if let Some(check_admin) = maybe_check_admin { let is_admin_or_owner = Self::is_admin_or_owner(check_admin)?; diff --git a/pallets/mapped-assets/src/lib.rs b/pallets/mapped-assets/src/lib.rs index a9b40d3d..2cdb2e5c 100644 --- a/pallets/mapped-assets/src/lib.rs +++ b/pallets/mapped-assets/src/lib.rs @@ -178,7 +178,7 @@ use frame_support::{ use frame_system::Config as SystemConfig; pub use pallet::*; -// use pallet_rbac::types::RoleBasedAccessControl; +use pallet_rbac::types::RoleBasedAccessControl; pub use weights::WeightInfo; type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; @@ -234,7 +234,7 @@ pub mod pallet { type RuntimeEvent: From> + IsType<::RuntimeEvent>; - // type Rbac: RoleBasedAccessControl; + type Rbac: RoleBasedAccessControl; /// The units in which we record balances. type Balance: Member + Parameter @@ -382,7 +382,7 @@ pub mod pallet { } #[pallet::genesis_build] - impl, I: 'static> GenesisBuild for GenesisConfig { + impl, I: 'static> BuildGenesisConfig for GenesisConfig { fn build(&self) { for (id, owner, is_sufficient, min_balance) in &self.assets { assert!(!Asset::::contains_key(id), "Asset id already in use"); diff --git a/pallets/mapped-assets/src/mock.rs b/pallets/mapped-assets/src/mock.rs index a200dd33..09074099 100644 --- a/pallets/mapped-assets/src/mock.rs +++ b/pallets/mapped-assets/src/mock.rs @@ -176,6 +176,7 @@ impl Config for Test { type RemoveItemsLimit = ConstU32<5>; #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = (); + type Rbac = RBAC; } use std::collections::HashMap; diff --git a/pallets/mapped-assets/src/tests.rs b/pallets/mapped-assets/src/tests.rs index 10695b8d..7567de5c 100644 --- a/pallets/mapped-assets/src/tests.rs +++ b/pallets/mapped-assets/src/tests.rs @@ -159,7 +159,7 @@ fn approval_lifecycle_works() { // can't approve non-existent token assert_noop!( Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 50), - Error::::UnknownAsset + Error::::Unknown ); // so we create it :) assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); @@ -185,7 +185,7 @@ fn transfer_approved_all_funds() { // can't approve non-existent token assert_noop!( Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 50), - Error::::UnknownAsset + Error::::Unknown ); // so we create it :) assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); @@ -788,7 +788,7 @@ fn set_metadata_should_work() { // Cannot add metadata to unknown asset assert_noop!( Assets::set_metadata(RuntimeOrigin::signed(1), 0, vec![0u8; 10], vec![0u8; 10], 12), - Error::::UnknownAsset, + Error::::Unknown, ); assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); // Cannot add metadata to unowned asset @@ -1094,7 +1094,7 @@ fn force_asset_status_should_work() { #[test] fn balance_conversion_should_work() { new_test_ext().execute_with(|| { - use frame_support::traits::tokens::BalanceConversion; + use frame_support::traits::tokens::ConversionToAssetBalance; let id = 42; assert_ok!(Assets::force_create(RuntimeOrigin::root(), id, 1, true, 10)); diff --git a/pallets/rbac/src/mock.rs b/pallets/rbac/src/mock.rs index 3815a61d..18317b6b 100644 --- a/pallets/rbac/src/mock.rs +++ b/pallets/rbac/src/mock.rs @@ -4,20 +4,16 @@ use frame_system as system; use frame_system::EnsureRoot; use sp_core::H256; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, }; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; // Configure a mock runtime to test the pallet. frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, RBAC: pallet_rbac::{Pallet, Call, Storage, Event}, } ); @@ -34,13 +30,12 @@ impl system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -76,5 +71,5 @@ impl pallet_rbac::Config for Test { } // Build genesis storage according to the mock runtime. pub fn new_test_ext() -> sp_io::TestExternalities { - system::GenesisConfig::default().build_storage::().unwrap().into() + system::GenesisConfig::::default().build_storage().unwrap().into() }