From 21370f5cbf2523db79a3960db490989071609d40 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Wed, 18 Oct 2023 12:35:19 -0600 Subject: [PATCH 01/34] update format to match the one for polkadot --- pallets/afloat/src/functions.rs | 10 +-- pallets/bitcoin-vaults/src/functions.rs | 28 ++++---- pallets/bitcoin-vaults/src/lib.rs | 12 ++-- pallets/confidential-docs/src/types.rs | 6 +- pallets/fruniques/src/functions.rs | 8 +-- pallets/fruniques/src/lib.rs | 4 +- pallets/fruniques/src/types.rs | 16 ++--- pallets/fund-admin/src/functions.rs | 29 ++++----- pallets/fund-admin/src/tests.rs | 30 ++++----- pallets/gated-marketplace/src/functions.rs | 28 ++++---- pallets/gated-marketplace/src/lib.rs | 15 ++--- pallets/gated-marketplace/src/tests.rs | 68 ++++++++++---------- pallets/mapped-assets/src/functions.rs | 40 ++++++------ pallets/mapped-assets/src/impl_stored_map.rs | 2 +- pallets/mapped-assets/src/lib.rs | 2 +- pallets/mapped-assets/src/types.rs | 2 +- 16 files changed, 146 insertions(+), 154 deletions(-) diff --git a/pallets/afloat/src/functions.rs b/pallets/afloat/src/functions.rs index 037753a7..4c39a1ea 100644 --- a/pallets/afloat/src/functions.rs +++ b/pallets/afloat/src/functions.rs @@ -64,7 +64,7 @@ impl Pallet { AfloatCollectionId::::put(collection_id); Ok(()) } else { - return Err(Error::::FailedToCreateFruniquesCollection.into()); + return Err(Error::::FailedToCreateFruniquesCollection.into()) } } @@ -461,8 +461,8 @@ impl Pallet { ); //ensure user has enough afloat balance ensure!( - Self::do_get_afloat_balance(who.clone()) - >= offer.price_per_credit * tax_credit_amount.into(), + Self::do_get_afloat_balance(who.clone()) >= + offer.price_per_credit * tax_credit_amount.into(), Error::::NotEnoughAfloatBalanceAvailable ); let zero_balance: T::Balance = Zero::zero(); @@ -609,7 +609,7 @@ impl Pallet { let tax_credit_amount_u32 = if let Ok(amount) = transaction.tax_credit_amount.try_into() { amount } else { - return Err(Error::::TaxCreditAmountOverflow.into()); + return Err(Error::::TaxCreditAmountOverflow.into()) }; let child_offer_id = pallet_gated_marketplace::Pallet::::do_enlist_sell_offer( @@ -713,7 +713,7 @@ impl Pallet { >::try_mutate(offer_id, |offer| -> DispatchResult { let offer = offer.as_mut().ok_or(Error::::OfferNotFound)?; if transaction.tax_credit_amount > offer.tax_credit_amount_remaining { - return Err(Error::::Underflow.into()); + return Err(Error::::Underflow.into()) } offer.tax_credit_amount_remaining = offer.tax_credit_amount_remaining - transaction.tax_credit_amount; diff --git a/pallets/bitcoin-vaults/src/functions.rs b/pallets/bitcoin-vaults/src/functions.rs index 046dcc7c..a963f995 100644 --- a/pallets/bitcoin-vaults/src/functions.rs +++ b/pallets/bitcoin-vaults/src/functions.rs @@ -33,7 +33,7 @@ impl Pallet { vault_members.clone().into_iter().try_for_each(|acc| { // check if all users have an xpub if !>::contains_key(acc.clone()) { - return Err(Error::::XPubNotFound); + return Err(Error::::XPubNotFound) } >::try_mutate(acc, |vault_vec| vault_vec.try_push(vault_id.clone())) .map_err(|_| Error::::SignerVaultLimit) @@ -153,8 +153,8 @@ impl Pallet { ensure!(vault.is_vault_member(&signer), Error::::SignerPermissionsNeeded); // if its finalized then fire error "already finalized" or "already broadcasted" ensure!( - proposal.status.eq(&ProposalStatus::Pending) - || proposal.status.eq(&ProposalStatus::Finalized), + proposal.status.eq(&ProposalStatus::Pending) || + proposal.status.eq(&ProposalStatus::Finalized), Error::::PendingProposalRequired ); // signs must be greater or equal than threshold @@ -265,7 +265,7 @@ impl Pallet { } } else { // xpub registered and the account doesnt own it: unavailable - return XpubStatus::Taken; + return XpubStatus::Taken } // Does the user owns the registered xpub? if yes, available } @@ -338,9 +338,9 @@ impl Pallet { pub fn get_pending_vaults() -> Vec<[u8; 32]> { >::iter() .filter_map(|(entry, vault)| { - if vault.descriptors.output_descriptor.is_empty() - && (vault.offchain_status.eq(&BDKStatus::::Pending) - || vault.offchain_status.eq( + if vault.descriptors.output_descriptor.is_empty() && + (vault.offchain_status.eq(&BDKStatus::::Pending) || + vault.offchain_status.eq( &BDKStatus::::RecoverableError( BoundedVec::::default(), ), @@ -356,11 +356,11 @@ impl Pallet { pub fn get_pending_proposals() -> Vec<[u8; 32]> { >::iter() .filter_map(|(id, proposal)| { - if proposal.psbt.is_empty() - && (proposal + if proposal.psbt.is_empty() && + (proposal .offchain_status - .eq(&BDKStatus::::Pending) - || proposal.offchain_status.eq( + .eq(&BDKStatus::::Pending) || + proposal.offchain_status.eq( &BDKStatus::::RecoverableError( BoundedVec::::default(), ), @@ -393,7 +393,7 @@ impl Pallet { >::iter() .filter_map(|(id, p)| { if p.can_be_finalized() { - return Some(id); + return Some(id) } None }) @@ -434,13 +434,13 @@ impl Pallet { let vec_body = response.body().collect::>(); let msj_str = str::from_utf8(vec_body.as_slice()).unwrap_or("Error 400: Bad request"); - return Err(Self::build_offchain_err(false, msj_str)); + return Err(Self::build_offchain_err(false, msj_str)) }, 500..=599 => { let vec_body = response.body().collect::>(); let msj_str = str::from_utf8(vec_body.as_slice()).unwrap_or("Error 500: Server error"); - return Err(Self::build_offchain_err(false, msj_str)); + return Err(Self::build_offchain_err(false, msj_str)) }, _ => return Err(Self::build_offchain_err(true, "Unknown error")), } diff --git a/pallets/bitcoin-vaults/src/lib.rs b/pallets/bitcoin-vaults/src/lib.rs index 67d4423f..632f22c0 100644 --- a/pallets/bitcoin-vaults/src/lib.rs +++ b/pallets/bitcoin-vaults/src/lib.rs @@ -279,7 +279,7 @@ pub mod pallet { // transactions without it let signer = Signer::::any_account(); if !signer.can_sign() { - return; + return } // Check if this OCW can modify the vaults @@ -745,7 +745,7 @@ pub mod pallet { let tx_res = Self::do_insert_descriptors(vault_payload.vault_id, descriptors, status); if tx_res.is_err() { - return Some(tx_res); + return Some(tx_res) } None }) @@ -775,7 +775,7 @@ pub mod pallet { let tx_res = Self::do_insert_psbt(proposal_psbt.proposal_id, bounded_psbt, status); if tx_res.is_err() { - return Some(tx_res); + return Some(tx_res) } None }) @@ -826,19 +826,19 @@ pub mod pallet { match call { Call::ocw_insert_descriptors { ref payload, ref signature } => { if !SignedPayload::::verify::(payload, signature.clone()) { - return InvalidTransaction::BadProof.into(); + return InvalidTransaction::BadProof.into() } valid_tx(b"unsigned_extrinsic_with_signed_payload".to_vec()) }, // compiler complains if they aren't on different match arms Call::ocw_insert_psbts { ref payload, ref signature } => { if !SignedPayload::::verify::(payload, signature.clone()) { - return InvalidTransaction::BadProof.into(); + return InvalidTransaction::BadProof.into() } valid_tx(b"unsigned_extrinsic_with_signed_payload".to_vec()) }, Call::ocw_finalize_psbts { ref payload, ref signature } => { if !SignedPayload::::verify::(payload, signature.clone()) { - return InvalidTransaction::BadProof.into(); + return InvalidTransaction::BadProof.into() } valid_tx(b"unsigned_extrinsic_with_signed_payload".to_vec()) }, diff --git a/pallets/confidential-docs/src/types.rs b/pallets/confidential-docs/src/types.rs index 84881ff6..6735c984 100644 --- a/pallets/confidential-docs/src/types.rs +++ b/pallets/confidential-docs/src/types.rs @@ -117,8 +117,8 @@ impl GroupMember { } pub fn can_remove_group_member(&self, group_member: &GroupMember) -> bool { - group_member.role != GroupRole::Owner - && (self.role == GroupRole::Owner - || (self.role == GroupRole::Admin && group_member.authorizer == self.member)) + group_member.role != GroupRole::Owner && + (self.role == GroupRole::Owner || + (self.role == GroupRole::Admin && group_member.authorizer == self.member)) } } diff --git a/pallets/fruniques/src/functions.rs b/pallets/fruniques/src/functions.rs index 14093231..59f2d2e8 100644 --- a/pallets/fruniques/src/functions.rs +++ b/pallets/fruniques/src/functions.rs @@ -62,7 +62,7 @@ impl Pallet { ) -> AttributeValue { if let Some(a) = pallet_uniques::Pallet::::attribute(class_id, instance_id, key) { return BoundedVec::::try_from(a) - .expect("Error on converting the attribute to BoundedVec"); + .expect("Error on converting the attribute to BoundedVec") } BoundedVec::::default() } @@ -80,14 +80,14 @@ impl Pallet { pub fn collection_exists(class_id: &T::CollectionId) -> bool { if let Some(_owner) = pallet_uniques::Pallet::::collection_owner(*class_id) { - return true; + 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) { - return true; + return true } false } @@ -314,7 +314,7 @@ impl Pallet { Self::do_mint(collection, owner.clone(), metadata.clone(), attributes)?; if let Some(ref parent_info) = parent_info { - return Self::do_nft_division(collection, item, metadata, parent_info, owner); + return Self::do_nft_division(collection, item, metadata, parent_info, owner) } let frunique_data = FruniqueData { diff --git a/pallets/fruniques/src/lib.rs b/pallets/fruniques/src/lib.rs index 5c3480d6..b862cfa1 100644 --- a/pallets/fruniques/src/lib.rs +++ b/pallets/fruniques/src/lib.rs @@ -341,7 +341,7 @@ pub mod pallet { Self::do_spawn(class_id, owner, metadata, attributes, Some(parent_info))?; - return Ok(()); + return Ok(()) }; Self::do_spawn(class_id, owner, metadata, attributes, None)?; @@ -377,7 +377,7 @@ pub mod pallet { |frunique_data| -> DispatchResult { let frunique = frunique_data.as_mut().ok_or(Error::::FruniqueNotFound)?; if frunique.verified == true || frunique.verified_by.is_some() { - return Err(Error::::FruniqueAlreadyVerified.into()); + return Err(Error::::FruniqueAlreadyVerified.into()) } frunique.verified = true; frunique.verified_by = Some(caller.clone()); diff --git a/pallets/fruniques/src/types.rs b/pallets/fruniques/src/types.rs index 27ab8f58..93a2ea93 100644 --- a/pallets/fruniques/src/types.rs +++ b/pallets/fruniques/src/types.rs @@ -43,10 +43,10 @@ pub struct ParentInfo { impl PartialEq for ParentInfo { fn eq(&self, other: &Self) -> bool { - self.collection_id == other.collection_id - && self.parent_id == other.parent_id - && self.parent_weight == other.parent_weight - && self.is_hierarchical == other.is_hierarchical + self.collection_id == other.collection_id && + self.parent_id == other.parent_id && + self.parent_weight == other.parent_weight && + self.is_hierarchical == other.is_hierarchical } } @@ -84,10 +84,10 @@ impl ParentInfoCall { impl PartialEq for ParentInfoCall { fn eq(&self, other: &Self) -> bool { - self.collection_id == other.collection_id - && self.parent_id == other.parent_id - && self.parent_percentage == other.parent_percentage - && self.is_hierarchical == other.is_hierarchical + self.collection_id == other.collection_id && + self.parent_id == other.parent_id && + self.parent_percentage == other.parent_percentage && + self.is_hierarchical == other.is_hierarchical } } diff --git a/pallets/fund-admin/src/functions.rs b/pallets/fund-admin/src/functions.rs index 5ad22852..5faf71f5 100644 --- a/pallets/fund-admin/src/functions.rs +++ b/pallets/fund-admin/src/functions.rs @@ -1606,8 +1606,8 @@ impl Pallet { DrawdownsInfo::::get(drawdown_id).ok_or(Error::::DrawdownNotFound)?; ensure!( - drawdown_data.drawdown_type == DrawdownType::ConstructionLoan - || drawdown_data.drawdown_type == DrawdownType::DeveloperEquity, + drawdown_data.drawdown_type == DrawdownType::ConstructionLoan || + drawdown_data.drawdown_type == DrawdownType::DeveloperEquity, Error::::DrawdownTypeNotSupportedForBulkUpload ); @@ -2843,7 +2843,7 @@ impl Pallet { // Check if the user role trying to be assigned matches the actual user role from UsersInfo // storage if user_data.role != role { - return Err(Error::::UserCannotHaveMoreThanOneRole.into()); + return Err(Error::::UserCannotHaveMoreThanOneRole.into()) } // Match user role. Check the max numbers of projects a user can be assigned to @@ -2851,7 +2851,7 @@ impl Pallet { ProxyRole::Administrator => { // Can't assign an administrator role account to a project, admins are scoped // globally - return Err(Error::::CannotAddAdminRole.into()); + return Err(Error::::CannotAddAdminRole.into()) }, ProxyRole::Investor => { // Investors can be assigned to a maximum of 1 project @@ -2896,9 +2896,8 @@ impl Pallet { match drawdown_data.status { DrawdownStatus::Draft => Ok(()), DrawdownStatus::Rejected => Ok(()), - DrawdownStatus::Submitted => { - Err(Error::::CannotPerformActionOnSubmittedDrawdown.into()) - }, + DrawdownStatus::Submitted => + Err(Error::::CannotPerformActionOnSubmittedDrawdown.into()), DrawdownStatus::Approved => { // Ensure admin permissions if Self::is_authorized( @@ -3226,9 +3225,8 @@ impl Pallet { match revenue_data.status { RevenueStatus::Draft => Ok(()), RevenueStatus::Rejected => Ok(()), - RevenueStatus::Submitted => { - Err(Error::::CannotPerformActionOnSubmittedRevenue.into()) - }, + RevenueStatus::Submitted => + Err(Error::::CannotPerformActionOnSubmittedRevenue.into()), RevenueStatus::Approved => { // Ensure admin permission if Self::is_authorized( @@ -3259,9 +3257,8 @@ impl Pallet { match revenue_transaction_data.status { RevenueTransactionStatus::Draft => Ok(()), RevenueTransactionStatus::Rejected => Ok(()), - RevenueTransactionStatus::Submitted => { - Err(Error::::CannotPerformActionOnSubmittedRevenueTransaction.into()) - }, + RevenueTransactionStatus::Submitted => + Err(Error::::CannotPerformActionOnSubmittedRevenueTransaction.into()), RevenueTransactionStatus::Approved => { // Ensure admin permissions if Self::is_authorized( @@ -3456,7 +3453,7 @@ impl Pallet { T::Currency::transfer(&admin, &user, T::TransferAmount::get(), KeepAlive)?; Ok(()) } else { - return Ok(()); + return Ok(()) } } @@ -3632,8 +3629,8 @@ impl Pallet { let transaction_data = TransactionsInfo::::get(transaction_id) .ok_or(Error::::TransactionNotFound)?; - if transaction_data.status != TransactionStatus::Approved - && transaction_data.status != TransactionStatus::Confirmed + if transaction_data.status != TransactionStatus::Approved && + transaction_data.status != TransactionStatus::Confirmed { >::try_mutate::<_, _, DispatchError, _>( transaction_id, diff --git a/pallets/fund-admin/src/tests.rs b/pallets/fund-admin/src/tests.rs index 51ad5ccb..c9d233f7 100644 --- a/pallets/fund-admin/src/tests.rs +++ b/pallets/fund-admin/src/tests.rs @@ -376,8 +376,8 @@ fn get_drawdown_id( for i in 0..drawdonws_by_project.len() { let drawdown_data = DrawdownsInfo::::get(drawdonws_by_project[i]).unwrap(); - if drawdown_data.drawdown_type == drawdown_type - && drawdown_data.drawdown_number == drawdown_number + if drawdown_data.drawdown_type == drawdown_type && + drawdown_data.drawdown_number == drawdown_number { drawdown_id = drawdonws_by_project[i]; } @@ -412,9 +412,9 @@ fn get_transaction_id( for i in 0..transactions_by_drawdown.len() { let transaction_data = TransactionsInfo::::get(transactions_by_drawdown[i]).unwrap(); - if transaction_data.project_id == project_id - && transaction_data.drawdown_id == drawdown_id - && transaction_data.expenditure_id == expenditure_id + if transaction_data.project_id == project_id && + transaction_data.drawdown_id == drawdown_id && + transaction_data.expenditure_id == expenditure_id { transaction_id = transactions_by_drawdown[i]; } @@ -459,9 +459,9 @@ fn get_revenue_transaction_id( for i in 0..transactions_by_revenue.len() { let revenue_transaction_data = RevenueTransactionsInfo::::get(transactions_by_revenue[i]).unwrap(); - if revenue_transaction_data.project_id == project_id - && revenue_transaction_data.revenue_id == revenue_id - && revenue_transaction_data.job_eligible_id == job_eligible_id + if revenue_transaction_data.project_id == project_id && + revenue_transaction_data.revenue_id == revenue_id && + revenue_transaction_data.job_eligible_id == job_eligible_id { revenue_transaction_id = transactions_by_revenue[i]; } @@ -1888,7 +1888,7 @@ fn expenditures_add_a_hard_cost_budget_expenditure_for_a_given_project_works() { .unwrap(); if expenditure_data.name == make_field_name("Expenditure Test: HardCost") { target_expenditure_id = expenditure_id; - break; + break } } @@ -1949,7 +1949,7 @@ fn expenditures_add_a_softcost_budget_expenditure_for_a_given_project_works() { .unwrap(); if expenditure_data.name == make_field_name("Expenditure Test: SoftCost") { target_expenditure_id = expenditure_id; - break; + break } } @@ -2010,7 +2010,7 @@ fn expenditures_add_an_operational_budget_expenditure_for_a_given_project_works( .unwrap(); if expenditure_data.name == make_field_name("Expenditure Test: Operational") { target_expenditure_id = expenditure_id; - break; + break } } @@ -2071,7 +2071,7 @@ fn expenditures_add_an_others_budget_expenditure_for_a_given_project_works() { .unwrap(); if expenditure_data.name == make_field_name("Expenditure Test: Others") { target_expenditure_id = expenditure_id; - break; + break } } @@ -2270,7 +2270,7 @@ fn expenditures_edit_a_given_expenditure_works() { if expenditure_data.name == make_field_name("Expenditure Test: Hard Cost") { target_expenditure_id = expenditure_id; - break; + break } } @@ -2444,7 +2444,7 @@ fn expenditures_admnistrator_tries_to_update_a_non_existent_expenditure_should_f if expenditure_data.name == make_field_name("Expenditure Test: Hard Cost") { target_expenditure_id = expenditure_id; - break; + break } } @@ -2522,7 +2522,7 @@ fn expenditures_delete_a_selected_expenditure_works() { if expenditure_data.name == make_field_name("Expenditure Test: Hard Cost") { target_expenditure_id = expenditure_id; - break; + break } } diff --git a/pallets/gated-marketplace/src/functions.rs b/pallets/gated-marketplace/src/functions.rs index ee3073f0..f6924d9e 100644 --- a/pallets/gated-marketplace/src/functions.rs +++ b/pallets/gated-marketplace/src/functions.rs @@ -176,7 +176,7 @@ impl Pallet { AccountOrApplication::Application(application_id) => >::iter() .find_map(|(acc, m_id, app_id)| { if m_id == marketplace_id && app_id == application_id { - return Some(acc); + return Some(acc) } None }) @@ -271,7 +271,7 @@ impl Pallet { match authority_type { MarketplaceRole::Owner => { ensure!(Self::owner_exist(marketplace_id), Error::::OwnerNotFound); - return Err(Error::::CantRemoveOwner.into()); + return Err(Error::::CantRemoveOwner.into()) }, MarketplaceRole::Admin => { // Admins can not delete themselves @@ -338,7 +338,7 @@ impl Pallet { if let Some(a) = pallet_uniques::Pallet::::owner(collection_id, item_id) { ensure!(a == authority, Error::::NotOwner); } else { - return Err(Error::::CollectionNotFound.into()); + return Err(Error::::CollectionNotFound.into()) } //ensure the price is valid @@ -414,7 +414,7 @@ impl Pallet { if let Some(a) = pallet_uniques::Pallet::::owner(collection_id, item_id) { ensure!(a != authority, Error::::CannotCreateOffer); } else { - return Err(Error::::CollectionNotFound.into()); + return Err(Error::::CollectionNotFound.into()) } //ensure the holder of NFT is in the same marketplace as the caller making the offer @@ -1128,12 +1128,10 @@ impl Pallet { .map_err(|_| Error::::ApplicationNotFound)?; match application.status { - ApplicationStatus::Pending => { - return Err(Error::::ApplicationStatusStillPending.into()) - }, - ApplicationStatus::Approved => { - return Err(Error::::ApplicationHasAlreadyBeenApproved.into()) - }, + ApplicationStatus::Pending => + return Err(Error::::ApplicationStatusStillPending.into()), + ApplicationStatus::Approved => + return Err(Error::::ApplicationHasAlreadyBeenApproved.into()), ApplicationStatus::Rejected => { //If status is Rejected, we need to delete the previous application from all the // storage sources. @@ -1219,10 +1217,10 @@ impl Pallet { for offer in offers { let offer_info = >::get(offer).ok_or(Error::::OfferNotFound)?; //ensure the offer_type is SellOrder, because this vector also contains buy offers. - if offer_info.marketplace_id == marketplace_id - && offer_info.offer_type == OfferType::SellOrder + if offer_info.marketplace_id == marketplace_id && + offer_info.offer_type == OfferType::SellOrder { - return Err(Error::::OfferAlreadyExists.into()); + return Err(Error::::OfferAlreadyExists.into()) } } } @@ -1242,7 +1240,7 @@ impl Pallet { //We need to check if the owner is in the marketplace if let Some(owner) = pallet_uniques::Pallet::::owner(*class_id, *instance_id) { if Self::is_authorized(owner, marketplace_id, Permission::EnlistSellOffer).is_ok() { - return Ok(()); + return Ok(()) } } Err(Error::::OwnerNotInMarketplace.into()) @@ -1298,7 +1296,7 @@ impl Pallet { if let Some(a) = pallet_uniques::Pallet::::owner(collection_id, item_id) { ensure!(a == who, Error::::NotOwner); } else { - return Err(Error::::CollectionNotFound.into()); + return Err(Error::::CollectionNotFound.into()) } let redemption_data: RedemptionData = RedemptionData { diff --git a/pallets/gated-marketplace/src/lib.rs b/pallets/gated-marketplace/src/lib.rs index c3f3fce1..c9fa43f6 100644 --- a/pallets/gated-marketplace/src/lib.rs +++ b/pallets/gated-marketplace/src/lib.rs @@ -404,9 +404,8 @@ pub mod pallet { let who = ensure_signed(origin)?; match block_args { BlockUserArgs::BlockUser(user) => Self::do_block_user(who, marketplace_id, user), - BlockUserArgs::UnblockUser(user) => { - Self::do_unblock_user(who, marketplace_id, user) - }, + BlockUserArgs::UnblockUser(user) => + Self::do_unblock_user(who, marketplace_id, user), } } @@ -819,12 +818,10 @@ pub mod pallet { ) -> DispatchResult { let who = ensure_signed(origin)?; match redeem { - RedeemArgs::AskForRedemption { collection_id, item_id } => { - return Self::do_ask_for_redeem(who, marketplace, collection_id, item_id) - }, - RedeemArgs::AcceptRedemption(redemption_id) => { - return Self::do_accept_redeem(who, marketplace, redemption_id) - }, + RedeemArgs::AskForRedemption { collection_id, item_id } => + return Self::do_ask_for_redeem(who, marketplace, collection_id, item_id), + RedeemArgs::AcceptRedemption(redemption_id) => + return Self::do_accept_redeem(who, marketplace, redemption_id), } } diff --git a/pallets/gated-marketplace/src/tests.rs b/pallets/gated-marketplace/src/tests.rs index e159b7bc..e88400f8 100644 --- a/pallets/gated-marketplace/src/tests.rs +++ b/pallets/gated-marketplace/src/tests.rs @@ -238,8 +238,8 @@ fn apply_to_marketplace_works() { )); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending).len() - == 1 + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending).len() == + 1 ); }); } @@ -266,8 +266,8 @@ fn apply_with_custodian_works() { )); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending).len() - == 1 + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending).len() == + 1 ); assert!(GatedMarketplace::custodians(4, m_id).pop().is_some()); }); @@ -1487,16 +1487,16 @@ fn remove_marketplace_deletes_storage_from_applicants_by_marketplace_status_pend None )); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending) - == vec![3] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending) == + vec![3] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) - == vec![] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) == + vec![] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) - == vec![] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) == + vec![] ); assert_ok!(GatedMarketplace::remove_marketplace(RuntimeOrigin::signed(1), m_id)); @@ -1505,12 +1505,12 @@ fn remove_marketplace_deletes_storage_from_applicants_by_marketplace_status_pend GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending) == vec![] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) - == vec![] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) == + vec![] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) - == vec![] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) == + vec![] ); assert!(GatedMarketplace::marketplaces(m_id).is_none()); }); @@ -1549,12 +1549,12 @@ fn remove_marketplace_deletes_storage_from_applicants_by_marketplace_status_appr GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending) == vec![] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) - == vec![3] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) == + vec![3] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) - == vec![] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) == + vec![] ); assert_ok!(GatedMarketplace::remove_marketplace(RuntimeOrigin::signed(1), m_id)); @@ -1563,12 +1563,12 @@ fn remove_marketplace_deletes_storage_from_applicants_by_marketplace_status_appr GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending) == vec![] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) - == vec![] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) == + vec![] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) - == vec![] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) == + vec![] ); assert!(GatedMarketplace::marketplaces(m_id).is_none()); }); @@ -1607,12 +1607,12 @@ fn remove_marketplace_deletes_storage_from_applicants_by_marketplace_status_reje GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending) == vec![] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) - == vec![] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) == + vec![] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) - == vec![3] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) == + vec![3] ); assert_ok!(GatedMarketplace::remove_marketplace(RuntimeOrigin::signed(1), m_id)); @@ -1621,12 +1621,12 @@ fn remove_marketplace_deletes_storage_from_applicants_by_marketplace_status_reje GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending) == vec![] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) - == vec![] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Approved) == + vec![] ); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) - == vec![] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Rejected) == + vec![] ); assert!(GatedMarketplace::marketplaces(m_id).is_none()); }); @@ -1655,8 +1655,8 @@ fn remove_marketplace_deletes_storage_from_applicantions_by_account_works() { )); let app_id = GatedMarketplace::applications_by_account(3, m_id).unwrap(); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending) - == vec![3] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending) == + vec![3] ); assert_ok!(GatedMarketplace::enroll( RuntimeOrigin::signed(1), @@ -1704,8 +1704,8 @@ fn remove_marketplace_deletes_storage_from_applications_works() { let app_id = GatedMarketplace::applications_by_account(3, m_id).unwrap(); assert!( - GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending) - == vec![3] + GatedMarketplace::applicants_by_marketplace(m_id, ApplicationStatus::Pending) == + vec![3] ); assert_ok!(GatedMarketplace::enroll( RuntimeOrigin::signed(1), diff --git a/pallets/mapped-assets/src/functions.rs b/pallets/mapped-assets/src/functions.rs index e9ffaf55..98f0c4bf 100644 --- a/pallets/mapped-assets/src/functions.rs +++ b/pallets/mapped-assets/src/functions.rs @@ -150,21 +150,21 @@ impl, I: 'static> Pallet { None => return DepositConsequence::UnknownAsset, }; if increase_supply && details.supply.checked_add(&amount).is_none() { - return DepositConsequence::Overflow; + return DepositConsequence::Overflow } if let Some(balance) = Self::maybe_balance(id, who) { if balance.checked_add(&amount).is_none() { - return DepositConsequence::Overflow; + return DepositConsequence::Overflow } } else { if amount < details.min_balance { - return DepositConsequence::BelowMinimum; + return DepositConsequence::BelowMinimum } if !details.is_sufficient && !frame_system::Pallet::::can_inc_consumer(who) { - return DepositConsequence::CannotCreate; + return DepositConsequence::CannotCreate } if details.is_sufficient && details.sufficients.checked_add(1).is_none() { - return DepositConsequence::Overflow; + return DepositConsequence::Overflow } } @@ -184,20 +184,20 @@ impl, I: 'static> Pallet { None => return UnknownAsset, }; if details.supply.checked_sub(&amount).is_none() { - return Underflow; + return Underflow } if details.is_frozen { - return Frozen; + return Frozen } if amount.is_zero() { - return Success; + return Success } let account = match Account::::get(id, who) { Some(a) => a, None => return NoFunds, }; if account.is_frozen { - return Frozen; + return Frozen } if let Some(rest) = account.balance.checked_sub(&amount) { if let Some(frozen) = T::Freezer::frozen_balance(id, who) { @@ -288,7 +288,7 @@ impl, I: 'static> Pallet { Ok(dust) => actual.saturating_add(dust), //< guaranteed by reducible_balance Err(e) => { debug_assert!(false, "passed from reducible_balance; qed"); - return Err(e); + return Err(e) }, }; @@ -454,7 +454,7 @@ impl, I: 'static> Pallet { ) -> DispatchResult, ) -> DispatchResult { if amount.is_zero() { - return Ok(()); + return Ok(()) } Self::can_increase(id, beneficiary, amount, true).into_result()?; @@ -570,7 +570,7 @@ impl, I: 'static> Pallet { ) -> DispatchResult, ) -> Result { if amount.is_zero() { - return Ok(amount); + return Ok(amount) } let actual = Self::prep_debit(id, target, amount, f)?; @@ -591,7 +591,7 @@ impl, I: 'static> Pallet { debug_assert!(account.balance.is_zero(), "checked in prep; qed"); target_died = Some(Self::dead_account(target, details, &account.reason, false)); if let Some(Remove) = target_died { - return Ok(()); + return Ok(()) } }; *maybe_account = Some(account); @@ -644,7 +644,7 @@ impl, I: 'static> Pallet { ) -> Result<(T::Balance, Option), DispatchError> { // Early exit if no-op. if amount.is_zero() { - return Ok((amount, None)); + return Ok((amount, None)) } let details = Asset::::get(id).ok_or(Error::::Unknown)?; @@ -668,7 +668,7 @@ impl, I: 'static> Pallet { // Skip if source == dest if source == dest { - return Ok(()); + return Ok(()) } // Burn any dust if needed. @@ -714,7 +714,7 @@ impl, I: 'static> Pallet { Some(Self::dead_account(source, details, &source_account.reason, false)); if let Some(Remove) = source_died { Account::::remove(id, &source); - return Ok(()); + return Ok(()) } } Account::::insert(id, &source, &source_account); @@ -809,7 +809,7 @@ impl, I: 'static> Pallet { let _ = Self::dead_account(&who, &mut details, &v.reason, true); dead_accounts.push(who); if dead_accounts.len() >= (max_items as usize) { - break; + break } } remaining_accounts = details.accounts; @@ -849,7 +849,7 @@ impl, I: 'static> Pallet { removed_approvals = removed_approvals.saturating_add(1); details.approvals = details.approvals.saturating_sub(1); if removed_approvals >= max_items { - break; + break } } Self::deposit_event(Event::ApprovalsDestroyed { @@ -1123,7 +1123,7 @@ impl, I: 'static> Pallet { maybe_check_admin: Option, ) -> DispatchResult { if amount.is_zero() { - return Ok(()); + return Ok(()) } Self::prep_debit( asset_id, @@ -1134,7 +1134,7 @@ impl, I: 'static> Pallet { Asset::::try_mutate(asset_id, |maybe_details| -> DispatchResult { let asset = maybe_details.as_mut().ok_or(Error::::UnknownAsset)?; if amount < asset.min_balance { - return Err(TokenError::BelowMinimum.into()); + return Err(TokenError::BelowMinimum.into()) } if let Some(admin) = maybe_check_admin { ensure!(admin == asset.admin, Error::::NoPermission); diff --git a/pallets/mapped-assets/src/impl_stored_map.rs b/pallets/mapped-assets/src/impl_stored_map.rs index 9e9af9d4..a4669c77 100644 --- a/pallets/mapped-assets/src/impl_stored_map.rs +++ b/pallets/mapped-assets/src/impl_stored_map.rs @@ -42,7 +42,7 @@ impl, I: 'static> StoredMap<(T::AssetId, T::AccountId), T::Extra> f if let Some(ref mut account) = maybe_account { account.extra = extra; } else { - return Err(DispatchError::NoProviders.into()); + return Err(DispatchError::NoProviders.into()) } } else { // They want to delete it. Let this pass if the item never existed anyway. diff --git a/pallets/mapped-assets/src/lib.rs b/pallets/mapped-assets/src/lib.rs index fe0d4213..1225ee01 100644 --- a/pallets/mapped-assets/src/lib.rs +++ b/pallets/mapped-assets/src/lib.rs @@ -1159,7 +1159,7 @@ pub mod pallet { ensure!(details.status == AssetStatus::Live, Error::::LiveAsset); ensure!(origin == details.owner, Error::::NoPermission); if details.owner == owner { - return Ok(()); + return Ok(()) } let metadata_deposit = Metadata::::get(id).deposit; diff --git a/pallets/mapped-assets/src/types.rs b/pallets/mapped-assets/src/types.rs index 35bb1453..722a1a45 100644 --- a/pallets/mapped-assets/src/types.rs +++ b/pallets/mapped-assets/src/types.rs @@ -123,7 +123,7 @@ pub enum ExistenceReason { impl ExistenceReason { pub(crate) fn take_deposit(&mut self) -> Option { if !matches!(self, ExistenceReason::DepositHeld(_)) { - return None; + return None } if let ExistenceReason::DepositHeld(deposit) = sp_std::mem::replace(self, ExistenceReason::DepositRefunded) From de38b35431e795a20757c75cd0ce8b47411dbe0d Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Wed, 18 Oct 2023 12:35:24 -0600 Subject: [PATCH 02/34] =?UTF-8?q?=F0=9F=93=A6=20chore(rust-toolchain.toml)?= =?UTF-8?q?:=20add=20rust-toolchain.toml=20file=20to=20specify=20the=20Rus?= =?UTF-8?q?t=20toolchain=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rust-toolchain.toml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 rust-toolchain.toml diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..c18ae658 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,14 @@ +[toolchain] +channel = "nightly" +components = [ + "cargo", + "clippy", + "rust-analyzer", + "rust-src", + "rust-std", + "rustc-dev", + "rustc", + "rustfmt", +] +targets = ["wasm32-unknown-unknown"] +profile = "minimal" From c796692c188bd729dfabbfc78b57bd24ec9fce0d Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Wed, 18 Oct 2023 12:36:49 -0600 Subject: [PATCH 03/34] =?UTF-8?q?=F0=9F=94=A7=20chore(Cargo.toml):=20updat?= =?UTF-8?q?e=20sp-runtime=20dependency=20to=20remove=20version=20constrain?= =?UTF-8?q?t=20for=20better=20compatibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/fruniques/Cargo.toml | 4 ++-- pallets/fund-admin-records/Cargo.toml | 4 ++-- pallets/fund-admin/Cargo.toml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pallets/fruniques/Cargo.toml b/pallets/fruniques/Cargo.toml index d76a5a3e..2ee1e036 100644 --- a/pallets/fruniques/Cargo.toml +++ b/pallets/fruniques/Cargo.toml @@ -23,13 +23,13 @@ scale-info = { default-features = false, version = "2.0.1", features = [ frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", optional = true } -sp-runtime = { default-features = false, version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } pallet-uniques = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } [dev-dependencies] -sp-core = { default-features = false, version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [features] diff --git a/pallets/fund-admin-records/Cargo.toml b/pallets/fund-admin-records/Cargo.toml index 03df82c2..30f219f2 100644 --- a/pallets/fund-admin-records/Cargo.toml +++ b/pallets/fund-admin-records/Cargo.toml @@ -23,11 +23,11 @@ scale-info = { version = "2.0.1", default-features = false, features = [ frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", optional = true } -sp-runtime = { default-features = false, version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [dev-dependencies] -sp-core = { default-features = false, version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [features] diff --git a/pallets/fund-admin/Cargo.toml b/pallets/fund-admin/Cargo.toml index e84e9937..e069df8b 100644 --- a/pallets/fund-admin/Cargo.toml +++ b/pallets/fund-admin/Cargo.toml @@ -23,13 +23,13 @@ scale-info = { version = "2.0.1", default-features = false, features = [ frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", optional = true } -sp-runtime = { default-features = false, version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } pallet-rbac = { default-features = false, version = "4.0.0-dev", path = "../rbac/" } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } [dev-dependencies] -sp-core = { default-features = false, version = "7.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [features] From 6ac39b02b668f079417a06c887739bb7729fdc04 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Wed, 18 Oct 2023 12:43:27 -0600 Subject: [PATCH 04/34] =?UTF-8?q?=F0=9F=94=84=20chore(rust-toolchain.toml)?= =?UTF-8?q?:=20update=20Rust=20toolchain=20to=20nightly-2023-05-22=20chann?= =?UTF-8?q?el=20=F0=9F=94=A7=20fix(rust-toolchain.toml):=20specify=20the?= =?UTF-8?q?=20exact=20nightly=20channel=20version=20to=20ensure=20consiste?= =?UTF-8?q?nt=20build=20environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index c18ae658..7dd204db 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly" +channel = "nightly-2023-05-22" components = [ "cargo", "clippy", From d53eb3e69480f5539c64e2ff6cb8308e91e34bb9 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Wed, 18 Oct 2023 12:58:30 -0600 Subject: [PATCH 05/34] =?UTF-8?q?=F0=9F=94=A7=20chore(lib.rs):=20update=20?= =?UTF-8?q?Scale=20trait=20implementation=20to=20use=20BlockNumberFor=20instead=20of=20Self::BlockNumber=20for=20better=20compatibi?= =?UTF-8?q?lity=20and=20flexibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/fund-admin-records/src/lib.rs | 2 +- pallets/fund-admin/src/lib.rs | 2 +- pallets/gated-marketplace/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pallets/fund-admin-records/src/lib.rs b/pallets/fund-admin-records/src/lib.rs index 7a20e4a1..d5490756 100644 --- a/pallets/fund-admin-records/src/lib.rs +++ b/pallets/fund-admin-records/src/lib.rs @@ -29,7 +29,7 @@ pub mod pallet { type Moment: Parameter + Default - + Scale + + Scale, Output = Self::Moment> + Copy + MaxEncodedLen + scale_info::StaticTypeInfo diff --git a/pallets/fund-admin/src/lib.rs b/pallets/fund-admin/src/lib.rs index 3b06d92f..eb1988d6 100644 --- a/pallets/fund-admin/src/lib.rs +++ b/pallets/fund-admin/src/lib.rs @@ -34,7 +34,7 @@ pub mod pallet { type Moment: Parameter + Default - + Scale + + Scale, Output = Self::Moment> + Copy + MaxEncodedLen + scale_info::StaticTypeInfo diff --git a/pallets/gated-marketplace/src/lib.rs b/pallets/gated-marketplace/src/lib.rs index c9fa43f6..756fcd99 100644 --- a/pallets/gated-marketplace/src/lib.rs +++ b/pallets/gated-marketplace/src/lib.rs @@ -37,7 +37,7 @@ pub mod pallet { type Moment: Parameter + Default - + Scale + + Scale, Output = Self::Moment> + Copy + MaxEncodedLen + scale_info::StaticTypeInfo From 9dfef1d7cb5e629649d2096de37190d68c5e2716 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Wed, 18 Oct 2023 13:05:39 -0600 Subject: [PATCH 06/34] =?UTF-8?q?=F0=9F=93=A6=20chore(pallets):=20update?= =?UTF-8?q?=20dependency=20versions=20in=20Cargo.toml=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔺 chore(pallets/afloat): update codec version to 3.6.1 🔺 chore(pallets/bitcoin-vaults): update codec version to 3.6.1 🔺 chore(pallets/confidential-docs): update codec version to 3.6.1 🔺 chore(pallets/fruniques): update codec version to 3.6.1 🔺 chore(pallets/fund-admin-records): update codec version to 3.6.1 🔺 chore(pallets/fund-admin): update codec version to 3.6.1 🔺 chore(pallets/gated-marketplace): update codec version to 3.6.1 🔺 chore(pallets/mapped-assets): update codec version to 3.6.1 and log version to 0.4.17 🔺 chore(pallets/rbac): update codec version to 3.6.1 🔺 chore(pallets/afloat): update scale-info version to 2.5.0 🔺 chore(pallets/bitcoin-vaults): update scale-info version to 2.5.0 🔺 chore(pallets/confidential-docs): update scale-info version to 2.5.0 🔺 chore(pallets/fruniques): update scale-info version to 2.5.0 🔺 chore(pallets/fund-admin-records): update scale-info version to 2.5.0 🔺 chore(pallets/fund-admin): update scale-info version to 2.5.0 🔺 chore(pallets/gated-marketplace): update scale-info version to 2.5.0 🔺 chore(pallets/mapped-assets): update scale-info version to 2.5.0 🔺 chore(pallets/rbac): update scale-info version to 2.5.0 📦 chore(Cargo.toml): update dependencies versions 🔺 deps(Cargo.toml): update codec to version 3.6.1 🔺 deps(Cargo.toml): update log to version 0.4.14 🔺 deps(Cargo.toml): update scale-info to version 2.5.0 🔺 deps(Cargo.toml): update frame-support to use polkadot-v1.0.0 branch --- Cargo.lock | 47 ++++++++++++++------------- pallets/afloat/Cargo.toml | 6 ++-- pallets/bitcoin-vaults/Cargo.toml | 6 ++-- pallets/confidential-docs/Cargo.toml | 6 ++-- pallets/fruniques/Cargo.toml | 4 +-- pallets/fund-admin-records/Cargo.toml | 4 +-- pallets/fund-admin/Cargo.toml | 4 +-- pallets/gated-marketplace/Cargo.toml | 6 ++-- pallets/mapped-assets/Cargo.toml | 28 +++++++++++----- pallets/rbac/Cargo.toml | 6 ++-- pallets/template/Cargo.toml | 6 ++-- 11 files changed, 59 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d770fb5..77efa020 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -139,7 +139,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] [[package]] @@ -925,7 +925,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] [[package]] @@ -1770,6 +1770,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "pallet-balances", "pallet-rbac", "parity-scale-codec", @@ -1830,9 +1831,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.5.0" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28" +checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -1845,9 +1846,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.4" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" +checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1992,9 +1993,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -2010,9 +2011,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.28" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -2126,7 +2127,7 @@ checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] [[package]] @@ -2337,22 +2338,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.163" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] [[package]] @@ -2952,9 +2953,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -2990,7 +2991,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] [[package]] @@ -3074,7 +3075,7 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] [[package]] @@ -3271,7 +3272,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -3293,7 +3294,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3702,5 +3703,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] diff --git a/pallets/afloat/Cargo.toml b/pallets/afloat/Cargo.toml index d236c4fe..6def8a88 100644 --- a/pallets/afloat/Cargo.toml +++ b/pallets/afloat/Cargo.toml @@ -14,11 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4" -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ - "derive", -] } +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } serde = { version = "1.0.140", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = [ +scale-info = { version = "2.5.0", default-features = false, features = [ "derive" ] } frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } diff --git a/pallets/bitcoin-vaults/Cargo.toml b/pallets/bitcoin-vaults/Cargo.toml index 8ef42930..4745a2a4 100644 --- a/pallets/bitcoin-vaults/Cargo.toml +++ b/pallets/bitcoin-vaults/Cargo.toml @@ -14,12 +14,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4" -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ - "derive", -] } +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } serde = { version = "1.0.140", default-features = false, features = ["derive"] } lite-json = { version = "0.1", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = [ +scale-info = { version = "2.5.0", default-features = false, features = [ "derive" ] } frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } diff --git a/pallets/confidential-docs/Cargo.toml b/pallets/confidential-docs/Cargo.toml index 31e7e64e..8407bce9 100644 --- a/pallets/confidential-docs/Cargo.toml +++ b/pallets/confidential-docs/Cargo.toml @@ -13,10 +13,8 @@ repository = "https://github.com/hashed-io/hashed-pallets" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ - "derive", -] } -scale-info = { version = "2.1.1", default-features = false, features = [ +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } +scale-info = { version = "2.5.0", default-features = false, features = [ "derive" ] } frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } diff --git a/pallets/fruniques/Cargo.toml b/pallets/fruniques/Cargo.toml index 2ee1e036..5e7ff07d 100644 --- a/pallets/fruniques/Cargo.toml +++ b/pallets/fruniques/Cargo.toml @@ -14,9 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4" -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ - "derive", -] } +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } scale-info = { default-features = false, version = "2.0.1", features = [ "derive" ] } diff --git a/pallets/fund-admin-records/Cargo.toml b/pallets/fund-admin-records/Cargo.toml index 30f219f2..a8353867 100644 --- a/pallets/fund-admin-records/Cargo.toml +++ b/pallets/fund-admin-records/Cargo.toml @@ -14,9 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4" -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ - "derive", -] } +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } scale-info = { version = "2.0.1", default-features = false, features = [ "derive" ] } diff --git a/pallets/fund-admin/Cargo.toml b/pallets/fund-admin/Cargo.toml index e069df8b..f78e9bc3 100644 --- a/pallets/fund-admin/Cargo.toml +++ b/pallets/fund-admin/Cargo.toml @@ -14,9 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4" -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ - "derive", -] } +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } scale-info = { version = "2.0.1", default-features = false, features = [ "derive" ] } diff --git a/pallets/gated-marketplace/Cargo.toml b/pallets/gated-marketplace/Cargo.toml index ceed6ef3..024c5abe 100644 --- a/pallets/gated-marketplace/Cargo.toml +++ b/pallets/gated-marketplace/Cargo.toml @@ -14,11 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4" -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ - "derive", -] } +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } serde = { version = "1.0.140", default-features = false, features = ["derive"] } -scale-info = { version = "2.1.1", default-features = false, features = [ +scale-info = { version = "2.5.0", default-features = false, features = [ "derive" ] } frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } diff --git a/pallets/mapped-assets/Cargo.toml b/pallets/mapped-assets/Cargo.toml index 7e8b3a30..caa7ca7e 100644 --- a/pallets/mapped-assets/Cargo.toml +++ b/pallets/mapped-assets/Cargo.toml @@ -13,8 +13,9 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = [ +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } +log = { version = "0.4.17", default-features = false } +scale-info = { version = "2.5.0", default-features = false, features = [ "derive" ] } sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } @@ -37,16 +38,27 @@ pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "p default = ["std"] std = [ "codec/std", - "scale-info/std", - "sp-std/std", - "sp-runtime/std", + "frame-benchmarking?/std", "frame-support/std", "frame-system/std", - "frame-benchmarking?/std", + "log/std", + "pallet-balances/std", + "scale-info/std", + "sp-core/std", + "sp-io/std", + "sp-runtime/std", + "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", + "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-balances/try-runtime", + "sp-runtime/try-runtime", ] -try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/rbac/Cargo.toml b/pallets/rbac/Cargo.toml index 23cb284e..9e47b2f6 100644 --- a/pallets/rbac/Cargo.toml +++ b/pallets/rbac/Cargo.toml @@ -14,10 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] log = "0.4" -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ - "derive", -] } -scale-info = { version = "2.1.1", default-features = false, features = [ +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } +scale-info = { version = "2.5.0", default-features = false, features = [ "derive" ] } frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } diff --git a/pallets/template/Cargo.toml b/pallets/template/Cargo.toml index 85df991a..06adf862 100644 --- a/pallets/template/Cargo.toml +++ b/pallets/template/Cargo.toml @@ -13,11 +13,9 @@ repository = "https://github.com/substrate-developer-hub/substrate-node-template targets = ["x86_64-unknown-linux-gnu"] [dependencies] -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ - "derive", -] } +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } log = { version = "0.4.14", default-features = false } -scale-info = { version = "2.1.1", default-features = false, features = [ +scale-info = { version = "2.5.0", default-features = false, features = [ "derive" ] } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } From d384a53081072283dec32121ab08a80c063ef98a Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Tue, 24 Oct 2023 13:09:23 -0600 Subject: [PATCH 07/34] wip update mapped assets --- pallets/mapped-assets/Cargo.toml | 26 +- pallets/mapped-assets/src/benchmarking.rs | 777 +++++++++++-------- pallets/mapped-assets/src/extra_mutator.rs | 8 +- pallets/mapped-assets/src/functions.rs | 678 +++++----------- pallets/mapped-assets/src/impl_fungibles.rs | 173 ++--- pallets/mapped-assets/src/impl_stored_map.rs | 6 +- pallets/mapped-assets/src/lib.rs | 498 ++++++------ pallets/mapped-assets/src/migration.rs | 137 ++++ pallets/mapped-assets/src/mock.rs | 85 +- pallets/mapped-assets/src/types.rs | 176 ++--- pallets/mapped-assets/src/weights.rs | 624 +++++++++------ 11 files changed, 1631 insertions(+), 1557 deletions(-) create mode 100644 pallets/mapped-assets/src/migration.rs diff --git a/pallets/mapped-assets/Cargo.toml b/pallets/mapped-assets/Cargo.toml index caa7ca7e..a4a1a8aa 100644 --- a/pallets/mapped-assets/Cargo.toml +++ b/pallets/mapped-assets/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] edition = "2021" license = "Apache-2.0" homepage = "https://substrate.io" -repository = "https://github.com/paritytech/substrate/" +repository = "https://github.com/hashed-io/hashed-pallets" description = "FRAME asset management pallet" readme = "README.md" @@ -26,10 +26,10 @@ frame-support = { git = "https://github.com/paritytech/substrate", branch = "pol # `system` module provides us with all sorts of useful stuff and macros depend on it being around. frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } pallet-rbac = { default-features = false, version = "4.0.0-dev", path = "../rbac/" } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } @@ -38,27 +38,17 @@ pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "p default = ["std"] std = [ "codec/std", - "frame-benchmarking?/std", - "frame-support/std", - "frame-system/std", - "log/std", - "pallet-balances/std", "scale-info/std", "sp-core/std", - "sp-io/std", - "sp-runtime/std", "sp-std/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", + "frame-benchmarking?/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", "sp-runtime/runtime-benchmarks", + "frame-system/runtime-benchmarks", ] -try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", - "pallet-balances/try-runtime", - "sp-runtime/try-runtime", -] +try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/mapped-assets/src/benchmarking.rs b/pallets/mapped-assets/src/benchmarking.rs index a4eb20e4..982edf33 100644 --- a/pallets/mapped-assets/src/benchmarking.rs +++ b/pallets/mapped-assets/src/benchmarking.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2020-2022 Parity Technologies (UK) Ltd. +// Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,8 +20,8 @@ #![cfg(feature = "runtime-benchmarks")] use super::*; -use frame_benchmarking::{ - account, benchmarks_instance_pallet, whitelist_account, whitelisted_caller, +use frame_benchmarking::v1::{ + account, benchmarks_instance_pallet, whitelist_account, whitelisted_caller, BenchmarkError, }; use frame_support::{ dispatch::UnfilteredDispatchable, @@ -35,69 +35,57 @@ use crate::Pallet as Assets; const SEED: u32 = 0; +fn default_asset_id, I: 'static>() -> T::AssetIdParameter { + T::BenchmarkHelper::create_asset_id_parameter(0) +} + fn create_default_asset, I: 'static>( is_sufficient: bool, -) -> (T::AccountId, AccountIdLookupOf) { +) -> (T::AssetIdParameter, T::AccountId, AccountIdLookupOf) { + let asset_id = default_asset_id::(); let caller: T::AccountId = whitelisted_caller(); let caller_lookup = T::Lookup::unlookup(caller.clone()); let root = SystemOrigin::Root.into(); assert!(Assets::::force_create( root, - Default::default(), + asset_id, caller_lookup.clone(), is_sufficient, 1u32.into(), ) .is_ok()); - (caller, caller_lookup) + (asset_id, caller, caller_lookup) } fn create_default_minted_asset, I: 'static>( is_sufficient: bool, amount: T::Balance, -) -> (T::AccountId, AccountIdLookupOf) { - let (caller, caller_lookup) = create_default_asset::(is_sufficient); +) -> (T::AssetIdParameter, T::AccountId, AccountIdLookupOf) { + let (asset_id, caller, caller_lookup) = create_default_asset::(is_sufficient); if !is_sufficient { - T::Currency::make_balance_be(&caller, T::Currency::minimum_balance()); + T::Currency::make_free_balance_be(&caller, T::Currency::minimum_balance()); } assert!(Assets::::mint( SystemOrigin::Signed(caller.clone()).into(), - Default::default(), + asset_id, caller_lookup.clone(), amount, ) .is_ok()); - (caller, caller_lookup) + (asset_id, caller, caller_lookup) } fn swap_is_sufficient, I: 'static>(s: &mut bool) { - Asset::::mutate(&T::AssetId::default(), |maybe_a| { + let asset_id = default_asset_id::(); + Asset::::mutate(&asset_id.into(), |maybe_a| { if let Some(ref mut a) = maybe_a { sp_std::mem::swap(s, &mut a.is_sufficient) } }); } -fn add_consumers, I: 'static>(minter: T::AccountId, n: u32) { - let origin = SystemOrigin::Signed(minter); - let mut s = false; - swap_is_sufficient::(&mut s); - for i in 0..n { - let target = account("consumer", i, SEED); - T::Currency::make_balance_be(&target, T::Currency::minimum_balance()); - let target_lookup = T::Lookup::unlookup(target); - assert!(Assets::::mint( - origin.clone().into(), - Default::default(), - target_lookup, - 100u32.into() - ) - .is_ok()); - } - swap_is_sufficient::(&mut s); -} - fn add_sufficients, I: 'static>(minter: T::AccountId, n: u32) { + let asset_id = default_asset_id::(); let origin = SystemOrigin::Signed(minter); let mut s = true; swap_is_sufficient::(&mut s); @@ -106,7 +94,7 @@ fn add_sufficients, I: 'static>(minter: T::AccountId, n: u32) { let target_lookup = T::Lookup::unlookup(target); assert!(Assets::::mint( origin.clone().into(), - Default::default(), + asset_id, target_lookup, 100u32.into() ) @@ -116,23 +104,23 @@ fn add_sufficients, I: 'static>(minter: T::AccountId, n: u32) { } fn add_approvals, I: 'static>(minter: T::AccountId, n: u32) { - T::Currency::deposit_creating(&minter, T::ApprovalDeposit::get() * n.into()); + let asset_id = default_asset_id::(); + T::Currency::deposit_creating( + &minter, + T::ApprovalDeposit::get() * n.into() + T::Currency::minimum_balance(), + ); let minter_lookup = T::Lookup::unlookup(minter.clone()); let origin = SystemOrigin::Signed(minter); - Assets::::mint( - origin.clone().into(), - Default::default(), - minter_lookup, - (100 * (n + 1)).into(), - ) - .unwrap(); + Assets::::mint(origin.clone().into(), asset_id, minter_lookup, (100 * (n + 1)).into()) + .unwrap(); + let enough = T::Currency::minimum_balance(); for i in 0..n { let target = account("approval", i, SEED); - T::Currency::make_balance_be(&target, T::Currency::minimum_balance()); + T::Currency::make_free_balance_be(&target, enough); let target_lookup = T::Lookup::unlookup(target); Assets::::approve_transfer( origin.clone().into(), - Default::default(), + asset_id, target_lookup, 100u32.into(), ) @@ -149,296 +137,419 @@ fn assert_event, I: 'static>(generic_event: >::Runti } benchmarks_instance_pallet! { - create { - let asset_id = Default::default(); - let origin = T::CreateOrigin::successful_origin(&asset_id); - let caller = T::CreateOrigin::ensure_origin(origin, &asset_id).unwrap(); - let caller_lookup = T::Lookup::unlookup(caller.clone()); - T::Currency::make_balance_be(&caller, DepositBalanceOf::::max_value()); - }: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup, 1u32.into()) - verify { - assert_last_event::(Event::Created { asset_id, creator: caller.clone(), owner: caller }.into()); - } + create { + let asset_id = default_asset_id::(); + let origin = T::CreateOrigin::try_successful_origin(&asset_id.into()) + .map_err(|_| BenchmarkError::Weightless)?; + let caller = T::CreateOrigin::ensure_origin(origin.clone(), &asset_id.into()).unwrap(); + let caller_lookup = T::Lookup::unlookup(caller.clone()); + T::Currency::make_free_balance_be(&caller, DepositBalanceOf::::max_value()); + }: _(origin, asset_id, caller_lookup, 1u32.into()) + verify { + assert_last_event::(Event::Created { asset_id: asset_id.into(), creator: caller.clone(), owner: caller }.into()); + } - force_create { - let caller: T::AccountId = whitelisted_caller(); - let caller_lookup = T::Lookup::unlookup(caller.clone()); - }: _(SystemOrigin::Root, Default::default(), caller_lookup, true, 1u32.into()) - verify { - assert_last_event::(Event::ForceCreated { asset_id: Default::default(), owner: caller }.into()); - } - - destroy { - let c in 0 .. 5_000; - let s in 0 .. 5_000; - let a in 0 .. 5_00; - let (caller, _) = create_default_asset::(true); - add_consumers::(caller.clone(), c); - add_sufficients::(caller.clone(), s); - add_approvals::(caller.clone(), a); - let witness = Asset::::get(T::AssetId::default()).unwrap().destroy_witness(); - }: _(SystemOrigin::Signed(caller), Default::default(), witness) - verify { - assert_last_event::(Event::Destroyed { asset_id: Default::default() }.into()); - } - - mint { - let (caller, caller_lookup) = create_default_asset::(true); - let amount = T::Balance::from(100u32); - }: _(SystemOrigin::Signed(caller.clone()), Default::default(), caller_lookup, amount) - verify { - assert_last_event::(Event::Issued { asset_id: Default::default(), owner: caller, total_supply: amount }.into()); - } - - burn { - let amount = T::Balance::from(100u32); - let (caller, caller_lookup) = create_default_minted_asset::(true, amount); - }: _(SystemOrigin::Signed(caller.clone()), Default::default(), caller_lookup, amount) - verify { - assert_last_event::(Event::Burned { asset_id: Default::default(), owner: caller, balance: amount }.into()); - } - - transfer { - let amount = T::Balance::from(100u32); - let (caller, caller_lookup) = create_default_minted_asset::(true, amount); - let target: T::AccountId = account("target", 0, SEED); - let target_lookup = T::Lookup::unlookup(target.clone()); - }: _(SystemOrigin::Signed(caller.clone()), Default::default(), target_lookup, amount) - verify { - assert_last_event::(Event::Transferred { asset_id: Default::default(), from: caller, to: target, amount }.into()); - } - - transfer_keep_alive { - let mint_amount = T::Balance::from(200u32); - let amount = T::Balance::from(100u32); - let (caller, caller_lookup) = create_default_minted_asset::(true, mint_amount); - let target: T::AccountId = account("target", 0, SEED); - let target_lookup = T::Lookup::unlookup(target.clone()); - }: _(SystemOrigin::Signed(caller.clone()), Default::default(), target_lookup, amount) - verify { - assert!(frame_system::Pallet::::account_exists(&caller)); - assert_last_event::(Event::Transferred { asset_id: Default::default(), from: caller, to: target, amount }.into()); - } - - force_transfer { - let amount = T::Balance::from(100u32); - let (caller, caller_lookup) = create_default_minted_asset::(true, amount); - let target: T::AccountId = account("target", 0, SEED); - let target_lookup = T::Lookup::unlookup(target.clone()); - }: _(SystemOrigin::Signed(caller.clone()), Default::default(), caller_lookup, target_lookup, amount) - verify { - assert_last_event::( - Event::Transferred { asset_id: Default::default(), from: caller, to: target, amount }.into() - ); - } - - freeze { - let (caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); - }: _(SystemOrigin::Signed(caller.clone()), Default::default(), caller_lookup) - verify { - assert_last_event::(Event::Frozen { asset_id: Default::default(), who: caller }.into()); - } - - thaw { - let (caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); - Assets::::freeze( - SystemOrigin::Signed(caller.clone()).into(), - Default::default(), - caller_lookup.clone(), - )?; - }: _(SystemOrigin::Signed(caller.clone()), Default::default(), caller_lookup) - verify { - assert_last_event::(Event::Thawed { asset_id: Default::default(), who: caller }.into()); - } - - freeze_asset { - let (caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); - }: _(SystemOrigin::Signed(caller.clone()), Default::default()) - verify { - assert_last_event::(Event::AssetFrozen { asset_id: Default::default() }.into()); - } - - thaw_asset { - let (caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); - Assets::::freeze_asset( - SystemOrigin::Signed(caller.clone()).into(), - Default::default(), - )?; - }: _(SystemOrigin::Signed(caller.clone()), Default::default()) - verify { - assert_last_event::(Event::AssetThawed { asset_id: Default::default() }.into()); - } - - transfer_ownership { - let (caller, _) = create_default_asset::(true); - let target: T::AccountId = account("target", 0, SEED); - let target_lookup = T::Lookup::unlookup(target.clone()); - }: _(SystemOrigin::Signed(caller), Default::default(), target_lookup) - verify { - assert_last_event::(Event::OwnerChanged { asset_id: Default::default(), owner: target }.into()); - } - - set_team { - let (caller, _) = create_default_asset::(true); - let target0 = T::Lookup::unlookup(account("target", 0, SEED)); - let target1 = T::Lookup::unlookup(account("target", 1, SEED)); - let target2 = T::Lookup::unlookup(account("target", 2, SEED)); - }: _(SystemOrigin::Signed(caller), Default::default(), target0, target1, target2) - verify { - assert_last_event::(Event::TeamChanged { - asset_id: Default::default(), - issuer: account("target", 0, SEED), - admin: account("target", 1, SEED), - freezer: account("target", 2, SEED), - }.into()); - } - - set_metadata { - let n in 0 .. T::StringLimit::get(); - let s in 0 .. T::StringLimit::get(); - - let name = vec![0u8; n as usize]; - let symbol = vec![0u8; s as usize]; - let decimals = 12; - - let (caller, _) = create_default_asset::(true); - T::Currency::make_balance_be(&caller, DepositBalanceOf::::max_value()); - }: _(SystemOrigin::Signed(caller), Default::default(), name.clone(), symbol.clone(), decimals) - verify { - let id = Default::default(); - assert_last_event::(Event::MetadataSet { asset_id: id, name, symbol, decimals, is_frozen: false }.into()); - } - - clear_metadata { - let (caller, _) = create_default_asset::(true); - T::Currency::make_balance_be(&caller, DepositBalanceOf::::max_value()); - let dummy = vec![0u8; T::StringLimit::get() as usize]; - let origin = SystemOrigin::Signed(caller.clone()).into(); - Assets::::set_metadata(origin, Default::default(), dummy.clone(), dummy, 12)?; - }: _(SystemOrigin::Signed(caller), Default::default()) - verify { - assert_last_event::(Event::MetadataCleared { asset_id: Default::default() }.into()); - } - - force_set_metadata { - let n in 0 .. T::StringLimit::get(); - let s in 0 .. T::StringLimit::get(); - - let name = vec![0u8; n as usize]; - let symbol = vec![0u8; s as usize]; - let decimals = 12; - - create_default_asset::(true); - - let origin = T::ForceOrigin::successful_origin(); - let call = Call::::force_set_metadata { - id: Default::default(), - name: name.clone(), - symbol: symbol.clone(), - decimals, - is_frozen: false, - }; - }: { call.dispatch_bypass_filter(origin)? } - verify { - let id = Default::default(); - assert_last_event::(Event::MetadataSet { asset_id: id, name, symbol, decimals, is_frozen: false }.into()); - } - - force_clear_metadata { - let (caller, _) = create_default_asset::(true); - T::Currency::make_balance_be(&caller, DepositBalanceOf::::max_value()); - let dummy = vec![0u8; T::StringLimit::get() as usize]; - let origin = SystemOrigin::Signed(caller).into(); - Assets::::set_metadata(origin, Default::default(), dummy.clone(), dummy, 12)?; - - let origin = T::ForceOrigin::successful_origin(); - let call = Call::::force_clear_metadata { id: Default::default() }; - }: { call.dispatch_bypass_filter(origin)? } - verify { - assert_last_event::(Event::MetadataCleared { asset_id: Default::default() }.into()); - } - - force_asset_status { - let (caller, caller_lookup) = create_default_asset::(true); - - let origin = T::ForceOrigin::successful_origin(); - let call = Call::::force_asset_status { - id: Default::default(), - owner: caller_lookup.clone(), - issuer: caller_lookup.clone(), - admin: caller_lookup.clone(), - freezer: caller_lookup, - min_balance: 100u32.into(), - is_sufficient: true, - is_frozen: false, - }; - }: { call.dispatch_bypass_filter(origin)? } - verify { - assert_last_event::(Event::AssetStatusChanged { asset_id: Default::default() }.into()); - } - - approve_transfer { - let (caller, _) = create_default_minted_asset::(true, 100u32.into()); - T::Currency::make_balance_be(&caller, DepositBalanceOf::::max_value()); - - let id = Default::default(); - let delegate: T::AccountId = account("delegate", 0, SEED); - let delegate_lookup = T::Lookup::unlookup(delegate.clone()); - let amount = 100u32.into(); - }: _(SystemOrigin::Signed(caller.clone()), id, delegate_lookup, amount) - verify { - assert_last_event::(Event::ApprovedTransfer { asset_id: id, source: caller, delegate, amount }.into()); - } - - transfer_approved { - let (owner, owner_lookup) = create_default_minted_asset::(true, 100u32.into()); - T::Currency::make_balance_be(&owner, DepositBalanceOf::::max_value()); - - let id = Default::default(); - let delegate: T::AccountId = account("delegate", 0, SEED); - whitelist_account!(delegate); - let delegate_lookup = T::Lookup::unlookup(delegate.clone()); - let amount = 100u32.into(); - let origin = SystemOrigin::Signed(owner.clone()).into(); - Assets::::approve_transfer(origin, id, delegate_lookup, amount)?; - - let dest: T::AccountId = account("dest", 0, SEED); - let dest_lookup = T::Lookup::unlookup(dest.clone()); - }: _(SystemOrigin::Signed(delegate.clone()), id, owner_lookup, dest_lookup, amount) - verify { - assert!(T::Currency::reserved_balance(&owner).is_zero()); - assert_event::(Event::Transferred { asset_id: id, from: owner, to: dest, amount }.into()); - } - - cancel_approval { - let (caller, _) = create_default_minted_asset::(true, 100u32.into()); - T::Currency::make_balance_be(&caller, DepositBalanceOf::::max_value()); - - let id = Default::default(); - let delegate: T::AccountId = account("delegate", 0, SEED); - let delegate_lookup = T::Lookup::unlookup(delegate.clone()); - let amount = 100u32.into(); - let origin = SystemOrigin::Signed(caller.clone()).into(); - Assets::::approve_transfer(origin, id, delegate_lookup.clone(), amount)?; - }: _(SystemOrigin::Signed(caller.clone()), id, delegate_lookup) - verify { - assert_last_event::(Event::ApprovalCancelled { asset_id: id, owner: caller, delegate }.into()); - } - - force_cancel_approval { - let (caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); - T::Currency::make_balance_be(&caller, DepositBalanceOf::::max_value()); - - let id = Default::default(); - let delegate: T::AccountId = account("delegate", 0, SEED); - let delegate_lookup = T::Lookup::unlookup(delegate.clone()); - let amount = 100u32.into(); - let origin = SystemOrigin::Signed(caller.clone()).into(); - Assets::::approve_transfer(origin, id, delegate_lookup.clone(), amount)?; - }: _(SystemOrigin::Signed(caller.clone()), id, caller_lookup, delegate_lookup) - verify { - assert_last_event::(Event::ApprovalCancelled { asset_id: id, owner: caller, delegate }.into()); - } - - impl_benchmark_test_suite!(Assets, crate::mock::new_test_ext(), crate::mock::Test) + force_create { + let asset_id = default_asset_id::(); + let caller: T::AccountId = whitelisted_caller(); + let caller_lookup = T::Lookup::unlookup(caller.clone()); + }: _(SystemOrigin::Root, asset_id, caller_lookup, true, 1u32.into()) + verify { + assert_last_event::(Event::ForceCreated { asset_id: asset_id.into(), owner: caller }.into()); + } + + start_destroy { + let (asset_id, caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); + Assets::::freeze_asset( + SystemOrigin::Signed(caller.clone()).into(), + asset_id, + )?; + }:_(SystemOrigin::Signed(caller), asset_id) + verify { + assert_last_event::(Event::DestructionStarted { asset_id: asset_id.into() }.into()); + } + + destroy_accounts { + let c in 0 .. T::RemoveItemsLimit::get(); + let (asset_id, caller, _) = create_default_asset::(true); + add_sufficients::(caller.clone(), c); + Assets::::freeze_asset( + SystemOrigin::Signed(caller.clone()).into(), + asset_id, + )?; + Assets::::start_destroy(SystemOrigin::Signed(caller.clone()).into(), asset_id)?; + }:_(SystemOrigin::Signed(caller), asset_id) + verify { + assert_last_event::(Event::AccountsDestroyed { + asset_id: asset_id.into(), + accounts_destroyed: c, + accounts_remaining: 0, + }.into()); + } + + destroy_approvals { + let a in 0 .. T::RemoveItemsLimit::get(); + let (asset_id, caller, _) = create_default_minted_asset::(true, 100u32.into()); + add_approvals::(caller.clone(), a); + Assets::::freeze_asset( + SystemOrigin::Signed(caller.clone()).into(), + asset_id, + )?; + Assets::::start_destroy(SystemOrigin::Signed(caller.clone()).into(), asset_id)?; + }:_(SystemOrigin::Signed(caller), asset_id) + verify { + assert_last_event::(Event::ApprovalsDestroyed { + asset_id: asset_id.into(), + approvals_destroyed: a, + approvals_remaining: 0, + }.into()); + } + + finish_destroy { + let (asset_id, caller, caller_lookup) = create_default_asset::(true); + Assets::::freeze_asset( + SystemOrigin::Signed(caller.clone()).into(), + asset_id, + )?; + Assets::::start_destroy(SystemOrigin::Signed(caller.clone()).into(), asset_id)?; + }:_(SystemOrigin::Signed(caller), asset_id) + verify { + assert_last_event::(Event::Destroyed { + asset_id: asset_id.into(), + }.into() + ); + } + + mint { + let (asset_id, caller, caller_lookup) = create_default_asset::(true); + let amount = T::Balance::from(100u32); + }: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup, amount) + verify { + assert_last_event::(Event::Issued { asset_id: asset_id.into(), owner: caller, amount }.into()); + } + + burn { + let amount = T::Balance::from(100u32); + let (asset_id, caller, caller_lookup) = create_default_minted_asset::(true, amount); + }: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup, amount) + verify { + assert_last_event::(Event::Burned { asset_id: asset_id.into(), owner: caller, balance: amount }.into()); + } + + transfer { + let amount = T::Balance::from(100u32); + let (asset_id, caller, caller_lookup) = create_default_minted_asset::(true, amount); + let target: T::AccountId = account("target", 0, SEED); + let target_lookup = T::Lookup::unlookup(target.clone()); + }: _(SystemOrigin::Signed(caller.clone()), asset_id, target_lookup, amount) + verify { + assert_last_event::(Event::Transferred { asset_id: asset_id.into(), from: caller, to: target, amount }.into()); + } + + transfer_keep_alive { + let mint_amount = T::Balance::from(200u32); + let amount = T::Balance::from(100u32); + let (asset_id, caller, caller_lookup) = create_default_minted_asset::(true, mint_amount); + let target: T::AccountId = account("target", 0, SEED); + let target_lookup = T::Lookup::unlookup(target.clone()); + }: _(SystemOrigin::Signed(caller.clone()), asset_id, target_lookup, amount) + verify { + assert!(frame_system::Pallet::::account_exists(&caller)); + assert_last_event::(Event::Transferred { asset_id: asset_id.into(), from: caller, to: target, amount }.into()); + } + + force_transfer { + let amount = T::Balance::from(100u32); + let (asset_id, caller, caller_lookup) = create_default_minted_asset::(true, amount); + let target: T::AccountId = account("target", 0, SEED); + let target_lookup = T::Lookup::unlookup(target.clone()); + }: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup, target_lookup, amount) + verify { + assert_last_event::( + Event::Transferred { asset_id: asset_id.into(), from: caller, to: target, amount }.into() + ); + } + + freeze { + let (asset_id, caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); + }: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup) + verify { + assert_last_event::(Event::Frozen { asset_id: asset_id.into(), who: caller }.into()); + } + + thaw { + let (asset_id, caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); + Assets::::freeze( + SystemOrigin::Signed(caller.clone()).into(), + asset_id, + caller_lookup.clone(), + )?; + }: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup) + verify { + assert_last_event::(Event::Thawed { asset_id: asset_id.into(), who: caller }.into()); + } + + freeze_asset { + let (asset_id, caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); + }: _(SystemOrigin::Signed(caller.clone()), asset_id) + verify { + assert_last_event::(Event::AssetFrozen { asset_id: asset_id.into() }.into()); + } + + thaw_asset { + let (asset_id, caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); + Assets::::freeze_asset( + SystemOrigin::Signed(caller.clone()).into(), + asset_id, + )?; + }: _(SystemOrigin::Signed(caller.clone()), asset_id) + verify { + assert_last_event::(Event::AssetThawed { asset_id: asset_id.into() }.into()); + } + + transfer_ownership { + let (asset_id, caller, _) = create_default_asset::(true); + let target: T::AccountId = account("target", 0, SEED); + let target_lookup = T::Lookup::unlookup(target.clone()); + }: _(SystemOrigin::Signed(caller), asset_id, target_lookup) + verify { + assert_last_event::(Event::OwnerChanged { asset_id: asset_id.into(), owner: target }.into()); + } + + set_team { + let (asset_id, caller, _) = create_default_asset::(true); + let target0 = T::Lookup::unlookup(account("target", 0, SEED)); + let target1 = T::Lookup::unlookup(account("target", 1, SEED)); + let target2 = T::Lookup::unlookup(account("target", 2, SEED)); + }: _(SystemOrigin::Signed(caller), asset_id, target0, target1, target2) + verify { + assert_last_event::(Event::TeamChanged { + asset_id: asset_id.into(), + issuer: account("target", 0, SEED), + admin: account("target", 1, SEED), + freezer: account("target", 2, SEED), + }.into()); + } + + set_metadata { + let n in 0 .. T::StringLimit::get(); + let s in 0 .. T::StringLimit::get(); + + let name = vec![0u8; n as usize]; + let symbol = vec![0u8; s as usize]; + let decimals = 12; + + let (asset_id, caller, _) = create_default_asset::(true); + T::Currency::make_free_balance_be(&caller, DepositBalanceOf::::max_value()); + }: _(SystemOrigin::Signed(caller), asset_id, name.clone(), symbol.clone(), decimals) + verify { + assert_last_event::(Event::MetadataSet { asset_id: asset_id.into(), name, symbol, decimals, is_frozen: false }.into()); + } + + clear_metadata { + let (asset_id, caller, _) = create_default_asset::(true); + T::Currency::make_free_balance_be(&caller, DepositBalanceOf::::max_value()); + let dummy = vec![0u8; T::StringLimit::get() as usize]; + let origin = SystemOrigin::Signed(caller.clone()).into(); + Assets::::set_metadata(origin, asset_id, dummy.clone(), dummy, 12)?; + }: _(SystemOrigin::Signed(caller), asset_id) + verify { + assert_last_event::(Event::MetadataCleared { asset_id: asset_id.into() }.into()); + } + + force_set_metadata { + let n in 0 .. T::StringLimit::get(); + let s in 0 .. T::StringLimit::get(); + + let name = vec![0u8; n as usize]; + let symbol = vec![0u8; s as usize]; + let decimals = 12; + + let (asset_id, _, _) = create_default_asset::(true); + + let origin = + T::ForceOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; + let call = Call::::force_set_metadata { + id: asset_id, + name: name.clone(), + symbol: symbol.clone(), + decimals, + is_frozen: false, + }; + }: { call.dispatch_bypass_filter(origin)? } + verify { + assert_last_event::(Event::MetadataSet { asset_id: asset_id.into(), name, symbol, decimals, is_frozen: false }.into()); + } + + force_clear_metadata { + let (asset_id, caller, _) = create_default_asset::(true); + T::Currency::make_free_balance_be(&caller, DepositBalanceOf::::max_value()); + let dummy = vec![0u8; T::StringLimit::get() as usize]; + let origin = SystemOrigin::Signed(caller).into(); + Assets::::set_metadata(origin, asset_id, dummy.clone(), dummy, 12)?; + + let origin = + T::ForceOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; + let call = Call::::force_clear_metadata { id: asset_id }; + }: { call.dispatch_bypass_filter(origin)? } + verify { + assert_last_event::(Event::MetadataCleared { asset_id: asset_id.into() }.into()); + } + + force_asset_status { + let (asset_id, caller, caller_lookup) = create_default_asset::(true); + + let origin = + T::ForceOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; + let call = Call::::force_asset_status { + id: asset_id, + owner: caller_lookup.clone(), + issuer: caller_lookup.clone(), + admin: caller_lookup.clone(), + freezer: caller_lookup, + min_balance: 100u32.into(), + is_sufficient: true, + is_frozen: false, + }; + }: { call.dispatch_bypass_filter(origin)? } + verify { + assert_last_event::(Event::AssetStatusChanged { asset_id: asset_id.into() }.into()); + } + + approve_transfer { + let (asset_id, caller, _) = create_default_minted_asset::(true, 100u32.into()); + T::Currency::make_free_balance_be(&caller, DepositBalanceOf::::max_value()); + + let delegate: T::AccountId = account("delegate", 0, SEED); + let delegate_lookup = T::Lookup::unlookup(delegate.clone()); + let amount = 100u32.into(); + }: _(SystemOrigin::Signed(caller.clone()), asset_id, delegate_lookup, amount) + verify { + assert_last_event::(Event::ApprovedTransfer { asset_id: asset_id.into(), source: caller, delegate, amount }.into()); + } + + transfer_approved { + let (asset_id, owner, owner_lookup) = create_default_minted_asset::(true, 100u32.into()); + T::Currency::make_free_balance_be(&owner, DepositBalanceOf::::max_value()); + + let delegate: T::AccountId = account("delegate", 0, SEED); + whitelist_account!(delegate); + let delegate_lookup = T::Lookup::unlookup(delegate.clone()); + let amount = 100u32.into(); + let origin = SystemOrigin::Signed(owner.clone()).into(); + Assets::::approve_transfer(origin, asset_id, delegate_lookup, amount)?; + + let dest: T::AccountId = account("dest", 0, SEED); + let dest_lookup = T::Lookup::unlookup(dest.clone()); + }: _(SystemOrigin::Signed(delegate.clone()), asset_id, owner_lookup, dest_lookup, amount) + verify { + assert!(T::Currency::reserved_balance(&owner).is_zero()); + assert_event::(Event::Transferred { asset_id: asset_id.into(), from: owner, to: dest, amount }.into()); + } + + cancel_approval { + let (asset_id, caller, _) = create_default_minted_asset::(true, 100u32.into()); + T::Currency::make_free_balance_be(&caller, DepositBalanceOf::::max_value()); + + let delegate: T::AccountId = account("delegate", 0, SEED); + let delegate_lookup = T::Lookup::unlookup(delegate.clone()); + let amount = 100u32.into(); + let origin = SystemOrigin::Signed(caller.clone()).into(); + Assets::::approve_transfer(origin, asset_id, delegate_lookup.clone(), amount)?; + }: _(SystemOrigin::Signed(caller.clone()), asset_id, delegate_lookup) + verify { + assert_last_event::(Event::ApprovalCancelled { asset_id: asset_id.into(), owner: caller, delegate }.into()); + } + + force_cancel_approval { + let (asset_id, caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); + T::Currency::make_free_balance_be(&caller, DepositBalanceOf::::max_value()); + + let delegate: T::AccountId = account("delegate", 0, SEED); + let delegate_lookup = T::Lookup::unlookup(delegate.clone()); + let amount = 100u32.into(); + let origin = SystemOrigin::Signed(caller.clone()).into(); + Assets::::approve_transfer(origin, asset_id, delegate_lookup.clone(), amount)?; + }: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup, delegate_lookup) + verify { + assert_last_event::(Event::ApprovalCancelled { asset_id: asset_id.into(), owner: caller, delegate }.into()); + } + + set_min_balance { + let (asset_id, caller, caller_lookup) = create_default_asset::(false); + }: _(SystemOrigin::Signed(caller.clone()), asset_id, 50u32.into()) + verify { + assert_last_event::(Event::AssetMinBalanceChanged { asset_id: asset_id.into(), new_min_balance: 50u32.into() }.into()); + } + + touch { + let (asset_id, asset_owner, asset_owner_lookup) = create_default_asset::(false); + let new_account: T::AccountId = account("newaccount", 1, SEED); + T::Currency::make_free_balance_be(&new_account, DepositBalanceOf::::max_value()); + assert_ne!(asset_owner, new_account); + assert!(!Account::::contains_key(asset_id.into(), &new_account)); + }: _(SystemOrigin::Signed(new_account.clone()), asset_id) + verify { + assert!(Account::::contains_key(asset_id.into(), &new_account)); + } + + touch_other { + let (asset_id, asset_owner, asset_owner_lookup) = create_default_asset::(false); + let new_account: T::AccountId = account("newaccount", 1, SEED); + let new_account_lookup = T::Lookup::unlookup(new_account.clone()); + T::Currency::make_free_balance_be(&asset_owner, DepositBalanceOf::::max_value()); + assert_ne!(asset_owner, new_account); + assert!(!Account::::contains_key(asset_id.into(), &new_account)); + }: _(SystemOrigin::Signed(asset_owner.clone()), asset_id, new_account_lookup) + verify { + assert!(Account::::contains_key(asset_id.into(), &new_account)); + } + + refund { + let (asset_id, asset_owner, asset_owner_lookup) = create_default_asset::(false); + let new_account: T::AccountId = account("newaccount", 1, SEED); + T::Currency::make_free_balance_be(&new_account, DepositBalanceOf::::max_value()); + assert_ne!(asset_owner, new_account); + assert!(Assets::::touch( + SystemOrigin::Signed(new_account.clone()).into(), + asset_id + ).is_ok()); + // `touch` should reserve some balance of the caller... + assert!(!T::Currency::reserved_balance(&new_account).is_zero()); + // ...and also create an `Account` entry. + assert!(Account::::contains_key(asset_id.into(), &new_account)); + }: _(SystemOrigin::Signed(new_account.clone()), asset_id, true) + verify { + // `refund`ing should of course repatriate the reserve + assert!(T::Currency::reserved_balance(&new_account).is_zero()); + } + + refund_other { + let (asset_id, asset_owner, asset_owner_lookup) = create_default_asset::(false); + let new_account: T::AccountId = account("newaccount", 1, SEED); + let new_account_lookup = T::Lookup::unlookup(new_account.clone()); + T::Currency::make_free_balance_be(&asset_owner, DepositBalanceOf::::max_value()); + assert_ne!(asset_owner, new_account); + assert!(Assets::::touch_other( + SystemOrigin::Signed(asset_owner.clone()).into(), + asset_id, + new_account_lookup.clone() + ).is_ok()); + // `touch_other` should reserve balance of the freezer + assert!(!T::Currency::reserved_balance(&asset_owner).is_zero()); + assert!(Account::::contains_key(asset_id.into(), &new_account)); + }: _(SystemOrigin::Signed(asset_owner.clone()), asset_id, new_account_lookup.clone()) + verify { + // this should repatriate the reserved balance of the freezer + assert!(T::Currency::reserved_balance(&asset_owner).is_zero()); + } + + block { + let (asset_id, caller, caller_lookup) = create_default_minted_asset::(true, 100u32.into()); + }: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup) + verify { + assert_last_event::(Event::Blocked { asset_id: asset_id.into(), who: caller }.into()); + } + + impl_benchmark_test_suite!(Assets, crate::mock::new_test_ext(), crate::mock::Test) } diff --git a/pallets/mapped-assets/src/extra_mutator.rs b/pallets/mapped-assets/src/extra_mutator.rs index b72bfa86..2a44df5f 100644 --- a/pallets/mapped-assets/src/extra_mutator.rs +++ b/pallets/mapped-assets/src/extra_mutator.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. +// Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -62,7 +62,7 @@ impl, I: 'static> ExtraMutator { id: T::AssetId, who: impl sp_std::borrow::Borrow, ) -> Option> { - if let Some(a) = Account::::get(id, who.borrow()) { + if let Some(a) = Account::::get(&id, who.borrow()) { Some(ExtraMutator:: { id, who: who.borrow().clone(), @@ -77,7 +77,7 @@ impl, I: 'static> ExtraMutator { /// Commit any changes to storage. pub fn commit(&mut self) -> Result<(), ()> { if let Some(extra) = self.pending.take() { - Account::::try_mutate(self.id, self.who.borrow(), |maybe_account| { + Account::::try_mutate(&self.id, &self.who, |maybe_account| { maybe_account.as_mut().ok_or(()).map(|account| account.extra = extra) }) } else { @@ -88,7 +88,7 @@ impl, I: 'static> ExtraMutator { /// Revert any changes, even those already committed by `self` and drop self. pub fn revert(mut self) -> Result<(), ()> { self.pending = None; - Account::::try_mutate(self.id, self.who.borrow(), |maybe_account| { + Account::::try_mutate(&self.id, &self.who, |maybe_account| { maybe_account .as_mut() .ok_or(()) diff --git a/pallets/mapped-assets/src/functions.rs b/pallets/mapped-assets/src/functions.rs index 98f0c4bf..f0559d1e 100644 --- a/pallets/mapped-assets/src/functions.rs +++ b/pallets/mapped-assets/src/functions.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. +// Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,7 +18,7 @@ //! Functions for the Assets pallet. use super::*; -use frame_support::{pallet_prelude::Encode, sp_io::hashing::blake2_256, traits::Get, BoundedVec}; +use frame_support::{defensive, traits::Get, BoundedVec}; use pallet_rbac::types::{IdOrVec, RoleBasedAccessControl}; use scale_info::prelude::vec; use sp_runtime::sp_std::vec::Vec; @@ -56,22 +56,6 @@ impl, I: 'static> Pallet { Account::::get(id, who.borrow()).map(|a| a.balance) } - /// Get the asset `id` reserved balance of `who`, or zero if the asset-account doesn't exist. - pub fn reserved_balance( - id: T::AssetId, - who: impl sp_std::borrow::Borrow, - ) -> T::Balance { - Self::maybe_reserved_balance(id, who).unwrap_or_default() - } - - /// Get the asset `id` reserved balance of `who` if the asset-account exists. - pub fn maybe_reserved_balance( - id: T::AssetId, - who: impl sp_std::borrow::Borrow, - ) -> Option { - Account::::get(id, who.borrow()).map(|a| a.reserved) - } - /// Get the total supply of an asset `id`. pub fn total_supply(id: T::AssetId) -> T::Balance { Self::maybe_total_supply(id).unwrap_or_default() @@ -82,30 +66,31 @@ impl, I: 'static> Pallet { Asset::::get(id).map(|x| x.supply) } - /// Get the total reserved supply of an asset `id`. - pub fn total_reserved_supply(id: T::AssetId) -> T::Balance { - Self::maybe_total_reserved_supply(id).unwrap_or_default() - } - - /// Get the total reversed supply of an asset `id` if the asset exists. - pub fn maybe_total_reserved_supply(id: T::AssetId) -> Option { - Asset::::get(id).map(|x| x.reserved) - } - pub(super) fn new_account( who: &T::AccountId, d: &mut AssetDetails>, - maybe_deposit: Option>, - ) -> Result>, DispatchError> { + maybe_deposit: Option<(&T::AccountId, DepositBalanceOf)>, + ) -> Result, DispatchError> { let accounts = d.accounts.checked_add(1).ok_or(ArithmeticError::Overflow)?; - let reason = if let Some(deposit) = maybe_deposit { - ExistenceReason::DepositHeld(deposit) + let reason = if let Some((depositor, deposit)) = maybe_deposit { + if depositor == who { + ExistenceReason::DepositHeld(deposit) + } else { + ExistenceReason::DepositFrom(depositor.clone(), deposit) + } } else if d.is_sufficient { frame_system::Pallet::::inc_sufficients(who); d.sufficients += 1; ExistenceReason::Sufficient } else { - frame_system::Pallet::::inc_consumers(who).map_err(|_| Error::::NoProvider)?; + frame_system::Pallet::::inc_consumers(who) + .map_err(|_| Error::::UnavailableConsumer)?; + // We ensure that we can still increment consumers once more because we could otherwise + // allow accidental usage of all consumer references which could cause grief. + if !frame_system::Pallet::::can_inc_consumer(who) { + frame_system::Pallet::::dec_consumers(who); + return Err(Error::::UnavailableConsumer.into()) + } ExistenceReason::Consumer }; d.accounts = accounts; @@ -115,18 +100,19 @@ impl, I: 'static> Pallet { pub(super) fn dead_account( who: &T::AccountId, d: &mut AssetDetails>, - reason: &ExistenceReason>, + reason: &ExistenceReasonOf, force: bool, ) -> DeadConsequence { + use ExistenceReason::*; match *reason { - ExistenceReason::Consumer => frame_system::Pallet::::dec_consumers(who), - ExistenceReason::Sufficient => { + Consumer => frame_system::Pallet::::dec_consumers(who), + Sufficient => { d.sufficients = d.sufficients.saturating_sub(1); frame_system::Pallet::::dec_sufficients(who); }, - ExistenceReason::DepositRefunded => {}, - ExistenceReason::DepositHeld(_) if !force => return Keep, - ExistenceReason::DepositHeld(_) => {}, + DepositRefunded => {}, + DepositHeld(_) | DepositFrom(..) if !force => return Keep, + DepositHeld(_) | DepositFrom(..) => {}, } d.accounts = d.accounts.saturating_sub(1); Remove @@ -145,22 +131,25 @@ impl, I: 'static> Pallet { amount: T::Balance, increase_supply: bool, ) -> DepositConsequence { - let details = match Asset::::get(id) { + let details = match Asset::::get(&id) { Some(details) => details, None => return DepositConsequence::UnknownAsset, }; if increase_supply && details.supply.checked_add(&amount).is_none() { return DepositConsequence::Overflow } - if let Some(balance) = Self::maybe_balance(id, who) { - if balance.checked_add(&amount).is_none() { + if let Some(account) = Account::::get(id, who) { + if account.status.is_blocked() { + return DepositConsequence::Blocked + } + if account.balance.checked_add(&amount).is_none() { return DepositConsequence::Overflow } } else { if amount < details.min_balance { return DepositConsequence::BelowMinimum } - if !details.is_sufficient && !frame_system::Pallet::::can_inc_consumer(who) { + if !details.is_sufficient && !frame_system::Pallet::::can_accrue_consumers(who, 2) { return DepositConsequence::CannotCreate } if details.is_sufficient && details.sufficients.checked_add(1).is_none() { @@ -179,28 +168,28 @@ impl, I: 'static> Pallet { keep_alive: bool, ) -> WithdrawConsequence { use WithdrawConsequence::*; - let details = match Asset::::get(id) { + let details = match Asset::::get(&id) { Some(details) => details, None => return UnknownAsset, }; if details.supply.checked_sub(&amount).is_none() { return Underflow } - if details.is_frozen { + if details.status == AssetStatus::Frozen { return Frozen } if amount.is_zero() { return Success } - let account = match Account::::get(id, who) { + let account = match Account::::get(&id, who) { Some(a) => a, - None => return NoFunds, + None => return BalanceLow, }; - if account.is_frozen { + if account.status.is_frozen() { return Frozen } if let Some(rest) = account.balance.checked_sub(&amount) { - if let Some(frozen) = T::Freezer::frozen_balance(id, who) { + if let Some(frozen) = T::Freezer::frozen_balance(id.clone(), who) { match frozen.checked_add(&details.min_balance) { Some(required) if rest < required => return Frozen, None => return Overflow, @@ -208,13 +197,8 @@ impl, I: 'static> Pallet { } } - let is_provider = false; - let is_required = is_provider && !frame_system::Pallet::::can_dec_provider(who); - let has_reserved_balance = !account.reserved.is_zero(); - let must_keep_alive = keep_alive || is_required || has_reserved_balance; - if rest < details.min_balance { - if must_keep_alive { + if keep_alive { WouldDie } else { ReducedToZero(rest) @@ -223,7 +207,7 @@ impl, I: 'static> Pallet { Success } } else { - NoFunds + BalanceLow } } @@ -234,11 +218,11 @@ impl, I: 'static> Pallet { who: &T::AccountId, keep_alive: bool, ) -> Result { - let details = Asset::::get(id).ok_or(Error::::UnknownAsset)?; - ensure!(!details.is_frozen, Error::::Frozen); + let details = Asset::::get(&id).ok_or(Error::::Unknown)?; + ensure!(details.status == AssetStatus::Live, Error::::AssetNotLive); - let account = Account::::get(id, who).ok_or(Error::::NoAccount)?; - ensure!(!account.is_frozen, Error::::Frozen); + let account = Account::::get(&id, who).ok_or(Error::::NoAccount)?; + ensure!(!account.status.is_frozen(), Error::::Frozen); let amount = if let Some(frozen) = T::Freezer::frozen_balance(id, who) { // Frozen balance: account CANNOT be deleted @@ -246,9 +230,7 @@ impl, I: 'static> Pallet { frozen.checked_add(&details.min_balance).ok_or(ArithmeticError::Overflow)?; account.balance.saturating_sub(required) } else { - let is_provider = false; - let is_required = is_provider && !frame_system::Pallet::::can_dec_provider(who); - if keep_alive || is_required { + if keep_alive { // We want to keep the account around. account.balance.saturating_sub(details.min_balance) } else { @@ -280,11 +262,11 @@ impl, I: 'static> Pallet { amount: T::Balance, f: DebitFlags, ) -> Result { - let actual = Self::reducible_balance(id, target, f.keep_alive)?.min(amount); + let actual = Self::reducible_balance(id.clone(), target, f.keep_alive)?.min(amount); ensure!(f.best_effort || actual >= amount, Error::::BalanceLow); let conseq = Self::can_decrease(id, target, actual, f.keep_alive); - let actual = match conseq.into_result() { + let actual = match conseq.into_result(f.keep_alive) { Ok(dust) => actual.saturating_add(dust), //< guaranteed by reducible_balance Err(e) => { debug_assert!(false, "passed from reducible_balance; qed"); @@ -325,44 +307,63 @@ impl, I: 'static> Pallet { Ok((credit, maybe_burn)) } - /// Creates a account for `who` to hold asset `id` with a zero balance and takes a deposit. - pub(super) fn do_touch(id: T::AssetId, who: T::AccountId) -> DispatchResult { - ensure!(!Account::::contains_key(id, &who), Error::::AlreadyExists); + /// Creates an account for `who` to hold asset `id` with a zero balance and takes a deposit. + /// + /// When `check_depositor` is set to true, the depositor must be either the asset's Admin or + /// Freezer, otherwise the depositor can be any account. + pub(super) fn do_touch( + id: T::AssetId, + who: T::AccountId, + depositor: T::AccountId, + check_depositor: bool, + ) -> DispatchResult { + ensure!(!Account::::contains_key(&id, &who), Error::::AlreadyExists); let deposit = T::AssetAccountDeposit::get(); - let mut details = Asset::::get(&id).ok_or(Error::::UnknownAsset)?; - let reason = Self::new_account(&who, &mut details, Some(deposit))?; - T::Currency::reserve(&who, deposit)?; + let mut details = Asset::::get(&id).ok_or(Error::::Unknown)?; + ensure!(details.status == AssetStatus::Live, Error::::AssetNotLive); + ensure!( + !check_depositor || &depositor == &details.admin || &depositor == &details.freezer, + Error::::NoPermission + ); + let reason = Self::new_account(&who, &mut details, Some((&depositor, deposit)))?; + T::Currency::reserve(&depositor, deposit)?; Asset::::insert(&id, details); Account::::insert( - id, + &id, &who, AssetAccountOf:: { balance: Zero::zero(), - reserved: Zero::zero(), - is_frozen: false, + status: AccountStatus::Liquid, reason, extra: T::Extra::default(), }, ); + Self::deposit_event(Event::Touched { asset_id: id, who, depositor }); Ok(()) } - /// Returns a deposit, destroying an asset-account. + /// Returns a deposit or a consumer reference, destroying an asset-account. + /// Non-zero balance accounts refunded and destroyed only if `allow_burn` is true. pub(super) fn do_refund(id: T::AssetId, who: T::AccountId, allow_burn: bool) -> DispatchResult { - let mut account = Account::::get(id, &who).ok_or(Error::::NoDeposit)?; - let deposit = account.reason.take_deposit().ok_or(Error::::NoDeposit)?; - let mut details = Asset::::get(&id).ok_or(Error::::UnknownAsset)?; - + use AssetStatus::*; + use ExistenceReason::*; + let mut account = Account::::get(&id, &who).ok_or(Error::::NoDeposit)?; + ensure!(matches!(account.reason, Consumer | DepositHeld(..)), Error::::NoDeposit); + let mut details = Asset::::get(&id).ok_or(Error::::Unknown)?; + ensure!(matches!(details.status, Live | Frozen), Error::::IncorrectStatus); ensure!(account.balance.is_zero() || allow_burn, Error::::WouldBurn); - ensure!(!details.is_frozen, Error::::Frozen); - ensure!(!account.is_frozen, Error::::Frozen); - T::Currency::unreserve(&who, deposit); + if let Some(deposit) = account.reason.take_deposit() { + T::Currency::unreserve(&who, deposit); + } if let Remove = Self::dead_account(&who, &mut details, &account.reason, false) { - Account::::remove(id, &who); + Account::::remove(&id, &who); } else { debug_assert!(false, "refund did not result in dead account?!"); + // deposit may have been refunded, need to update `Account` + Account::::insert(id, &who, account); + return Ok(()) } Asset::::insert(&id, details); // Executing a hook here is safe, since it is not in a `mutate`. @@ -370,6 +371,37 @@ impl, I: 'static> Pallet { Ok(()) } + /// Returns a `DepositFrom` of an account only if balance is zero. + pub(super) fn do_refund_other( + id: T::AssetId, + who: &T::AccountId, + caller: &T::AccountId, + ) -> DispatchResult { + let mut account = Account::::get(&id, &who).ok_or(Error::::NoDeposit)?; + let (depositor, deposit) = + account.reason.take_deposit_from().ok_or(Error::::NoDeposit)?; + let mut details = Asset::::get(&id).ok_or(Error::::Unknown)?; + ensure!(details.status == AssetStatus::Live, Error::::AssetNotLive); + ensure!(!account.status.is_frozen(), Error::::Frozen); + ensure!(caller == &depositor || caller == &details.admin, Error::::NoPermission); + ensure!(account.balance.is_zero(), Error::::WouldBurn); + + T::Currency::unreserve(&depositor, deposit); + + if let Remove = Self::dead_account(&who, &mut details, &account.reason, false) { + Account::::remove(&id, &who); + } else { + debug_assert!(false, "refund did not result in dead account?!"); + // deposit may have been refunded, need to update `Account` + Account::::insert(&id, &who, account); + return Ok(()) + } + Asset::::insert(&id, details); + // Executing a hook here is safe, since it is not in a `mutate`. + T::Freezer::died(id, &who); + return Ok(()) + } + /// Increases the asset `id` balance of `beneficiary` by `amount`. /// /// This alters the registered supply of the asset and emits an event. @@ -381,7 +413,7 @@ 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 { ensure!(check_issuer == details.issuer, Error::::NoPermission); } @@ -457,25 +489,25 @@ impl, I: 'static> Pallet { return Ok(()) } - Self::can_increase(id, beneficiary, amount, true).into_result()?; - Asset::::try_mutate(id, |maybe_details| -> DispatchResult { - let details = maybe_details.as_mut().ok_or(Error::::UnknownAsset)?; - + Self::can_increase(id.clone(), beneficiary, amount, true).into_result()?; + Asset::::try_mutate(&id, |maybe_details| -> DispatchResult { + let details = maybe_details.as_mut().ok_or(Error::::Unknown)?; + ensure!(details.status == AssetStatus::Live, Error::::AssetNotLive); check(details)?; - Account::::try_mutate(id, beneficiary, |maybe_account| -> DispatchResult { + Account::::try_mutate(&id, beneficiary, |maybe_account| -> DispatchResult { match maybe_account { Some(ref mut account) => { account.balance.saturating_accrue(amount); }, maybe_account @ None => { - // Note this should never fail as it's already checked by `can_increase`. + // Note this should never fail as it's already checked by + // `can_increase`. ensure!(amount >= details.min_balance, TokenError::BelowMinimum); *maybe_account = Some(AssetAccountOf:: { balance: amount, - reserved: Zero::zero(), reason: Self::new_account(beneficiary, details, None)?, - is_frozen: false, + status: AccountStatus::Liquid, extra: T::Extra::default(), }); }, @@ -501,13 +533,13 @@ impl, I: 'static> Pallet { maybe_check_admin: Option, f: DebitFlags, ) -> Result { - let d = Asset::::get(id).ok_or(Error::::Unknown)?; + let d = Asset::::get(&id).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 actual = Self::decrease_balance(id.clone(), target, amount, f, |actual, details| { // Check admin rights. if let Some(check_admin) = maybe_check_admin { ensure!(check_admin == details.admin, Error::::NoPermission); @@ -573,15 +605,17 @@ impl, I: 'static> Pallet { return Ok(amount) } - let actual = Self::prep_debit(id, target, amount, f)?; - let mut target_died: Option = None; + let details = Asset::::get(&id).ok_or(Error::::Unknown)?; + ensure!(details.status == AssetStatus::Live, Error::::AssetNotLive); - Asset::::try_mutate(id, |maybe_details| -> DispatchResult { - let details = maybe_details.as_mut().ok_or(Error::::UnknownAsset)?; + let actual = Self::prep_debit(id.clone(), target, amount, f)?; + let mut target_died: Option = None; + Asset::::try_mutate(&id, |maybe_details| -> DispatchResult { + let details = maybe_details.as_mut().ok_or(Error::::Unknown)?; check(actual, details)?; - Account::::try_mutate(id, target, |maybe_account| -> DispatchResult { + Account::::try_mutate(&id, target, |maybe_account| -> DispatchResult { let mut account = maybe_account.take().ok_or(Error::::NoAccount)?; debug_assert!(account.balance >= actual, "checked in prep; qed"); @@ -625,7 +659,7 @@ impl, I: 'static> Pallet { f: TransferFlags, ) -> Result { let (balance, died) = - Self::transfer_and_die(id, source, dest, amount, maybe_need_admin, f)?; + Self::transfer_and_die(id.clone(), source, dest, amount, maybe_need_admin, f)?; if let Some(Remove) = died { T::Freezer::died(id, source); } @@ -646,20 +680,19 @@ impl, I: 'static> Pallet { if amount.is_zero() { return Ok((amount, None)) } - - let details = Asset::::get(id).ok_or(Error::::Unknown)?; + let details = Asset::::get(&id).ok_or(Error::::Unknown)?; ensure!(details.status == AssetStatus::Live, Error::::AssetNotLive); // Figure out the debit and credit, together with side-effects. - let debit = Self::prep_debit(id, source, amount, f.into())?; - let (credit, maybe_burn) = Self::prep_credit(id, dest, amount, debit, f.burn_dust)?; + let debit = Self::prep_debit(id.clone(), source, amount, f.into())?; + let (credit, maybe_burn) = Self::prep_credit(id.clone(), dest, amount, debit, f.burn_dust)?; let mut source_account = - Account::::get(id, &source).ok_or(Error::::NoAccount)?; + Account::::get(&id, &source).ok_or(Error::::NoAccount)?; let mut source_died: Option = None; - Asset::::try_mutate(id, |maybe_details| -> DispatchResult { - let details = maybe_details.as_mut().ok_or(Error::::UnknownAsset)?; + Asset::::try_mutate(&id, |maybe_details| -> DispatchResult { + let details = maybe_details.as_mut().ok_or(Error::::Unknown)?; // Check admin rights. if let Some(need_admin) = maybe_need_admin { @@ -683,7 +716,7 @@ impl, I: 'static> Pallet { debug_assert!(source_account.balance >= debit, "checked in prep; qed"); source_account.balance = source_account.balance.saturating_sub(debit); - Account::::try_mutate(id, &dest, |maybe_account| -> DispatchResult { + Account::::try_mutate(&id, &dest, |maybe_account| -> DispatchResult { match maybe_account { Some(ref mut account) => { // Calculate new balance; this will not saturate since it's already checked @@ -697,8 +730,7 @@ impl, I: 'static> Pallet { maybe_account @ None => { *maybe_account = Some(AssetAccountOf:: { balance: credit, - reserved: Zero::zero(), - is_frozen: false, + status: AccountStatus::Liquid, reason: Self::new_account(dest, details, None)?, extra: T::Extra::default(), }); @@ -713,11 +745,11 @@ impl, I: 'static> Pallet { source_died = Some(Self::dead_account(source, details, &source_account.reason, false)); if let Some(Remove) = source_died { - Account::::remove(id, &source); + Account::::remove(&id, &source); return Ok(()) } } - Account::::insert(id, &source, &source_account); + Account::::insert(&id, &source, &source_account); Ok(()) })?; @@ -744,30 +776,28 @@ impl, I: 'static> Pallet { is_sufficient: bool, min_balance: T::Balance, ) -> DispatchResult { - ensure!(!Asset::::contains_key(id), Error::::InUse); + ensure!(!Asset::::contains_key(&id), Error::::InUse); ensure!(!min_balance.is_zero(), Error::::MinBalanceZero); Asset::::insert( - id, + &id, AssetDetails { owner: owner.clone(), issuer: owner.clone(), admin: owner.clone(), freezer: owner.clone(), supply: Zero::zero(), - reserved: Zero::zero(), deposit: Zero::zero(), min_balance, is_sufficient, accounts: 0, sufficients: 0, approvals: 0, - is_frozen: false, status: AssetStatus::Live, }, ); + ensure!(T::CallbackHandle::created(&id, &owner).is_ok(), Error::::CallbackFailed); Self::deposit_event(Event::ForceCreated { asset_id: id, owner: owner.clone() }); - T::CallbackHandle::created(&id, &owner); Ok(()) } @@ -777,8 +807,8 @@ impl, I: 'static> Pallet { id: T::AssetId, maybe_check_owner: Option, ) -> DispatchResult { - Asset::::try_mutate_exists(id, |maybe_details| -> Result<(), DispatchError> { - let mut details = maybe_details.as_mut().ok_or(Error::::Unknown)?; + Asset::::try_mutate_exists(id.clone(), |maybe_details| -> Result<(), DispatchError> { + let details = maybe_details.as_mut().ok_or(Error::::Unknown)?; if let Some(check_owner) = maybe_check_owner { ensure!(details.owner == check_owner, Error::::NoPermission); } @@ -800,15 +830,26 @@ impl, I: 'static> Pallet { let mut dead_accounts: Vec = vec![]; let mut remaining_accounts = 0; let _ = - Asset::::try_mutate_exists(id, |maybe_details| -> Result<(), DispatchError> { + Asset::::try_mutate_exists(&id, |maybe_details| -> Result<(), DispatchError> { let mut details = maybe_details.as_mut().ok_or(Error::::Unknown)?; // Should only destroy accounts while the asset is in a destroying state ensure!(details.status == AssetStatus::Destroying, Error::::IncorrectStatus); - - for (who, v) in Account::::drain_prefix(id) { - let _ = Self::dead_account(&who, &mut details, &v.reason, true); - dead_accounts.push(who); - if dead_accounts.len() >= (max_items as usize) { + for (i, (who, mut v)) in Account::::iter_prefix(&id).enumerate() { + // unreserve the existence deposit if any + if let Some((depositor, deposit)) = v.reason.take_deposit_from() { + T::Currency::unreserve(&depositor, deposit); + } else if let Some(deposit) = v.reason.take_deposit() { + T::Currency::unreserve(&who, deposit); + } + if let Remove = Self::dead_account(&who, &mut details, &v.reason, false) { + Account::::remove(&id, &who); + dead_accounts.push(who); + } else { + // deposit may have been released, need to update `Account` + Account::::insert(&id, &who, v); + defensive!("destroy did not result in dead account?!"); + } + if i + 1 >= (max_items as usize) { break } } @@ -817,7 +858,7 @@ impl, I: 'static> Pallet { })?; for who in &dead_accounts { - T::Freezer::died(id, &who); + T::Freezer::died(id.clone(), &who); } Self::deposit_event(Event::AccountsDestroyed { @@ -837,14 +878,15 @@ impl, I: 'static> Pallet { max_items: u32, ) -> Result { let mut removed_approvals = 0; - let _ = - Asset::::try_mutate_exists(id, |maybe_details| -> Result<(), DispatchError> { - let mut details = maybe_details.as_mut().ok_or(Error::::Unknown)?; + let _ = Asset::::try_mutate_exists( + id.clone(), + |maybe_details| -> Result<(), DispatchError> { + let details = maybe_details.as_mut().ok_or(Error::::Unknown)?; // Should only destroy accounts while the asset is in a destroying state. ensure!(details.status == AssetStatus::Destroying, Error::::IncorrectStatus); - for ((owner, _), approval) in Approvals::::drain_prefix((id,)) { + for ((owner, _), approval) in Approvals::::drain_prefix((id.clone(),)) { T::Currency::unreserve(&owner, approval.deposit); removed_approvals = removed_approvals.saturating_add(1); details.approvals = details.approvals.saturating_sub(1); @@ -857,9 +899,9 @@ impl, I: 'static> Pallet { approvals_destroyed: removed_approvals as u32, approvals_remaining: details.approvals as u32, }); - T::CallbackHandle::destroyed(&id); Ok(()) - })?; + }, + )?; Ok(removed_approvals) } @@ -867,11 +909,12 @@ impl, I: 'static> Pallet { /// /// On success, the `Event::Destroyed` event is emitted. pub(super) fn do_finish_destroy(id: T::AssetId) -> DispatchResult { - Asset::::try_mutate_exists(id, |maybe_details| -> Result<(), DispatchError> { + Asset::::try_mutate_exists(id.clone(), |maybe_details| -> Result<(), DispatchError> { let details = maybe_details.take().ok_or(Error::::Unknown)?; ensure!(details.status == AssetStatus::Destroying, Error::::IncorrectStatus); ensure!(details.accounts == 0, Error::::InUse); ensure!(details.approvals == 0, Error::::InUse); + ensure!(T::CallbackHandle::destroyed(&id).is_ok(), Error::::CallbackFailed); let metadata = Metadata::::take(&id); T::Currency::unreserve( @@ -884,67 +927,6 @@ impl, I: 'static> Pallet { }) } - /// Destroy an existing asset. - /// - /// * `id`: The asset you want to destroy. - /// * `witness`: Witness data needed about the current state of the asset, used to confirm - /// complexity of the operation. - /// * `maybe_check_owner`: An optional check before destroying the asset, if the provided - /// account is the owner of that asset. Can be used for authorization checks. - /* pub(super) fn do_destroy( - id: T::AssetId, - witness: DestroyWitness, - maybe_check_owner: Option, - ) -> Result { - let mut dead_accounts: Vec = vec![]; - - let result_witness: DestroyWitness = Asset::::try_mutate_exists( - id, - |maybe_details| -> Result { - let mut details = maybe_details.take().ok_or(Error::::UnknownAsset)?; - if let Some(check_owner) = maybe_check_owner { - ensure!(details.owner == check_owner, Error::::NoPermission); - } - ensure!(details.accounts <= witness.accounts, Error::::BadWitness); - ensure!(details.sufficients <= witness.sufficients, Error::::BadWitness); - ensure!(details.approvals <= witness.approvals, Error::::BadWitness); - - for (who, v) in Account::::drain_prefix(id) { - // We have to force this as it's destroying the entire asset class. - // This could mean that some accounts now have irreversibly reserved - // funds. - let _ = Self::dead_account(&who, &mut details, &v.reason, true); - dead_accounts.push(who); - } - debug_assert_eq!(details.accounts, 0); - debug_assert_eq!(details.sufficients, 0); - - let metadata = Metadata::::take(&id); - T::Currency::unreserve( - &details.owner, - details.deposit.saturating_add(metadata.deposit), - ); - - for ((owner, _), approval) in Approvals::::drain_prefix((&id,)) { - T::Currency::unreserve(&owner, approval.deposit); - } - Self::deposit_event(Event::Destroyed { asset_id: id }); - - Ok(DestroyWitness { - accounts: details.accounts, - sufficients: details.sufficients, - approvals: details.approvals, - }) - }, - )?; - - // Execute hooks outside of `mutate`. - for who in dead_accounts { - T::Freezer::died(id, &who); - } - Ok(result_witness) - } */ - /// Creates an approval from `owner` to spend `amount` of asset `id` tokens by 'delegate' /// while reserving `T::ApprovalDeposit` from owner /// @@ -955,10 +937,10 @@ impl, I: 'static> Pallet { delegate: &T::AccountId, amount: T::Balance, ) -> DispatchResult { - let mut d = Asset::::get(id).ok_or(Error::::UnknownAsset)?; + let mut d = Asset::::get(&id).ok_or(Error::::Unknown)?; ensure!(d.status == AssetStatus::Live, Error::::AssetNotLive); Approvals::::try_mutate( - (id, &owner, &delegate), + (id.clone(), &owner, &delegate), |maybe_approved| -> DispatchResult { let mut approved = match maybe_approved.take() { // an approval already exists and is being updated @@ -979,7 +961,7 @@ impl, I: 'static> Pallet { Ok(()) }, )?; - Asset::::insert(id, d); + Asset::::insert(&id, d); Self::deposit_event(Event::ApprovedTransfer { asset_id: id, source: owner.clone(), @@ -1006,22 +988,23 @@ impl, I: 'static> Pallet { ) -> DispatchResult { let mut owner_died: Option = None; - let d = Asset::::get(id).ok_or(Error::::Unknown)?; + let d = Asset::::get(&id).ok_or(Error::::Unknown)?; ensure!(d.status == AssetStatus::Live, Error::::AssetNotLive); Approvals::::try_mutate_exists( - (id, &owner, delegate), + (id.clone(), &owner, delegate), |maybe_approved| -> DispatchResult { let mut approved = maybe_approved.take().ok_or(Error::::Unapproved)?; let remaining = approved.amount.checked_sub(&amount).ok_or(Error::::Unapproved)?; let f = TransferFlags { keep_alive: false, best_effort: false, burn_dust: false }; - owner_died = Self::transfer_and_die(id, owner, destination, amount, None, f)?.1; + owner_died = + Self::transfer_and_die(id.clone(), owner, destination, amount, None, f)?.1; if remaining.is_zero() { T::Currency::unreserve(owner, approved.deposit); - Asset::::mutate(id, |maybe_details| { + Asset::::mutate(id.clone(), |maybe_details| { if let Some(details) = maybe_details { details.approvals.saturating_dec(); } @@ -1054,17 +1037,15 @@ impl, I: 'static> Pallet { let bounded_symbol: BoundedVec = symbol.clone().try_into().map_err(|_| Error::::BadMetadata)?; - let d = Asset::::get(id).ok_or(Error::::UnknownAsset)?; + let d = Asset::::get(&id).ok_or(Error::::Unknown)?; ensure!(d.status == AssetStatus::Live, Error::::AssetNotLive); ensure!(from == &d.owner, Error::::NoPermission); - Metadata::::try_mutate_exists(id, |metadata| { + Metadata::::try_mutate_exists(id.clone(), |metadata| { ensure!(metadata.as_ref().map_or(true, |m| !m.is_frozen), Error::::NoPermission); let old_deposit = metadata.take().map_or(Zero::zero(), |m| m.deposit); - let new_deposit = T::MetadataDepositPerByte::get() - .saturating_mul(((name.len() + symbol.len()) as u32).into()) - .saturating_add(T::MetadataDepositBase::get()); + let new_deposit = Self::calc_metadata_deposit(&name, &symbol); if new_deposit > old_deposit { T::Currency::reserve(from, new_deposit - old_deposit)?; @@ -1091,282 +1072,19 @@ impl, I: 'static> Pallet { }) } - pub fn reserved_balance_named( - id: &T::ReserveIdentifier, - asset_id: &T::AssetId, - who: &T::AccountId, - ) -> T::Balance { - let reserves = Self::reserves(asset_id, who); - reserves - .binary_search_by_key(id, |data| data.id) - .map(|index| reserves[index].amount) - .unwrap_or_default() + /// Calculate the metadata deposit for the provided data. + pub(super) fn calc_metadata_deposit(name: &[u8], symbol: &[u8]) -> DepositBalanceOf { + T::MetadataDepositPerByte::get() + .saturating_mul(((name.len() + symbol.len()) as u32).into()) + .saturating_add(T::MetadataDepositBase::get()) } - pub fn has_named_reserve( - id: &T::ReserveIdentifier, - asset_id: &T::AssetId, - who: &T::AccountId, - ) -> bool { - let reserves = Self::reserves(asset_id, who); - reserves.binary_search_by_key(id, |data| data.id).is_ok() - } - - /// Move `value` from the free balance from `who` to a named reserve balance. - /// - /// Is a no-op if value to be reserved is zero. - pub fn reserve_named( - id: &T::ReserveIdentifier, - asset_id: T::AssetId, - who: &T::AccountId, - amount: T::Balance, - maybe_check_admin: Option, - ) -> DispatchResult { - if amount.is_zero() { - return Ok(()) - } - Self::prep_debit( - asset_id, - who, - amount, - DebitFlags { best_effort: false, keep_alive: true }, - )?; - Asset::::try_mutate(asset_id, |maybe_details| -> DispatchResult { - let asset = maybe_details.as_mut().ok_or(Error::::UnknownAsset)?; - if amount < asset.min_balance { - return Err(TokenError::BelowMinimum.into()) - } - if let Some(admin) = maybe_check_admin { - ensure!(admin == asset.admin, Error::::NoPermission); - } - asset.reserved = - asset.reserved.checked_add(&amount).ok_or(ArithmeticError::Overflow)?; - Account::::try_mutate(asset_id, who, |maybe_account| -> DispatchResult { - let account = maybe_account.as_mut().ok_or(Error::::NoAccount)?; - account.balance = - account.balance.checked_sub(&amount).ok_or(Error::::BalanceLow)?; - account.reserved = - account.reserved.checked_add(&amount).ok_or(ArithmeticError::Overflow)?; - Reserves::::try_mutate(asset_id, who, |reserves| -> DispatchResult { - match reserves.binary_search_by_key(id, |data| data.id) { - Ok(_) => return Err(Error::::ReserveAlreadyExists.into()), - Err(index) => { - reserves - .try_insert(index, ReserveData { id: *id, amount }) - .map_err(|_| Error::::TooManyReserves)?; - }, - }; - Ok(()) - }) + /// Returns all the non-zero balances for all assets of the given `account`. + pub fn account_balances(account: T::AccountId) -> Vec<(T::AssetId, T::Balance)> { + Asset::::iter_keys() + .filter_map(|id| { + Self::maybe_balance(id.clone(), account.clone()).map(|balance| (id, balance)) }) - })?; - Self::deposit_event(Event::::Reserved { - reserve_id: id.clone(), - asset_id, - who: who.clone(), - amount, - }); - Ok(()) - } - - pub fn unreserve_named( - id: &T::ReserveIdentifier, - asset_id: T::AssetId, - who: &T::AccountId, - maybe_check_admin: Option, - ) -> DispatchResult { - let amount = Self::remove_named_reserve(id, asset_id, who, false, maybe_check_admin)?; - Self::deposit_event(Event::::Unreserved { - reserve_id: id.clone(), - asset_id, - who: who.clone(), - amount, - }); - Ok(()) - } - - pub fn burn_named_reserve( - id: &T::ReserveIdentifier, - asset_id: T::AssetId, - who: &T::AccountId, - maybe_check_admin: Option, - ) -> DispatchResult { - let amount = Self::remove_named_reserve(id, asset_id, who, true, maybe_check_admin)?; - Self::deposit_event(Event::::BurnedReserve { - reserve_id: id.clone(), - asset_id, - who: who.clone(), - amount, - }); - Ok(()) - } - - fn remove_named_reserve( - id: &T::ReserveIdentifier, - asset_id: T::AssetId, - who: &T::AccountId, - burn: bool, - maybe_check_admin: Option, - ) -> Result { - let mut amount = Zero::zero(); - Reserves::::try_mutate_exists(asset_id, who, |maybe_reserves| -> DispatchResult { - let reserves = maybe_reserves.as_mut().ok_or(Error::::UnknownReserve)?; - match reserves.binary_search_by_key(id, |data| data.id) { - Ok(index) => { - amount = reserves[index].amount; - Asset::::try_mutate(asset_id, |maybe_asset| -> DispatchResult { - let asset = maybe_asset.as_mut().ok_or(Error::::UnknownAsset)?; - ensure!(!asset.is_frozen, Error::::Frozen); - if let Some(admin) = maybe_check_admin { - ensure!(admin == asset.admin, Error::::NoPermission); - } - asset.reserved = asset - .reserved - .checked_sub(&amount) - .ok_or(ArithmeticError::Underflow)?; - if burn { - asset.supply = asset - .supply - .checked_sub(&amount) - .ok_or(ArithmeticError::Underflow)?; - } - Account::::try_mutate( - asset_id, - who, - |maybe_account| -> DispatchResult { - let account = - maybe_account.as_mut().ok_or(Error::::NoAccount)?; - ensure!(!account.is_frozen, Error::::Frozen); - if !burn { - account.balance = account - .balance - .checked_add(&amount) - .ok_or(ArithmeticError::Overflow)?; - } - account.reserved = account - .reserved - .checked_sub(&amount) - .ok_or(ArithmeticError::Underflow)?; - Ok(()) - }, - ) - })?; - reserves.remove(index); - }, - Err(_) => return Err(Error::::UnknownReserve.into()), - }; - Ok(()) - })?; - Ok(amount) - } - - pub fn transfer_named_reserve( - id: &T::ReserveIdentifier, - asset_id: T::AssetId, - from: &T::AccountId, - to: &T::AccountId, - maybe_check_admin: Option, - ) -> DispatchResult { - let mut amount = Zero::zero(); - Reserves::::try_mutate_exists(asset_id, from, |maybe_reserves| -> DispatchResult { - let reserves = maybe_reserves.as_mut().ok_or(Error::::UnknownReserve)?; - match reserves.binary_search_by_key(id, |data| data.id) { - Ok(index) => { - amount = reserves[index].amount; - Self::prep_credit(asset_id, to, amount, amount, false)?; - Asset::::try_mutate(asset_id, |maybe_asset| -> DispatchResult { - let asset = maybe_asset.as_mut().ok_or(Error::::UnknownAsset)?; - ensure!(!asset.is_frozen, Error::::Frozen); - if let Some(admin) = maybe_check_admin { - ensure!(admin == asset.admin, Error::::NoPermission); - } - asset.reserved = asset - .reserved - .checked_sub(&amount) - .ok_or(ArithmeticError::Underflow)?; - Account::::try_mutate( - asset_id, - from, - |maybe_from_account| -> DispatchResult { - let from_account = - maybe_from_account.as_mut().ok_or(Error::::NoAccount)?; - ensure!(!from_account.is_frozen, Error::::Frozen); - from_account.reserved = from_account - .reserved - .checked_sub(&amount) - .ok_or(ArithmeticError::Underflow)?; - Account::::try_mutate( - asset_id, - to, - |maybe_to_account| -> DispatchResult { - match maybe_to_account { - Some(ref mut to_account) => { - to_account.balance = to_account - .balance - .checked_add(&amount) - .ok_or(ArithmeticError::Overflow)?; - }, - maybe_account @ None => { - *maybe_account = Some(AssetAccountOf:: { - balance: amount, - reserved: Zero::zero(), - is_frozen: false, - reason: Self::new_account(to, asset, None)?, - extra: T::Extra::default(), - }); - }, - }; - Ok(()) - }, - ) - }, - ) - })?; - reserves.remove(index); - }, - Err(_) => return Err(Error::::UnknownReserve.into()), - }; - Ok(()) - })?; - Self::deposit_event(Event::::TransferredReserve { - reserve_id: id.clone(), - asset_id, - from: from.clone(), - to: to.clone(), - amount, - }); - Ok(()) - } - - pub(super) fn do_reserve_named( - id: &T::ReserveIdentifier, - asset_id: T::AssetId, - who: &T::AccountId, - amount: T::Balance, - admin: T::AccountId, - ) -> DispatchResult { - Self::reserve_named(id, asset_id, who, amount, Some(admin)) - } - - pub(super) fn do_unreserve_named( - id: &T::ReserveIdentifier, - asset_id: T::AssetId, - who: &T::AccountId, - admin: T::AccountId, - ) -> DispatchResult { - Self::unreserve_named(id, asset_id, who, Some(admin)) - } - - pub(super) fn do_burn_named_reserve( - id: &T::ReserveIdentifier, - asset_id: T::AssetId, - who: &T::AccountId, - admin: T::AccountId, - ) -> DispatchResult { - Self::burn_named_reserve(id, asset_id, who, Some(admin)) - } - - pub fn does_asset_exists(asset_id: T::AssetId) -> bool { - Asset::::contains_key(asset_id) + .collect::>() } } diff --git a/pallets/mapped-assets/src/impl_fungibles.rs b/pallets/mapped-assets/src/impl_fungibles.rs index 99fb6be2..a7df3d15 100644 --- a/pallets/mapped-assets/src/impl_fungibles.rs +++ b/pallets/mapped-assets/src/impl_fungibles.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. +// Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,8 +17,17 @@ //! Implementations for fungibles trait. +use frame_support::{ + defensive, + traits::tokens::{ + Fortitude, + Precision::{self, BestEffort}, + Preservation::{self, Expendable}, + Provenance::{self, Minted}, + }, +}; + use super::*; -use frame_support::storage::KeyPrefixIterator; impl, I: 'static> fungibles::Inspect<::AccountId> for Pallet { type AssetId = T::AssetId; @@ -36,21 +45,27 @@ impl, I: 'static> fungibles::Inspect<::AccountId Pallet::::balance(asset, who) } + fn total_balance(asset: Self::AssetId, who: &::AccountId) -> Self::Balance { + Pallet::::balance(asset, who) + } + fn reducible_balance( asset: Self::AssetId, who: &::AccountId, - keep_alive: bool, + preservation: Preservation, + _: Fortitude, ) -> Self::Balance { - Pallet::::reducible_balance(asset, who, keep_alive).unwrap_or(Zero::zero()) + Pallet::::reducible_balance(asset, who, !matches!(preservation, Expendable)) + .unwrap_or(Zero::zero()) } fn can_deposit( asset: Self::AssetId, who: &::AccountId, amount: Self::Balance, - mint: bool, + provenance: Provenance, ) -> DepositConsequence { - Pallet::::can_increase(asset, who, amount, mint) + Pallet::::can_increase(asset, who, amount, provenance == Minted) } fn can_withdraw( @@ -66,69 +81,57 @@ impl, I: 'static> fungibles::Inspect<::AccountId } } -impl, I: 'static> fungibles::InspectMetadata<::AccountId> - for Pallet -{ - /// Return the name of an asset. - fn name(asset: &Self::AssetId) -> Vec { - Metadata::::get(asset).name.to_vec() - } - - /// Return the symbol of an asset. - fn symbol(asset: &Self::AssetId) -> Vec { - Metadata::::get(asset).symbol.to_vec() - } - - /// Return the decimals of an asset. - fn decimals(asset: &Self::AssetId) -> u8 { - Metadata::::get(asset).decimals - } -} - impl, I: 'static> fungibles::Mutate<::AccountId> for Pallet { - fn mint_into( - asset: Self::AssetId, - who: &::AccountId, + fn done_mint_into( + asset_id: Self::AssetId, + beneficiary: &::AccountId, amount: Self::Balance, - ) -> DispatchResult { - Self::do_mint(asset, who, amount, None) + ) { + Self::deposit_event(Event::Issued { asset_id, owner: beneficiary.clone(), amount }) } - fn burn_from( - asset: Self::AssetId, - who: &::AccountId, - amount: Self::Balance, - ) -> Result { - let f = DebitFlags { keep_alive: false, best_effort: false }; - Self::do_burn(asset, who, amount, None, f) + fn done_burn_from( + asset_id: Self::AssetId, + target: &::AccountId, + balance: Self::Balance, + ) { + Self::deposit_event(Event::Burned { asset_id, owner: target.clone(), balance }); } - fn slash( - asset: Self::AssetId, - who: &::AccountId, + fn done_transfer( + asset_id: Self::AssetId, + source: &::AccountId, + dest: &::AccountId, amount: Self::Balance, - ) -> Result { - let f = DebitFlags { keep_alive: false, best_effort: true }; - Self::do_burn(asset, who, amount, None, f) + ) { + Self::deposit_event(Event::Transferred { + asset_id, + from: source.clone(), + to: dest.clone(), + amount, + }); } } -impl, I: 'static> fungibles::Transfer for Pallet { - fn transfer( - asset: Self::AssetId, - source: &T::AccountId, - dest: &T::AccountId, - amount: T::Balance, - keep_alive: bool, - ) -> Result { - let f = TransferFlags { keep_alive, best_effort: false, burn_dust: false }; - Self::do_transfer(asset, source, dest, amount, None, f) - } +impl, I: 'static> fungibles::Balanced<::AccountId> + for Pallet +{ + type OnDropCredit = fungibles::DecreaseIssuance; + type OnDropDebt = fungibles::IncreaseIssuance; } impl, I: 'static> fungibles::Unbalanced for Pallet { - fn set_balance(_: Self::AssetId, _: &T::AccountId, _: Self::Balance) -> DispatchResult { - unreachable!("set_balance is not used if other functions are impl'd"); + fn handle_raw_dust(_: Self::AssetId, _: Self::Balance) {} + fn handle_dust(_: fungibles::Dust) { + defensive!("`decrease_balance` and `increase_balance` have non-default impls; nothing else calls this; qed"); + } + fn write_balance( + _: Self::AssetId, + _: &T::AccountId, + _: Self::Balance, + ) -> Result, DispatchError> { + defensive!("write_balance is not used if other functions are impl'd"); + Err(DispatchError::Unavailable) } fn set_total_issuance(id: T::AssetId, amount: Self::Balance) { Asset::::mutate_exists(id, |maybe_asset| { @@ -141,36 +144,27 @@ impl, I: 'static> fungibles::Unbalanced for Pallet Result { - let f = DebitFlags { keep_alive: false, best_effort: false }; + let f = DebitFlags { + keep_alive: preservation != Expendable, + best_effort: precision == BestEffort, + }; Self::decrease_balance(asset, who, amount, f, |_, _| Ok(())) } - fn decrease_balance_at_most( - asset: T::AssetId, - who: &T::AccountId, - amount: Self::Balance, - ) -> Self::Balance { - let f = DebitFlags { keep_alive: false, best_effort: true }; - Self::decrease_balance(asset, who, amount, f, |_, _| Ok(())).unwrap_or(Zero::zero()) - } fn increase_balance( asset: T::AssetId, who: &T::AccountId, amount: Self::Balance, + _: Precision, ) -> Result { Self::increase_balance(asset, who, amount, |_| Ok(()))?; Ok(amount) } - fn increase_balance_at_most( - asset: T::AssetId, - who: &T::AccountId, - amount: Self::Balance, - ) -> Self::Balance { - match Self::increase_balance(asset, who, amount, |_| Ok(())) { - Ok(()) => amount, - Err(_) => Zero::zero(), - } - } + + // TODO: #13196 implement deactivate/reactivate once we have inactive balance tracking. } impl, I: 'static> fungibles::Create for Pallet { @@ -184,22 +178,6 @@ impl, I: 'static> fungibles::Create for Pallet } } -/* impl, I: 'static> fungibles::Destroy for Pallet { - type DestroyWitness = DestroyWitness; - - fn get_destroy_witness(asset: &T::AssetId) -> Option { - Asset::::get(asset).map(|asset_details| asset_details.destroy_witness()) - } - - fn destroy( - id: T::AssetId, - witness: Self::DestroyWitness, - maybe_check_owner: Option, - ) -> Result { - Self::do_destroy(id, witness, maybe_check_owner) - } -} */ - impl, I: 'static> fungibles::Destroy for Pallet { fn start_destroy(id: T::AssetId, maybe_check_owner: Option) -> DispatchResult { Self::do_start_destroy(id, maybe_check_owner) @@ -248,6 +226,19 @@ impl, I: 'static> fungibles::metadata::Mutate<:: } } +impl, I: 'static> + fungibles::metadata::MetadataDeposit< + ::AccountId>>::Balance, + > for Pallet +{ + fn calc_metadata_deposit( + name: &[u8], + symbol: &[u8], + ) -> ::AccountId>>::Balance { + Self::calc_metadata_deposit(&name, &symbol) + } +} + impl, I: 'static> fungibles::approvals::Inspect<::AccountId> for Pallet { diff --git a/pallets/mapped-assets/src/impl_stored_map.rs b/pallets/mapped-assets/src/impl_stored_map.rs index a4669c77..a7a5a085 100644 --- a/pallets/mapped-assets/src/impl_stored_map.rs +++ b/pallets/mapped-assets/src/impl_stored_map.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. +// Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ use super::*; impl, I: 'static> StoredMap<(T::AssetId, T::AccountId), T::Extra> for Pallet { fn get(id_who: &(T::AssetId, T::AccountId)) -> T::Extra { - let &(id, ref who) = id_who; + let (id, who) = id_who; Account::::get(id, who).map(|a| a.extra).unwrap_or_default() } @@ -29,7 +29,7 @@ impl, I: 'static> StoredMap<(T::AssetId, T::AccountId), T::Extra> f id_who: &(T::AssetId, T::AccountId), f: impl FnOnce(&mut Option) -> Result, ) -> Result { - let &(id, ref who) = id_who; + let (id, who) = id_who; let mut maybe_extra = Account::::get(id, who).map(|a| a.extra); let r = f(&mut maybe_extra)?; // They want to write some value or delete it. diff --git a/pallets/mapped-assets/src/lib.rs b/pallets/mapped-assets/src/lib.rs index 1225ee01..a9b40d3d 100644 --- a/pallets/mapped-assets/src/lib.rs +++ b/pallets/mapped-assets/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. +// Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -82,6 +82,10 @@ //! * `approve_transfer`: Create or increase an delegated transfer. //! * `cancel_approval`: Rescind a previous approval. //! * `transfer_approved`: Transfer third-party's assets to another account. +//! * `touch`: Create an asset account for non-provider assets. Caller must place a deposit. +//! * `refund`: Return the deposit (if any) of the caller's asset account or a consumer reference +//! (if any) of the caller's account. +//! * `refund_other`: Return the deposit (if any) of a specified asset account. //! //! ### Permissioned Functions //! @@ -98,12 +102,16 @@ //! * `burn`: Decreases the asset balance of an account; called by the asset class's Admin. //! * `force_transfer`: Transfers between arbitrary accounts; called by the asset class's Admin. //! * `freeze`: Disallows further `transfer`s from an account; called by the asset class's Freezer. -//! * `thaw`: Allows further `transfer`s from an account; called by the asset class's Admin. +//! * `thaw`: Allows further `transfer`s to and from an account; called by the asset class's Admin. //! * `transfer_ownership`: Changes an asset class's Owner; called by the asset class's Owner. //! * `set_team`: Changes an asset class's Admin, Freezer and Issuer; called by the asset class's //! Owner. //! * `set_metadata`: Set the metadata of an asset class; called by the asset class's Owner. //! * `clear_metadata`: Remove the metadata of an asset class; called by the asset class's Owner. +//! * `touch_other`: Create an asset account for specified account. Caller must place a deposit; +//! called by the asset class's Freezer or Admin. +//! * `block`: Disallows further `transfer`s to and from an account; called by the asset class's +//! Freezer. //! //! Please refer to the [`Call`] enum and its associated variants for documentation on each //! function. @@ -116,16 +124,25 @@ //! //! Please refer to the [`Pallet`] struct for details on publicly available functions. //! +//! ### Callbacks +//! +//! Using `CallbackHandle` associated type, user can configure custom callback functions which are +//! executed when new asset is created or an existing asset is destroyed. +//! //! ## Related Modules //! //! * [`System`](../frame_system/index.html) //! * [`Support`](../frame_support/index.html) +// This recursion limit is needed because we have too many benchmarks and benchmarking will fail if +// we add more without this limit. +#![recursion_limit = "1024"] // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] #[cfg(feature = "runtime-benchmarks")] mod benchmarking; +pub mod migration; #[cfg(test)] pub mod mock; #[cfg(test)] @@ -140,20 +157,18 @@ mod impl_stored_map; pub mod types; pub use types::*; -use codec::HasCompact; use scale_info::TypeInfo; use sp_runtime::{ - traits::{ - AtLeast32BitUnsigned, Bounded, CheckedAdd, CheckedSub, Saturating, StaticLookup, Zero, - }, + traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedSub, Saturating, StaticLookup, Zero}, ArithmeticError, TokenError, }; -use sp_std::{borrow::Borrow, prelude::*}; +use sp_std::prelude::*; use frame_support::{ dispatch::{DispatchError, DispatchResult}, ensure, pallet_prelude::DispatchResultWithPostInfo, + storage::KeyPrefixIterator, traits::{ tokens::{fungibles, DepositConsequence, WithdrawConsequence}, BalanceStatus::Reserved, @@ -161,39 +176,37 @@ use frame_support::{ }, }; use frame_system::Config as SystemConfig; -use sp_runtime::AccountId32; pub use pallet::*; -use pallet_rbac::types::RoleBasedAccessControl; +// use pallet_rbac::types::RoleBasedAccessControl; pub use weights::WeightInfo; type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; +const LOG_TARGET: &str = "runtime::assets"; /// Trait with callbacks that are executed after successfull asset creation or destruction. 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 DefaultCallback; - -impl AssetsCallback for DefaultCallback { - fn created(_id: &u32, _owner: &AccountId32) { - // Empty implementation + fn created(_id: &AssetId, _owner: &AccountId) -> Result<(), ()> { + Ok(()) } - fn destroyed(_id: &u32) { - // Empty implementation + /// Indicates that asset with `id` has just been destroyed + fn destroyed(_id: &AssetId) -> Result<(), ()> { + Ok(()) } } +/// Empty implementation in case no callbacks are required. +impl AssetsCallback for () {} + #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; + use frame_support::{ + pallet_prelude::*, + traits::{AccountTouch, ContainsPair}, + }; use frame_system::pallet_prelude::*; /// The current storage version. @@ -203,6 +216,17 @@ pub mod pallet { #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); + #[cfg(feature = "runtime-benchmarks")] + pub trait BenchmarkHelper { + fn create_asset_id_parameter(id: u32) -> AssetIdParameter; + } + #[cfg(feature = "runtime-benchmarks")] + impl> BenchmarkHelper for () { + fn create_asset_id_parameter(id: u32) -> AssetIdParameter { + id.into() + } + } + #[pallet::config] /// The module configuration trait. pub trait Config: frame_system::Config { @@ -210,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 @@ -228,14 +252,7 @@ pub mod pallet { type RemoveItemsLimit: Get; /// Identifier for the class of asset. - type AssetId: Member - + Parameter - + Default - + Copy - + HasCompact - + MaybeSerializeDeserialize - + MaxEncodedLen - + TypeInfo; + type AssetId: Member + Parameter + Clone + MaybeSerializeDeserialize + MaxEncodedLen; /// Wrapper around `Self::AssetId` to use in dispatchable call signatures. Allows the use /// of compact encoding in instances of the pallet, which will prevent breaking changes @@ -291,10 +308,6 @@ pub mod pallet { #[pallet::constant] type StringLimit: Get; - /// The maximum number of named reserves that can exist on an account. - #[pallet::constant] - type MaxReserves: Get; - /// A hook to allow a per-asset, per-account minimum balance to be enforced. This must be /// respected in all permissionless operations. type Freezer: FrozenBalance; @@ -308,8 +321,9 @@ pub mod pallet { /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; - /// The id type for named reserves. - type ReserveIdentifier: Parameter + Member + MaxEncodedLen + Ord + Copy; + /// Helper trait for benchmarks. + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper: BenchmarkHelper; } #[pallet::storage] @@ -332,19 +346,6 @@ pub mod pallet { AssetAccountOf, >; - /// Named reserves on account balances for a specific asset. - #[pallet::storage] - #[pallet::getter(fn reserves)] - pub type Reserves, I: 'static = ()> = StorageDoubleMap< - _, - Blake2_128Concat, - T::AssetId, - Blake2_128Concat, - T::AccountId, - BoundedVec, T::MaxReserves>, - ValueQuery, - >; - #[pallet::storage] /// Approved balance transfers. First balance is the amount approved for transfer. Second /// is the amount of `T::Currency` reserved for storing this. @@ -370,6 +371,7 @@ pub mod pallet { >; #[pallet::genesis_config] + #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig, I: 'static = ()> { /// Genesis assets: id, owner, is_sufficient, min_balance pub assets: Vec<(T::AssetId, T::AccountId, bool, T::Balance)>, @@ -379,17 +381,6 @@ pub mod pallet { pub accounts: Vec<(T::AssetId, T::AccountId, T::Balance)>, } - #[cfg(feature = "std")] - impl, I: 'static> Default for GenesisConfig { - fn default() -> Self { - Self { - assets: Default::default(), - metadata: Default::default(), - accounts: Default::default(), - } - } - } - #[pallet::genesis_build] impl, I: 'static> GenesisBuild for GenesisConfig { fn build(&self) { @@ -404,14 +395,12 @@ pub mod pallet { admin: owner.clone(), freezer: owner.clone(), supply: Zero::zero(), - reserved: Zero::zero(), deposit: Zero::zero(), min_balance: *min_balance, is_sufficient: *is_sufficient, accounts: 0, sufficients: 0, approvals: 0, - is_frozen: false, status: AssetStatus::Live, }, ); @@ -437,12 +426,12 @@ pub mod pallet { for (id, account_id, amount) in &self.accounts { let result = >::increase_balance( - *id, + id.clone(), account_id, *amount, |details| -> DispatchResult { debug_assert!( - T::Balance::max_value() - details.supply >= *amount, + details.supply.checked_add(&amount).is_some(), "checked in prep; qed" ); details.supply = details.supply.saturating_add(*amount); @@ -460,7 +449,7 @@ pub mod pallet { /// Some asset class was created. Created { asset_id: T::AssetId, creator: T::AccountId, owner: T::AccountId }, /// Some assets were issued. - Issued { asset_id: T::AssetId, owner: T::AccountId, total_supply: T::Balance }, + Issued { asset_id: T::AssetId, owner: T::AccountId, amount: T::Balance }, /// Some assets were transferred. Transferred { asset_id: T::AssetId, @@ -468,35 +457,6 @@ pub mod pallet { to: T::AccountId, amount: T::Balance, }, - /// Some assets were reserved. - Reserved { - reserve_id: T::ReserveIdentifier, - asset_id: T::AssetId, - who: T::AccountId, - amount: T::Balance, - }, - /// Some reserved assets were unreserved. - Unreserved { - reserve_id: T::ReserveIdentifier, - asset_id: T::AssetId, - who: T::AccountId, - amount: T::Balance, - }, - /// Some reserved assets were burned. - BurnedReserve { - reserve_id: T::ReserveIdentifier, - asset_id: T::AssetId, - who: T::AccountId, - amount: T::Balance, - }, - /// Some reserved assets were transferred. - TransferredReserve { - reserve_id: T::ReserveIdentifier, - asset_id: T::AssetId, - from: T::AccountId, - to: T::AccountId, - amount: T::Balance, - }, /// Some assets were destroyed. Burned { asset_id: T::AssetId, owner: T::AccountId, balance: T::Balance }, /// The management team changed. @@ -527,7 +487,6 @@ pub mod pallet { /// An asset class is in the process of being destroyed. DestructionStarted { asset_id: T::AssetId }, /// An asset class was destroyed. - /// An asset class was destroyed. Destroyed { asset_id: T::AssetId }, /// Some asset class was force-created. ForceCreated { asset_id: T::AssetId, owner: T::AccountId }, @@ -561,6 +520,12 @@ pub mod pallet { }, /// An asset has had its attributes changed by the `Force` origin. AssetStatusChanged { asset_id: T::AssetId }, + /// The min_balance of an asset has been updated by the asset owner. + AssetMinBalanceChanged { asset_id: T::AssetId, new_min_balance: T::Balance }, + /// Some account `who` was created with a deposit from `depositor`. + Touched { asset_id: T::AssetId, who: T::AccountId, depositor: T::AccountId }, + /// Some account `who` was blocked. + Blocked { asset_id: T::AssetId, who: T::AccountId }, } #[pallet::error] @@ -572,7 +537,6 @@ pub mod pallet { /// The signing account has no permission to do the operation. NoPermission, /// The given asset ID is unknown. - UnknownAsset, Unknown, /// The origin account is frozen. Frozen, @@ -583,9 +547,9 @@ pub mod pallet { /// Minimum balance should be non-zero. MinBalanceZero, /// Unable to increment the consumer reference counters on the account. Either no provider - /// reference exists to allow a non-zero balance of a non-self-sufficient asset, or the - /// maximum number of consumers has been reached. - NoProvider, + /// reference exists to allow a non-zero balance of a non-self-sufficient asset, or one + /// fewer then the maximum number of consumers has been reached. + UnavailableConsumer, /// Invalid metadata given. BadMetadata, /// No approval exists that would allow the transfer. @@ -598,12 +562,6 @@ pub mod pallet { NoDeposit, /// The operation would result in funds being burned. WouldBurn, - /// Number of named reserves exceed MaxReserves - TooManyReserves, - /// Named reserve already exists - ReserveAlreadyExists, - /// Unknown reserve - UnknownReserve, /// The asset is a live asset and is actively being used. Usually emit for operations such /// as `start_destroy` which require the asset to be in a destroying state. LiveAsset, @@ -613,9 +571,11 @@ pub mod pallet { IncorrectStatus, /// The asset should be frozen before the given operation. NotFrozen, + /// Callback action resulted in error + CallbackFailed, } - #[pallet::call] + #[pallet::call(weight(>::WeightInfo))] impl, I: 'static> Pallet { /// Issue a new class of fungible assets from a public origin. /// @@ -637,47 +597,46 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::create())] pub fn create( origin: OriginFor, - #[pallet::compact] id: T::AssetId, + id: T::AssetIdParameter, admin: AccountIdLookupOf, min_balance: T::Balance, ) -> DispatchResult { + let id: T::AssetId = id.into(); let owner = T::CreateOrigin::ensure_origin(origin, &id)?; let admin = T::Lookup::lookup(admin)?; - ensure!(!Asset::::contains_key(id), Error::::InUse); + ensure!(!Asset::::contains_key(&id), Error::::InUse); ensure!(!min_balance.is_zero(), Error::::MinBalanceZero); let deposit = T::AssetDeposit::get(); T::Currency::reserve(&owner, deposit)?; Asset::::insert( - id, + id.clone(), AssetDetails { owner: owner.clone(), issuer: admin.clone(), admin: admin.clone(), freezer: admin.clone(), supply: Zero::zero(), - reserved: Zero::zero(), deposit, min_balance, is_sufficient: false, accounts: 0, sufficients: 0, approvals: 0, - is_frozen: false, status: AssetStatus::Live, }, ); + ensure!(T::CallbackHandle::created(&id, &owner).is_ok(), Error::::CallbackFailed); Self::deposit_event(Event::Created { asset_id: id, creator: owner.clone(), owner: admin, }); - T::CallbackHandle::created(&id, &owner); + Ok(()) } @@ -701,60 +660,19 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::force_create())] pub fn force_create( origin: OriginFor, - #[pallet::compact] id: T::AssetId, + id: T::AssetIdParameter, owner: AccountIdLookupOf, is_sufficient: bool, #[pallet::compact] min_balance: T::Balance, ) -> DispatchResult { T::ForceOrigin::ensure_origin(origin)?; let owner = T::Lookup::lookup(owner)?; + let id: T::AssetId = id.into(); Self::do_force_create(id, owner, is_sufficient, min_balance) } - /// Destroy a class of fungible assets. - /// - /// The origin must conform to `ForceOrigin` or must be Signed and the sender must be the - /// owner of the asset `id`. - /// - /// - `id`: The identifier of the asset to be destroyed. This must identify an existing - /// asset. - /// - /// Emits `Destroyed` event when successful. - /// - /// NOTE: It can be helpful to first freeze an asset before destroying it so that you - /// can provide accurate witness information and prevent users from manipulating state - /// in a way that can make it harder to destroy. - /// - /// Weight: `O(c + p + a)` where: - /// - `c = (witness.accounts - witness.sufficients)` - /// - `s = witness.sufficients` - /// - `a = witness.approvals` - /* #[pallet::weight(T::WeightInfo::destroy( - witness.accounts.saturating_sub(witness.sufficients), - witness.sufficients, - witness.approvals, - ))] - pub fn destroy( - origin: OriginFor, - #[pallet::compact] id: T::AssetId, - witness: DestroyWitness, - ) -> DispatchResultWithPostInfo { - let maybe_check_owner = match T::ForceOrigin::try_origin(origin) { - Ok(_) => None, - Err(origin) => Some(ensure_signed(origin)?), - }; - let details = Self::do_destroy(id, witness, maybe_check_owner)?; - Ok(Some(T::WeightInfo::destroy( - details.accounts.saturating_sub(details.sufficients), - details.sufficients, - details.approvals, - )) - .into()) - } */ - /// Start the process of destroying a fungible asset class. /// /// `start_destroy` is the first in a series of extrinsics that should be called, to allow @@ -767,7 +685,6 @@ pub mod pallet { /// /// The asset class must be frozen before calling `start_destroy`. #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::start_destroy())] pub fn start_destroy(origin: OriginFor, id: T::AssetIdParameter) -> DispatchResult { let maybe_check_owner = match T::ForceOrigin::try_origin(origin) { Ok(_) => None, @@ -836,7 +753,6 @@ pub mod pallet { /// /// Each successful call emits the `Event::Destroyed` event. #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::finish_destroy())] pub fn finish_destroy(origin: OriginFor, id: T::AssetIdParameter) -> DispatchResult { let _ = ensure_signed(origin)?; let id: T::AssetId = id.into(); @@ -856,7 +772,6 @@ pub mod pallet { /// Weight: `O(1)` /// Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`. #[pallet::call_index(6)] - #[pallet::weight(T::WeightInfo::mint())] pub fn mint( origin: OriginFor, id: T::AssetIdParameter, @@ -886,7 +801,6 @@ pub mod pallet { /// Weight: `O(1)` /// Modes: Post-existence of `who`; Pre & post Zombie-status of `who`. #[pallet::call_index(7)] - #[pallet::weight(T::WeightInfo::burn())] pub fn burn( origin: OriginFor, id: T::AssetIdParameter, @@ -921,7 +835,6 @@ pub mod pallet { /// Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of /// `target`. #[pallet::call_index(8)] - #[pallet::weight(T::WeightInfo::transfer())] pub fn transfer( origin: OriginFor, id: T::AssetIdParameter, @@ -955,7 +868,6 @@ pub mod pallet { /// Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of /// `target`. #[pallet::call_index(9)] - #[pallet::weight(T::WeightInfo::transfer_keep_alive())] pub fn transfer_keep_alive( origin: OriginFor, id: T::AssetIdParameter, @@ -969,6 +881,7 @@ pub mod pallet { let f = TransferFlags { keep_alive: true, best_effort: false, burn_dust: false }; Self::do_transfer(id, &source, &dest, amount, None, f).map(|_| ()) } + /// Move some assets from one account to another. /// /// Origin must be Signed and the sender should be the Admin of the asset `id`. @@ -989,7 +902,6 @@ pub mod pallet { /// Modes: Pre-existence of `dest`; Post-existence of `source`; Account pre-existence of /// `dest`. #[pallet::call_index(10)] - #[pallet::weight(T::WeightInfo::force_transfer())] pub fn force_transfer( origin: OriginFor, id: T::AssetIdParameter, @@ -1005,7 +917,10 @@ pub mod pallet { let f = TransferFlags { keep_alive: false, best_effort: false, burn_dust: false }; Self::do_transfer(id, &source, &dest, amount, Some(origin), f).map(|_| ()) } - /// Disallow further unprivileged transfers from an account. + + /// Disallow further unprivileged transfers of an asset `id` from an account `who`. `who` + /// must already exist as an entry in `Account`s of the asset. If you want to freeze an + /// account that does not have an entry, use `touch_other` first. /// /// Origin must be Signed and the sender should be the Freezer of the asset `id`. /// @@ -1016,7 +931,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(11)] - #[pallet::weight(T::WeightInfo::freeze())] pub fn freeze( origin: OriginFor, id: T::AssetIdParameter, @@ -1025,7 +939,7 @@ pub mod pallet { let origin = ensure_signed(origin)?; let id: T::AssetId = id.into(); - let d = Asset::::get(id).ok_or(Error::::Unknown)?; + let d = Asset::::get(&id).ok_or(Error::::Unknown)?; ensure!( d.status == AssetStatus::Live || d.status == AssetStatus::Frozen, Error::::AssetNotLive @@ -1033,8 +947,9 @@ pub mod pallet { ensure!(origin == d.freezer, Error::::NoPermission); let who = T::Lookup::lookup(who)?; - Account::::try_mutate(id, &who, |maybe_account| -> DispatchResult { - maybe_account.as_mut().ok_or(Error::::NoAccount)?.is_frozen = true; + Account::::try_mutate(&id, &who, |maybe_account| -> DispatchResult { + maybe_account.as_mut().ok_or(Error::::NoAccount)?.status = + AccountStatus::Frozen; Ok(()) })?; @@ -1042,7 +957,7 @@ pub mod pallet { Ok(()) } - /// Allow unprivileged transfers from an account again. + /// Allow unprivileged transfers to and from an account again. /// /// Origin must be Signed and the sender should be the Admin of the asset `id`. /// @@ -1053,7 +968,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(12)] - #[pallet::weight(T::WeightInfo::thaw())] pub fn thaw( origin: OriginFor, id: T::AssetIdParameter, @@ -1062,7 +976,7 @@ pub mod pallet { let origin = ensure_signed(origin)?; let id: T::AssetId = id.into(); - let details = Asset::::get(id).ok_or(Error::::Unknown)?; + let details = Asset::::get(&id).ok_or(Error::::Unknown)?; ensure!( details.status == AssetStatus::Live || details.status == AssetStatus::Frozen, Error::::AssetNotLive @@ -1070,8 +984,9 @@ pub mod pallet { ensure!(origin == details.admin, Error::::NoPermission); let who = T::Lookup::lookup(who)?; - Account::::try_mutate(id, &who, |maybe_account| -> DispatchResult { - maybe_account.as_mut().ok_or(Error::::NoAccount)?.is_frozen = false; + Account::::try_mutate(&id, &who, |maybe_account| -> DispatchResult { + maybe_account.as_mut().ok_or(Error::::NoAccount)?.status = + AccountStatus::Liquid; Ok(()) })?; @@ -1089,12 +1004,11 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(13)] - #[pallet::weight(T::WeightInfo::freeze_asset())] pub fn freeze_asset(origin: OriginFor, id: T::AssetIdParameter) -> DispatchResult { let origin = ensure_signed(origin)?; let id: T::AssetId = id.into(); - Asset::::try_mutate(id, |maybe_details| { + Asset::::try_mutate(id.clone(), |maybe_details| { let d = maybe_details.as_mut().ok_or(Error::::Unknown)?; ensure!(d.status == AssetStatus::Live, Error::::AssetNotLive); ensure!(origin == d.freezer, Error::::NoPermission); @@ -1116,12 +1030,11 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(14)] - #[pallet::weight(T::WeightInfo::thaw_asset())] pub fn thaw_asset(origin: OriginFor, id: T::AssetIdParameter) -> DispatchResult { let origin = ensure_signed(origin)?; let id: T::AssetId = id.into(); - Asset::::try_mutate(id, |maybe_details| { + Asset::::try_mutate(id.clone(), |maybe_details| { let d = maybe_details.as_mut().ok_or(Error::::Unknown)?; ensure!(origin == d.admin, Error::::NoPermission); ensure!(d.status == AssetStatus::Frozen, Error::::NotFrozen); @@ -1144,7 +1057,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(15)] - #[pallet::weight(T::WeightInfo::transfer_ownership())] pub fn transfer_ownership( origin: OriginFor, id: T::AssetIdParameter, @@ -1154,7 +1066,7 @@ pub mod pallet { let owner = T::Lookup::lookup(owner)?; let id: T::AssetId = id.into(); - Asset::::try_mutate(id, |maybe_details| { + Asset::::try_mutate(id.clone(), |maybe_details| { let details = maybe_details.as_mut().ok_or(Error::::Unknown)?; ensure!(details.status == AssetStatus::Live, Error::::LiveAsset); ensure!(origin == details.owner, Error::::NoPermission); @@ -1162,7 +1074,7 @@ pub mod pallet { return Ok(()) } - let metadata_deposit = Metadata::::get(id).deposit; + let metadata_deposit = Metadata::::get(&id).deposit; let deposit = details.deposit + metadata_deposit; // Move the deposit to the new owner. @@ -1188,7 +1100,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(16)] - #[pallet::weight(T::WeightInfo::set_team())] pub fn set_team( origin: OriginFor, id: T::AssetIdParameter, @@ -1202,7 +1113,7 @@ pub mod pallet { let freezer = T::Lookup::lookup(freezer)?; let id: T::AssetId = id.into(); - Asset::::try_mutate(id, |maybe_details| { + Asset::::try_mutate(id.clone(), |maybe_details| { let details = maybe_details.as_mut().ok_or(Error::::Unknown)?; ensure!(details.status == AssetStatus::Live, Error::::AssetNotLive); ensure!(origin == details.owner, Error::::NoPermission); @@ -1258,16 +1169,15 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(18)] - #[pallet::weight(T::WeightInfo::clear_metadata())] pub fn clear_metadata(origin: OriginFor, id: T::AssetIdParameter) -> DispatchResult { let origin = ensure_signed(origin)?; let id: T::AssetId = id.into(); - let d = Asset::::get(id).ok_or(Error::::Unknown)?; + let d = Asset::::get(&id).ok_or(Error::::Unknown)?; ensure!(d.status == AssetStatus::Live, Error::::AssetNotLive); ensure!(origin == d.owner, Error::::NoPermission); - Metadata::::try_mutate_exists(id, |metadata| { + Metadata::::try_mutate_exists(id.clone(), |metadata| { let deposit = metadata.take().ok_or(Error::::Unknown)?.deposit; T::Currency::unreserve(&d.owner, deposit); Self::deposit_event(Event::MetadataCleared { asset_id: id }); @@ -1308,8 +1218,8 @@ pub mod pallet { let bounded_symbol: BoundedVec = symbol.clone().try_into().map_err(|_| Error::::BadMetadata)?; - ensure!(Asset::::contains_key(id), Error::::Unknown); - Metadata::::try_mutate_exists(id, |metadata| { + ensure!(Asset::::contains_key(&id), Error::::Unknown); + Metadata::::try_mutate_exists(id.clone(), |metadata| { let deposit = metadata.take().map_or(Zero::zero(), |m| m.deposit); *metadata = Some(AssetMetadata { deposit, @@ -1342,7 +1252,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(20)] - #[pallet::weight(T::WeightInfo::force_clear_metadata())] pub fn force_clear_metadata( origin: OriginFor, id: T::AssetIdParameter, @@ -1350,8 +1259,8 @@ pub mod pallet { T::ForceOrigin::ensure_origin(origin)?; let id: T::AssetId = id.into(); - let d = Asset::::get(id).ok_or(Error::::Unknown)?; - Metadata::::try_mutate_exists(id, |metadata| { + let d = Asset::::get(&id).ok_or(Error::::Unknown)?; + Metadata::::try_mutate_exists(id.clone(), |metadata| { let deposit = metadata.take().ok_or(Error::::Unknown)?.deposit; T::Currency::unreserve(&d.owner, deposit); Self::deposit_event(Event::MetadataCleared { asset_id: id }); @@ -1382,7 +1291,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(21)] - #[pallet::weight(T::WeightInfo::force_asset_status())] pub fn force_asset_status( origin: OriginFor, id: T::AssetIdParameter, @@ -1397,7 +1305,7 @@ pub mod pallet { T::ForceOrigin::ensure_origin(origin)?; let id: T::AssetId = id.into(); - Asset::::try_mutate(id, |maybe_asset| { + Asset::::try_mutate(id.clone(), |maybe_asset| { let mut asset = maybe_asset.take().ok_or(Error::::Unknown)?; ensure!(asset.status != AssetStatus::Destroying, Error::::AssetNotLive); asset.owner = T::Lookup::lookup(owner)?; @@ -1439,7 +1347,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(22)] - #[pallet::weight(T::WeightInfo::approve_transfer())] pub fn approve_transfer( origin: OriginFor, id: T::AssetIdParameter, @@ -1466,7 +1373,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(23)] - #[pallet::weight(T::WeightInfo::cancel_approval())] pub fn cancel_approval( origin: OriginFor, id: T::AssetIdParameter, @@ -1475,15 +1381,15 @@ pub mod pallet { let owner = ensure_signed(origin)?; let delegate = T::Lookup::lookup(delegate)?; let id: T::AssetId = id.into(); - let mut d = Asset::::get(id).ok_or(Error::::Unknown)?; + let mut d = Asset::::get(&id).ok_or(Error::::Unknown)?; ensure!(d.status == AssetStatus::Live, Error::::AssetNotLive); - let approval = - Approvals::::take((id, &owner, &delegate)).ok_or(Error::::Unknown)?; + let approval = Approvals::::take((id.clone(), &owner, &delegate)) + .ok_or(Error::::Unknown)?; T::Currency::unreserve(&owner, approval.deposit); d.approvals.saturating_dec(); - Asset::::insert(id, d); + Asset::::insert(id.clone(), d); Self::deposit_event(Event::ApprovalCancelled { asset_id: id, owner, delegate }); Ok(()) @@ -1503,7 +1409,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(24)] - #[pallet::weight(T::WeightInfo::force_cancel_approval())] pub fn force_cancel_approval( origin: OriginFor, id: T::AssetIdParameter, @@ -1511,7 +1416,7 @@ pub mod pallet { delegate: AccountIdLookupOf, ) -> DispatchResult { let id: T::AssetId = id.into(); - let mut d = Asset::::get(id).ok_or(Error::::Unknown)?; + let mut d = Asset::::get(&id).ok_or(Error::::Unknown)?; ensure!(d.status == AssetStatus::Live, Error::::AssetNotLive); T::ForceOrigin::try_origin(origin) .map(|_| ()) @@ -1524,11 +1429,11 @@ pub mod pallet { let owner = T::Lookup::lookup(owner)?; let delegate = T::Lookup::lookup(delegate)?; - let approval = - Approvals::::take((id, &owner, &delegate)).ok_or(Error::::Unknown)?; + let approval = Approvals::::take((id.clone(), &owner, &delegate)) + .ok_or(Error::::Unknown)?; T::Currency::unreserve(&owner, approval.deposit); d.approvals.saturating_dec(); - Asset::::insert(id, d); + Asset::::insert(id.clone(), d); Self::deposit_event(Event::ApprovalCancelled { asset_id: id, owner, delegate }); Ok(()) @@ -1553,7 +1458,6 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::call_index(25)] - #[pallet::weight(T::WeightInfo::transfer_approved())] pub fn transfer_approved( origin: OriginFor, id: T::AssetIdParameter, @@ -1578,22 +1482,25 @@ pub mod pallet { /// /// Emits `Touched` event when successful. #[pallet::call_index(26)] - #[pallet::weight(T::WeightInfo::mint())] + #[pallet::weight(T::WeightInfo::touch())] pub fn touch(origin: OriginFor, id: T::AssetIdParameter) -> DispatchResult { + let who = ensure_signed(origin)?; let id: T::AssetId = id.into(); - Self::do_touch(id, ensure_signed(origin)?) + Self::do_touch(id, who.clone(), who, false) } - /// Return the deposit (if any) of an asset account. + /// Return the deposit (if any) of an asset account or a consumer reference (if any) of an + /// account. /// /// The origin must be Signed. /// - /// - `id`: The identifier of the asset for the account to be created. + /// - `id`: The identifier of the asset for which the caller would like the deposit + /// refunded. /// - `allow_burn`: If `true` then assets may be destroyed in order to complete the refund. /// /// Emits `Refunded` event when successful. #[pallet::call_index(27)] - #[pallet::weight(T::WeightInfo::mint())] + #[pallet::weight(T::WeightInfo::refund())] pub fn refund( origin: OriginFor, id: T::AssetIdParameter, @@ -1603,87 +1510,158 @@ pub mod pallet { Self::do_refund(id, ensure_signed(origin)?, allow_burn) } - /// Reserve some assets on an account for a specific asset. + /// Sets the minimum balance of an asset. /// - /// Origin must be Signed and the sender should be the Admin of the asset `id`. + /// Only works if there aren't any accounts that are holding the asset or if + /// the new value of `min_balance` is less than the old one. /// - /// - `id`: The identifier to be used for the reserve - /// - `asset_id`: The identifier of the asset. - /// - `who`: The account on which the assets are to be reserved. - /// - `amount`: The amount to reserve - /// `who`'s free balance is decreased by amount and the reserve balance increased by amount. - /// The reserve balance of the asset with asset_id is increased by amount. A named reserve - /// with id is added to reserves. + /// Origin must be Signed and the sender has to be the Owner of the + /// asset `id`. /// - /// Emits `Reserved` with the reserved amount. + /// - `id`: The identifier of the asset. + /// - `min_balance`: The new value of `min_balance`. /// - /// Weight: `O(1)` + /// Emits `AssetMinBalanceChanged` event when successful. #[pallet::call_index(28)] - #[pallet::weight(Weight::from_parts(10_000,0) + T::DbWeight::get().writes(1))] - pub fn reserve( + pub fn set_min_balance( origin: OriginFor, - id: T::ReserveIdentifier, - #[pallet::compact] asset_id: T::AssetId, + id: T::AssetIdParameter, + min_balance: T::Balance, + ) -> DispatchResult { + let origin = ensure_signed(origin)?; + let id: T::AssetId = id.into(); + + let mut details = Asset::::get(&id).ok_or(Error::::Unknown)?; + ensure!(origin == details.owner, Error::::NoPermission); + + let old_min_balance = details.min_balance; + // If the asset is marked as sufficient it won't be allowed to + // change the min_balance. + ensure!(!details.is_sufficient, Error::::NoPermission); + + // Ensure that either the new min_balance is less than old + // min_balance or there aren't any accounts holding the asset. + ensure!( + min_balance < old_min_balance || details.accounts == 0, + Error::::NoPermission + ); + + details.min_balance = min_balance; + Asset::::insert(&id, details); + + Self::deposit_event(Event::AssetMinBalanceChanged { + asset_id: id, + new_min_balance: min_balance, + }); + Ok(()) + } + + /// Create an asset account for `who`. + /// + /// A deposit will be taken from the signer account. + /// + /// - `origin`: Must be Signed by `Freezer` or `Admin` of the asset `id`; the signer account + /// must have sufficient funds for a deposit to be taken. + /// - `id`: The identifier of the asset for the account to be created. + /// - `who`: The account to be created. + /// + /// Emits `Touched` event when successful. + #[pallet::call_index(29)] + #[pallet::weight(T::WeightInfo::touch_other())] + pub fn touch_other( + origin: OriginFor, + id: T::AssetIdParameter, who: AccountIdLookupOf, - #[pallet::compact] amount: T::Balance, ) -> DispatchResult { let origin = ensure_signed(origin)?; let who = T::Lookup::lookup(who)?; - Self::do_reserve_named(&id, asset_id, &who, amount, origin) + let id: T::AssetId = id.into(); + Self::do_touch(id, who, origin, true) } - /// Unreserve assets reserved under id from an account - /// - /// Origin must be Signed and the sender should be the Admin of the asset `id`. + /// Return the deposit (if any) of a target asset account. Useful if you are the depositor. /// - /// - `id`: The identifier to be used for the reserve - /// - `asset_id`: The identifier of the asset. - /// - `who`: The account on which the assets are to be unreserved. - /// `who`'s free balance is increased by amount and the reserve balance decreased by amount. - /// The reserve balance of the asset with asset_id is decreased by amount. The named reserve - /// with id is removed. + /// The origin must be Signed and either the account owner, depositor, or asset `Admin`. In + /// order to burn a non-zero balance of the asset, the caller must be the account and should + /// use `refund`. /// - /// Emits `Uneserved` with the reserved amount. + /// - `id`: The identifier of the asset for the account holding a deposit. + /// - `who`: The account to refund. /// - /// Weight: `O(1)` - #[pallet::call_index(29)] - #[pallet::weight(Weight::from_parts(10_000,0) + T::DbWeight::get().writes(1))] - pub fn unreserve( + /// Emits `Refunded` event when successful. + #[pallet::call_index(30)] + #[pallet::weight(T::WeightInfo::refund_other())] + pub fn refund_other( origin: OriginFor, - id: T::ReserveIdentifier, - #[pallet::compact] asset_id: T::AssetId, + id: T::AssetIdParameter, who: AccountIdLookupOf, ) -> DispatchResult { let origin = ensure_signed(origin)?; let who = T::Lookup::lookup(who)?; - Self::do_unreserve_named(&id, asset_id, &who, origin) + let id: T::AssetId = id.into(); + Self::do_refund_other(id, &who, &origin) } - /// Burn assets reserved under id from an account + /// Disallow further unprivileged transfers of an asset `id` to and from an account `who`. /// - /// Origin must be Signed and the sender should be the Admin of the asset `id`. + /// Origin must be Signed and the sender should be the Freezer of the asset `id`. /// - /// - `id`: The identifier to be used for the reserve - /// - `asset_id`: The identifier of the asset. - /// - `who`: The account on which the reserved assets are to be burned. - /// `who`'s reserve balance is decreased by amount. - /// The reserve balance of the asset with asset_id is decreased by amount and the supply is - /// decreased by amount. The named reserve with id is removed. + /// - `id`: The identifier of the account's asset. + /// - `who`: The account to be unblocked. /// - /// Emits `BurnedReserve` with the reserved amount. + /// Emits `Blocked`. /// /// Weight: `O(1)` - #[pallet::call_index(30)] - #[pallet::weight(Weight::from_parts(10_000,0) + T::DbWeight::get().writes(1))] - pub fn burn_reserve( + #[pallet::call_index(31)] + pub fn block( origin: OriginFor, - id: T::ReserveIdentifier, - #[pallet::compact] asset_id: T::AssetId, + id: T::AssetIdParameter, who: AccountIdLookupOf, ) -> DispatchResult { let origin = ensure_signed(origin)?; + let id: T::AssetId = id.into(); + + let d = Asset::::get(&id).ok_or(Error::::Unknown)?; + ensure!( + d.status == AssetStatus::Live || d.status == AssetStatus::Frozen, + Error::::AssetNotLive + ); + ensure!(origin == d.freezer, Error::::NoPermission); let who = T::Lookup::lookup(who)?; - Self::do_burn_named_reserve(&id, asset_id, &who, origin) + + Account::::try_mutate(&id, &who, |maybe_account| -> DispatchResult { + maybe_account.as_mut().ok_or(Error::::NoAccount)?.status = + AccountStatus::Blocked; + Ok(()) + })?; + + Self::deposit_event(Event::::Blocked { asset_id: id, who }); + Ok(()) + } + } + + /// Implements [`AccountTouch`] trait. + /// Note that a depositor can be any account, without any specific privilege. + /// This implementation is supposed to be used only for creation of system accounts. + impl, I: 'static> AccountTouch for Pallet { + type Balance = DepositBalanceOf; + + fn deposit_required(_: T::AssetId) -> Self::Balance { + T::AssetAccountDeposit::get() + } + + fn touch(asset: T::AssetId, who: T::AccountId, depositor: T::AccountId) -> DispatchResult { + Self::do_touch(asset, who, depositor, false) + } + } + + /// Implements [`ContainsPair`] trait for a pair of asset and account IDs. + impl, I: 'static> ContainsPair for Pallet { + /// Check if an account with the given asset ID and account address exists. + fn contains(asset: &T::AssetId, who: &T::AccountId) -> bool { + Account::::contains_key(asset, who) } } } + +sp_core::generate_feature_enabled_macro!(runtime_benchmarks_enabled, feature = "runtime-benchmarks", $); diff --git a/pallets/mapped-assets/src/migration.rs b/pallets/mapped-assets/src/migration.rs new file mode 100644 index 00000000..d854a64a --- /dev/null +++ b/pallets/mapped-assets/src/migration.rs @@ -0,0 +1,137 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use super::*; +use frame_support::{log, traits::OnRuntimeUpgrade}; + +#[cfg(feature = "try-runtime")] +use sp_runtime::TryRuntimeError; + +pub mod v1 { + use frame_support::{pallet_prelude::*, weights::Weight}; + + use super::*; + + #[derive(Decode)] + pub struct OldAssetDetails { + pub owner: AccountId, + pub issuer: AccountId, + pub admin: AccountId, + pub freezer: AccountId, + pub supply: Balance, + pub deposit: DepositBalance, + pub min_balance: Balance, + pub is_sufficient: bool, + pub accounts: u32, + pub sufficients: u32, + pub approvals: u32, + pub is_frozen: bool, + } + + impl OldAssetDetails { + fn migrate_to_v1(self) -> AssetDetails { + let status = if self.is_frozen { AssetStatus::Frozen } else { AssetStatus::Live }; + + AssetDetails { + owner: self.owner, + issuer: self.issuer, + admin: self.admin, + freezer: self.freezer, + supply: self.supply, + deposit: self.deposit, + min_balance: self.min_balance, + is_sufficient: self.is_sufficient, + accounts: self.accounts, + sufficients: self.sufficients, + approvals: self.approvals, + status, + } + } + } + + pub struct MigrateToV1(sp_std::marker::PhantomData); + impl OnRuntimeUpgrade for MigrateToV1 { + fn on_runtime_upgrade() -> Weight { + let current_version = Pallet::::current_storage_version(); + let onchain_version = Pallet::::on_chain_storage_version(); + if onchain_version == 0 && current_version == 1 { + let mut translated = 0u64; + Asset::::translate::< + OldAssetDetails>, + _, + >(|_key, old_value| { + translated.saturating_inc(); + Some(old_value.migrate_to_v1()) + }); + current_version.put::>(); + log::info!( + target: LOG_TARGET, + "Upgraded {} pools, storage to version {:?}", + translated, + current_version + ); + T::DbWeight::get().reads_writes(translated + 1, translated + 1) + } else { + log::info!( + target: LOG_TARGET, + "Migration did not execute. This probably should be removed" + ); + T::DbWeight::get().reads(1) + } + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, TryRuntimeError> { + frame_support::ensure!( + Pallet::::on_chain_storage_version() == 0, + "must upgrade linearly" + ); + let prev_count = Asset::::iter().count(); + Ok((prev_count as u32).encode()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(prev_count: Vec) -> Result<(), TryRuntimeError> { + let prev_count: u32 = Decode::decode(&mut prev_count.as_slice()).expect( + "the state parameter should be something that was generated by pre_upgrade", + ); + let post_count = Asset::::iter().count() as u32; + ensure!( + prev_count == post_count, + "the asset count before and after the migration should be the same" + ); + + let current_version = Pallet::::current_storage_version(); + let onchain_version = Pallet::::on_chain_storage_version(); + + frame_support::ensure!(current_version == 1, "must_upgrade"); + ensure!( + current_version == onchain_version, + "after migration, the current_version and onchain_version should be the same" + ); + + Asset::::iter().try_for_each(|(_id, asset)| -> Result<(), TryRuntimeError> { + ensure!( + asset.status == AssetStatus::Live || asset.status == AssetStatus::Frozen, + "assets should only be live or frozen. None should be in destroying status, or undefined state" + ); + Ok(()) + })?; + Ok(()) + } + } +} diff --git a/pallets/mapped-assets/src/mock.rs b/pallets/mapped-assets/src/mock.rs index 47de1684..a200dd33 100644 --- a/pallets/mapped-assets/src/mock.rs +++ b/pallets/mapped-assets/src/mock.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2019-2022 Parity Technologies (UK) Ltd. +// Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,29 +23,26 @@ use crate as pallet_assets; use codec::Encode; use frame_support::{ construct_runtime, parameter_types, - traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, GenesisBuild}, + traits::{AsEnsureOriginWithArg, ConstU32, ConstU64}, }; use frame_system::EnsureRoot; use sp_core::H256; use sp_io::storage; 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, - { - System: frame_system::{Pallet, Call, Config, Storage, Event}, - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - Assets: pallet_assets::{Pallet, Call, Storage, Event}, - RBAC: pallet_rbac::{Pallet, Call, Storage, Event}, + pub enum Test + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + Assets: pallet_assets::{Pallet, Call, Storage, Event}, + RBAC: pallet_rbac::{Pallet, Call, Storage, Event}, + } ); @@ -58,13 +55,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 AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type DbWeight = (); @@ -110,28 +106,59 @@ impl pallet_balances::Config for Test { type MaxLocks = (); type MaxReserves = (); type ReserveIdentifier = [u8; 8]; + type RuntimeHoldReason = (); + type FreezeIdentifier = (); + type MaxHolds = (); + type MaxFreezes = (); } pub struct AssetsCallbackHandle; impl AssetsCallback for AssetsCallbackHandle { - fn created(_id: &AssetId, _owner: &AccountId) { - storage::set(b"asset_created", &().encode()); + fn created(_id: &AssetId, _owner: &AccountId) -> Result<(), ()> { + if Self::should_err() { + Err(()) + } else { + storage::set(Self::CREATED.as_bytes(), &().encode()); + Ok(()) + } } - fn destroyed(_id: &AssetId) { - storage::set(b"asset_destroyed", &().encode()); + fn destroyed(_id: &AssetId) -> Result<(), ()> { + if Self::should_err() { + Err(()) + } else { + storage::set(Self::DESTROYED.as_bytes(), &().encode()); + Ok(()) + } } } -parameter_types! { - pub const MaxReserves: u32 = 3; +impl AssetsCallbackHandle { + pub const CREATED: &'static str = "asset_created"; + pub const DESTROYED: &'static str = "asset_destroyed"; + + const RETURN_ERROR: &'static str = "return_error"; + + // Configures `Self` to return `Ok` when callbacks are invoked + pub fn set_return_ok() { + storage::clear(Self::RETURN_ERROR.as_bytes()); + } + + // Configures `Self` to return `Err` when callbacks are invoked + pub fn set_return_error() { + storage::set(Self::RETURN_ERROR.as_bytes(), &().encode()); + } + + // If `true`, callback should return `Err`, `Ok` otherwise. + fn should_err() -> bool { + storage::exists(Self::RETURN_ERROR.as_bytes()) + } } impl Config for Test { type RuntimeEvent = RuntimeEvent; type Balance = u64; type AssetId = u32; - type Rbac = RBAC; type AssetIdParameter = u32; type Currency = Balances; type CreateOrigin = AsEnsureOriginWithArg>; @@ -147,8 +174,8 @@ impl Config for Test { type CallbackHandle = AssetsCallbackHandle; type Extra = (); type RemoveItemsLimit = ConstU32<5>; - type MaxReserves = MaxReserves; - type ReserveIdentifier = u32; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); } use std::collections::HashMap; @@ -158,8 +185,8 @@ pub enum Hook { Died(u32, u64), } parameter_types! { - static Frozen: HashMap<(u32, u64), u64> = Default::default(); - static Hooks: Vec = Default::default(); + static Frozen: HashMap<(u32, u64), u64> = Default::default(); + static Hooks: Vec = Default::default(); } pub struct TestFreezer; @@ -197,7 +224,7 @@ pub(crate) fn take_hooks() -> Vec { } pub(crate) fn new_test_ext() -> sp_io::TestExternalities { - let mut storage = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut storage = frame_system::GenesisConfig::::default().build_storage().unwrap(); let config: pallet_assets::GenesisConfig = pallet_assets::GenesisConfig { assets: vec![ diff --git a/pallets/mapped-assets/src/types.rs b/pallets/mapped-assets/src/types.rs index 722a1a45..559afccb 100644 --- a/pallets/mapped-assets/src/types.rs +++ b/pallets/mapped-assets/src/types.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. +// Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,15 +20,20 @@ use super::*; use frame_support::{ pallet_prelude::*, - sp_io::hashing::blake2_256, - traits::{fungible, tokens::BalanceConversion}, + traits::{fungible, tokens::ConversionToAssetBalance}, }; use sp_runtime::{traits::Convert, FixedPointNumber, FixedPointOperand, FixedU128}; pub(super) type DepositBalanceOf = <>::Currency as Currency<::AccountId>>::Balance; -pub(super) type AssetAccountOf = - AssetAccount<>::Balance, DepositBalanceOf, >::Extra>; +pub(super) type AssetAccountOf = AssetAccount< + >::Balance, + DepositBalanceOf, + >::Extra, + ::AccountId, +>; +pub(super) type ExistenceReasonOf = + ExistenceReason, ::AccountId>; /// AssetStatus holds the current state of the asset. It could either be Live and available for use, /// or in a Destroying state. @@ -44,7 +49,7 @@ pub(super) enum AssetStatus { } #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] -pub struct AssetDetails { +pub struct AssetDetails { /// Can change `owner`, `issuer`, `freezer` and `admin` accounts. pub(super) owner: AccountId, /// Can mint tokens. @@ -55,8 +60,6 @@ pub struct AssetDetails - AssetDetails -{ - /* pub fn destroy_witness(&self) -> DestroyWitness { - DestroyWitness { - accounts: self.accounts, - sufficients: self.sufficients, - approvals: self.approvals, - } - } */ - - pub fn free_supply(&self) -> Balance { - self.supply.saturating_sub(self.reserved) - } -} - /// Data concerning an approval. #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, MaxEncodedLen, TypeInfo)] pub struct Approval { @@ -104,23 +89,35 @@ pub struct Approval { #[test] fn ensure_bool_decodes_to_consumer_or_sufficient() { - assert_eq!(false.encode(), ExistenceReason::<()>::Consumer.encode()); - assert_eq!(true.encode(), ExistenceReason::<()>::Sufficient.encode()); + assert_eq!(false.encode(), ExistenceReason::<(), ()>::Consumer.encode()); + assert_eq!(true.encode(), ExistenceReason::<(), ()>::Sufficient.encode()); } +/// The reason for an account's existence within an asset class. #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] -pub enum ExistenceReason { +pub enum ExistenceReason { + /// A consumer reference was used to create this account. #[codec(index = 0)] Consumer, + /// The asset class is `sufficient` for account existence. #[codec(index = 1)] Sufficient, + /// The account holder has placed a deposit to exist within an asset class. #[codec(index = 2)] DepositHeld(Balance), + /// A deposit was placed for this account to exist, but it has been refunded. #[codec(index = 3)] DepositRefunded, + /// Some other `AccountId` has placed a deposit to make this account exist. + /// An account with such a reason might not be referenced in `system`. + #[codec(index = 4)] + DepositFrom(AccountId, Balance), } -impl ExistenceReason { +impl ExistenceReason +where + AccountId: Clone, +{ pub(crate) fn take_deposit(&mut self) -> Option { if !matches!(self, ExistenceReason::DepositHeld(_)) { return None @@ -133,18 +130,56 @@ impl ExistenceReason { None } } + + pub(crate) fn take_deposit_from(&mut self) -> Option<(AccountId, Balance)> { + if !matches!(self, ExistenceReason::DepositFrom(..)) { + return None + } + if let ExistenceReason::DepositFrom(depositor, deposit) = + sp_std::mem::replace(self, ExistenceReason::DepositRefunded) + { + Some((depositor, deposit)) + } else { + None + } + } } +#[test] +fn ensure_bool_decodes_to_liquid_or_frozen() { + assert_eq!(false.encode(), AccountStatus::Liquid.encode()); + assert_eq!(true.encode(), AccountStatus::Frozen.encode()); +} + +/// The status of an asset account. #[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] -pub struct AssetAccount { - /// The free balance. +pub enum AccountStatus { + /// Asset account can receive and transfer the assets. + Liquid, + /// Asset account cannot transfer the assets. + Frozen, + /// Asset account cannot receive and transfer the assets. + Blocked, +} +impl AccountStatus { + /// Returns `true` if frozen or blocked. + pub(crate) fn is_frozen(&self) -> bool { + matches!(self, AccountStatus::Frozen | AccountStatus::Blocked) + } + /// Returns `true` if blocked. + pub(crate) fn is_blocked(&self) -> bool { + matches!(self, AccountStatus::Blocked) + } +} + +#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] +pub struct AssetAccount { + /// The balance. pub(super) balance: Balance, - /// The reserved balance. - pub(super) reserved: Balance, - /// Whether the account is frozen. - pub(super) is_frozen: bool, + /// The status of the account. + pub(super) status: AccountStatus, /// The reason for the existence of the account. - pub(super) reason: ExistenceReason, + pub(super) reason: ExistenceReason, /// Additional "sidecar" data, in case some other pallet wants to use this storage item. pub(super) extra: Extra, } @@ -165,20 +200,6 @@ pub struct AssetMetadata { pub(super) is_frozen: bool, } -/* /// Witness data for the destroy transactions. -#[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] -pub struct DestroyWitness { - /// The number of accounts holding the asset. - #[codec(compact)] - pub(super) accounts: u32, - /// The number of accounts holding the asset with a self-sufficient reference. - #[codec(compact)] - pub(super) sufficients: u32, - /// The number of transfer-approvals of the asset. - #[codec(compact)] - pub(super) approvals: u32, -} */ - /// Trait for allowing a minimum balance on the account to be specified, beyond the /// `minimum_balance` of the asset. This is additive - the `minimum_balance` of the asset must be /// met *and then* anything here in addition. @@ -226,14 +247,14 @@ pub(super) struct TransferFlags { } #[derive(Copy, Clone, PartialEq, Eq)] -pub struct DebitFlags { +pub(super) struct DebitFlags { /// The debited account must stay alive at the end of the operation; an error is returned if /// this cannot be achieved legally. - pub keep_alive: bool, + pub(super) keep_alive: bool, /// Less than the amount specified needs be debited by the operation for it to be considered /// successful. If `false`, then the amount debited will always be at least the amount /// specified. - pub best_effort: bool, + pub(super) best_effort: bool, } impl From for DebitFlags { @@ -265,7 +286,7 @@ type BalanceOf = >>::Balance; /// Converts a balance value into an asset balance based on the ratio between the fungible's /// minimum balance and the minimum asset balance. pub struct BalanceToAssetBalance(PhantomData<(F, T, CON, I)>); -impl BalanceConversion, AssetIdOf, AssetBalanceOf> +impl ConversionToAssetBalance, AssetIdOf, AssetBalanceOf> for BalanceToAssetBalance where F: fungible::Inspect>, @@ -298,48 +319,3 @@ where .saturating_mul_int(balance)) } } - -/// Store named reserved balance. -#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, MaxEncodedLen, TypeInfo)] -pub struct ReserveData { - /// The identifier for the named reserve. - pub id: ReserveIdentifier, - /// The amount of the named reserve. - pub amount: Balance, -} - -#[derive( - Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, MaxEncodedLen, TypeInfo, Copy, -)] -pub enum AfloatRole { - Owner, - Admin, - BuyerOrSeller, - CPA, -} - -impl Default for AfloatRole { - fn default() -> Self { - AfloatRole::BuyerOrSeller - } -} - -impl AfloatRole { - pub fn to_vec(self) -> Vec { - match self { - Self::Owner => "Owner".as_bytes().to_vec(), - Self::Admin => "Admin".as_bytes().to_vec(), - Self::BuyerOrSeller => "BuyerOrSeller".as_bytes().to_vec(), - Self::CPA => "CPA".as_bytes().to_vec(), - } - } - - pub fn id(&self) -> [u8; 32] { - self.to_vec().using_encoded(blake2_256) - } - - pub fn enum_to_vec() -> Vec> { - use crate::types::AfloatRole::*; - [Owner.to_vec(), Admin.to_vec(), BuyerOrSeller.to_vec(), CPA.to_vec()].to_vec() - } -} diff --git a/pallets/mapped-assets/src/weights.rs b/pallets/mapped-assets/src/weights.rs index c4f25b6a..f20f7e31 100644 --- a/pallets/mapped-assets/src/weights.rs +++ b/pallets/mapped-assets/src/weights.rs @@ -18,34 +18,37 @@ //! Autogenerated weights for pallet_assets //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-06-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `runner-e8ezs4ez-project-145-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: -// target/production/substrate +// ./target/production/substrate // benchmark // pallet +// --chain=dev // --steps=50 // --repeat=20 +// --pallet=pallet_assets +// --no-storage-info +// --no-median-slopes +// --no-min-squares // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json -// --pallet=pallet_assets -// --chain=dev -// --header=./HEADER-APACHE2 // --output=./frame/assets/src/weights.rs +// --header=./HEADER-APACHE2 // --template=./.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions needed for pallet_assets. pub trait WeightInfo { @@ -76,6 +79,11 @@ pub trait WeightInfo { fn cancel_approval() -> Weight; fn force_cancel_approval() -> Weight; fn set_min_balance() -> Weight; + fn touch() -> Weight; + fn touch_other() -> Weight; + fn refund() -> Weight; + fn refund_other() -> Weight; + fn block() -> Weight; } /// Weights for pallet_assets using the Substrate node and recommended hardware. @@ -87,10 +95,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn create() -> Weight { // Proof Size summary in bytes: - // Measured: `325` - // Estimated: `7268` - // Minimum execution time: 28_265_000 picoseconds. - Weight::from_parts(28_764_000, 7268) + // Measured: `293` + // Estimated: `3675` + // Minimum execution time: 31_340_000 picoseconds. + Weight::from_parts(31_977_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -100,8 +108,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `153` // Estimated: `3675` - // Minimum execution time: 15_125_000 picoseconds. - Weight::from_parts(15_468_000, 3675) + // Minimum execution time: 13_342_000 picoseconds. + Weight::from_parts(13_782_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -109,33 +117,33 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn start_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `417` + // Measured: `385` // Estimated: `3675` - // Minimum execution time: 15_368_000 picoseconds. - Weight::from_parts(15_625_000, 3675) + // Minimum execution time: 14_437_000 picoseconds. + Weight::from_parts(14_833_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1001 w:1000) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1000 w:1000) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// The range of component `c` is `[0, 1000]`. fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `25 + c * (240 ±0)` - // Estimated: `8232 + c * (5180 ±0)` - // Minimum execution time: 20_816_000 picoseconds. - Weight::from_parts(21_045_000, 8232) - // Standard Error: 7_118 - .saturating_add(Weight::from_parts(12_723_454, 0).saturating_mul(c.into())) + // Measured: `0 + c * (208 ±0)` + // Estimated: `3675 + c * (2609 ±0)` + // Minimum execution time: 18_728_000 picoseconds. + Weight::from_parts(18_982_000, 3675) + // Standard Error: 11_708 + .saturating_add(Weight::from_parts(14_363_570, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 5180).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 2609).saturating_mul(c.into())) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) @@ -144,12 +152,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `a` is `[0, 1000]`. fn destroy_approvals(a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `554 + a * (86 ±0)` - // Estimated: `7288 + a * (2623 ±0)` - // Minimum execution time: 20_923_000 picoseconds. - Weight::from_parts(21_229_000, 7288) - // Standard Error: 7_215 - .saturating_add(Weight::from_parts(12_915_292, 0).saturating_mul(a.into())) + // Measured: `522 + a * (86 ±0)` + // Estimated: `3675 + a * (2623 ±0)` + // Minimum execution time: 18_611_000 picoseconds. + Weight::from_parts(18_970_000, 3675) + // Standard Error: 13_224 + .saturating_add(Weight::from_parts(16_397_299, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -162,107 +170,107 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn finish_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `383` - // Estimated: `7280` - // Minimum execution time: 15_764_000 picoseconds. - Weight::from_parts(16_245_000, 7280) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 14_504_000 picoseconds. + Weight::from_parts(14_906_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn mint() -> Weight { // Proof Size summary in bytes: - // Measured: `383` - // Estimated: `7242` - // Minimum execution time: 28_814_000 picoseconds. - Weight::from_parts(29_407_000, 7242) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 26_653_000 picoseconds. + Weight::from_parts(27_260_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `491` - // Estimated: `7242` - // Minimum execution time: 34_784_000 picoseconds. - Weight::from_parts(35_402_000, 7242) + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 33_625_000 picoseconds. + Weight::from_parts(34_474_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:2 w:2) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `530` - // Estimated: `13412` - // Minimum execution time: 49_110_000 picoseconds. - Weight::from_parts(50_483_000, 13412) + // Measured: `498` + // Estimated: `6208` + // Minimum execution time: 47_609_000 picoseconds. + Weight::from_parts(48_476_000, 6208) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:2 w:2) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `530` - // Estimated: `13412` - // Minimum execution time: 43_585_000 picoseconds. - Weight::from_parts(44_207_000, 13412) + // Measured: `498` + // Estimated: `6208` + // Minimum execution time: 41_625_000 picoseconds. + Weight::from_parts(43_030_000, 6208) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:2 w:2) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `530` - // Estimated: `13412` - // Minimum execution time: 49_238_000 picoseconds. - Weight::from_parts(77_664_000, 13412) + // Measured: `498` + // Estimated: `6208` + // Minimum execution time: 47_661_000 picoseconds. + Weight::from_parts(48_469_000, 6208) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: Assets Asset (r:1 w:0) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn freeze() -> Weight { // Proof Size summary in bytes: - // Measured: `491` - // Estimated: `7242` - // Minimum execution time: 19_198_000 picoseconds. - Weight::from_parts(19_585_000, 7242) + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 17_727_000 picoseconds. + Weight::from_parts(18_384_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: Assets Asset (r:1 w:0) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn thaw() -> Weight { // Proof Size summary in bytes: - // Measured: `491` - // Estimated: `7242` - // Minimum execution time: 19_659_000 picoseconds. - Weight::from_parts(20_079_000, 7242) + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 17_657_000 picoseconds. + Weight::from_parts(18_282_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -270,10 +278,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn freeze_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `417` + // Measured: `385` // Estimated: `3675` - // Minimum execution time: 15_035_000 picoseconds. - Weight::from_parts(15_594_000, 3675) + // Minimum execution time: 13_743_000 picoseconds. + Weight::from_parts(14_193_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -281,10 +289,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn thaw_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `417` + // Measured: `385` // Estimated: `3675` - // Minimum execution time: 15_073_000 picoseconds. - Weight::from_parts(15_862_000, 3675) + // Minimum execution time: 13_653_000 picoseconds. + Weight::from_parts(14_263_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -294,10 +302,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn transfer_ownership() -> Weight { // Proof Size summary in bytes: - // Measured: `383` - // Estimated: `7280` - // Minimum execution time: 17_343_000 picoseconds. - Weight::from_parts(17_656_000, 7280) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 15_328_000 picoseconds. + Weight::from_parts(16_042_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -305,10 +313,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn set_team() -> Weight { // Proof Size summary in bytes: - // Measured: `383` + // Measured: `351` // Estimated: `3675` - // Minimum execution time: 15_902_000 picoseconds. - Weight::from_parts(16_439_000, 3675) + // Minimum execution time: 14_097_000 picoseconds. + Weight::from_parts(14_641_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -320,10 +328,10 @@ impl WeightInfo for SubstrateWeight { /// The range of component `s` is `[0, 50]`. fn set_metadata(_n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `383` - // Estimated: `7280` - // Minimum execution time: 27_222_000 picoseconds. - Weight::from_parts(29_151_657, 7280) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 29_535_000 picoseconds. + Weight::from_parts(31_456_892, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -333,10 +341,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `579` - // Estimated: `7280` - // Minimum execution time: 27_976_000 picoseconds. - Weight::from_parts(28_289_000, 7280) + // Measured: `515` + // Estimated: `3675` + // Minimum execution time: 30_680_000 picoseconds. + Weight::from_parts(31_930_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -349,11 +357,11 @@ impl WeightInfo for SubstrateWeight { fn force_set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `190` - // Estimated: `7280` - // Minimum execution time: 16_162_000 picoseconds. - Weight::from_parts(17_137_043, 7280) - // Standard Error: 982 - .saturating_add(Weight::from_parts(4_180, 0).saturating_mul(s.into())) + // Estimated: `3675` + // Minimum execution time: 14_660_000 picoseconds. + Weight::from_parts(15_718_387, 3675) + // Standard Error: 622 + .saturating_add(Weight::from_parts(2_640, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -363,10 +371,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn force_clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `579` - // Estimated: `7280` - // Minimum execution time: 27_219_000 picoseconds. - Weight::from_parts(27_931_000, 7280) + // Measured: `515` + // Estimated: `3675` + // Minimum execution time: 30_853_000 picoseconds. + Weight::from_parts(31_483_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -374,10 +382,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn force_asset_status() -> Weight { // Proof Size summary in bytes: - // Measured: `383` + // Measured: `351` // Estimated: `3675` - // Minimum execution time: 15_313_000 picoseconds. - Weight::from_parts(15_775_000, 3675) + // Minimum execution time: 13_632_000 picoseconds. + Weight::from_parts(14_077_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -387,10 +395,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) fn approve_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `417` - // Estimated: `7288` - // Minimum execution time: 31_865_000 picoseconds. - Weight::from_parts(32_316_000, 7288) + // Measured: `385` + // Estimated: `3675` + // Minimum execution time: 33_780_000 picoseconds. + Weight::from_parts(34_533_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -399,15 +407,15 @@ impl WeightInfo for SubstrateWeight { /// Storage: Assets Approvals (r:1 w:1) /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) /// Storage: Assets Account (r:2 w:2) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn transfer_approved() -> Weight { // Proof Size summary in bytes: - // Measured: `700` - // Estimated: `17025` - // Minimum execution time: 67_203_000 picoseconds. - Weight::from_parts(109_742_000, 17025) + // Measured: `668` + // Estimated: `6208` + // Minimum execution time: 67_712_000 picoseconds. + Weight::from_parts(69_946_000, 6208) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -417,10 +425,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) fn cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `587` - // Estimated: `7288` - // Minimum execution time: 33_430_000 picoseconds. - Weight::from_parts(33_824_000, 7288) + // Measured: `555` + // Estimated: `3675` + // Minimum execution time: 36_668_000 picoseconds. + Weight::from_parts(37_637_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -430,10 +438,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) fn force_cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `587` - // Estimated: `7288` - // Minimum execution time: 33_596_000 picoseconds. - Weight::from_parts(34_226_000, 7288) + // Measured: `555` + // Estimated: `3675` + // Minimum execution time: 36_685_000 picoseconds. + Weight::from_parts(37_950_000, 3675) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -441,13 +449,82 @@ impl WeightInfo for SubstrateWeight { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn set_min_balance() -> Weight { // Proof Size summary in bytes: - // Measured: `383` + // Measured: `351` // Estimated: `3675` - // Minimum execution time: 16_367_000 picoseconds. - Weight::from_parts(16_703_000, 3675) + // Minimum execution time: 14_466_000 picoseconds. + Weight::from_parts(14_924_000, 3675) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 34_874_000 picoseconds. + Weight::from_parts(36_330_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 33_278_000 picoseconds. + Weight::from_parts(34_104_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 32_898_000 picoseconds. + Weight::from_parts(33_489_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 31_243_000 picoseconds. + Weight::from_parts(31_909_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 17_692_000 picoseconds. + Weight::from_parts(18_253_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } // For backwards compatibility and tests @@ -458,10 +535,10 @@ impl WeightInfo for () { /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn create() -> Weight { // Proof Size summary in bytes: - // Measured: `325` - // Estimated: `7268` - // Minimum execution time: 28_265_000 picoseconds. - Weight::from_parts(28_764_000, 7268) + // Measured: `293` + // Estimated: `3675` + // Minimum execution time: 31_340_000 picoseconds. + Weight::from_parts(31_977_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -471,8 +548,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `153` // Estimated: `3675` - // Minimum execution time: 15_125_000 picoseconds. - Weight::from_parts(15_468_000, 3675) + // Minimum execution time: 13_342_000 picoseconds. + Weight::from_parts(13_782_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -480,33 +557,33 @@ impl WeightInfo for () { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn start_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `417` + // Measured: `385` // Estimated: `3675` - // Minimum execution time: 15_368_000 picoseconds. - Weight::from_parts(15_625_000, 3675) + // Minimum execution time: 14_437_000 picoseconds. + Weight::from_parts(14_833_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1001 w:1000) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1000 w:1000) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// The range of component `c` is `[0, 1000]`. fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `25 + c * (240 ±0)` - // Estimated: `8232 + c * (5180 ±0)` - // Minimum execution time: 20_816_000 picoseconds. - Weight::from_parts(21_045_000, 8232) - // Standard Error: 7_118 - .saturating_add(Weight::from_parts(12_723_454, 0).saturating_mul(c.into())) + // Measured: `0 + c * (208 ±0)` + // Estimated: `3675 + c * (2609 ±0)` + // Minimum execution time: 18_728_000 picoseconds. + Weight::from_parts(18_982_000, 3675) + // Standard Error: 11_708 + .saturating_add(Weight::from_parts(14_363_570, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 5180).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 2609).saturating_mul(c.into())) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) @@ -515,12 +592,12 @@ impl WeightInfo for () { /// The range of component `a` is `[0, 1000]`. fn destroy_approvals(a: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `554 + a * (86 ±0)` - // Estimated: `7288 + a * (2623 ±0)` - // Minimum execution time: 20_923_000 picoseconds. - Weight::from_parts(21_229_000, 7288) - // Standard Error: 7_215 - .saturating_add(Weight::from_parts(12_915_292, 0).saturating_mul(a.into())) + // Measured: `522 + a * (86 ±0)` + // Estimated: `3675 + a * (2623 ±0)` + // Minimum execution time: 18_611_000 picoseconds. + Weight::from_parts(18_970_000, 3675) + // Standard Error: 13_224 + .saturating_add(Weight::from_parts(16_397_299, 0).saturating_mul(a.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -533,107 +610,107 @@ impl WeightInfo for () { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn finish_destroy() -> Weight { // Proof Size summary in bytes: - // Measured: `383` - // Estimated: `7280` - // Minimum execution time: 15_764_000 picoseconds. - Weight::from_parts(16_245_000, 7280) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 14_504_000 picoseconds. + Weight::from_parts(14_906_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn mint() -> Weight { // Proof Size summary in bytes: - // Measured: `383` - // Estimated: `7242` - // Minimum execution time: 28_814_000 picoseconds. - Weight::from_parts(29_407_000, 7242) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 26_653_000 picoseconds. + Weight::from_parts(27_260_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `491` - // Estimated: `7242` - // Minimum execution time: 34_784_000 picoseconds. - Weight::from_parts(35_402_000, 7242) + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 33_625_000 picoseconds. + Weight::from_parts(34_474_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:2 w:2) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `530` - // Estimated: `13412` - // Minimum execution time: 49_110_000 picoseconds. - Weight::from_parts(50_483_000, 13412) + // Measured: `498` + // Estimated: `6208` + // Minimum execution time: 47_609_000 picoseconds. + Weight::from_parts(48_476_000, 6208) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:2 w:2) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `530` - // Estimated: `13412` - // Minimum execution time: 43_585_000 picoseconds. - Weight::from_parts(44_207_000, 13412) + // Measured: `498` + // Estimated: `6208` + // Minimum execution time: 41_625_000 picoseconds. + Weight::from_parts(43_030_000, 6208) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// Storage: Assets Asset (r:1 w:1) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:2 w:2) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `530` - // Estimated: `13412` - // Minimum execution time: 49_238_000 picoseconds. - Weight::from_parts(77_664_000, 13412) + // Measured: `498` + // Estimated: `6208` + // Minimum execution time: 47_661_000 picoseconds. + Weight::from_parts(48_469_000, 6208) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// Storage: Assets Asset (r:1 w:0) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn freeze() -> Weight { // Proof Size summary in bytes: - // Measured: `491` - // Estimated: `7242` - // Minimum execution time: 19_198_000 picoseconds. - Weight::from_parts(19_585_000, 7242) + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 17_727_000 picoseconds. + Weight::from_parts(18_384_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: Assets Asset (r:1 w:0) /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) /// Storage: Assets Account (r:1 w:1) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) fn thaw() -> Weight { // Proof Size summary in bytes: - // Measured: `491` - // Estimated: `7242` - // Minimum execution time: 19_659_000 picoseconds. - Weight::from_parts(20_079_000, 7242) + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 17_657_000 picoseconds. + Weight::from_parts(18_282_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -641,10 +718,10 @@ impl WeightInfo for () { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn freeze_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `417` + // Measured: `385` // Estimated: `3675` - // Minimum execution time: 15_035_000 picoseconds. - Weight::from_parts(15_594_000, 3675) + // Minimum execution time: 13_743_000 picoseconds. + Weight::from_parts(14_193_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -652,10 +729,10 @@ impl WeightInfo for () { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn thaw_asset() -> Weight { // Proof Size summary in bytes: - // Measured: `417` + // Measured: `385` // Estimated: `3675` - // Minimum execution time: 15_073_000 picoseconds. - Weight::from_parts(15_862_000, 3675) + // Minimum execution time: 13_653_000 picoseconds. + Weight::from_parts(14_263_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -665,10 +742,10 @@ impl WeightInfo for () { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn transfer_ownership() -> Weight { // Proof Size summary in bytes: - // Measured: `383` - // Estimated: `7280` - // Minimum execution time: 17_343_000 picoseconds. - Weight::from_parts(17_656_000, 7280) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 15_328_000 picoseconds. + Weight::from_parts(16_042_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -676,10 +753,10 @@ impl WeightInfo for () { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn set_team() -> Weight { // Proof Size summary in bytes: - // Measured: `383` + // Measured: `351` // Estimated: `3675` - // Minimum execution time: 15_902_000 picoseconds. - Weight::from_parts(16_439_000, 3675) + // Minimum execution time: 14_097_000 picoseconds. + Weight::from_parts(14_641_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -691,10 +768,10 @@ impl WeightInfo for () { /// The range of component `s` is `[0, 50]`. fn set_metadata(_n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `383` - // Estimated: `7280` - // Minimum execution time: 27_222_000 picoseconds. - Weight::from_parts(29_151_657, 7280) + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 29_535_000 picoseconds. + Weight::from_parts(31_456_892, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -704,10 +781,10 @@ impl WeightInfo for () { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `579` - // Estimated: `7280` - // Minimum execution time: 27_976_000 picoseconds. - Weight::from_parts(28_289_000, 7280) + // Measured: `515` + // Estimated: `3675` + // Minimum execution time: 30_680_000 picoseconds. + Weight::from_parts(31_930_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -720,11 +797,11 @@ impl WeightInfo for () { fn force_set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `190` - // Estimated: `7280` - // Minimum execution time: 16_162_000 picoseconds. - Weight::from_parts(17_137_043, 7280) - // Standard Error: 982 - .saturating_add(Weight::from_parts(4_180, 0).saturating_mul(s.into())) + // Estimated: `3675` + // Minimum execution time: 14_660_000 picoseconds. + Weight::from_parts(15_718_387, 3675) + // Standard Error: 622 + .saturating_add(Weight::from_parts(2_640, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -734,10 +811,10 @@ impl WeightInfo for () { /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) fn force_clear_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `579` - // Estimated: `7280` - // Minimum execution time: 27_219_000 picoseconds. - Weight::from_parts(27_931_000, 7280) + // Measured: `515` + // Estimated: `3675` + // Minimum execution time: 30_853_000 picoseconds. + Weight::from_parts(31_483_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -745,10 +822,10 @@ impl WeightInfo for () { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn force_asset_status() -> Weight { // Proof Size summary in bytes: - // Measured: `383` + // Measured: `351` // Estimated: `3675` - // Minimum execution time: 15_313_000 picoseconds. - Weight::from_parts(15_775_000, 3675) + // Minimum execution time: 13_632_000 picoseconds. + Weight::from_parts(14_077_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -758,10 +835,10 @@ impl WeightInfo for () { /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) fn approve_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `417` - // Estimated: `7288` - // Minimum execution time: 31_865_000 picoseconds. - Weight::from_parts(32_316_000, 7288) + // Measured: `385` + // Estimated: `3675` + // Minimum execution time: 33_780_000 picoseconds. + Weight::from_parts(34_533_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -770,15 +847,15 @@ impl WeightInfo for () { /// Storage: Assets Approvals (r:1 w:1) /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) /// Storage: Assets Account (r:2 w:2) - /// Proof: Assets Account (max_values: None, max_size: Some(102), added: 2577, mode: MaxEncodedLen) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) /// Storage: System Account (r:1 w:1) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) fn transfer_approved() -> Weight { // Proof Size summary in bytes: - // Measured: `700` - // Estimated: `17025` - // Minimum execution time: 67_203_000 picoseconds. - Weight::from_parts(109_742_000, 17025) + // Measured: `668` + // Estimated: `6208` + // Minimum execution time: 67_712_000 picoseconds. + Weight::from_parts(69_946_000, 6208) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -788,10 +865,10 @@ impl WeightInfo for () { /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) fn cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `587` - // Estimated: `7288` - // Minimum execution time: 33_430_000 picoseconds. - Weight::from_parts(33_824_000, 7288) + // Measured: `555` + // Estimated: `3675` + // Minimum execution time: 36_668_000 picoseconds. + Weight::from_parts(37_637_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -801,10 +878,10 @@ impl WeightInfo for () { /// Proof: Assets Approvals (max_values: None, max_size: Some(148), added: 2623, mode: MaxEncodedLen) fn force_cancel_approval() -> Weight { // Proof Size summary in bytes: - // Measured: `587` - // Estimated: `7288` - // Minimum execution time: 33_596_000 picoseconds. - Weight::from_parts(34_226_000, 7288) + // Measured: `555` + // Estimated: `3675` + // Minimum execution time: 36_685_000 picoseconds. + Weight::from_parts(37_950_000, 3675) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -812,11 +889,80 @@ impl WeightInfo for () { /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) fn set_min_balance() -> Weight { // Proof Size summary in bytes: - // Measured: `383` + // Measured: `351` // Estimated: `3675` - // Minimum execution time: 16_367_000 picoseconds. - Weight::from_parts(16_703_000, 3675) + // Minimum execution time: 14_466_000 picoseconds. + Weight::from_parts(14_924_000, 3675) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } -} \ No newline at end of file + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 34_874_000 picoseconds. + Weight::from_parts(36_330_000, 3675) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 33_278_000 picoseconds. + Weight::from_parts(34_104_000, 3675) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 32_898_000 picoseconds. + Weight::from_parts(33_489_000, 3675) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 31_243_000 picoseconds. + Weight::from_parts(31_909_000, 3675) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 17_692_000 picoseconds. + Weight::from_parts(18_253_000, 3675) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } +} From 17d6130f132f34440c03640e6740921c31675b7d Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Tue, 24 Oct 2023 13:58:53 -0600 Subject: [PATCH 08/34] =?UTF-8?q?=F0=9F=9A=80=20chore(mapped-assets):=20up?= =?UTF-8?q?date=20dependencies=20in=20Cargo.toml=20to=20latest=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 fix(mapped-assets): import missing sp_io::hashing::blake2_256 in functions.rs ✨ feat(mapped-assets): add AfloatRole enum and related functions in types.rs --- pallets/mapped-assets/Cargo.toml | 16 +++++------ pallets/mapped-assets/src/functions.rs | 2 +- pallets/mapped-assets/src/types.rs | 37 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/pallets/mapped-assets/Cargo.toml b/pallets/mapped-assets/Cargo.toml index a4a1a8aa..8f647e4a 100644 --- a/pallets/mapped-assets/Cargo.toml +++ b/pallets/mapped-assets/Cargo.toml @@ -18,21 +18,21 @@ log = { version = "0.4.17", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ "derive" ] } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-std = { version = "8.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } # Needed for various traits. In our case, `OnFinalize`. -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } # Needed for type-safe access to storage DB. -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } # `system` module provides us with all sorts of useful stuff and macros depend on it being around. -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-core = { version = "21.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } pallet-rbac = { default-features = false, version = "4.0.0-dev", path = "../rbac/" } [dev-dependencies] -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sp-std = { version = "8.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-io = { version = "23.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } [features] default = ["std"] diff --git a/pallets/mapped-assets/src/functions.rs b/pallets/mapped-assets/src/functions.rs index f0559d1e..9289ddee 100644 --- a/pallets/mapped-assets/src/functions.rs +++ b/pallets/mapped-assets/src/functions.rs @@ -18,7 +18,7 @@ //! Functions for the Assets pallet. use super::*; -use frame_support::{defensive, traits::Get, BoundedVec}; +use frame_support::{defensive, sp_io::hashing::blake2_256, traits::Get, BoundedVec}; use pallet_rbac::types::{IdOrVec, RoleBasedAccessControl}; use scale_info::prelude::vec; use sp_runtime::sp_std::vec::Vec; diff --git a/pallets/mapped-assets/src/types.rs b/pallets/mapped-assets/src/types.rs index 559afccb..04c98896 100644 --- a/pallets/mapped-assets/src/types.rs +++ b/pallets/mapped-assets/src/types.rs @@ -20,6 +20,7 @@ use super::*; use frame_support::{ pallet_prelude::*, + sp_io::hashing::blake2_256, traits::{fungible, tokens::ConversionToAssetBalance}, }; use sp_runtime::{traits::Convert, FixedPointNumber, FixedPointOperand, FixedU128}; @@ -319,3 +320,39 @@ where .saturating_mul_int(balance)) } } + +#[derive( + Encode, Decode, Clone, Eq, PartialEq, RuntimeDebugNoBound, MaxEncodedLen, TypeInfo, Copy, +)] +pub enum AfloatRole { + Owner, + Admin, + BuyerOrSeller, + CPA, +} + +impl Default for AfloatRole { + fn default() -> Self { + AfloatRole::BuyerOrSeller + } +} + +impl AfloatRole { + pub fn to_vec(self) -> Vec { + match self { + Self::Owner => "Owner".as_bytes().to_vec(), + Self::Admin => "Admin".as_bytes().to_vec(), + Self::BuyerOrSeller => "BuyerOrSeller".as_bytes().to_vec(), + Self::CPA => "CPA".as_bytes().to_vec(), + } + } + + pub fn id(&self) -> [u8; 32] { + self.to_vec().using_encoded(blake2_256) + } + + pub fn enum_to_vec() -> Vec> { + use crate::types::AfloatRole::*; + [Owner.to_vec(), Admin.to_vec(), BuyerOrSeller.to_vec(), CPA.to_vec()].to_vec() + } +} From 5e443de95a918721eb8778ebeed0147f06c6cf00 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Tue, 24 Oct 2023 13:59:15 -0600 Subject: [PATCH 09/34] update deps --- Cargo.lock | 599 ++++++++++++++++++++++++++--------------------------- 1 file changed, 292 insertions(+), 307 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77efa020..6342310d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,22 +12,13 @@ dependencies = [ "regex", ] -[[package]] -name = "addr2line" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli 0.26.2", -] - [[package]] name = "addr2line" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli 0.27.2", + "gimli", ] [[package]] @@ -109,9 +100,9 @@ dependencies = [ [[package]] name = "array-bytes" -version = "4.2.0" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" +checksum = "d9b1c5a481ec30a5abd8dfbd94ab5cf1bb4e9a66be7f1b3b322f2f1170c200fd" [[package]] name = "arrayref" @@ -154,26 +145,20 @@ version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line 0.19.0", + "addr2line", "cc", "cfg-if", "libc", "miniz_oxide", - "object 0.30.3", + "object", "rustc-demangle", ] [[package]] name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - -[[package]] -name = "base58" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" @@ -275,9 +260,9 @@ dependencies = [ [[package]] name = "bounded-collections" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fbd1d11282a1eb134d3c3b7cf8ce213b5161c6e5f73fb1b98618482c606b64" +checksum = "ca548b6163b872067dc5eb82fd130c56881435e30367d2073594a3d9744120dd" dependencies = [ "log", "parity-scale-codec", @@ -285,6 +270,12 @@ dependencies = [ "serde", ] +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + [[package]] name = "bumpalo" version = "3.13.0" @@ -329,9 +320,9 @@ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-expr" -version = "0.10.3" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3" dependencies = [ "smallvec", ] @@ -360,6 +351,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" +[[package]] +name = "const-random" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11df32a13d7892ec42d51d3d175faba5211ffe13ed25d4fb348ac9e9ce835593" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom 0.2.9", + "once_cell", + "tiny-keccak", +] + [[package]] name = "constant_time_eq" version = "0.2.5" @@ -392,9 +403,9 @@ dependencies = [ [[package]] name = "cranelift-entity" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f42ea692c7b450ad18b8c9889661505d51c09ec4380cf1c2d278dbb2da22cae1" +checksum = "40099d38061b37e505e63f89bab52199037a72b931ad4868d9089ff7268660b0" dependencies = [ "serde", ] @@ -416,9 +427,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.4.9" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" dependencies = [ "generic-array 0.14.7", "rand_core 0.6.4", @@ -484,9 +495,9 @@ dependencies = [ [[package]] name = "der" -version = "0.6.1" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ "const-oid", "zeroize", @@ -539,16 +550,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle", ] -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - [[package]] name = "dyn-clonable" version = "0.9.0" @@ -578,14 +584,16 @@ checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" [[package]] name = "ecdsa" -version = "0.14.8" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" dependencies = [ "der", + "digest 0.10.7", "elliptic-curve", "rfc6979", - "signature", + "signature 2.1.0", + "spki", ] [[package]] @@ -594,7 +602,7 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ - "signature", + "signature 1.6.4", ] [[package]] @@ -631,17 +639,17 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.12.3" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" dependencies = [ "base16ct", "crypto-bigint", - "der", "digest 0.10.7", "ff", "generic-array 0.14.7", "group", + "pkcs8", "rand_core 0.6.4", "sec1", "subtle", @@ -677,15 +685,15 @@ dependencies = [ [[package]] name = "expander" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f360349150728553f92e4c997a16af8915f418d3a0f21b440d34c5632f16ed84" +checksum = "5f86a749cf851891866c10515ef6c299b5c69661465e9c3bbe7e07a2b77fb0f7" dependencies = [ "blake2", "fs-err", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] @@ -702,9 +710,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "ff" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ "rand_core 0.6.4", "subtle", @@ -734,7 +742,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support", "frame-support-procedural", @@ -742,7 +750,7 @@ dependencies = [ "linregress", "log", "parity-scale-codec", - "paste 1.0.12", + "paste", "scale-info", "serde", "sp-api", @@ -758,9 +766,9 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "15.1.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" +checksum = "87cf1549fba25a6fcac22785b61698317d958e96cac72a59102ea45b9ae64692" dependencies = [ "cfg-if", "parity-scale-codec", @@ -771,7 +779,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "bitflags", "environmental", @@ -780,9 +788,9 @@ dependencies = [ "impl-trait-for-tuples", "k256", "log", - "once_cell", + "macro_magic", "parity-scale-codec", - "paste 1.0.12", + "paste", "scale-info", "serde", "smallvec", @@ -790,6 +798,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-core-hashing-proc-macro", + "sp-debug-derive", "sp-inherents", "sp-io", "sp-runtime", @@ -804,45 +813,49 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "Inflector", "cfg-expr", "derive-syn-parse", + "expander", "frame-support-procedural-tools", "itertools", + "macro_magic", + "proc-macro-warning", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ + "cfg-if", "frame-support", "log", "parity-scale-codec", @@ -940,12 +953,6 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" - [[package]] name = "futures-util" version = "0.3.28" @@ -981,6 +988,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -1007,25 +1015,20 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.2" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" dependencies = [ "fallible-iterator", + "indexmap", "stable_deref_trait", ] -[[package]] -name = "gimli" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" - [[package]] name = "group" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", "rand_core 0.6.4", @@ -1245,13 +1248,14 @@ dependencies = [ [[package]] name = "k256" -version = "0.11.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", + "once_cell", "sha2 0.10.6", ] @@ -1276,12 +1280,6 @@ version = "0.2.144" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" -[[package]] -name = "libm" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" - [[package]] name = "libsecp256k1" version = "0.7.1" @@ -1353,20 +1351,20 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lite-json" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0460d985423a026b4d9b828a7c6eed1bcf606f476322f3f9b507529686a61715" +checksum = "cd0e787ffe1153141a0f6f6d759fdf1cc34b1226e088444523812fd412a5cca2" dependencies = [ "lite-parser", ] [[package]] name = "lite-parser" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c50092e40e0ccd1bf2015a10333fde0502ff95b832b0895dc1ca0d7ac6c52f6" +checksum = "c3d5f9dc37c52d889a21fd701983d02bb6a84f852c5140a6c80ef4557f7dc29e" dependencies = [ - "paste 0.1.18", + "paste", ] [[package]] @@ -1394,6 +1392,54 @@ dependencies = [ "libc", ] +[[package]] +name = "macro_magic" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aee866bfee30d2d7e83835a4574aad5b45adba4cc807f2a3bbba974e5d4383c9" +dependencies = [ + "macro_magic_core", + "macro_magic_macros", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "macro_magic_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e766a20fd9c72bab3e1e64ed63f36bd08410e75803813df210d1ce297d7ad00" +dependencies = [ + "const-random", + "derive-syn-parse", + "macro_magic_core_macros", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "macro_magic_core_macros" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d710e1214dffbab3b5dacb21475dde7d6ed84c69ff722b3a47a782668d44fbac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "macro_magic_macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" +dependencies = [ + "macro_magic_core", + "quote", + "syn 2.0.38", +] + [[package]] name = "matchers" version = "0.0.1" @@ -1430,9 +1476,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.6.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ "autocfg", ] @@ -1446,12 +1492,6 @@ dependencies = [ "hash-db", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "merlin" version = "2.0.1" @@ -1506,17 +1546,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-complex" version = "0.4.3" @@ -1553,7 +1582,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", - "num-bigint", "num-integer", "num-traits", ] @@ -1577,24 +1605,15 @@ dependencies = [ "libc", ] -[[package]] -name = "object" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" -dependencies = [ - "crc32fast", - "hashbrown 0.12.3", - "indexmap", - "memchr", -] - [[package]] name = "object" version = "0.30.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ + "crc32fast", + "hashbrown 0.13.2", + "indexmap", "memchr", ] @@ -1643,7 +1662,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -1799,7 +1818,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -1817,7 +1836,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "frame-benchmarking", "frame-support", @@ -1885,31 +1904,12 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "paste" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -dependencies = [ - "paste-impl", - "proc-macro-hack", -] - [[package]] name = "paste" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" -[[package]] -name = "paste-impl" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -dependencies = [ - "proc-macro-hack", -] - [[package]] name = "pbkdf2" version = "0.8.0" @@ -1948,9 +1948,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs8" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der", "spki", @@ -1986,10 +1986,15 @@ dependencies = [ ] [[package]] -name = "proc-macro-hack" -version = "0.5.20+deprecated" +name = "proc-macro-warning" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" +checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] [[package]] name = "proc-macro2" @@ -2164,13 +2169,12 @@ checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "rfc6979" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "crypto-bigint", "hmac 0.12.1", - "zeroize", + "subtle", ] [[package]] @@ -2219,6 +2223,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.13" @@ -2297,9 +2307,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "sec1" -version = "0.3.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", "der", @@ -2427,6 +2437,12 @@ name = "signature" version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ "digest 0.10.7", "rand_core 0.6.4", @@ -2441,7 +2457,7 @@ dependencies = [ "approx", "num-complex", "num-traits", - "paste 1.0.12", + "paste", "wide", ] @@ -2463,13 +2479,16 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "hash-db", "log", "parity-scale-codec", + "scale-info", "sp-api-proc-macro", "sp-core", + "sp-externalities", + "sp-metadata-ir", "sp-runtime", "sp-state-machine", "sp-std", @@ -2481,7 +2500,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "Inflector", "blake2", @@ -2489,13 +2508,13 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] name = "sp-application-crypto" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "23.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -2507,8 +2526,8 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "16.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "integer-sqrt", "num-traits", @@ -2521,14 +2540,14 @@ dependencies = [ [[package]] name = "sp-core" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "21.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", - "base58", "bitflags", "blake2", "bounded-collections", + "bs58", "dyn-clonable", "ed25519-zebra", "futures", @@ -2541,6 +2560,7 @@ dependencies = [ "merlin", "parity-scale-codec", "parking_lot", + "paste", "primitive-types", "rand 0.8.5", "regex", @@ -2559,48 +2579,47 @@ dependencies = [ "substrate-bip39", "thiserror", "tiny-bip39", + "tracing", "zeroize", ] [[package]] name = "sp-core-hashing" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "9.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "blake2b_simd", "byteorder", "digest 0.10.7", "sha2 0.10.6", "sha3", - "sp-std", "twox-hash", ] [[package]] name = "sp-core-hashing-proc-macro" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "9.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ - "proc-macro2", "quote", "sp-core-hashing", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] name = "sp-debug-derive" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] name = "sp-externalities" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "0.19.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "environmental", "parity-scale-codec", @@ -2611,13 +2630,12 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-core", "sp-runtime", "sp-std", "thiserror", @@ -2625,16 +2643,16 @@ dependencies = [ [[package]] name = "sp-io" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "23.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "bytes", "ed25519", "ed25519-dalek", - "futures", "libsecp256k1", "log", "parity-scale-codec", + "rustversion", "secp256k1", "sp-core", "sp-externalities", @@ -2650,25 +2668,31 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "0.27.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ - "async-trait", - "futures", - "merlin", "parity-scale-codec", "parking_lot", - "schnorrkel", - "serde", "sp-core", "sp-externalities", "thiserror", ] +[[package]] +name = "sp-metadata-ir" +version = "0.1.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +dependencies = [ + "frame-metadata", + "parity-scale-codec", + "scale-info", + "sp-std", +] + [[package]] name = "sp-panic-handler" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "backtrace", "lazy_static", @@ -2677,15 +2701,15 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "24.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", "parity-scale-codec", - "paste 1.0.12", + "paste", "rand 0.8.5", "scale-info", "serde", @@ -2699,8 +2723,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "17.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -2717,23 +2741,25 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "11.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ + "impl-trait-for-tuples", "parity-scale-codec", "scale-info", + "serde", "sp-core", "sp-runtime", "sp-std", @@ -2741,8 +2767,8 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "0.28.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "hash-db", "log", @@ -2757,17 +2783,18 @@ dependencies = [ "sp-trie", "thiserror", "tracing", + "trie-db", ] [[package]] name = "sp-std" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" [[package]] name = "sp-storage" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "13.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -2780,11 +2807,9 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "async-trait", - "futures-timer", - "log", "parity-scale-codec", "sp-inherents", "sp-runtime", @@ -2794,8 +2819,8 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "10.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "sp-std", @@ -2806,12 +2831,12 @@ dependencies = [ [[package]] name = "sp-trie" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "22.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "ahash 0.8.3", "hash-db", - "hashbrown 0.12.3", + "hashbrown 0.13.2", "lazy_static", "memory-db", "nohash-hasher", @@ -2829,8 +2854,8 @@ dependencies = [ [[package]] name = "sp-version" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "22.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -2846,33 +2871,32 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", ] [[package]] name = "sp-wasm-interface" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "14.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "anyhow", "impl-trait-for-tuples", "log", "parity-scale-codec", "sp-std", - "wasmi", "wasmtime", ] [[package]] name = "sp-weights" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#98f2e3451c9143278ec53c6718940aeabcd3b68a" +version = "20.0.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "parity-scale-codec", "scale-info", @@ -2886,9 +2910,9 @@ dependencies = [ [[package]] name = "spki" -version = "0.6.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", "der", @@ -3023,6 +3047,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -3305,44 +3338,11 @@ version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" -[[package]] -name = "wasmi" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" -dependencies = [ - "parity-wasm", - "wasmi-validation", - "wasmi_core", -] - -[[package]] -name = "wasmi-validation" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" -dependencies = [ - "parity-wasm", -] - -[[package]] -name = "wasmi_core" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" -dependencies = [ - "downcast-rs", - "libm", - "memory_units", - "num-rational", - "num-traits", -] - [[package]] name = "wasmparser" -version = "0.100.0" +version = "0.102.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b20236ab624147dfbb62cf12a19aaf66af0e41b8398838b66e997d07d269d4" +checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" dependencies = [ "indexmap", "url", @@ -3350,9 +3350,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a222f5fa1e14b2cefc286f1b68494d7a965f4bf57ec04c59bb62673d639af6" +checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9" dependencies = [ "anyhow", "bincode", @@ -3360,9 +3360,9 @@ dependencies = [ "indexmap", "libc", "log", - "object 0.29.0", + "object", "once_cell", - "paste 1.0.12", + "paste", "psm", "serde", "target-lexicon", @@ -3370,30 +3370,30 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit", "wasmtime-runtime", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-asm-macros" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4407a7246e7d2f3d8fb1cf0c72fda8dbafdb6dd34d555ae8bea0e5ae031089cc" +checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-environ" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b8b50962eae38ee319f7b24900b7cf371f03eebdc17400c1dc8575fc10c9a7" +checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" dependencies = [ "anyhow", "cranelift-entity", - "gimli 0.26.2", + "gimli", "indexmap", "log", - "object 0.29.0", + "object", "serde", "target-lexicon", "thiserror", @@ -3403,52 +3403,52 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffaed4f9a234ba5225d8e64eac7b4a5d13b994aeb37353cde2cbeb3febda9eaa" +checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" dependencies = [ - "addr2line 0.17.0", + "addr2line", "anyhow", "bincode", "cfg-if", "cpp_demangle", - "gimli 0.26.2", + "gimli", "log", - "object 0.29.0", + "object", "rustc-demangle", "serde", "target-lexicon", "wasmtime-environ", "wasmtime-jit-icache-coherence", "wasmtime-runtime", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-jit-debug" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2" +checksum = "6e0554b84c15a27d76281d06838aed94e13a77d7bf604bbbaf548aa20eb93846" dependencies = [ "once_cell", ] [[package]] name = "wasmtime-jit-icache-coherence" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a28ae1e648461bfdbb79db3efdaee1bca5b940872e4175390f465593a2e54c" +checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd" dependencies = [ "cfg-if", "libc", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-runtime" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e704b126e4252788ccfc3526d4d4511d4b23c521bf123e447ac726c14545217b" +checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441" dependencies = [ "anyhow", "cc", @@ -3459,20 +3459,20 @@ dependencies = [ "mach", "memfd", "memoffset", - "paste 1.0.12", + "paste", "rand 0.8.5", "rustix 0.36.14", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-types" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e5572c5727c1ee7e8f28717aaa8400e4d22dcbd714ea5457d85b5005206568" +checksum = "a4f6fffd2a1011887d57f07654dd112791e872e3ff4a2e626aee8059ee17f06f" dependencies = [ "cranelift-entity", "serde", @@ -3521,21 +3521,6 @@ dependencies = [ "windows-targets 0.48.0", ] -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - [[package]] name = "windows-sys" version = "0.45.0" From 711e29088dc26eab736accd2ceb33ed845195870 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Tue, 24 Oct 2023 14:08:49 -0600 Subject: [PATCH 10/34] =?UTF-8?q?=F0=9F=9A=80=20chore(Cargo.toml):=20updat?= =?UTF-8?q?e=20dependencies=20versions=20to=20improve=20compatibility=20an?= =?UTF-8?q?d=20performance=20=F0=9F=90=9B=20fix(functions.rs):=20fix=20clo?= =?UTF-8?q?ning=20of=20class=5Fid=20variable=20to=20prevent=20ownership=20?= =?UTF-8?q?issues=20=E2=9C=A8=20feat(functions.rs):=20add=20support=20for?= =?UTF-8?q?=20creating=20frunique=20collections=20with=20configurable=20ow?= =?UTF-8?q?ner=20and=20admin=20roles=20=F0=9F=90=9B=20fix(functions.rs):?= =?UTF-8?q?=20fix=20cloning=20of=20collection=20variable=20to=20prevent=20?= =?UTF-8?q?ownership=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/fruniques/Cargo.toml | 18 ++++++------- pallets/fruniques/src/functions.rs | 41 ++++++++++++++++++------------ 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/pallets/fruniques/Cargo.toml b/pallets/fruniques/Cargo.toml index 5e7ff07d..e6809d56 100644 --- a/pallets/fruniques/Cargo.toml +++ b/pallets/fruniques/Cargo.toml @@ -13,22 +13,22 @@ repository = "https://github.com/hashed-io/hashed-pallets" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -log = "0.4" +log = { version = "0.4.17", default-features = false } codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } -scale-info = { default-features = false, version = "2.0.1", features = [ +scale-info = { default-features = false, version = "2.5.0", features = [ "derive" ] } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", optional = true } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -pallet-uniques = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", optional = true } +sp-runtime = { version = "24.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +pallet-uniques = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-io = { version = "23.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } [features] default = ["std"] diff --git a/pallets/fruniques/src/functions.rs b/pallets/fruniques/src/functions.rs index 59f2d2e8..4c6fde23 100644 --- a/pallets/fruniques/src/functions.rs +++ b/pallets/fruniques/src/functions.rs @@ -164,7 +164,7 @@ impl Pallet { ) -> DispatchResult { pallet_uniques::Pallet::::set_attribute( origin, - *class_id, + *class_id.clone(), Some(instance_id), key, value, @@ -182,15 +182,15 @@ impl Pallet { where ::ItemId: From, { - let nex_item: ItemId = >::try_get(collection).unwrap_or(0); - >::insert(collection, nex_item + 1); + let nex_item: ItemId = >::try_get(collection.clone()).unwrap_or(0); + >::insert(collection.clone(), nex_item + 1); let item = Self::u32_to_instance_id(nex_item); - pallet_uniques::Pallet::::do_mint(collection, item, owner, |_| Ok(()))?; + pallet_uniques::Pallet::::do_mint(collection.clone(), item, owner, |_| Ok(()))?; pallet_uniques::Pallet::::set_metadata( frame_system::RawOrigin::Root.into(), - collection, + collection.clone(), item.clone(), metadata, false, @@ -200,7 +200,7 @@ impl Pallet { for (key, value) in attributes { pallet_uniques::Pallet::::set_attribute( frame_system::RawOrigin::Root.into(), - collection, + collection.clone(), Some(item), key, value, @@ -272,15 +272,23 @@ impl Pallet { let scope_id = class_id.using_encoded(blake2_256); T::Rbac::create_scope(Self::pallet_id(), scope_id)?; - Self::insert_auth_in_frunique_collection(owner.clone(), class_id, FruniqueRole::Owner)?; + Self::insert_auth_in_frunique_collection( + owner.clone(), + class_id.clone(), + FruniqueRole::Owner, + )?; pallet_uniques::Pallet::::do_create_collection( - class_id, + class_id.clone(), owner.clone(), admin.clone(), T::CollectionDeposit::get(), false, - pallet_uniques::Event::Created { collection: class_id, creator: admin.clone(), owner }, + pallet_uniques::Event::Created { + collection: class_id.clone(), + creator: admin.clone(), + owner, + }, )?; pallet_uniques::Pallet::::set_collection_metadata( @@ -308,13 +316,13 @@ impl Pallet { { ensure!(Self::collection_exists(&collection), Error::::CollectionNotFound); - let nex_item: ItemId = >::try_get(collection).unwrap_or(0); + let nex_item: ItemId = >::try_get(collection.clone()).unwrap_or(0); let item = Self::u32_to_instance_id(nex_item); - Self::do_mint(collection, owner.clone(), metadata.clone(), attributes)?; + Self::do_mint(collection.clone(), owner.clone(), metadata.clone(), attributes)?; if let Some(ref parent_info) = parent_info { - return Self::do_nft_division(collection, item, metadata, parent_info, owner) + return Self::do_nft_division(collection.clone(), item, metadata, parent_info, owner) } let frunique_data = FruniqueData { @@ -329,7 +337,7 @@ impl Pallet { verified_by: None, }; - >::insert(collection, item, frunique_data); + >::insert(collection.clone(), item, frunique_data); >::insert(collection, item, true); Ok(()) @@ -382,7 +390,7 @@ impl Pallet { verified_by: None, }; - >::insert(collection, item, frunique_data); + >::insert(collection.clone(), item, frunique_data); let frunique_child: ChildInfo = ChildInfo { collection_id: collection, @@ -422,13 +430,14 @@ impl Pallet { ensure!(Self::collection_exists(&collection), Error::::CollectionNotFound); ensure!(Self::instance_exists(&collection, &item), Error::::FruniqueNotFound); - let frunique_data: FruniqueData = >::try_get(collection, item).unwrap(); + let frunique_data: FruniqueData = + >::try_get(collection.clone(), item).unwrap(); ensure!(!frunique_data.frozen, Error::::FruniqueFrozen); ensure!(!frunique_data.redeemed, Error::::FruniqueAlreadyRedeemed); >::try_mutate::<_, _, _, DispatchError, _>( - collection, + collection.clone(), item, |frunique_data| -> DispatchResult { let frunique = frunique_data.as_mut().ok_or(Error::::FruniqueNotFound)?; From 8dc111c5d004fbcc0fb119c99c328d6d9b2131ca Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Tue, 24 Oct 2023 14:13:25 -0600 Subject: [PATCH 11/34] =?UTF-8?q?=F0=9F=9A=80=20chore(Cargo.toml):=20updat?= =?UTF-8?q?e=20dependencies=20versions=20for=20lite-json,=20frame-support,?= =?UTF-8?q?=20frame-system,=20sp-core,=20sp-io,=20sp-runtime,=20sp-std=20t?= =?UTF-8?q?o=20improve=20compatibility=20and=20stability=20=F0=9F=94=A7=20?= =?UTF-8?q?fix(functions.rs):=20import=20BlockNumberFor=20from=20frame=5Fs?= =?UTF-8?q?ystem::pallet=5Fprelude=20to=20fix=20compilation=20error=20?= =?UTF-8?q?=F0=9F=94=A7=20fix(lib.rs):=20update=20weight=20for=20ocw=5Fins?= =?UTF-8?q?ert=5Fdescriptors,=20ocw=5Finsert=5Fpsbts,=20ocw=5Ffinalize=5Fp?= =?UTF-8?q?sbts=20to=20improve=20performance=20and=20resource=20usage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/bitcoin-vaults/Cargo.toml | 14 +++++++------- pallets/bitcoin-vaults/src/functions.rs | 7 +++++-- pallets/bitcoin-vaults/src/lib.rs | 6 +++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pallets/bitcoin-vaults/Cargo.toml b/pallets/bitcoin-vaults/Cargo.toml index 4745a2a4..08811172 100644 --- a/pallets/bitcoin-vaults/Cargo.toml +++ b/pallets/bitcoin-vaults/Cargo.toml @@ -16,17 +16,17 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4" codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } serde = { version = "1.0.140", default-features = false, features = ["derive"] } -lite-json = { version = "0.1", default-features = false } +lite-json = { version = "0.2", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ "derive" ] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-core = { version = "21.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-io = { version = "23.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-std = { version = "8.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true } [dev-dependencies] diff --git a/pallets/bitcoin-vaults/src/functions.rs b/pallets/bitcoin-vaults/src/functions.rs index a963f995..52376e17 100644 --- a/pallets/bitcoin-vaults/src/functions.rs +++ b/pallets/bitcoin-vaults/src/functions.rs @@ -1,7 +1,10 @@ use super::*; use crate::types::*; use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256}; -use frame_system::offchain::{SendUnsignedTransaction, Signer}; +use frame_system::{ + offchain::{SendUnsignedTransaction, Signer}, + pallet_prelude::BlockNumberFor, +}; use lite_json::{ json::{JsonValue, NumberValue}, parse_json, Serialize as jsonSerialize, @@ -824,7 +827,7 @@ impl Pallet { /* --- Block Number provider section. Needed to implement locks on offchain storage */ impl BlockNumberProvider for Pallet { - type BlockNumber = T::BlockNumber; + type BlockNumber = BlockNumberFor; fn current_block_number() -> Self::BlockNumber { >::block_number() diff --git a/pallets/bitcoin-vaults/src/lib.rs b/pallets/bitcoin-vaults/src/lib.rs index 632f22c0..eedf113f 100644 --- a/pallets/bitcoin-vaults/src/lib.rs +++ b/pallets/bitcoin-vaults/src/lib.rs @@ -714,7 +714,7 @@ pub mod pallet { /// /// Meant to be unsigned with signed payload and used by an offchain worker #[pallet::call_index(15)] - #[pallet::weight(0)] + #[pallet::weight(Weight::from_parts(10_000,0) + T::DbWeight::get().reads_writes(1,1))] pub fn ocw_insert_descriptors( origin: OriginFor, payload: VaultsPayload, @@ -756,7 +756,7 @@ pub mod pallet { /// /// Meant to be unsigned with signed payload and used by an offchain worker #[pallet::call_index(16)] - #[pallet::weight(0)] + #[pallet::weight(Weight::from_parts(10_000,0) + T::DbWeight::get().reads_writes(1,1))] pub fn ocw_insert_psbts( origin: OriginFor, payload: ProposalsPayload, @@ -787,7 +787,7 @@ pub mod pallet { /// /// Meant to be unsigned with signed payload and used by an offchain worker #[pallet::call_index(17)] - #[pallet::weight(0)] + #[pallet::weight(Weight::from_parts(10_000,0) + T::DbWeight::get().reads_writes(1,1))] pub fn ocw_finalize_psbts( origin: OriginFor, payload: ProposalsPayload, // here the payload From 64f1f0d108ce6b34683fdde7fc76b58940281f52 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Tue, 24 Oct 2023 14:14:07 -0600 Subject: [PATCH 12/34] =?UTF-8?q?=F0=9F=94=8D=20chore(.gitignore):=20add?= =?UTF-8?q?=20log=20files=20to=20be=20ignored=20by=20git=20=F0=9F=94=8D=20?= =?UTF-8?q?chore(.gitignore):=20add=20/pallets/fund-admin/scripts=20direct?= =?UTF-8?q?ory=20to=20be=20ignored=20by=20git?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 74e11259..6ea5fa0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Generated by Cargo # will have compiled files and executables +*log **/target/ # These are backup files generated by rustfmt **/*.rs.bk @@ -39,4 +40,4 @@ md5-wasm md5-genesis-head # Fund-admin scripts -/pallets/fund-admin/scripts \ No newline at end of file +/pallets/fund-admin/scripts From 0187673ef004b604f28fd792a91900e0cbcea290 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Tue, 24 Oct 2023 14:21:33 -0600 Subject: [PATCH 13/34] =?UTF-8?q?=F0=9F=94=A7=20chore(lib.rs):=20add=20#[d?= =?UTF-8?q?erive(Default)]=20to=20the=20GenesisConfig=20struct=20in=20orde?= =?UTF-8?q?r=20to=20enable=20default=20values=20for=20its=20fields?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/bitcoin-vaults/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pallets/bitcoin-vaults/src/lib.rs b/pallets/bitcoin-vaults/src/lib.rs index eedf113f..5dfb6668 100644 --- a/pallets/bitcoin-vaults/src/lib.rs +++ b/pallets/bitcoin-vaults/src/lib.rs @@ -39,6 +39,7 @@ pub mod pallet { /* --- Genesis Structs Section --- */ #[pallet::genesis_config] + #[derive(Default)] pub struct GenesisConfig { pub bdk_services_url: Vec, } From b05e7bfb56dc382bbb2ca522595a806d2986d400 Mon Sep 17 00:00:00 2001 From: sebastianmontero Date: Fri, 27 Oct 2023 14:58:34 -0600 Subject: [PATCH 14/34] Fix build issues polkadotv1 (#22) * Mapped assets pallet DebitFlags struct is private to the crate, so the debitFlags parameter from the afloat_do_burn method was removed and the debitFlags created internally, finally updated the afloat pallet accordingly. AssetId type is no longer Copy, so called the clone method where necessary. CollectionId type is no longer Copy, so called the clone method where necessary. JSON NumberValue struct has a new negative field, so this field was added as necesary. GenesisBuild has been deprecated, so the BitcoinVaults and MappedAssets pallets to use the new BuildGenesisConfig trait. Updated the block_number parameter type to be BlockNumberFor. Added does_asset_exist method to the MappedAssets pallet. Updated the way of checking overflow in the MappedAssets pallet to use checked_add. Added back the Rbac type to the MappedAssets pallet. * The where clause of the enum when contructing a mock runtime has been deprecated, so this clause was removed for all pallet mocks.Nonce and Block types have been added to the system::Config, and the Index, BlockNumber and Header types have been removed, so all pallet implementations for the Test runtime have been updated accordingly. FreezeIdentifier, MaxFreezes, RuntimeHoldReason and MaxHolds types have been added for the balances pallet, so the test runtimes for pallets that use the balances pallet have been added accordingly. The GenesisConfig is now generic over the runtime, so the test build_storage for all pallets have been updated accordingly, also this is now behind the BuildStorage trait so it has been imported where required. The UnknownAsset error of the mapped assets pallet has been updated to be Unknown, so updated some of the tests accordingly. The tokens BalanceConversion trait has been replaced by ConversionToAssetBalance, so updated the mapped assets test pallet accordingly. --- pallets/afloat/src/functions.rs | 13 ++- pallets/afloat/src/mock.rs | 35 ++++---- pallets/bitcoin-vaults/src/functions.rs | 5 +- pallets/bitcoin-vaults/src/lib.rs | 16 ++-- pallets/bitcoin-vaults/src/mock.rs | 30 +++---- pallets/confidential-docs/src/mock.rs | 22 ++--- pallets/fruniques/src/functions.rs | 14 ++-- pallets/fruniques/src/mock.rs | 32 +++----- pallets/fruniques/src/tests.rs | 7 +- pallets/fund-admin-records/src/mock.rs | 17 ++-- pallets/fund-admin/src/mock.rs | 32 +++----- pallets/gated-marketplace/src/functions.rs | 93 +++++++++++++--------- pallets/gated-marketplace/src/mock.rs | 57 +++++-------- pallets/mapped-assets/src/functions.rs | 41 +++++----- pallets/mapped-assets/src/lib.rs | 6 +- pallets/mapped-assets/src/mock.rs | 1 + pallets/mapped-assets/src/tests.rs | 8 +- pallets/rbac/src/mock.rs | 17 ++-- 18 files changed, 206 insertions(+), 240 deletions(-) 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() } From ddc4779cd73540eb013cffc34cc897f9312ccc03 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Mon, 30 Oct 2023 11:25:41 -0600 Subject: [PATCH 15/34] update deps --- Cargo.lock | 638 +++++++++++++++++++++++++++++------------------------ 1 file changed, 352 insertions(+), 286 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6342310d..014f3618 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,7 +18,16 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli", + "gimli 0.27.3", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli 0.28.0", ] [[package]] @@ -29,32 +38,33 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", + "zerocopy", ] [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -85,9 +95,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "approx" @@ -118,15 +128,15 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", @@ -141,16 +151,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line", + "addr2line 0.21.0", "cc", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.32.1", "rustc-demangle", ] @@ -187,6 +197,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + [[package]] name = "bitvec" version = "1.0.1" @@ -210,12 +226,12 @@ dependencies = [ [[package]] name = "blake2b_simd" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" +checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec 0.7.4", "constant_time_eq", ] @@ -278,9 +294,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byte-slice-cast" @@ -296,27 +312,30 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-expr" @@ -335,21 +354,21 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "winapi", + "windows-targets 0.48.5", ] [[package]] name = "const-oid" -version = "0.9.2" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "const-random" @@ -366,16 +385,16 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "tiny-keccak", ] [[package]] name = "constant_time_eq" -version = "0.2.5" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" [[package]] name = "core-foundation-sys" @@ -394,9 +413,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -578,9 +597,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" [[package]] name = "ecdsa" @@ -633,9 +652,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" @@ -663,24 +682,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" [[package]] -name = "errno" -version = "0.3.1" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "errno" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "cc", "libc", + "windows-sys 0.48.0", ] [[package]] @@ -732,9 +746,9 @@ dependencies = [ [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -781,7 +795,7 @@ name = "frame-support" version = "4.0.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "environmental", "frame-metadata", "frame-support-procedural", @@ -883,9 +897,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -898,9 +912,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -908,15 +922,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -926,15 +940,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", @@ -943,21 +957,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -1004,9 +1018,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -1015,15 +1029,21 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" dependencies = [ "fallible-iterator", - "indexmap", + "indexmap 1.9.3", "stable_deref_trait", ] +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + [[package]] name = "group" version = "0.13.0" @@ -1056,7 +1076,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.6", + "ahash 0.7.7", ] [[package]] @@ -1065,23 +1085,20 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.6", ] [[package]] -name = "hermit-abi" -version = "0.2.6" +name = "hashbrown" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "hermit-abi" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -1131,16 +1148,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] @@ -1154,9 +1171,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1202,6 +1219,16 @@ dependencies = [ "serde", ] +[[package]] +name = "indexmap" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +dependencies = [ + "equivalent", + "hashbrown 0.14.2", +] + [[package]] name = "integer-sqrt" version = "0.1.5" @@ -1217,7 +1244,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi", "libc", "windows-sys 0.48.0", ] @@ -1233,15 +1260,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1256,7 +1283,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2 0.10.6", + "sha2 0.10.8", ] [[package]] @@ -1276,9 +1303,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libsecp256k1" @@ -1330,9 +1357,9 @@ dependencies = [ [[package]] name = "linregress" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "475015a7f8f017edb28d2e69813be23500ad4b32cfe3421c4148efc97324ee52" +checksum = "4de04dcecc58d366391f9920245b85ffa684558a5ef6e7736e754347c3aea9c2" dependencies = [ "nalgebra", ] @@ -1345,9 +1372,9 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lite-json" @@ -1369,9 +1396,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -1379,9 +1406,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.18" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "mach" @@ -1446,14 +1473,14 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] name = "matrixmultiply" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090126dc04f95dc0d1c1c91f61bdd474b3930ca064c1edc8a849da2c6cbe1e77" +checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" dependencies = [ "autocfg", "rawpointer", @@ -1461,17 +1488,17 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memfd" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.37.19", + "rustix 0.38.21", ] [[package]] @@ -1506,18 +1533,18 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] [[package]] name = "nalgebra" -version = "0.32.2" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68d47bba83f9e2006d117a9a33af1524e655516b8919caac694427a6fb1e511" +checksum = "307ed9b18cc2423f29e83f84fd23a8e73628727990181f18641a8b5dc2ab1caa" dependencies = [ "approx", "matrixmultiply", @@ -1531,9 +1558,9 @@ dependencies = [ [[package]] name = "nalgebra-macros" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d232c68884c0c99810a5a4d333ef7e47689cfd0edc85efc9e54e1e6bf5212766" +checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998" dependencies = [ "proc-macro2", "quote", @@ -1548,9 +1575,9 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "num-complex" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" dependencies = [ "num-traits", ] @@ -1561,7 +1588,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "itoa", ] @@ -1588,40 +1615,49 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi", "libc", ] [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "crc32fast", "hashbrown 0.13.2", - "indexmap", + "indexmap 1.9.3", + "memchr", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.17.2" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -1854,7 +1890,7 @@ version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "bitvec", "byte-slice-cast", "bytes", @@ -1893,22 +1929,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.48.5", ] [[package]] name = "paste" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pbkdf2" @@ -1930,15 +1966,15 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -1964,9 +2000,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "primitive-types" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", @@ -2088,7 +2124,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -2108,27 +2144,27 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] name = "ref-cast" -version = "1.0.16" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43faa91b1c8b36841ee70e97188a869d37ae21759da6846d4be66de5bf7b12c" +checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.16" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" +checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", @@ -2137,13 +2173,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.3" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.2", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -2155,6 +2192,17 @@ dependencies = [ "regex-syntax 0.6.29", ] +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", +] + [[package]] name = "regex-syntax" version = "0.6.29" @@ -2163,9 +2211,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rfc6979" @@ -2197,11 +2245,11 @@ checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] name = "rustix" -version = "0.36.14" +version = "0.36.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e4d67015953998ad0eb82887a0eb0129e18a7e2f3b7b0f6c422fddcd503d62" +checksum = "305efbd14fde4139eb501df5f136994bb520b033fa9fbdce287507dc23b8c7ed" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -2211,15 +2259,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ - "bitflags", + "bitflags 2.4.1", "errno", - "io-lifetimes", "libc", - "linux-raw-sys 0.3.8", + "linux-raw-sys 0.4.10", "windows-sys 0.48.0", ] @@ -2231,24 +2278,24 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "safe_arch" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794821e4ccb0d9f979512f9c1973480123f9bd62a90d74ab0f9426fcf8f4a529" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" dependencies = [ "bytemuck", ] [[package]] name = "scale-info" -version = "2.7.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b569c32c806ec3abdf3b5869fb8bf1e0d275a7c1c9b0b05603d9464632649edf" +checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" dependencies = [ "bitvec", "cfg-if", @@ -2260,9 +2307,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.6.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53012eae69e5aa5c14671942a5dd47de59d4cdcff8532a6dd0e081faf1119482" +checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2276,7 +2323,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.6", "cfg-if", "hashbrown 0.13.2", ] @@ -2301,9 +2348,9 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sec1" @@ -2348,18 +2395,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", @@ -2368,9 +2415,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -2404,9 +2451,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -2425,9 +2472,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] @@ -2463,18 +2510,18 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "sp-api" @@ -2544,7 +2591,7 @@ version = "21.0.0" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ "array-bytes", - "bitflags", + "bitflags 1.3.2", "blake2", "bounded-collections", "bs58", @@ -2591,7 +2638,7 @@ dependencies = [ "blake2b_simd", "byteorder", "digest 0.10.7", - "sha2 0.10.6", + "sha2 0.10.8", "sha3", "twox-hash", ] @@ -2834,7 +2881,7 @@ name = "sp-trie" version = "22.0.0" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.6", "hash-db", "hashbrown 0.13.2", "lazy_static", @@ -2920,9 +2967,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.40.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47a8ad42e5fc72d5b1eb104a5546937eaf39843499948bb666d6e93c62423b" +checksum = "5e6915280e2d0db8911e5032a5c275571af6bdded2916abd691a659be25d3439" dependencies = [ "Inflector", "num-format", @@ -2994,24 +3041,24 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.7" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" +checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", @@ -3040,7 +3087,7 @@ dependencies = [ "pbkdf2 0.11.0", "rand 0.8.5", "rustc-hash", - "sha2 0.10.6", + "sha2 0.10.8", "thiserror", "unicode-normalization", "wasm-bindgen", @@ -3073,28 +3120,27 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "toml_datetime" -version = "0.6.2" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" [[package]] name = "toml_edit" -version = "0.19.10" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap", + "indexmap 2.0.2", "toml_datetime", "winnow", ] [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3102,9 +3148,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", @@ -3113,9 +3159,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -3123,12 +3169,12 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] @@ -3206,9 +3252,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "uint" @@ -3230,9 +3276,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -3251,9 +3297,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "url" -version = "2.3.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -3286,9 +3332,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3296,9 +3342,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", @@ -3311,9 +3357,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3321,9 +3367,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", @@ -3334,9 +3380,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasmparser" @@ -3344,7 +3390,7 @@ version = "0.102.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" dependencies = [ - "indexmap", + "indexmap 1.9.3", "url", ] @@ -3357,10 +3403,10 @@ dependencies = [ "anyhow", "bincode", "cfg-if", - "indexmap", + "indexmap 1.9.3", "libc", "log", - "object", + "object 0.30.4", "once_cell", "paste", "psm", @@ -3390,10 +3436,10 @@ checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" dependencies = [ "anyhow", "cranelift-entity", - "gimli", - "indexmap", + "gimli 0.27.3", + "indexmap 1.9.3", "log", - "object", + "object 0.30.4", "serde", "target-lexicon", "thiserror", @@ -3407,14 +3453,14 @@ version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" dependencies = [ - "addr2line", + "addr2line 0.19.0", "anyhow", "bincode", "cfg-if", "cpp_demangle", - "gimli", + "gimli 0.27.3", "log", - "object", + "object 0.30.4", "rustc-demangle", "serde", "target-lexicon", @@ -3453,7 +3499,7 @@ dependencies = [ "anyhow", "cc", "cfg-if", - "indexmap", + "indexmap 1.9.3", "libc", "log", "mach", @@ -3461,7 +3507,7 @@ dependencies = [ "memoffset", "paste", "rand 0.8.5", - "rustix 0.36.14", + "rustix 0.36.17", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", @@ -3482,9 +3528,9 @@ dependencies = [ [[package]] name = "wide" -version = "0.7.9" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cd0496a71f3cc6bc4bf0ed91346426a5099e93d89807e663162dc5a1069ff65" +checksum = "c68938b57b33da363195412cfc5fc37c9ed49aa9cfe2156fde64b8d2c9498242" dependencies = [ "bytemuck", "safe_arch", @@ -3513,12 +3559,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -3536,7 +3582,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -3556,17 +3602,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -3577,9 +3623,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -3589,9 +3635,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -3601,9 +3647,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -3613,9 +3659,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -3625,9 +3671,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -3637,9 +3683,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -3649,15 +3695,15 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.4.6" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" dependencies = [ "memchr", ] @@ -3671,6 +3717,26 @@ dependencies = [ "tap", ] +[[package]] +name = "zerocopy" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd66a62464e3ffd4e37bd09950c2b9dd6c4f8767380fabba0d523f9a775bc85a" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "255c4596d41e6916ced49cfafea18727b24d67878fa180ddfd69b9df34fd1726" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "zeroize" version = "1.6.0" From d61dc78af6cfc60b3f8af260b90f1c8ce0ef7df1 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Mon, 30 Oct 2023 12:48:15 -0600 Subject: [PATCH 16/34] =?UTF-8?q?=F0=9F=90=9B=20fix(mock.rs):=20change=20B?= =?UTF-8?q?alance=20type=20from=20u128=20to=20u64=20to=20reduce=20memory?= =?UTF-8?q?=20usage=20=F0=9F=90=9B=20fix(mock.rs):=20change=20ExistentialD?= =?UTF-8?q?eposit=20type=20from=20ConstU128<100>=20to=20ConstU64<1>=20to?= =?UTF-8?q?=20set=20a=20lower=20minimum=20balance=20requirement=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(mock.rs):=20remove=20MaxReserves=20configura?= =?UTF-8?q?tion=20to=20use=20default=20value=20=F0=9F=90=9B=20fix(mock.rs)?= =?UTF-8?q?:=20remove=20MaxFreezes=20configuration=20to=20use=20default=20?= =?UTF-8?q?value=20=E2=9C=A8=20feat(mock.rs):=20add=20Result=20return=20ty?= =?UTF-8?q?pe=20to=20created=20and=20destroyed=20functions=20in=20AssetsCa?= =?UTF-8?q?llback=20trait=20implementation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/afloat/src/mock.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pallets/afloat/src/mock.rs b/pallets/afloat/src/mock.rs index 5134600a..be49cce7 100644 --- a/pallets/afloat/src/mock.rs +++ b/pallets/afloat/src/mock.rs @@ -154,19 +154,19 @@ impl pallet_uniques::Config for Test { } impl pallet_balances::Config for Test { - type Balance = u128; + type Balance = u64; type DustRemoval = (); type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ConstU128<100>; + type ExistentialDeposit = ConstU64<1>; type AccountStore = System; type WeightInfo = (); type MaxLocks = (); - type MaxReserves = ConstU32<50>; + type MaxReserves = (); type ReserveIdentifier = [u8; 8]; - type FreezeIdentifier = (); - type MaxFreezes = (); type RuntimeHoldReason = (); + type FreezeIdentifier = (); type MaxHolds = (); + type MaxFreezes = (); } parameter_types! { @@ -207,9 +207,9 @@ pub trait AssetsCallback { pub struct AssetsCallbackHandle; impl pallet_mapped_assets::AssetsCallback for AssetsCallbackHandle { - fn created(_id: &AssetId, _owner: &u64) {} + fn created(_id: &AssetId, _owner: &u64) -> Result<(), ()> {} - fn destroyed(_id: &AssetId) {} + fn destroyed(_id: &AssetId) -> Result<(), ()> {} } impl pallet_mapped_assets::Config for Test { @@ -242,13 +242,13 @@ pub fn new_test_ext() -> sp_io::TestExternalities { t.execute_with(|| { Balances::make_free_balance_be(&1, 100); Balances::make_free_balance_be(&2, 100); - Afloat::initial_setup( - RawOrigin::Root.into(), - 1, - 2, - CreateAsset::New { asset_id: 0, min_balance: 1 }, - ) - .expect("Error on GatedMarketplace configuring initial setup"); + let args = InitialSetupArgs::All { + creator: 1, + admin: 2, + asset: CreateAsset::New { asset_id: 0, min_balance: 1 }, + }; + Afloat::initial_setup(RawOrigin::Root.into(), args) + .expect("Error on GatedMarketplace configuring initial setup"); }); t } From 1970cf82c5033ec572728514dd8714391f064fda Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Mon, 30 Oct 2023 12:48:39 -0600 Subject: [PATCH 17/34] =?UTF-8?q?=F0=9F=94=A7=20fix(tests.rs):=20update=20?= =?UTF-8?q?struct=20field=20names=20in=20sign=5Fup=5Fworks,=20update=5Fuse?= =?UTF-8?q?r=5Finfo=5Fedit=5Fworks,=20update=5Fother=5Fuser=5Finfo=5Fby=5F?= =?UTF-8?q?not=5Fadmin=5Ffails,=20update=5Fother=5Fuser=5Finfo=5Fby=5Fadmi?= =?UTF-8?q?n=5Fworks,=20update=5Fuser=5Finfo=5Fdelete=5Fworks,=20set=5Fafl?= =?UTF-8?q?oat=5Fbalance=5Fworks,=20set=5Fbalance=5Fby=5Fother=5Fthan=5Fow?= =?UTF-8?q?ner=5Ffails=20to=20match=20changes=20in=20the=20struct=20defini?= =?UTF-8?q?tion=20=E2=9C=A8=20feat(tests.rs):=20add=20support=20for=20new?= =?UTF-8?q?=20struct=20field=20names=20in=20sign=5Fup=5Fworks,=20update=5F?= =?UTF-8?q?user=5Finfo=5Fedit=5Fworks,=20update=5Fother=5Fuser=5Finfo=5Fby?= =?UTF-8?q?=5Fnot=5Fadmin=5Ffails,=20update=5Fother=5Fuser=5Finfo=5Fby=5Fa?= =?UTF-8?q?dmin=5Fworks,=20update=5Fuser=5Finfo=5Fdelete=5Fworks,=20set=5F?= =?UTF-8?q?afloat=5Fbalance=5Fworks,=20set=5Fbalance=5Fby=5Fother=5Fthan?= =?UTF-8?q?=5Fowner=5Ffails=20to=20improve=20code=20readability=20and=20ma?= =?UTF-8?q?intainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔨 refactor(tests.rs): update test functions to use new struct field names for SignUpArgs --- pallets/afloat/src/tests.rs | 138 ++++++++++++++---------------------- 1 file changed, 53 insertions(+), 85 deletions(-) diff --git a/pallets/afloat/src/tests.rs b/pallets/afloat/src/tests.rs index 22adc7bc..cc3cb0a4 100644 --- a/pallets/afloat/src/tests.rs +++ b/pallets/afloat/src/tests.rs @@ -22,10 +22,9 @@ fn sign_up_works() { let user = new_account(3); Balances::make_free_balance_be(&user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 1, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args)); @@ -41,23 +40,16 @@ fn update_user_info_edit_works() { Balances::make_free_balance_be(&user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 1, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args)); let update_args = UpdateUserArgs::Edit { - first_name: Some(ShortString::try_from(b"New".to_vec()).unwrap()), - last_name: Some(ShortString::try_from(b"User".to_vec()).unwrap()), - email: Some(LongString::try_from(b"Info".to_vec()).unwrap()), - lang_key: None, - phone: None, - credits_needed: None, - cpa_id: None, - state: None, + cid: ShortString::try_from(b"New".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"User".to_vec()).unwrap(), }; assert_ok!(Afloat::update_user_info( @@ -67,9 +59,8 @@ fn update_user_info_edit_works() { )); let updated_user = UserInfo::::get(user).unwrap(); - assert_eq!(updated_user.first_name, ShortString::try_from(b"New".to_vec()).unwrap()); - assert_eq!(updated_user.last_name, ShortString::try_from(b"User".to_vec()).unwrap()); - assert_eq!(updated_user.email, LongString::try_from(b"Info".to_vec()).unwrap()); + assert_eq!(updated_user.cid, ShortString::try_from(b"New".to_vec()).unwrap()); + assert_eq!(updated_user.cid_creator, ShortString::try_from(b"User".to_vec()).unwrap()); }); } @@ -83,23 +74,16 @@ fn update_other_user_info_by_not_admin_fails() { Balances::make_free_balance_be(&other_user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 1, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args)); let update_args = UpdateUserArgs::Edit { - first_name: Some(ShortString::try_from(b"New".to_vec()).unwrap()), - last_name: Some(ShortString::try_from(b"User".to_vec()).unwrap()), - email: Some(LongString::try_from(b"Info".to_vec()).unwrap()), - lang_key: None, - phone: None, - credits_needed: None, - cpa_id: None, - state: None, + cid: ShortString::try_from(b"New".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"User".to_vec()).unwrap(), }; assert_noop!( @@ -127,23 +111,16 @@ fn update_other_user_info_by_admin_works() { Balances::make_free_balance_be(&other_user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 1, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args)); let update_args = UpdateUserArgs::Edit { - first_name: Some(ShortString::try_from(b"New".to_vec()).unwrap()), - last_name: Some(ShortString::try_from(b"User".to_vec()).unwrap()), - email: Some(LongString::try_from(b"Info".to_vec()).unwrap()), - lang_key: None, - phone: None, - credits_needed: None, - cpa_id: None, - state: None, + cid: ShortString::try_from(b"New".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"User".to_vec()).unwrap(), }; assert_ok!(Afloat::update_user_info( @@ -153,9 +130,8 @@ fn update_other_user_info_by_admin_works() { )); let updated_user = UserInfo::::get(user).unwrap(); - assert_eq!(updated_user.first_name, ShortString::try_from(b"New".to_vec()).unwrap()); - assert_eq!(updated_user.last_name, ShortString::try_from(b"User".to_vec()).unwrap()); - assert_eq!(updated_user.email, LongString::try_from(b"Info".to_vec()).unwrap()); + assert_eq!(updated_user.cid, ShortString::try_from(b"New".to_vec()).unwrap()); + assert_eq!(updated_user.cid_creator, ShortString::try_from(b"User".to_vec()).unwrap()); }); } @@ -166,10 +142,9 @@ fn update_user_info_delete_works() { Balances::make_free_balance_be(&user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 1, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args)); @@ -197,10 +172,9 @@ fn kill_storage_works() { Balances::make_free_balance_be(&user2, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 1, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; // Add users @@ -211,8 +185,9 @@ fn kill_storage_works() { assert!(UserInfo::::contains_key(user1)); assert!(UserInfo::::contains_key(user2)); + let killStorageArgs = KillStorageArgs::All; // Kill storage with admin - assert_ok!(Afloat::kill_storage(RawOrigin::Signed(admin.clone()).into())); + assert_ok!(Afloat::kill_storage(RawOrigin::Signed(admin.clone()).into(), killStorageArgs)); // Ensure users no longer exist assert!(!UserInfo::::contains_key(user1)); @@ -232,10 +207,11 @@ fn kill_storage_works() { fn kill_storage_fails_for_non_admin() { new_test_ext().execute_with(|| { let user = new_account(3); + let killStorageArgs = KillStorageArgs::All; // Attempt to kill storage with non-admin user assert_noop!( - Afloat::kill_storage(RawOrigin::Signed(user.clone()).into()), + Afloat::kill_storage(RawOrigin::Signed(user.clone()).into(), killStorageArgs), Error::::Unauthorized ); }); @@ -251,10 +227,9 @@ fn set_afloat_balance_works() { Balances::make_free_balance_be(&other_user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 1, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args.clone())); @@ -276,10 +251,9 @@ fn set_balance_by_other_than_owner_fails() { Balances::make_free_balance_be(&other_user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 1, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args.clone())); @@ -305,10 +279,9 @@ fn create_tax_credit_works() { Balances::make_free_balance_be(&other_user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 1, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args.clone())); @@ -334,12 +307,10 @@ fn create_sell_order_works() { Balances::make_free_balance_be(&other_user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 0, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; - assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args.clone())); assert_ok!(Afloat::sign_up(RawOrigin::Signed(other_user.clone()).into(), args.clone())); @@ -370,10 +341,9 @@ fn take_sell_order_works() { Balances::make_free_balance_be(&other_user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 0, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args.clone())); @@ -417,10 +387,9 @@ fn create_buy_order_works() { Balances::make_free_balance_be(&other_user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 0, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args.clone())); @@ -455,10 +424,9 @@ fn take_buy_order_works() { Balances::make_free_balance_be(&other_user, 100); let args = SignUpArgs::BuyerOrSeller { - first_name: ShortString::try_from(b"Afloat".to_vec()).unwrap(), - last_name: ShortString::try_from(b"User".to_vec()).unwrap(), - email: LongString::try_from(b"Afloatuser@gmail.com".to_vec()).unwrap(), - state: 0, + cid: ShortString::try_from(b"cid".to_vec()).unwrap(), + cid_creator: ShortString::try_from(b"cid_creator".to_vec()).unwrap(), + group: ShortString::try_from(b"Group".to_vec()).unwrap(), }; assert_ok!(Afloat::sign_up(RawOrigin::Signed(user.clone()).into(), args.clone())); From 13d45c20f57b091c5cb92a0826d47fb1e34f02c3 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Mon, 30 Oct 2023 12:49:07 -0600 Subject: [PATCH 18/34] update tests --- pallets/mapped-assets/src/tests.rs | 812 +++++++++++++++++++---------- 1 file changed, 540 insertions(+), 272 deletions(-) diff --git a/pallets/mapped-assets/src/tests.rs b/pallets/mapped-assets/src/tests.rs index 7567de5c..06d4ec12 100644 --- a/pallets/mapped-assets/src/tests.rs +++ b/pallets/mapped-assets/src/tests.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2019-2022 Parity Technologies (UK) Ltd. +// Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,8 @@ use super::*; use crate::{mock::*, Error}; use frame_support::{ assert_noop, assert_ok, - traits::{fungibles::InspectEnumerable, Currency}, + dispatch::GetDispatchInfo, + traits::{fungibles::InspectEnumerable, tokens::Preservation::Protect, Currency}, }; use pallet_balances::Error as BalancesError; use sp_io::storage; @@ -33,15 +34,67 @@ fn asset_ids() -> Vec { s } +/// returns tuple of asset's account and sufficient counts +fn asset_account_counts(asset_id: u32) -> (u32, u32) { + let asset = Asset::::get(asset_id).unwrap(); + (asset.accounts, asset.sufficients) +} + +#[test] +fn transfer_should_never_burn() { + new_test_ext().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, false, 1)); + Balances::make_free_balance_be(&1, 100); + Balances::make_free_balance_be(&2, 100); + + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + assert_eq!(Assets::balance(0, 1), 100); + + while System::inc_consumers(&2).is_ok() {} + let _ = System::dec_consumers(&2); + let _ = System::dec_consumers(&2); + // Exactly one consumer ref remaining. + assert_eq!(System::consumers(&2), 1); + + let _ = >::transfer(0, &1, &2, 50, Protect); + System::assert_has_event(RuntimeEvent::Assets(crate::Event::Transferred { + asset_id: 0, + from: 1, + to: 2, + amount: 50, + })); + assert_eq!(Assets::balance(0, 1), 50); + assert_eq!(Assets::balance(0, 1) + Assets::balance(0, 2), 100); + }); +} + #[test] fn basic_minting_should_work() { new_test_ext().execute_with(|| { assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 1, 1, true, 1)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + System::assert_last_event(RuntimeEvent::Assets(crate::Event::Issued { + asset_id: 0, + owner: 1, + amount: 100, + })); assert_eq!(Assets::balance(0, 1), 100); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); + System::assert_last_event(RuntimeEvent::Assets(crate::Event::Issued { + asset_id: 0, + owner: 2, + amount: 100, + })); assert_eq!(Assets::balance(0, 2), 100); - assert_eq!(asset_ids(), vec![0, 999]); + assert_eq!(asset_ids(), vec![0, 1, 999]); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 1, 1, 100)); + System::assert_last_event(RuntimeEvent::Assets(crate::Event::Issued { + asset_id: 1, + owner: 1, + amount: 100, + })); + assert_eq!(Assets::account_balances(1), vec![(0, 100), (999, 100), (1, 100)]); }); } @@ -90,7 +143,7 @@ fn minting_insufficient_assets_with_deposit_without_consumer_should_work() { assert_ok!(Assets::touch(RuntimeOrigin::signed(1), 0)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); assert_eq!(Balances::reserved_balance(&1), 10); - assert_eq!(System::consumers(&1), 0); + assert_eq!(System::consumers(&1), 1); }); } @@ -131,9 +184,11 @@ fn refunding_asset_deposit_without_burn_should_work() { assert_eq!(Assets::balance(0, 2), 100); assert_eq!(Assets::balance(0, 1), 0); assert_eq!(Balances::reserved_balance(&1), 10); + assert_eq!(asset_account_counts(0), (2, 0)); assert_ok!(Assets::refund(RuntimeOrigin::signed(1), 0, false)); assert_eq!(Balances::reserved_balance(&1), 0); assert_eq!(Assets::balance(1, 0), 0); + assert_eq!(asset_account_counts(0), (1, 0)); }); } @@ -153,6 +208,99 @@ fn refunding_calls_died_hook() { }); } +#[test] +fn refunding_with_sufficient_existence_reason_should_fail() { + new_test_ext().execute_with(|| { + // create sufficient asset + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + // create an asset account with sufficient existence reason + // by transferring some sufficient assets + assert_ok!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 50)); + assert_eq!(Assets::balance(0, 1), 50); + assert_eq!(Assets::balance(0, 2), 50); + assert_eq!(asset_account_counts(0), (2, 2)); + // fails to refund + assert_noop!(Assets::refund(RuntimeOrigin::signed(2), 0, true), Error::::NoDeposit); + }); +} + +#[test] +fn refunding_with_deposit_from_should_fail() { + new_test_ext().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, false, 1)); + Balances::make_free_balance_be(&1, 100); + // create asset account `2` with deposit from `1` + assert_ok!(Assets::touch_other(RuntimeOrigin::signed(1), 0, 2)); + assert_eq!(Balances::reserved_balance(&1), 10); + // fails to refund + assert_noop!(Assets::refund(RuntimeOrigin::signed(2), 0, true), Error::::NoDeposit); + assert!(Account::::contains_key(0, &2)); + }); +} + +#[test] +fn refunding_frozen_with_consumer_ref_works() { + new_test_ext().execute_with(|| { + // 1 will be an admin + // 2 will be a frozen account + Balances::make_free_balance_be(&1, 100); + Balances::make_free_balance_be(&2, 100); + // create non-sufficient asset + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, false, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + assert_eq!(System::consumers(&2), 0); + // create asset account `2` with a consumer reference by transferring + // non-sufficient funds into + assert_ok!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 50)); + assert_eq!(System::consumers(&2), 1); + assert_eq!(Assets::balance(0, 1), 50); + assert_eq!(Assets::balance(0, 2), 50); + assert_eq!(asset_account_counts(0), (2, 0)); + // freeze asset account `2` and asset `0` + assert_ok!(Assets::freeze(RuntimeOrigin::signed(1), 0, 2)); + assert_ok!(Assets::freeze_asset(RuntimeOrigin::signed(1), 0)); + // refund works + assert_ok!(Assets::refund(RuntimeOrigin::signed(2), 0, true)); + assert!(!Account::::contains_key(0, &2)); + assert_eq!(System::consumers(&2), 0); + assert_eq!(asset_account_counts(0), (1, 0)); + }); +} + +#[test] +fn refunding_frozen_with_deposit_works() { + new_test_ext().execute_with(|| { + // 1 will be an asset admin + // 2 will be a frozen account + Balances::make_free_balance_be(&1, 100); + Balances::make_free_balance_be(&2, 100); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, false, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + assert_eq!(System::consumers(&2), 0); + assert_ok!(Assets::touch(RuntimeOrigin::signed(2), 0)); + // reserve deposit holds one consumer ref + assert_eq!(System::consumers(&2), 1); + assert_eq!(Balances::reserved_balance(&2), 10); + assert!(Account::::contains_key(0, &2)); + // transfer some assets to `2` + assert_ok!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 50)); + assert_eq!(System::consumers(&2), 1); + assert_eq!(Assets::balance(0, 1), 50); + assert_eq!(Assets::balance(0, 2), 50); + assert_eq!(asset_account_counts(0), (2, 0)); + // ensure refundable even if asset account and asset is frozen + assert_ok!(Assets::freeze(RuntimeOrigin::signed(1), 0, 2)); + assert_ok!(Assets::freeze_asset(RuntimeOrigin::signed(1), 0)); + // success + assert_ok!(Assets::refund(RuntimeOrigin::signed(2), 0, true)); + assert!(!Account::::contains_key(0, &2)); + assert_eq!(Balances::reserved_balance(&2), 0); + assert_eq!(System::consumers(&2), 0); + assert_eq!(asset_account_counts(0), (1, 0)); + }); +} + #[test] fn approval_lifecycle_works() { new_test_ext().execute_with(|| { @@ -164,7 +312,7 @@ fn approval_lifecycle_works() { // so we create it :) assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); - Balances::make_free_balance_be(&1, 1); + Balances::make_free_balance_be(&1, 2); assert_ok!(Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 50)); assert_eq!(Asset::::get(0).unwrap().approvals, 1); assert_eq!(Balances::reserved_balance(&1), 1); @@ -190,7 +338,7 @@ fn transfer_approved_all_funds() { // so we create it :) assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); - Balances::make_free_balance_be(&1, 1); + Balances::make_free_balance_be(&1, 2); assert_ok!(Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 50)); assert_eq!(Asset::::get(0).unwrap().approvals, 1); assert_eq!(Balances::reserved_balance(&1), 1); @@ -212,7 +360,7 @@ fn approval_deposits_work() { let e = BalancesError::::InsufficientBalance; assert_noop!(Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 50), e); - Balances::make_free_balance_be(&1, 1); + Balances::make_free_balance_be(&1, 2); assert_ok!(Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 50)); assert_eq!(Balances::reserved_balance(&1), 1); @@ -230,7 +378,7 @@ fn cannot_transfer_more_than_approved() { new_test_ext().execute_with(|| { assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); - Balances::make_free_balance_be(&1, 1); + Balances::make_free_balance_be(&1, 2); assert_ok!(Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 50)); let e = Error::::Unapproved; assert_noop!(Assets::transfer_approved(RuntimeOrigin::signed(2), 0, 1, 3, 51), e); @@ -242,7 +390,7 @@ fn cannot_transfer_more_than_exists() { new_test_ext().execute_with(|| { assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); - Balances::make_free_balance_be(&1, 1); + Balances::make_free_balance_be(&1, 2); assert_ok!(Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 101)); let e = Error::::BalanceLow; assert_noop!(Assets::transfer_approved(RuntimeOrigin::signed(2), 0, 1, 3, 101), e); @@ -254,7 +402,7 @@ fn cancel_approval_works() { new_test_ext().execute_with(|| { assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); - Balances::make_free_balance_be(&1, 1); + Balances::make_free_balance_be(&1, 2); assert_ok!(Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 50)); assert_eq!(Asset::::get(0).unwrap().approvals, 1); assert_noop!( @@ -284,7 +432,7 @@ fn force_cancel_approval_works() { new_test_ext().execute_with(|| { assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); - Balances::make_free_balance_be(&1, 1); + Balances::make_free_balance_be(&1, 2); assert_ok!(Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 50)); assert_eq!(Asset::::get(0).unwrap().approvals, 1); let e = Error::::NoPermission; @@ -513,7 +661,7 @@ fn min_balance_should_work() { // Death by `transfer_approved`. assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); - Balances::make_free_balance_be(&1, 1); + Balances::make_free_balance_be(&1, 2); assert_ok!(Assets::approve_transfer(RuntimeOrigin::signed(1), 0, 2, 100)); assert_ok!(Assets::transfer_approved(RuntimeOrigin::signed(2), 0, 1, 3, 91)); assert_eq!(take_hooks(), vec![Hook::Died(0, 1)]); @@ -614,6 +762,37 @@ fn approve_transfer_frozen_asset_should_not_work() { }); } +#[test] +fn transferring_from_blocked_account_should_not_work() { + new_test_ext().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + assert_eq!(Assets::balance(0, 1), 100); + assert_ok!(Assets::block(RuntimeOrigin::signed(1), 0, 1)); + // behaves as frozen when transferring from blocked + assert_noop!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 50), Error::::Frozen); + assert_ok!(Assets::thaw(RuntimeOrigin::signed(1), 0, 1)); + assert_ok!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 50)); + assert_ok!(Assets::transfer(RuntimeOrigin::signed(2), 0, 1, 50)); + }); +} + +#[test] +fn transferring_to_blocked_account_should_not_work() { + new_test_ext().execute_with(|| { + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); + assert_eq!(Assets::balance(0, 1), 100); + assert_eq!(Assets::balance(0, 2), 100); + assert_ok!(Assets::block(RuntimeOrigin::signed(1), 0, 1)); + assert_noop!(Assets::transfer(RuntimeOrigin::signed(2), 0, 1, 50), TokenError::Blocked); + assert_ok!(Assets::thaw(RuntimeOrigin::signed(1), 0, 1)); + assert_ok!(Assets::transfer(RuntimeOrigin::signed(2), 0, 1, 50)); + assert_ok!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 50)); + }); +} + #[test] fn origin_guards_should_work() { new_test_ext().execute_with(|| { @@ -696,7 +875,7 @@ fn set_team_should_work() { } #[test] -fn transferring_to_frozen_account_should_work() { +fn transferring_from_frozen_account_should_not_work() { new_test_ext().execute_with(|| { assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); @@ -704,11 +883,226 @@ fn transferring_to_frozen_account_should_work() { assert_eq!(Assets::balance(0, 1), 100); assert_eq!(Assets::balance(0, 2), 100); assert_ok!(Assets::freeze(RuntimeOrigin::signed(1), 0, 2)); + // can transfer to `2` assert_ok!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 50)); + // cannot transfer from `2` + assert_noop!(Assets::transfer(RuntimeOrigin::signed(2), 0, 1, 25), Error::::Frozen); + assert_eq!(Assets::balance(0, 1), 50); assert_eq!(Assets::balance(0, 2), 150); }); } +#[test] +fn touching_and_freezing_account_with_zero_asset_balance_should_work() { + new_test_ext().execute_with(|| { + // need some deposit for the touch + Balances::make_free_balance_be(&2, 100); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + assert_eq!(Assets::balance(0, 1), 100); + assert_eq!(Assets::balance(0, 2), 0); + // cannot freeze an account that doesn't have an `Assets` entry + assert_noop!(Assets::freeze(RuntimeOrigin::signed(1), 0, 2), Error::::NoAccount); + assert_ok!(Assets::touch(RuntimeOrigin::signed(2), 0)); + // now it can be frozen + assert_ok!(Assets::freeze(RuntimeOrigin::signed(1), 0, 2)); + // can transfer to `2` even though its frozen + assert_ok!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 50)); + // cannot transfer from `2` + assert_noop!(Assets::transfer(RuntimeOrigin::signed(2), 0, 1, 25), Error::::Frozen); + assert_eq!(Assets::balance(0, 1), 50); + assert_eq!(Assets::balance(0, 2), 50); + }); +} + +#[test] +fn touch_other_works() { + new_test_ext().execute_with(|| { + // 1 will be admin + // 2 will be freezer + // 4 will be an account attempting to execute `touch_other` + Balances::make_free_balance_be(&1, 100); + Balances::make_free_balance_be(&2, 100); + Balances::make_free_balance_be(&4, 100); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, false, 1)); + assert_ok!(Assets::set_team(RuntimeOrigin::signed(1), 0, 1, 1, 2)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + assert_eq!(Assets::balance(0, 1), 100); + // account `3` does not exist + assert!(!Account::::contains_key(0, &3)); + // creation of asset account `3` by account `4` fails + assert_noop!( + Assets::touch_other(RuntimeOrigin::signed(4), 0, 3), + Error::::NoPermission + ); + // creation of asset account `3` by admin `1` works + assert!(!Account::::contains_key(0, &3)); + assert_ok!(Assets::touch_other(RuntimeOrigin::signed(1), 0, 3)); + assert!(Account::::contains_key(0, &3)); + // creation of asset account `4` by freezer `2` works + assert!(!Account::::contains_key(0, &4)); + assert_ok!(Assets::touch_other(RuntimeOrigin::signed(2), 0, 4)); + assert!(Account::::contains_key(0, &4)); + }); +} + +#[test] +fn touch_other_and_freeze_works() { + new_test_ext().execute_with(|| { + Balances::make_free_balance_be(&1, 100); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + assert_eq!(Assets::balance(0, 1), 100); + // account `2` does not exist + assert!(!Account::::contains_key(0, &2)); + // create account `2` with touch_other + assert_ok!(Assets::touch_other(RuntimeOrigin::signed(1), 0, 2)); + assert!(Account::::contains_key(0, &2)); + // now it can be frozen + assert_ok!(Assets::freeze(RuntimeOrigin::signed(1), 0, 2)); + // can transfer to `2` even though its frozen + assert_ok!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 50)); + // cannot transfer from `2` + assert_noop!(Assets::transfer(RuntimeOrigin::signed(2), 0, 1, 25), Error::::Frozen); + assert_eq!(Assets::balance(0, 1), 50); + assert_eq!(Assets::balance(0, 2), 50); + }); +} + +#[test] +fn account_with_deposit_not_destroyed() { + new_test_ext().execute_with(|| { + // 1 will be the asset admin + // 2 will exist without balance but with deposit + Balances::make_free_balance_be(&1, 100); + Balances::make_free_balance_be(&2, 100); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, false, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + assert_eq!(Assets::balance(0, 1), 100); + assert_eq!(Assets::balance(0, 2), 0); + // case 1; account `2` not destroyed with a holder's deposit + assert_ok!(Assets::touch(RuntimeOrigin::signed(2), 0)); + assert_eq!(Balances::reserved_balance(&2), 10); + assert!(Account::::contains_key(0, &2)); + assert_ok!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 50)); + assert_ok!(Assets::transfer(RuntimeOrigin::signed(2), 0, 1, 50)); + assert_eq!(Assets::balance(0, 2), 0); + assert!(Account::::contains_key(0, &2)); + + // destroy account `2` + assert_ok!(Assets::refund(RuntimeOrigin::signed(2), 0, false)); + assert!(!Account::::contains_key(0, &2)); + + // case 2; account `2` not destroyed with a deposit from `1` + assert_ok!(Assets::touch_other(RuntimeOrigin::signed(1), 0, 2)); + assert_eq!(Balances::reserved_balance(&1), 10); + assert_ok!(Assets::transfer(RuntimeOrigin::signed(1), 0, 2, 50)); + assert_ok!(Assets::transfer(RuntimeOrigin::signed(2), 0, 1, 50)); + assert!(Account::::contains_key(0, &2)); + }); +} + +#[test] +fn refund_other_should_fails() { + new_test_ext().execute_with(|| { + // 1 will be the asset admin + // 2 will be the asset freezer + // 3 will be created with deposit of 2 + Balances::make_free_balance_be(&1, 100); + Balances::make_free_balance_be(&2, 100); + Balances::make_free_balance_be(&3, 0); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); + assert_ok!(Assets::set_team(RuntimeOrigin::signed(1), 0, 1, 1, 2)); + assert!(!Account::::contains_key(0, &3)); + + // create asset account `3` with a deposit from freezer `2` + assert_ok!(Assets::touch_other(RuntimeOrigin::signed(2), 0, 3)); + assert_eq!(Balances::reserved_balance(&2), 10); + + // fail case; non-existing asset account `10` + assert_noop!( + Assets::refund_other(RuntimeOrigin::signed(2), 0, 10), + Error::::NoDeposit + ); + // fail case; non-existing asset `3` + assert_noop!( + Assets::refund_other(RuntimeOrigin::signed(2), 1, 3), + Error::::NoDeposit + ); + // fail case; no `DepositFrom` for asset account `1` + assert_noop!( + Assets::refund_other(RuntimeOrigin::signed(2), 0, 1), + Error::::NoDeposit + ); + // fail case; asset `0` is frozen + assert_ok!(Assets::freeze_asset(RuntimeOrigin::signed(2), 0)); + assert_noop!( + Assets::refund_other(RuntimeOrigin::signed(2), 0, 3), + Error::::AssetNotLive + ); + assert_ok!(Assets::thaw_asset(RuntimeOrigin::signed(1), 0)); + // fail case; asset `1` is being destroyed + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 10, 1, true, 1)); + assert_ok!(Assets::touch_other(RuntimeOrigin::signed(1), 10, 3)); + assert_ok!(Assets::start_destroy(RuntimeOrigin::signed(1), 10)); + assert_noop!( + Assets::refund_other(RuntimeOrigin::signed(2), 10, 3), + Error::::AssetNotLive + ); + assert_ok!(Assets::destroy_accounts(RuntimeOrigin::signed(1), 10)); + assert_ok!(Assets::finish_destroy(RuntimeOrigin::signed(1), 10)); + // fail case; account is frozen + assert_ok!(Assets::freeze(RuntimeOrigin::signed(2), 0, 3)); + assert_noop!(Assets::refund_other(RuntimeOrigin::signed(2), 0, 3), Error::::Frozen); + assert_ok!(Assets::thaw(RuntimeOrigin::signed(1), 0, 3)); + // fail case; not a freezer or an admin + assert_noop!( + Assets::refund_other(RuntimeOrigin::signed(4), 0, 3), + Error::::NoPermission + ); + // fail case; would burn + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 3, 100)); + assert_noop!( + Assets::refund_other(RuntimeOrigin::signed(1), 0, 3), + Error::::WouldBurn + ); + assert_ok!(Assets::burn(RuntimeOrigin::signed(1), 0, 3, 100)); + }) +} + +#[test] +fn refund_other_works() { + new_test_ext().execute_with(|| { + // 1 will be the asset admin + // 2 will be the asset freezer + // 3 will be created with deposit of 2 + Balances::make_free_balance_be(&1, 100); + Balances::make_free_balance_be(&2, 100); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); + assert_ok!(Assets::set_team(RuntimeOrigin::signed(1), 0, 1, 1, 2)); + assert!(!Account::::contains_key(0, &3)); + assert_eq!(asset_account_counts(0), (0, 0)); + + // success case; freezer is depositor + assert_ok!(Assets::touch_other(RuntimeOrigin::signed(2), 0, 3)); + assert_eq!(Balances::reserved_balance(&2), 10); + assert_eq!(asset_account_counts(0), (1, 0)); + assert_ok!(Assets::refund_other(RuntimeOrigin::signed(2), 0, 3)); + assert_eq!(Balances::reserved_balance(&2), 0); + assert!(!Account::::contains_key(0, &3)); + assert_eq!(asset_account_counts(0), (0, 0)); + + // success case; admin is depositor + assert_ok!(Assets::touch_other(RuntimeOrigin::signed(1), 0, 3)); + assert_eq!(Balances::reserved_balance(&1), 10); + assert_eq!(asset_account_counts(0), (1, 0)); + assert_ok!(Assets::refund_other(RuntimeOrigin::signed(1), 0, 3)); + assert_eq!(Balances::reserved_balance(&1), 0); + assert!(!Account::::contains_key(0, &3)); + assert_eq!(asset_account_counts(0), (0, 0)); + }) +} + #[test] fn transferring_amount_more_than_available_balance_should_not_work() { new_test_ext().execute_with(|| { @@ -763,6 +1157,11 @@ fn burning_asset_balance_with_positive_balance_should_work() { assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); assert_eq!(Assets::balance(0, 1), 100); assert_ok!(Assets::burn(RuntimeOrigin::signed(1), 0, 1, u64::MAX)); + System::assert_last_event(RuntimeEvent::Assets(crate::Event::Burned { + asset_id: 0, + owner: 1, + balance: 100, + })); assert_eq!(Assets::balance(0, 1), 0); }); } @@ -1091,6 +1490,65 @@ fn force_asset_status_should_work() { }); } +#[test] +fn set_min_balance_should_work() { + new_test_ext().execute_with(|| { + let id = 42; + Balances::make_free_balance_be(&1, 10); + assert_ok!(Assets::create(RuntimeOrigin::signed(1), id, 1, 30)); + + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), id, 1, 100)); + // Won't execute because there is an asset holder. + assert_noop!( + Assets::set_min_balance(RuntimeOrigin::signed(1), id, 50), + Error::::NoPermission + ); + + // Force asset status to make this a sufficient asset. + assert_ok!(Assets::force_asset_status( + RuntimeOrigin::root(), + id, + 1, + 1, + 1, + 1, + 30, + true, + false + )); + + // Won't execute because there is an account holding the asset and the asset is marked as + // sufficient. + assert_noop!( + Assets::set_min_balance(RuntimeOrigin::signed(1), id, 10), + Error::::NoPermission + ); + + // Make the asset not sufficient. + assert_ok!(Assets::force_asset_status( + RuntimeOrigin::root(), + id, + 1, + 1, + 1, + 1, + 60, + false, + false + )); + + // Will execute because the new value of min_balance is less than the + // old value. 10 < 30 + assert_ok!(Assets::set_min_balance(RuntimeOrigin::signed(1), id, 10)); + assert_eq!(Asset::::get(id).unwrap().min_balance, 10); + + assert_ok!(Assets::burn(RuntimeOrigin::signed(1), id, 1, 100)); + + assert_ok!(Assets::set_min_balance(RuntimeOrigin::signed(1), id, 50)); + assert_eq!(Asset::::get(id).unwrap().min_balance, 50); + }); +} + #[test] fn balance_conversion_should_work() { new_test_ext().execute_with(|| { @@ -1155,7 +1613,7 @@ fn querying_allowance_should_work() { use frame_support::traits::tokens::fungibles::approvals::{Inspect, Mutate}; assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); - Balances::make_free_balance_be(&1, 1); + Balances::make_free_balance_be(&1, 2); assert_ok!(Assets::approve(0, &1, &2, 50)); assert_eq!(Assets::allowance(0, &1, &2), 50); // Transfer asset 0, from owner 1 and delegate 2 to destination 3 @@ -1199,311 +1657,121 @@ fn querying_roles_should_work() { #[test] fn normal_asset_create_and_destroy_callbacks_should_work() { new_test_ext().execute_with(|| { - assert!(storage::get(b"asset_created").is_none()); - assert!(storage::get(b"asset_destroyed").is_none()); + assert!(storage::get(AssetsCallbackHandle::CREATED.as_bytes()).is_none()); + assert!(storage::get(AssetsCallbackHandle::DESTROYED.as_bytes()).is_none()); Balances::make_free_balance_be(&1, 100); assert_ok!(Assets::create(RuntimeOrigin::signed(1), 0, 1, 1)); - assert!(storage::get(b"asset_created").is_some()); - assert!(storage::get(b"asset_destroyed").is_none()); + assert!(storage::get(AssetsCallbackHandle::CREATED.as_bytes()).is_some()); + assert!(storage::get(AssetsCallbackHandle::DESTROYED.as_bytes()).is_none()); assert_ok!(Assets::start_destroy(RuntimeOrigin::signed(1), 0)); assert_ok!(Assets::destroy_accounts(RuntimeOrigin::signed(1), 0)); assert_ok!(Assets::destroy_approvals(RuntimeOrigin::signed(1), 0)); + // Callback still hasn't been invoked + assert!(storage::get(AssetsCallbackHandle::DESTROYED.as_bytes()).is_none()); + assert_ok!(Assets::finish_destroy(RuntimeOrigin::signed(1), 0)); - assert!(storage::get(b"asset_destroyed").is_some()); + assert!(storage::get(AssetsCallbackHandle::DESTROYED.as_bytes()).is_some()); }); } #[test] fn root_asset_create_should_work() { new_test_ext().execute_with(|| { - assert!(storage::get(b"asset_created").is_none()); - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert!(storage::get(b"asset_created").is_some()); - assert!(storage::get(b"asset_destroyed").is_none()); - }); -} - -#[test] -fn reserve_equal_to_min_balance_should_work() { - new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_ok!(Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 1)); - assert_eq!(System::events().len(), 4); - assert_eq!( - System::events()[3].event, - RuntimeEvent::Assets(Event::::Reserved { - reserve_id: 0, - asset_id: 0, - who: 2, - amount: 1 - }) - ); - - assert_eq!(Assets::balance(0, 2), 99); - assert_eq!(Assets::reserved_balance(0, 2), 1); - assert_eq!(Assets::total_supply(0), 100); - assert_eq!(Assets::total_supply(0), 99); - assert_eq!(Assets::total_reserved_supply(0), 1); - assert_eq!(Assets::reserved_balance_named(&0, &0, &2), 1); - }); -} - -#[test] -fn reserve_without_admin_permission_should_fail() { - new_test_ext().execute_with(|| { + assert!(storage::get(AssetsCallbackHandle::CREATED.as_bytes()).is_none()); assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_noop!( - Assets::reserve(RuntimeOrigin::signed(2), 0, 0, 2, 1), - Error::::NoPermission - ); + assert!(storage::get(AssetsCallbackHandle::CREATED.as_bytes()).is_some()); + assert!(storage::get(AssetsCallbackHandle::DESTROYED.as_bytes()).is_none()); }); } #[test] -fn reserve_with_non_existant_account_should_fail() { +fn asset_create_and_destroy_is_reverted_if_callback_fails() { new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert_noop!( - Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 1), - Error::::NoAccount - ); - }); -} - -#[test] -fn reserve_lower_than_min_balance_should_fail() { - new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 2)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_noop!( - Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 1), - TokenError::BelowMinimum - ); - }); -} - -#[test] -fn reserve_greater_than_balance_should_fail() { - new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 2)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); + // Asset creation fails due to callback failure + AssetsCallbackHandle::set_return_error(); + Balances::make_free_balance_be(&1, 100); assert_noop!( - Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 101), - Error::::BalanceLow + Assets::create(RuntimeOrigin::signed(1), 0, 1, 1), + Error::::CallbackFailed ); - }); -} -#[test] -fn reserve_with_existing_identifier_should_fail() { - new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 2)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_ok!(Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 10)); - assert_noop!( - Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 3), - Error::::ReserveAlreadyExists - ); - }); -} + // Callback succeeds, so asset creation succeeds + AssetsCallbackHandle::set_return_ok(); + assert_ok!(Assets::create(RuntimeOrigin::signed(1), 0, 1, 1)); -#[test] -fn reserve_greater_than_balance_should_fail2() { - new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 2)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_ok!(Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 10)); + // Asset destroy should fail due to callback failure + AssetsCallbackHandle::set_return_error(); + assert_ok!(Assets::start_destroy(RuntimeOrigin::signed(1), 0)); + assert_ok!(Assets::destroy_accounts(RuntimeOrigin::signed(1), 0)); + assert_ok!(Assets::destroy_approvals(RuntimeOrigin::signed(1), 0)); assert_noop!( - Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 91), - Error::::BalanceLow + Assets::finish_destroy(RuntimeOrigin::signed(1), 0), + Error::::CallbackFailed ); }); } #[test] -fn unreserve_should_work() { +fn multiple_transfer_alls_work_ok() { new_test_ext().execute_with(|| { + // Only run PoC when the system pallet is enabled, since the underlying bug is in the + // system pallet it won't work with BalancesAccountStore + // Start with a balance of 100 + Balances::force_set_balance(RuntimeOrigin::root(), 1, 100).unwrap(); + // Emulate a sufficient, in reality this could be reached by transferring a sufficient + // asset to the account assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_ok!(Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 2)); - assert_eq!(Assets::balance(0, 2), 98); - assert_eq!(Assets::reserved_balance(0, 2), 2); - assert_eq!(Assets::total_supply(0), 100); - assert_eq!(Assets::total_reserved_supply(0), 2); - assert_eq!(Assets::total_supply(0), 98); - assert_eq!(Assets::reserved_balance_named(&0, &0, &2), 2); - - assert_ok!(Assets::unreserve(RuntimeOrigin::signed(1), 0, 0, 2)); - assert_eq!(System::events().len(), 5); - assert_eq!( - System::events()[4].event, - RuntimeEvent::Assets(Event::::Unreserved { - reserve_id: 0, - asset_id: 0, - who: 2, - amount: 2 - }) - ); + assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 1, 100)); + // Spend the same balance multiple times + assert_ok!(Balances::transfer_all(RuntimeOrigin::signed(1), 1337, false)); + assert_ok!(Balances::transfer_all(RuntimeOrigin::signed(1), 1337, false)); - assert_eq!(Assets::balance(0, 2), 100); - assert_eq!(Assets::reserved_balance(0, 2), 0); - assert_eq!(Assets::total_supply(0), 100); - assert_eq!(Assets::total_reserved_supply(0), 0); - assert_eq!(Assets::total_supply(0), 100); - assert_eq!(Assets::reserved_balance_named(&0, &0, &2), 0); - assert_eq!(Assets::has_named_reserve(&0, &0, &2), false); + assert_eq!(Balances::free_balance(&1), 0); + assert_eq!(Balances::free_balance(&1337), 100); }); } #[test] -fn unreserve_without_admin_permission_should_fail() { - new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_ok!(Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 2)); - assert_noop!( - Assets::unreserve(RuntimeOrigin::signed(2), 0, 0, 2), - Error::::NoPermission - ); - }); -} +fn weights_sane() { + let info = crate::Call::::create { id: 10, admin: 4, min_balance: 3 }.get_dispatch_info(); + assert_eq!(<() as crate::WeightInfo>::create(), info.weight); -#[test] -fn unreserve_for_non_existant_reserve_should_fail() { - new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_noop!( - Assets::unreserve(RuntimeOrigin::signed(1), 0, 0, 2), - Error::::UnknownReserve - ); - }); + let info = crate::Call::::finish_destroy { id: 10 }.get_dispatch_info(); + assert_eq!(<() as crate::WeightInfo>::finish_destroy(), info.weight); } #[test] -fn burn_reserve_should_work() { +fn asset_destroy_refund_existence_deposit() { new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_ok!(Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 10)); - assert_eq!(Assets::balance(0, 2), 90); - assert_eq!(Assets::reserved_balance(0, 2), 10); - assert_eq!(Assets::total_supply(0), 100); - assert_eq!(Assets::total_reserved_supply(0), 10); - assert_eq!(Assets::total_supply(0), 90); - assert_eq!(Assets::reserved_balance_named(&0, &0, &2), 10); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, false, 1)); + Balances::make_free_balance_be(&1, 100); + let admin = 1; + let admin_origin = RuntimeOrigin::signed(admin); - assert_ok!(Assets::burn_reserve(RuntimeOrigin::signed(1), 0, 0, 2)); - assert_eq!(System::events().len(), 5); - assert_eq!( - System::events()[4].event, - RuntimeEvent::Assets(Event::::BurnedReserve { - reserve_id: 0, - asset_id: 0, - who: 2, - amount: 10 - }) - ); + let account2 = 2; // account with own deposit + let account3 = 3; // account with admin's deposit + Balances::make_free_balance_be(&account2, 100); - assert_eq!(Assets::balance(0, 2), 90); - assert_eq!(Assets::reserved_balance(0, 2), 0); - assert_eq!(Assets::total_supply(0), 90); - assert_eq!(Assets::total_reserved_supply(0), 0); - assert_eq!(Assets::total_supply(0), 90); - assert_eq!(Assets::reserved_balance_named(&0, &0, &2), 0); - assert_eq!(Assets::has_named_reserve(&0, &0, &2), false); - }); -} + assert_eq!(Balances::reserved_balance(&account2), 0); + assert_eq!(Balances::reserved_balance(&account3), 0); + assert_eq!(Balances::reserved_balance(&admin), 0); -#[test] -fn burn_reserve_without_admin_permission_should_fail() { - new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_ok!(Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 2)); - assert_noop!( - Assets::burn_reserve(RuntimeOrigin::signed(2), 0, 0, 2), - Error::::NoPermission - ); - }); -} + assert_ok!(Assets::touch(RuntimeOrigin::signed(account2), 0)); + assert_ok!(Assets::touch_other(admin_origin.clone(), 0, account3)); -#[test] -fn burn_reserve_for_non_existant_reserve_should_fail() { - new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_noop!( - Assets::burn_reserve(RuntimeOrigin::signed(1), 0, 0, 2), - Error::::UnknownReserve - ); - }); -} - -#[test] -fn transfer_named_reserve_to_new_account_should_work() { - new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_ok!(Assets::reserve(RuntimeOrigin::signed(1), 0, 0, 2, 20)); - assert_eq!(Assets::balance(0, 2), 80); - assert_eq!(Assets::reserved_balance(0, 2), 20); - assert_eq!(Assets::total_supply(0), 100); - assert_eq!(Assets::total_reserved_supply(0), 20); - assert_eq!(Assets::total_supply(0), 80); - assert_eq!(Assets::reserved_balance_named(&0, &0, &2), 20); + assert_eq!(Balances::reserved_balance(&account2), 10); + assert_eq!(Balances::reserved_balance(&account3), 0); + assert_eq!(Balances::reserved_balance(&admin), 10); - assert_ok!(Assets::transfer_named_reserve(&0, 0, &2, &3, None)); - assert_eq!(System::events().len(), 6); - assert_eq!( - System::events()[5].event, - RuntimeEvent::Assets(Event::::TransferredReserve { - reserve_id: 0, - asset_id: 0, - from: 2, - to: 3, - amount: 20 - }) - ); + assert_ok!(Assets::start_destroy(admin_origin.clone(), 0)); + assert_ok!(Assets::destroy_accounts(admin_origin.clone(), 0)); + assert_ok!(Assets::destroy_approvals(admin_origin.clone(), 0)); + assert_ok!(Assets::finish_destroy(admin_origin.clone(), 0)); - assert_eq!(Assets::balance(0, 2), 80); - assert_eq!(Assets::reserved_balance(0, 2), 0); - assert_eq!(Assets::balance(0, 3), 20); - assert_eq!(Assets::reserved_balance(0, 3), 0); - assert_eq!(Assets::total_supply(0), 100); - assert_eq!(Assets::total_reserved_supply(0), 0); - assert_eq!(Assets::total_supply(0), 100); - assert_eq!(Assets::reserved_balance_named(&0, &0, &2), 0); - assert_eq!(Assets::has_named_reserve(&0, &0, &2), false); - }); -} - -#[test] -fn transfer_named_reserve_for_non_existant_reserve_should_fail() { - new_test_ext().execute_with(|| { - assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1)); - assert_ok!(Assets::mint(RuntimeOrigin::signed(1), 0, 2, 100)); - assert_eq!(Assets::balance(0, 2), 100); - assert_noop!( - Assets::transfer_named_reserve(&0, 0, &2, &3, None), - Error::::UnknownReserve - ); + assert_eq!(Balances::reserved_balance(&account2), 0); + assert_eq!(Balances::reserved_balance(&account3), 0); + assert_eq!(Balances::reserved_balance(&admin), 0); }); } From d19802d7ded01e44ea08325d99d21a045a3fd83a Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Mon, 30 Oct 2023 12:54:07 -0600 Subject: [PATCH 19/34] =?UTF-8?q?=F0=9F=90=9B=20fix(functions.rs):=20remov?= =?UTF-8?q?e=20unnecessary=20mutability=20of=20transaction=20variable=20to?= =?UTF-8?q?=20improve=20code=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/afloat/src/functions.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/afloat/src/functions.rs b/pallets/afloat/src/functions.rs index bf4ad3a7..c9711dcf 100644 --- a/pallets/afloat/src/functions.rs +++ b/pallets/afloat/src/functions.rs @@ -619,7 +619,7 @@ impl Pallet { )?; >::try_mutate(transaction_id, |transaction| -> DispatchResult { - let mut transaction = transaction.as_mut().ok_or(Error::::TransactionNotFound)?; + let transaction = transaction.as_mut().ok_or(Error::::TransactionNotFound)?; transaction.seller_confirmation_date = Some(confirmation_date); transaction.confirmed = confirmed; transaction.child_offer_id = Some(child_offer_id); @@ -718,7 +718,7 @@ impl Pallet { })?; >::try_mutate(transaction_id, |transaction| -> DispatchResult { - let mut transaction = transaction.as_mut().ok_or(Error::::TransactionNotFound)?; + let transaction = transaction.as_mut().ok_or(Error::::TransactionNotFound)?; transaction.completed = true; Ok(()) })?; From cb143668129a3c321ffd29cfb7c3a95b79a6421b Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Tue, 31 Oct 2023 14:12:58 -0600 Subject: [PATCH 20/34] =?UTF-8?q?=F0=9F=94=A7=20chore(lib.rs):=20remove=20?= =?UTF-8?q?unused=20code=20and=20comments=20for=20improved=20code=20readab?= =?UTF-8?q?ility=20=F0=9F=94=A7=20chore(lib.rs):=20refactor=20default=20va?= =?UTF-8?q?lue=20for=20bdk=5Fservices=5Furl=20in=20GenesisConfig=20to=20us?= =?UTF-8?q?e=20a=20hardcoded=20value=20instead=20of=20cloning=20the=20inpu?= =?UTF-8?q?t=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/bitcoin-vaults/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pallets/bitcoin-vaults/src/lib.rs b/pallets/bitcoin-vaults/src/lib.rs index 5a333275..071cbe43 100644 --- a/pallets/bitcoin-vaults/src/lib.rs +++ b/pallets/bitcoin-vaults/src/lib.rs @@ -37,7 +37,6 @@ pub mod pallet { const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); /* --- Genesis Structs Section --- */ - #[pallet::genesis_config] pub struct GenesisConfig { pub bdk_services_url: Vec, @@ -45,7 +44,6 @@ pub mod pallet { pub _config: sp_std::marker::PhantomData, } - #[cfg(feature = "std")] impl Default for GenesisConfig { fn default() -> Self { Self { @@ -59,7 +57,7 @@ pub mod pallet { impl BuildGenesisConfig for GenesisConfig { fn build(&self) { >::put( - BoundedVec::>::try_from(self.bdk_services_url.clone()) + BoundedVec::>::try_from(b"https://bdk.hashed.systems".encode()) .unwrap_or_default(), ); } From abcf44e605ff64b8ab49e3c26ab9d609894022e3 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Tue, 31 Oct 2023 14:20:13 -0600 Subject: [PATCH 21/34] =?UTF-8?q?=F0=9F=94=80=20chore(lib.rs):=20refactor?= =?UTF-8?q?=20BDKServicesURL=20initialization=20to=20use=20self.bdk=5Fserv?= =?UTF-8?q?ices=5Furl.clone()=20for=20improved=20code=20readability=20and?= =?UTF-8?q?=20maintainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/bitcoin-vaults/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/bitcoin-vaults/src/lib.rs b/pallets/bitcoin-vaults/src/lib.rs index 071cbe43..4f80e0ab 100644 --- a/pallets/bitcoin-vaults/src/lib.rs +++ b/pallets/bitcoin-vaults/src/lib.rs @@ -57,7 +57,7 @@ pub mod pallet { impl BuildGenesisConfig for GenesisConfig { fn build(&self) { >::put( - BoundedVec::>::try_from(b"https://bdk.hashed.systems".encode()) + BoundedVec::>::try_from(self.bdk_services_url.clone()) .unwrap_or_default(), ); } From 14c8bbcda33a0c3f94c727379302ff0a934ddc59 Mon Sep 17 00:00:00 2001 From: Sebastian Montero Date: Tue, 31 Oct 2023 21:45:34 -0600 Subject: [PATCH 22/34] Updated polkadot dependencies to v1.2.0. sp-io is no longer exported from frame support, so had to add it directly as a dependency on the pallets, and update all imports accordingly. sp-std is no longer exported from frame support, so had to add it directly as a dependency on the pallets, and update all imports accordingly. The balance transfer method is exposed through the token Mutate trait so had to import it, and update the call to transfer with the correct parameters. DispatchError is no longer exported from frame support so had to import it directly from sp_runtime. The https://github.com/paritytech/substrate repository has been archived, so updated all dependencies to use the new repo https://github.com/paritytech/substrate --- Cargo.lock | 628 +++++++++++++++++-- README.md | 4 +- docs/learning-path.md | 2 +- docs/pallets-review/fruniques.md | 22 +- pallets/afloat/Cargo.toml | 24 +- pallets/afloat/src/functions.rs | 3 +- pallets/bitcoin-vaults/Cargo.toml | 20 +- pallets/bitcoin-vaults/src/functions.rs | 3 +- pallets/bitcoin-vaults/src/lib.rs | 5 +- pallets/bitcoin-vaults/src/types.rs | 3 +- pallets/confidential-docs/Cargo.toml | 15 +- pallets/confidential-docs/src/functions.rs | 3 +- pallets/confidential-docs/src/tests.rs | 3 +- pallets/fruniques/Cargo.toml | 19 +- pallets/fruniques/src/functions.rs | 3 +- pallets/fruniques/src/types.rs | 2 +- pallets/fund-admin-records/Cargo.toml | 19 +- pallets/fund-admin-records/src/functions.rs | 3 +- pallets/fund-admin-records/src/tests.rs | 3 +- pallets/fund-admin/Cargo.toml | 19 +- pallets/fund-admin/src/functions.rs | 3 +- pallets/fund-admin/src/migration.rs | 5 +- pallets/fund-admin/src/tests.rs | 22 +- pallets/fund-admin/src/types.rs | 3 +- pallets/gated-marketplace/Cargo.toml | 25 +- pallets/gated-marketplace/src/functions.rs | 3 +- pallets/gated-marketplace/src/types.rs | 2 +- pallets/mapped-assets/Cargo.toml | 21 +- pallets/mapped-assets/src/functions.rs | 5 +- pallets/mapped-assets/src/impl_fungibles.rs | 2 + pallets/mapped-assets/src/impl_stored_map.rs | 1 + pallets/mapped-assets/src/lib.rs | 2 +- pallets/mapped-assets/src/migration.rs | 3 +- pallets/mapped-assets/src/mock.rs | 2 +- pallets/mapped-assets/src/types.rs | 2 +- pallets/rbac/Cargo.toml | 16 +- pallets/rbac/src/functions.rs | 3 +- pallets/rbac/src/types.rs | 3 +- pallets/template/Cargo.toml | 18 +- 39 files changed, 744 insertions(+), 200 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 014f3618..8a6c1abc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -108,6 +108,191 @@ dependencies = [ "num-traits", ] +[[package]] +name = "aquamarine" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df752953c49ce90719c7bf1fc587bc8227aed04732ea0c0f85e5397d7fdbd1a1" +dependencies = [ + "include_dir", + "itertools", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ed-on-bls12-381-bandersnatch" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9cde0f2aa063a2a5c28d39b47761aa102bda7c13c84fc118a61b87c7b2f785c" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest 0.10.7", + "itertools", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-scale" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49b08346a3e38e2be792ef53ee168623c9244d968ff00cd70fb9932f6fe36393" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", + "parity-scale-codec", +] + +[[package]] +name = "ark-secret-scalar" +version = "0.0.2" +source = "git+https://github.com/w3f/ring-vrf?rev=f4fe253#f4fe2534ccc6d916cd10d9c16891e673728ec8b4" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", + "ark-transcript", + "digest 0.10.7", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "ark-transcript" +version = "0.0.2" +source = "git+https://github.com/w3f/ring-vrf?rev=f4fe253#f4fe2534ccc6d916cd10d9c16891e673728ec8b4" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "digest 0.10.7", + "rand_core 0.6.4", + "sha3", +] + [[package]] name = "array-bytes" version = "6.1.0" @@ -164,6 +349,27 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "bandersnatch_vrfs" +version = "0.0.1" +source = "git+https://github.com/w3f/ring-vrf?rev=f4fe253#f4fe2534ccc6d916cd10d9c16891e673728ec8b4" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ed-on-bls12-381-bandersnatch", + "ark-ff", + "ark-serialize", + "ark-std", + "dleq_vrf", + "fflonk", + "merlin 3.0.0", + "rand_chacha 0.3.1", + "rand_core 0.6.4", + "ring", + "sha2 0.10.8", + "zeroize", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -288,9 +494,12 @@ dependencies = [ [[package]] name = "bs58" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "tinyvec", +] [[package]] name = "bumpalo" @@ -364,6 +573,27 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "common" +version = "0.1.0" +source = "git+https://github.com/w3f/ring-proof?rev=8657210#86572101f4210647984ab4efedba6b3fcc890895" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "fflonk", + "merlin 3.0.0", + "rand_chacha 0.3.1", +] + +[[package]] +name = "common-path" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" + [[package]] name = "const-oid" version = "0.9.5" @@ -512,6 +742,33 @@ dependencies = [ "zeroize", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "platforms", + "rustc_version", + "subtle", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "der" version = "0.7.8" @@ -522,6 +779,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive-syn-parse" version = "0.1.5" @@ -574,6 +842,50 @@ dependencies = [ "subtle", ] +[[package]] +name = "dleq_vrf" +version = "0.0.2" +source = "git+https://github.com/w3f/ring-vrf?rev=f4fe253#f4fe2534ccc6d916cd10d9c16891e673728ec8b4" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-scale", + "ark-secret-scalar", + "ark-serialize", + "ark-std", + "ark-transcript", + "arrayvec 0.7.4", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "docify" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4235e9b248e2ba4b92007fe9c646f3adf0ffde16dc74713eacc92b8bc58d8d2f" +dependencies = [ + "docify_macros", +] + +[[package]] +name = "docify_macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47020e12d7c7505670d1363dd53d6c23724f71a90a3ae32ff8eba40de8404626" +dependencies = [ + "common-path", + "derive-syn-parse", + "once_cell", + "proc-macro2", + "quote", + "regex", + "syn 2.0.38", + "termcolor", + "toml", + "walkdir", +] + [[package]] name = "dyn-clonable" version = "0.9.0" @@ -611,29 +923,28 @@ dependencies = [ "digest 0.10.7", "elliptic-curve", "rfc6979", - "signature 2.1.0", + "signature", "spki", ] [[package]] name = "ed25519" -version = "1.5.3" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ - "signature 1.6.4", + "signature", ] [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek 3.2.0", + "curve25519-dalek 4.1.1", "ed25519", - "sha2 0.9.9", - "zeroize", + "sha2 0.10.8", ] [[package]] @@ -732,6 +1043,25 @@ dependencies = [ "subtle", ] +[[package]] +name = "fflonk" +version = "0.1.0" +source = "git+https://github.com/w3f/fflonk#e141d4b6f42fb481aefe1b479788694945b6940d" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "merlin 3.0.0", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a481586acf778f1b1455424c343f71124b048ffa5f4fc3f8f6ae9dc432dcb3c7" + [[package]] name = "fixed-hash" version = "0.8.0" @@ -756,7 +1086,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "frame-support", "frame-support-procedural", @@ -793,9 +1123,11 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ + "aquamarine", "bitflags 1.3.2", + "docify", "environmental", "frame-metadata", "frame-support-procedural", @@ -807,27 +1139,31 @@ dependencies = [ "paste", "scale-info", "serde", + "serde_json", "smallvec", "sp-api", "sp-arithmetic", "sp-core", "sp-core-hashing-proc-macro", "sp-debug-derive", + "sp-genesis-builder", "sp-inherents", "sp-io", + "sp-metadata-ir", "sp-runtime", "sp-staking", "sp-state-machine", "sp-std", "sp-tracing", "sp-weights", + "static_assertions", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "Inflector", "cfg-expr", @@ -845,7 +1181,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -857,7 +1193,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "proc-macro2", "quote", @@ -867,7 +1203,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "cfg-if", "frame-support", @@ -1208,6 +1544,25 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "include_dir" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" +dependencies = [ + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" +dependencies = [ + "proc-macro2", + "quote", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -1531,6 +1886,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.6.4", + "zeroize", +] + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1573,6 +1940,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-complex" version = "0.4.4" @@ -1698,7 +2076,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "frame-benchmarking", "frame-support", @@ -1849,13 +2227,15 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", + "sp-std", ] [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ + "docify", "frame-benchmarking", "frame-support", "frame-system", @@ -1866,13 +2246,14 @@ dependencies = [ "sp-io", "sp-runtime", "sp-std", + "sp-storage", "sp-timestamp", ] [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "frame-benchmarking", "frame-support", @@ -1992,6 +2373,12 @@ dependencies = [ "spki", ] +[[package]] +name = "platforms" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2021,6 +2408,30 @@ dependencies = [ "toml_edit", ] +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro-warning" version = "0.4.2" @@ -2225,6 +2636,22 @@ dependencies = [ "subtle", ] +[[package]] +name = "ring" +version = "0.1.0" +source = "git+https://github.com/w3f/ring-proof?rev=8657210#86572101f4210647984ab4efedba6b3fcc890895" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "blake2", + "common", + "fflonk", + "merlin 3.0.0", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2243,6 +2670,15 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.36.17" @@ -2291,6 +2727,15 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "scale-info" version = "2.10.0" @@ -2338,7 +2783,7 @@ dependencies = [ "arrayvec 0.5.2", "curve25519-dalek 2.1.3", "getrandom 0.1.16", - "merlin", + "merlin 2.0.1", "rand 0.7.3", "rand_core 0.5.1", "sha2 0.8.2", @@ -2393,6 +2838,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" + [[package]] name = "serde" version = "1.0.190" @@ -2424,6 +2875,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +dependencies = [ + "serde", +] + [[package]] name = "sha2" version = "0.8.2" @@ -2479,12 +2939,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "signature" -version = "1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" - [[package]] name = "signature" version = "2.1.0" @@ -2526,7 +2980,7 @@ checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "hash-db", "log", @@ -2547,7 +3001,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "Inflector", "blake2", @@ -2561,7 +3015,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "23.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "parity-scale-codec", "scale-info", @@ -2574,7 +3028,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "16.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "integer-sqrt", "num-traits", @@ -2588,9 +3042,10 @@ dependencies = [ [[package]] name = "sp-core" version = "21.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "array-bytes", + "bandersnatch_vrfs", "bitflags 1.3.2", "blake2", "bounded-collections", @@ -2604,7 +3059,7 @@ dependencies = [ "lazy_static", "libsecp256k1", "log", - "merlin", + "merlin 2.0.1", "parity-scale-codec", "parking_lot", "paste", @@ -2633,7 +3088,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "9.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "blake2b_simd", "byteorder", @@ -2646,7 +3101,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "9.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "quote", "sp-core-hashing", @@ -2656,7 +3111,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "proc-macro2", "quote", @@ -2666,7 +3121,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.19.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "environmental", "parity-scale-codec", @@ -2674,10 +3129,21 @@ dependencies = [ "sp-storage", ] +[[package]] +name = "sp-genesis-builder" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +dependencies = [ + "serde_json", + "sp-api", + "sp-runtime", + "sp-std", +] + [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -2691,10 +3157,9 @@ dependencies = [ [[package]] name = "sp-io" version = "23.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "bytes", - "ed25519", "ed25519-dalek", "libsecp256k1", "log", @@ -2716,7 +3181,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.27.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "parity-scale-codec", "parking_lot", @@ -2728,7 +3193,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -2739,7 +3204,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "backtrace", "lazy_static", @@ -2749,7 +3214,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "24.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "either", "hash256-std-hasher", @@ -2771,7 +3236,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -2789,7 +3254,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "Inflector", "proc-macro-crate", @@ -2801,7 +3266,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -2815,7 +3280,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.28.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "hash-db", "log", @@ -2836,12 +3301,12 @@ dependencies = [ [[package]] name = "sp-std" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" [[package]] name = "sp-storage" version = "13.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "impl-serde", "parity-scale-codec", @@ -2854,7 +3319,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "async-trait", "parity-scale-codec", @@ -2867,7 +3332,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "parity-scale-codec", "sp-std", @@ -2879,7 +3344,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "22.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "ahash 0.8.6", "hash-db", @@ -2902,7 +3367,7 @@ dependencies = [ [[package]] name = "sp-version" version = "22.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "impl-serde", "parity-scale-codec", @@ -2919,7 +3384,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -2930,7 +3395,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "14.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -2943,7 +3408,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "20.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" dependencies = [ "parity-scale-codec", "scale-info", @@ -3045,6 +3510,15 @@ version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" +[[package]] +name = "termcolor" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.50" @@ -3118,11 +3592,26 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "toml" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + [[package]] name = "toml_datetime" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -3131,6 +3620,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.0.2", + "serde", + "serde_spanned", "toml_datetime", "winnow", ] @@ -3212,9 +3703,9 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "767abe6ffed88a1889671a102c2861ae742726f52e0a5a425b92c9fbfa7e9c85" +checksum = "ff28e0f815c2fea41ebddf148e008b077d2faddb026c9555b29696114d602642" dependencies = [ "hash-db", "hashbrown 0.13.2", @@ -3318,6 +3809,16 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -3552,6 +4053,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/README.md b/README.md index 2959cf0d..5627ceea 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ An index is a short and easy-to-remember version of an address. Claiming an inde The Recovery pallet is an M-of-N social recovery tool for users to gain access to their accounts if the private key or other authentication mechanism is lost. Through this pallet, a user is able to make calls on-behalf-of another account which they have recovered. The recovery process is protected by trusted "friends" whom the original account owner chooses. A threshold (M) out of N friends are needed to give another account access to the recoverable account. -#### [Uniques (NFTs)](https://github.com/paritytech/substrate/tree/master/frame/uniques) +#### [Uniques (NFTs)](https://github.com/paritytech/polkadot-sdk/tree/master/frame/uniques) A simple, secure module for dealing with non-fungible assets. @@ -235,7 +235,7 @@ the following: ### Pallets The runtime in this project is constructed using many FRAME pallets that ship with the -[core Substrate repository](https://github.com/paritytech/substrate/tree/master/frame) and a +[core Substrate repository](https://github.com/paritytech/polkadot-sdk/tree/master/frame) and a template pallet that is [defined in the `pallets`](./pallets/template/src/lib.rs) directory. A FRAME pallet is compromised of a number of blockchain primitives: diff --git a/docs/learning-path.md b/docs/learning-path.md index f80e998f..e972e9f0 100644 --- a/docs/learning-path.md +++ b/docs/learning-path.md @@ -65,7 +65,7 @@ Now that you have an idea for the environment, dive deeper into both the Rust tr - [PolkaWallet Flutter SDK](https://github.com/polkawallet-io/sdk) - [Front End template](https://github.com/substrate-developer-hub/substrate-front-end-template) from Parity -2. Review tooling for data caching and query -[Useful API sidecar](https://github.com/paritytech/substrate-api-sidecar) from Parity -[Awesome Substrate tools section](https://substrate.io/ecosystem/resources/awesome-substrate/#tools) +2. Review tooling for data caching and query -[Useful API sidecar](https://github.com/paritytech/polkadot-sdk-api-sidecar) from Parity -[Awesome Substrate tools section](https://substrate.io/ecosystem/resources/awesome-substrate/#tools) ### Tools and Tips diff --git a/docs/pallets-review/fruniques.md b/docs/pallets-review/fruniques.md index ec425565..af71165b 100644 --- a/docs/pallets-review/fruniques.md +++ b/docs/pallets-review/fruniques.md @@ -2,34 +2,34 @@ ## Spawn mechanism -Taken from #1 +Taken from #1 `Fruniques` is a stateful pallet. It needs to store additional data to maintain various relationships and state. We need to design/build the data structure for this additional state, as described below. There are a few NFT protocols in the Polkadot ecosystem: https://wiki.polkadot.network/docs/learn-nft -Of these, we should build to the [`Uniques` ](https://wiki.polkadot.network/docs/learn-nft#uniques) patterns. It is the implementation from Parity and I believe the most recent. It is the only one compatible with Statemint/Statemine. We can build to multiple protocols if it makes sense, but let's start with `Uniques`. +Of these, we should build to the [`Uniques` ](https://wiki.polkadot.network/docs/learn-nft#uniques) patterns. It is the implementation from Parity and I believe the most recent. It is the only one compatible with Statemint/Statemine. We can build to multiple protocols if it makes sense, but let's start with `Uniques`. -In addition to a regular `Unique`, a [`Frunique`](https://hashed.systems/hashed-chain) needs to store a reference to the parent, a different `Unique`. There also needs to be a heuristic for specifying if metadata is inherited from the parent or not. It seems like Metadata is a set of Key:Value pairs that can be assigned at the `class` level (a group or collection of NFTs) and at the `instance` level (a single NFT). +In addition to a regular `Unique`, a [`Frunique`](https://hashed.systems/hashed-chain) needs to store a reference to the parent, a different `Unique`. There also needs to be a heuristic for specifying if metadata is inherited from the parent or not. It seems like Metadata is a set of Key:Value pairs that can be assigned at the `class` level (a group or collection of NFTs) and at the `instance` level (a single NFT). -Here's the function `set_attribute`: -https://github.com/paritytech/substrate/blob/master/frame/uniques/src/lib.rs#L959 +Here's the function `set_attribute`: +https://github.com/paritytech/polkadot-sdk/blob/master/frame/uniques/src/lib.rs#L959 -Let's map the cannabis lifecycle. +Let's map the cannabis lifecycle. > NOTE: the cannabis use case may be able to be implemented with a lighter weight protocol, but it seems like it might be handy to use the same structure -1. Seeds come from a vendor as a package with a count, e.g. 100 seeds in a bag. This bag is an `InstanceId` even though it actually contains 100 seeds. +1. Seeds come from a vendor as a package with a count, e.g. 100 seeds in a bag. This bag is an `InstanceId` even though it actually contains 100 seeds. 2. Seeds that germinate get cubed; others are scrapped. 3. When a seed is cubed, it receives its own `InstanceID` (I've been calling this a `spawn` function) for the first time. The count of seeds that did germinate should be tracked, but not individually, and they are scrapped. 4. Successful cubed seeds become mother plants; perhaps through some iteration or trial/error to discover most productive mother(s). 5. Mother plants produce clones (and may produce flower directly). -7. The parent-->child relationship is well represented as a [Directed Acyclic Graph](https://hazelcast.com/glossary/directed-acyclic-graph), which is what we are building on chain. +7. The parent-->child relationship is well represented as a [Directed Acyclic Graph](https://hazelcast.com/glossary/directed-acyclic-graph), which is what we are building on chain. 8. Clones may be sold directly to clone buyers. -7. Clones produce flower, measured in weight. When flower is harvested, the weight values of the material are recorded as continuous value. So the `InstanceId` would map this specific `bag of weed`, and there would also be a data element for weight. +7. Clones produce flower, measured in weight. When flower is harvested, the weight values of the material are recorded as continuous value. So the `InstanceId` would map this specific `bag of weed`, and there would also be a data element for weight. -The sum of this continuous value for all peers should always equal the continuous value of the parent. This is a critical feature that maintains the economic hierarchy of the NFTs. Tax credits can be subdivided based on this continuous value, but just like the weed, none can be lost or compromised along the way. This feature - the `NFT Rollup` enables many use cases. +The sum of this continuous value for all peers should always equal the continuous value of the parent. This is a critical feature that maintains the economic hierarchy of the NFTs. Tax credits can be subdivided based on this continuous value, but just like the weed, none can be lost or compromised along the way. This feature - the `NFT Rollup` enables many use cases. 9. Flower gets tested, and results are implied across that entire harvest/mother? The test results include a set of files and also a set of values. We need a structure to assign this data/metadata across the appropriate `InstanceIds`. -10. Flower is sold to dispensaries. +10. Flower is sold to dispensaries. - [ ] Research and prototype a pallet data storage mapping to hold the appropriate data to maintain the hierarchy and enforce the aggregation rules. diff --git a/pallets/afloat/Cargo.toml b/pallets/afloat/Cargo.toml index 6def8a88..839859f0 100644 --- a/pallets/afloat/Cargo.toml +++ b/pallets/afloat/Cargo.toml @@ -17,25 +17,25 @@ log = "0.4" codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } serde = { version = "1.0.140", default-features = false, features = ["derive"] } scale-info = { version = "2.5.0", default-features = false, features = [ - "derive" + "derive", ] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -pallet-uniques = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } pallet-fruniques = { path = "../fruniques", default-features = false, version = "0.1.0-dev" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } pallet-gated-marketplace = { path = "../gated-marketplace/", default-features = false, version = "4.0.0-dev" } pallet-mapped-assets = { path = "../mapped-assets/", default-features = false, version = "4.0.0-dev" } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } [features] default = ["std"] diff --git a/pallets/afloat/src/functions.rs b/pallets/afloat/src/functions.rs index c9711dcf..5b3fffde 100644 --- a/pallets/afloat/src/functions.rs +++ b/pallets/afloat/src/functions.rs @@ -7,9 +7,10 @@ use pallet_gated_marketplace::types::{Marketplace, MarketplaceRole}; 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 frame_support::traits::Time; use pallet_rbac::types::{IdOrVec, RoleBasedAccessControl, RoleId}; use scale_info::prelude::vec; +use sp_io::hashing::blake2_256; use sp_runtime::{ sp_std::{str, vec::Vec}, traits::Zero, diff --git a/pallets/bitcoin-vaults/Cargo.toml b/pallets/bitcoin-vaults/Cargo.toml index 08811172..11ab6a55 100644 --- a/pallets/bitcoin-vaults/Cargo.toml +++ b/pallets/bitcoin-vaults/Cargo.toml @@ -18,19 +18,19 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = serde = { version = "1.0.140", default-features = false, features = ["derive"] } lite-json = { version = "0.2", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ - "derive" + "derive", ] } -frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true } -sp-core = { version = "21.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-io = { version = "23.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-std = { version = "8.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true } +frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } +sp-core = { version = "21.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } [dev-dependencies] -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [features] default = ["std"] diff --git a/pallets/bitcoin-vaults/src/functions.rs b/pallets/bitcoin-vaults/src/functions.rs index 613af6a3..de6546fe 100644 --- a/pallets/bitcoin-vaults/src/functions.rs +++ b/pallets/bitcoin-vaults/src/functions.rs @@ -1,6 +1,6 @@ use super::*; use crate::types::*; -use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256}; +use frame_support::pallet_prelude::*; use frame_system::{ offchain::{SendUnsignedTransaction, Signer}, pallet_prelude::BlockNumberFor, @@ -9,6 +9,7 @@ use lite_json::{ json::{JsonValue, NumberValue}, parse_json, Serialize as jsonSerialize, }; +use sp_io::hashing::blake2_256; use sp_runtime::{ offchain::{http, Duration}, sp_std::{str, vec::Vec}, diff --git a/pallets/bitcoin-vaults/src/lib.rs b/pallets/bitcoin-vaults/src/lib.rs index 5a333275..a7fc16b1 100644 --- a/pallets/bitcoin-vaults/src/lib.rs +++ b/pallets/bitcoin-vaults/src/lib.rs @@ -20,11 +20,12 @@ pub mod pallet { //#[cfg(feature = "std")] //use frame_support::serde::{Deserialize, Serialize}; use crate::types::*; - use frame_support::{pallet_prelude::BoundedVec, sp_io::hashing::blake2_256, traits::Get}; + use frame_support::{pallet_prelude::BoundedVec, traits::Get}; use frame_system::{ offchain::{AppCrypto, CreateSignedTransaction, SignedPayload, Signer}, pallet_prelude::*, }; + use sp_io::hashing::blake2_256; use sp_runtime::{ offchain::{ storage_lock::{BlockAndTime, StorageLock}, @@ -45,7 +46,7 @@ pub mod pallet { pub _config: sp_std::marker::PhantomData, } - #[cfg(feature = "std")] + // #[cfg(feature = "std")] impl Default for GenesisConfig { fn default() -> Self { Self { diff --git a/pallets/bitcoin-vaults/src/types.rs b/pallets/bitcoin-vaults/src/types.rs index 7eb20b73..3e247687 100644 --- a/pallets/bitcoin-vaults/src/types.rs +++ b/pallets/bitcoin-vaults/src/types.rs @@ -1,7 +1,8 @@ use super::*; -use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256}; +use frame_support::pallet_prelude::*; use frame_system::offchain::{SignedPayload, SigningTypes}; use sp_core::crypto::KeyTypeId; +use sp_io::hashing::blake2_256; use sp_runtime::sp_std::vec::Vec; pub type Description = BoundedVec::VaultDescriptionMaxLen>; diff --git a/pallets/confidential-docs/Cargo.toml b/pallets/confidential-docs/Cargo.toml index 8407bce9..1c75179b 100644 --- a/pallets/confidential-docs/Cargo.toml +++ b/pallets/confidential-docs/Cargo.toml @@ -15,16 +15,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ - "derive" + "derive", ] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } +sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [features] default = ["std"] diff --git a/pallets/confidential-docs/src/functions.rs b/pallets/confidential-docs/src/functions.rs index 1d239d28..78dcbd20 100644 --- a/pallets/confidential-docs/src/functions.rs +++ b/pallets/confidential-docs/src/functions.rs @@ -1,5 +1,6 @@ use super::*; -use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256}; +use frame_support::pallet_prelude::*; +use sp_io::hashing::blake2_256; //use frame_system::pallet_prelude::*; use crate::types::*; diff --git a/pallets/confidential-docs/src/tests.rs b/pallets/confidential-docs/src/tests.rs index 6e4c072d..7d5abbf8 100644 --- a/pallets/confidential-docs/src/tests.rs +++ b/pallets/confidential-docs/src/tests.rs @@ -1,7 +1,8 @@ use crate::{mock::*, types::*, Error, Event}; use codec::Encode; -use frame_support::{assert_noop, assert_ok, sp_io::hashing::blake2_256}; +use frame_support::{assert_noop, assert_ok}; use frame_system as system; +use sp_io::hashing::blake2_256; fn generate_user_id(id: &str) -> UserId { format!("user id: {}", id).using_encoded(blake2_256) diff --git a/pallets/fruniques/Cargo.toml b/pallets/fruniques/Cargo.toml index e6809d56..95aa24b2 100644 --- a/pallets/fruniques/Cargo.toml +++ b/pallets/fruniques/Cargo.toml @@ -16,19 +16,20 @@ targets = ["x86_64-unknown-linux-gnu"] log = { version = "0.4.17", default-features = false } codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } scale-info = { default-features = false, version = "2.5.0", features = [ - "derive" + "derive", ] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", optional = true } -sp-runtime = { version = "24.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -pallet-uniques = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", optional = true } +sp-runtime = { version = "24.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +pallet-uniques = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [dev-dependencies] -sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -sp-io = { version = "23.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +sp-io = { version = "23.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } [features] default = ["std"] diff --git a/pallets/fruniques/src/functions.rs b/pallets/fruniques/src/functions.rs index 843fd403..a19a516f 100644 --- a/pallets/fruniques/src/functions.rs +++ b/pallets/fruniques/src/functions.rs @@ -1,9 +1,10 @@ use super::*; use crate::types::*; -use frame_support::{sp_io::hashing::blake2_256, traits::tokens::nonfungibles::Inspect}; +use frame_support::traits::tokens::nonfungibles::Inspect; use frame_system::pallet_prelude::*; use scale_info::prelude::string::String; +use sp_io::hashing::blake2_256; use pallet_rbac::types::*; diff --git a/pallets/fruniques/src/types.rs b/pallets/fruniques/src/types.rs index 93a2ea93..bc2ca6c5 100644 --- a/pallets/fruniques/src/types.rs +++ b/pallets/fruniques/src/types.rs @@ -2,7 +2,7 @@ use super::*; use frame_support::pallet_prelude::*; -use frame_support::sp_io::hashing::blake2_256; +use sp_io::hashing::blake2_256; use sp_runtime::{sp_std::vec::Vec, Permill}; pub type AttributeKey = BoundedVec::KeyLimit>; diff --git a/pallets/fund-admin-records/Cargo.toml b/pallets/fund-admin-records/Cargo.toml index a8353867..e87f9288 100644 --- a/pallets/fund-admin-records/Cargo.toml +++ b/pallets/fund-admin-records/Cargo.toml @@ -16,17 +16,18 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4" codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } scale-info = { version = "2.0.1", default-features = false, features = [ - "derive" + "derive", ] } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", optional = true } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", optional = true } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } [features] default = ["std"] @@ -36,7 +37,7 @@ std = [ "frame-support/std", "frame-system/std", "frame-benchmarking/std", - "pallet-timestamp/std" + "pallet-timestamp/std", ] runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/fund-admin-records/src/functions.rs b/pallets/fund-admin-records/src/functions.rs index 71617654..e8941cc6 100644 --- a/pallets/fund-admin-records/src/functions.rs +++ b/pallets/fund-admin-records/src/functions.rs @@ -1,5 +1,6 @@ use super::*; -use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256, traits::Time}; +use frame_support::{pallet_prelude::*, traits::Time}; +use sp_io::hashing::blake2_256; use crate::types::*; diff --git a/pallets/fund-admin-records/src/tests.rs b/pallets/fund-admin-records/src/tests.rs index af157994..39f0b886 100644 --- a/pallets/fund-admin-records/src/tests.rs +++ b/pallets/fund-admin-records/src/tests.rs @@ -1,5 +1,6 @@ use crate::{mock::*, types::*, Error, Records}; -use frame_support::{assert_noop, assert_ok, bounded_vec}; +use frame_support::{assert_noop, assert_ok}; +use sp_core::bounded_vec; fn make_project_id(v: &str) -> ProjectId { let v: ProjectId = v.as_bytes().to_vec().try_into().unwrap_or_default(); diff --git a/pallets/fund-admin/Cargo.toml b/pallets/fund-admin/Cargo.toml index f78e9bc3..d61a25eb 100644 --- a/pallets/fund-admin/Cargo.toml +++ b/pallets/fund-admin/Cargo.toml @@ -16,19 +16,20 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4" codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } scale-info = { version = "2.0.1", default-features = false, features = [ - "derive" + "derive", ] } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", optional = true } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", optional = true } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } pallet-rbac = { default-features = false, version = "4.0.0-dev", path = "../rbac/" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } [features] default = ["std"] diff --git a/pallets/fund-admin/src/functions.rs b/pallets/fund-admin/src/functions.rs index 5faf71f5..16d00168 100644 --- a/pallets/fund-admin/src/functions.rs +++ b/pallets/fund-admin/src/functions.rs @@ -1,5 +1,6 @@ use super::*; -use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256}; +use frame_support::{pallet_prelude::*}; +use sp_io::hashing::blake2_256; use scale_info::prelude::vec; use sp_runtime::sp_std::vec::Vec; // vec primitive // vec![] macro diff --git a/pallets/fund-admin/src/migration.rs b/pallets/fund-admin/src/migration.rs index 9adde220..2dc1ec66 100644 --- a/pallets/fund-admin/src/migration.rs +++ b/pallets/fund-admin/src/migration.rs @@ -3,8 +3,9 @@ use super::*; const LOG_TARGET: &str = "\nFund Admin pallet migration "; use crate::types::*; -use frame_support::{log, pallet_prelude::*, storage_alias, traits::OnRuntimeUpgrade, Identity}; -use sp_runtime::{sp_std::vec::Vec, Saturating}; +use frame_support::{pallet_prelude::*, storage_alias, traits::OnRuntimeUpgrade, Identity}; +use log; +use sp_runtime::Saturating; mod v0 { use super::*; diff --git a/pallets/fund-admin/src/tests.rs b/pallets/fund-admin/src/tests.rs index c9d233f7..40283513 100644 --- a/pallets/fund-admin/src/tests.rs +++ b/pallets/fund-admin/src/tests.rs @@ -5,8 +5,18 @@ use crate::{ TransactionsByRevenue, TransactionsInfo, UsersByProject, UsersInfo, }; use frame_support::{ - assert_noop, assert_ok, bounded_vec, error::BadOrigin, traits::ConstU32, BoundedVec, + assert_noop, assert_ok, + error::BadOrigin, + traits::{ + tokens::{ + fungible::Mutate, + Preservation::{Expendable, Preserve, Protect}, + }, + ConstU32, + }, + BoundedVec, }; +use sp_core::bounded_vec; use sp_runtime::DispatchResult; type RbacErr = pallet_rbac::Error; @@ -644,12 +654,8 @@ fn balances_an_administrator_goes_out_of_balance_should_fail() { let admin_free_balance = Balances::free_balance(1); assert_eq!(admin_free_balance, InitialAdminBalance::get() - TransferAmount::get()); - Balances::transfer( - RuntimeOrigin::signed(1), - 2, - admin_free_balance - TransferAmount::get() / 2, - ) - .unwrap(); + Balances::transfer(&1, &2, admin_free_balance - TransferAmount::get() / 2, Expendable) + .unwrap(); assert_noop!( FundAdmin::users( @@ -684,7 +690,7 @@ fn balances_an_administrator_does_not_have_anough_free_balance_to_perform_a_user let admin_free_balance = Balances::free_balance(1); assert_eq!(admin_free_balance, InitialAdminBalance::get() - TransferAmount::get()); - Balances::transfer(RuntimeOrigin::signed(1), 2, admin_free_balance).unwrap(); + Balances::transfer(&1, &2, admin_free_balance, Expendable).unwrap(); assert_noop!( FundAdmin::users( diff --git a/pallets/fund-admin/src/types.rs b/pallets/fund-admin/src/types.rs index e95b3584..294f84fb 100644 --- a/pallets/fund-admin/src/types.rs +++ b/pallets/fund-admin/src/types.rs @@ -1,5 +1,6 @@ use super::*; -use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256}; +use frame_support::pallet_prelude::*; +use sp_io::hashing::blake2_256; use sp_runtime::sp_std::vec::Vec; pub type FieldName = BoundedVec>; diff --git a/pallets/gated-marketplace/Cargo.toml b/pallets/gated-marketplace/Cargo.toml index 024c5abe..fe39ef6c 100644 --- a/pallets/gated-marketplace/Cargo.toml +++ b/pallets/gated-marketplace/Cargo.toml @@ -17,23 +17,24 @@ log = "0.4" codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } serde = { version = "1.0.140", default-features = false, features = ["derive"] } scale-info = { version = "2.5.0", default-features = false, features = [ - "derive" + "derive", ] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -pallet-uniques = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } pallet-fruniques = { path = "../fruniques", default-features = false, version = "0.1.0-dev" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } pallet-mapped-assets = { path = "../mapped-assets/", default-features = false, version = "4.0.0-dev" } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [features] default = ["std"] @@ -49,7 +50,7 @@ std = [ "pallet-fruniques/std", "pallet-timestamp/std", "pallet-rbac/std", - "pallet-mapped-assets/std" + "pallet-mapped-assets/std", ] runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/gated-marketplace/src/functions.rs b/pallets/gated-marketplace/src/functions.rs index a97da208..04a496f0 100644 --- a/pallets/gated-marketplace/src/functions.rs +++ b/pallets/gated-marketplace/src/functions.rs @@ -1,6 +1,7 @@ use super::*; use crate::types::*; -use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256, traits::Time}; +use frame_support::{pallet_prelude::*, traits::Time}; +use sp_io::hashing::blake2_256; use frame_system::{pallet_prelude::*, RawOrigin}; use pallet_rbac::types::*; use scale_info::prelude::vec; // vec![] macro diff --git a/pallets/gated-marketplace/src/types.rs b/pallets/gated-marketplace/src/types.rs index a3efd6ca..5623d4fd 100644 --- a/pallets/gated-marketplace/src/types.rs +++ b/pallets/gated-marketplace/src/types.rs @@ -1,7 +1,7 @@ use super::*; use frame_support::pallet_prelude::*; //use frame_system::pallet_prelude::*; -use frame_support::sp_io::hashing::blake2_256; +use sp_io::hashing::blake2_256; use sp_runtime::sp_std::vec::Vec; pub type Fields = BoundedVec<(FieldName, Cid), ::MaxFiles>; diff --git a/pallets/mapped-assets/Cargo.toml b/pallets/mapped-assets/Cargo.toml index 8f647e4a..40ba2e97 100644 --- a/pallets/mapped-assets/Cargo.toml +++ b/pallets/mapped-assets/Cargo.toml @@ -16,23 +16,24 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ - "derive" + "derive", ] } -sp-std = { version = "8.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } # Needed for various traits. In our case, `OnFinalize`. -sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } # Needed for type-safe access to storage DB. -frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } # `system` module provides us with all sorts of useful stuff and macros depend on it being around. -frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true } -sp-core = { version = "21.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } +sp-core = { version = "21.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } pallet-rbac = { default-features = false, version = "4.0.0-dev", path = "../rbac/" } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [dev-dependencies] -sp-std = { version = "8.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-io = { version = "23.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } [features] default = ["std"] diff --git a/pallets/mapped-assets/src/functions.rs b/pallets/mapped-assets/src/functions.rs index a86c518a..125d8558 100644 --- a/pallets/mapped-assets/src/functions.rs +++ b/pallets/mapped-assets/src/functions.rs @@ -19,10 +19,11 @@ use super::*; use codec::Encode; -use frame_support::{defensive, sp_io::hashing::blake2_256, traits::Get, BoundedVec}; +use frame_support::{defensive, traits::Get, BoundedVec}; use pallet_rbac::types::{IdOrVec, RoleBasedAccessControl}; use scale_info::prelude::vec; -use sp_runtime::sp_std::vec::Vec; +use sp_io::hashing::blake2_256; +use sp_runtime::{sp_std::vec::Vec, DispatchError}; #[must_use] pub(super) enum DeadConsequence { diff --git a/pallets/mapped-assets/src/impl_fungibles.rs b/pallets/mapped-assets/src/impl_fungibles.rs index a7df3d15..b94f2b11 100644 --- a/pallets/mapped-assets/src/impl_fungibles.rs +++ b/pallets/mapped-assets/src/impl_fungibles.rs @@ -27,6 +27,8 @@ use frame_support::{ }, }; +use sp_runtime::DispatchError; + use super::*; impl, I: 'static> fungibles::Inspect<::AccountId> for Pallet { diff --git a/pallets/mapped-assets/src/impl_stored_map.rs b/pallets/mapped-assets/src/impl_stored_map.rs index a7a5a085..7592e1cf 100644 --- a/pallets/mapped-assets/src/impl_stored_map.rs +++ b/pallets/mapped-assets/src/impl_stored_map.rs @@ -18,6 +18,7 @@ //! Assets pallet's `StoredMap` implementation. use super::*; +use sp_runtime::DispatchError; impl, I: 'static> StoredMap<(T::AssetId, T::AccountId), T::Extra> for Pallet { fn get(id_who: &(T::AssetId, T::AccountId)) -> T::Extra { diff --git a/pallets/mapped-assets/src/lib.rs b/pallets/mapped-assets/src/lib.rs index 2cdb2e5c..eed01494 100644 --- a/pallets/mapped-assets/src/lib.rs +++ b/pallets/mapped-assets/src/lib.rs @@ -165,7 +165,7 @@ use sp_runtime::{ use sp_std::prelude::*; use frame_support::{ - dispatch::{DispatchError, DispatchResult}, + dispatch::DispatchResult, ensure, pallet_prelude::DispatchResultWithPostInfo, storage::KeyPrefixIterator, diff --git a/pallets/mapped-assets/src/migration.rs b/pallets/mapped-assets/src/migration.rs index d854a64a..efe77714 100644 --- a/pallets/mapped-assets/src/migration.rs +++ b/pallets/mapped-assets/src/migration.rs @@ -16,7 +16,8 @@ // limitations under the License. use super::*; -use frame_support::{log, traits::OnRuntimeUpgrade}; +use frame_support::traits::OnRuntimeUpgrade; +use log; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; diff --git a/pallets/mapped-assets/src/mock.rs b/pallets/mapped-assets/src/mock.rs index 09074099..ef8eb605 100644 --- a/pallets/mapped-assets/src/mock.rs +++ b/pallets/mapped-assets/src/mock.rs @@ -245,7 +245,7 @@ pub(crate) fn new_test_ext() -> sp_io::TestExternalities { config.assimilate_storage(&mut storage).unwrap(); let mut ext: sp_io::TestExternalities = storage.into(); - // Clear thread local vars for https://github.com/paritytech/substrate/issues/10479. + // Clear thread local vars for https://github.com/paritytech/polkadot-sdk/issues/10479. ext.execute_with(|| take_hooks()); ext.execute_with(|| System::set_block_number(1)); ext diff --git a/pallets/mapped-assets/src/types.rs b/pallets/mapped-assets/src/types.rs index 04c98896..6726066e 100644 --- a/pallets/mapped-assets/src/types.rs +++ b/pallets/mapped-assets/src/types.rs @@ -20,9 +20,9 @@ use super::*; use frame_support::{ pallet_prelude::*, - sp_io::hashing::blake2_256, traits::{fungible, tokens::ConversionToAssetBalance}, }; +use sp_io::hashing::blake2_256; use sp_runtime::{traits::Convert, FixedPointNumber, FixedPointOperand, FixedU128}; pub(super) type DepositBalanceOf = diff --git a/pallets/rbac/Cargo.toml b/pallets/rbac/Cargo.toml index 9e47b2f6..b78b202b 100644 --- a/pallets/rbac/Cargo.toml +++ b/pallets/rbac/Cargo.toml @@ -16,16 +16,18 @@ targets = ["x86_64-unknown-linux-gnu"] log = "0.4" codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ - "derive" + "derive", ] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false, optional = true } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [features] default = ["std"] diff --git a/pallets/rbac/src/functions.rs b/pallets/rbac/src/functions.rs index 95cab53b..23c164a5 100644 --- a/pallets/rbac/src/functions.rs +++ b/pallets/rbac/src/functions.rs @@ -1,8 +1,9 @@ use super::*; use frame_support::pallet_prelude::*; //use frame_system::pallet_prelude::*; -use frame_support::{sp_io::hashing::blake2_256, sp_std::borrow::ToOwned}; +use sp_io::hashing::blake2_256; use sp_runtime::sp_std::vec::Vec; +use sp_std::borrow::ToOwned; use crate::types::*; diff --git a/pallets/rbac/src/types.rs b/pallets/rbac/src/types.rs index ab5fd9a6..37d18f83 100644 --- a/pallets/rbac/src/types.rs +++ b/pallets/rbac/src/types.rs @@ -1,5 +1,6 @@ //use super::*; -use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256}; +use frame_support::pallet_prelude::*; +use sp_io::hashing::blake2_256; use sp_runtime::sp_std::vec::Vec; pub type PalletId = [u8; 32]; diff --git a/pallets/template/Cargo.toml b/pallets/template/Cargo.toml index 06adf862..114a13cf 100644 --- a/pallets/template/Cargo.toml +++ b/pallets/template/Cargo.toml @@ -16,18 +16,18 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } log = { version = "0.4.14", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ - "derive" + "derive", ] } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", optional = true } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", optional = true } +sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } -sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } [features] default = ["std"] From 8cac63a93342c35013a434a2905a1124f212c3fc Mon Sep 17 00:00:00 2001 From: Sebastian Montero Date: Wed, 1 Nov 2023 08:47:59 -0600 Subject: [PATCH 23/34] Fixed mock afloat assets callback handler. --- pallets/afloat/Cargo.toml | 1 + pallets/afloat/src/mock.rs | 12 ++++++++---- pallets/afloat/src/types.rs | 3 ++- pallets/bitcoin-vaults/Cargo.toml | 8 ++++---- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pallets/afloat/Cargo.toml b/pallets/afloat/Cargo.toml index 839859f0..d9947668 100644 --- a/pallets/afloat/Cargo.toml +++ b/pallets/afloat/Cargo.toml @@ -30,6 +30,7 @@ pallet-fruniques = { path = "../fruniques", default-features = false, version = pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } pallet-gated-marketplace = { path = "../gated-marketplace/", default-features = false, version = "4.0.0-dev" } pallet-mapped-assets = { path = "../mapped-assets/", default-features = false, version = "4.0.0-dev" } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } [dev-dependencies] sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } diff --git a/pallets/afloat/src/mock.rs b/pallets/afloat/src/mock.rs index be49cce7..0543bbb3 100644 --- a/pallets/afloat/src/mock.rs +++ b/pallets/afloat/src/mock.rs @@ -1,7 +1,7 @@ -use crate as pallet_afloat; +use crate::{self as pallet_afloat, types::InitialSetupArgs}; use frame_support::{ parameter_types, - traits::{AsEnsureOriginWithArg, ConstU128, ConstU32, ConstU64, Currency}, + traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, Currency}, }; use frame_system as system; use sp_core::H256; @@ -207,9 +207,13 @@ pub trait AssetsCallback { pub struct AssetsCallbackHandle; impl pallet_mapped_assets::AssetsCallback for AssetsCallbackHandle { - fn created(_id: &AssetId, _owner: &u64) -> Result<(), ()> {} + fn created(_id: &AssetId, _owner: &u64) -> Result<(), ()> { + Ok(()) + } - fn destroyed(_id: &AssetId) -> Result<(), ()> {} + fn destroyed(_id: &AssetId) -> Result<(), ()> { + Ok(()) + } } impl pallet_mapped_assets::Config for Test { diff --git a/pallets/afloat/src/types.rs b/pallets/afloat/src/types.rs index 8eb5d8c1..4b5dc017 100644 --- a/pallets/afloat/src/types.rs +++ b/pallets/afloat/src/types.rs @@ -1,6 +1,7 @@ use super::*; -use frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256}; +use frame_support::pallet_prelude::*; use pallet_fruniques::types::FruniqueRole; +use sp_io::hashing::blake2_256; use sp_runtime::sp_std::vec::Vec; pub type ShortString = BoundedVec>; diff --git a/pallets/bitcoin-vaults/Cargo.toml b/pallets/bitcoin-vaults/Cargo.toml index 11ab6a55..ff3c78c6 100644 --- a/pallets/bitcoin-vaults/Cargo.toml +++ b/pallets/bitcoin-vaults/Cargo.toml @@ -23,10 +23,10 @@ scale-info = { version = "2.5.0", default-features = false, features = [ frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } -sp-core = { version = "21.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } [dev-dependencies] From 665298f4e3a97eb2eef0876495a85dba208b7202 Mon Sep 17 00:00:00 2001 From: Sebastian Montero Date: Thu, 2 Nov 2023 18:11:38 -0600 Subject: [PATCH 24/34] Updated polkadot version to 1.3 --- Cargo.lock | 161 +++++++++++++++++--------- pallets/afloat/Cargo.toml | 24 ++-- pallets/bitcoin-vaults/Cargo.toml | 18 +-- pallets/confidential-docs/Cargo.toml | 14 +-- pallets/fruniques/Cargo.toml | 18 +-- pallets/fund-admin-records/Cargo.toml | 16 +-- pallets/fund-admin/Cargo.toml | 18 +-- pallets/gated-marketplace/Cargo.toml | 22 ++-- pallets/mapped-assets/Cargo.toml | 20 ++-- pallets/rbac/Cargo.toml | 16 +-- pallets/template/Cargo.toml | 16 +-- 11 files changed, 196 insertions(+), 147 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a6c1abc..e8f56949 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -122,6 +122,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb00293ba84f51ce3bd026bd0de55899c4e68f0a39a5728cebae3a73ffdc0a4f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + [[package]] name = "ark-bls12-381" version = "0.4.0" @@ -221,21 +232,22 @@ dependencies = [ [[package]] name = "ark-scale" -version = "0.0.10" +version = "0.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b08346a3e38e2be792ef53ee168623c9244d968ff00cd70fb9932f6fe36393" +checksum = "51bd73bb6ddb72630987d37fa963e99196896c0d0ea81b7c894567e74a2f83af" dependencies = [ "ark-ec", "ark-ff", "ark-serialize", "ark-std", "parity-scale-codec", + "scale-info", ] [[package]] name = "ark-secret-scalar" version = "0.0.2" -source = "git+https://github.com/w3f/ring-vrf?rev=f4fe253#f4fe2534ccc6d916cd10d9c16891e673728ec8b4" +source = "git+https://github.com/w3f/ring-vrf?rev=4b09416#4b09416fd23383ec436ddac127d58c7b7cd392c6" dependencies = [ "ark-ec", "ark-ff", @@ -283,7 +295,7 @@ dependencies = [ [[package]] name = "ark-transcript" version = "0.0.2" -source = "git+https://github.com/w3f/ring-vrf?rev=f4fe253#f4fe2534ccc6d916cd10d9c16891e673728ec8b4" +source = "git+https://github.com/w3f/ring-vrf?rev=4b09416#4b09416fd23383ec436ddac127d58c7b7cd392c6" dependencies = [ "ark-ff", "ark-serialize", @@ -352,7 +364,7 @@ dependencies = [ [[package]] name = "bandersnatch_vrfs" version = "0.0.1" -source = "git+https://github.com/w3f/ring-vrf?rev=f4fe253#f4fe2534ccc6d916cd10d9c16891e673728ec8b4" +source = "git+https://github.com/w3f/ring-vrf?rev=4b09416#4b09416fd23383ec436ddac127d58c7b7cd392c6" dependencies = [ "ark-bls12-381", "ark-ec", @@ -576,7 +588,7 @@ dependencies = [ [[package]] name = "common" version = "0.1.0" -source = "git+https://github.com/w3f/ring-proof?rev=8657210#86572101f4210647984ab4efedba6b3fcc890895" +source = "git+https://github.com/w3f/ring-proof#edd1e90b847e560bf60fc2e8712235ccfa11a9a9" dependencies = [ "ark-ec", "ark-ff", @@ -626,6 +638,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +[[package]] +name = "constcat" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" + [[package]] name = "core-foundation-sys" version = "0.8.4" @@ -756,6 +774,7 @@ dependencies = [ "platforms", "rustc_version", "subtle", + "zeroize", ] [[package]] @@ -845,7 +864,7 @@ dependencies = [ [[package]] name = "dleq_vrf" version = "0.0.2" -source = "git+https://github.com/w3f/ring-vrf?rev=f4fe253#f4fe2534ccc6d916cd10d9c16891e673728ec8b4" +source = "git+https://github.com/w3f/ring-vrf?rev=4b09416#4b09416fd23383ec436ddac127d58c7b7cd392c6" dependencies = [ "ark-ec", "ark-ff", @@ -933,6 +952,7 @@ version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ + "pkcs8", "signature", ] @@ -944,7 +964,9 @@ checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ "curve25519-dalek 4.1.1", "ed25519", + "serde", "sha2 0.10.8", + "zeroize", ] [[package]] @@ -1086,7 +1108,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "frame-support", "frame-support-procedural", @@ -1123,7 +1145,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "aquamarine", "bitflags 1.3.2", @@ -1163,7 +1185,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "Inflector", "cfg-expr", @@ -1175,13 +1197,14 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", + "sp-core-hashing", "syn 2.0.38", ] [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1193,7 +1216,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "proc-macro2", "quote", @@ -1203,7 +1226,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "cfg-if", "frame-support", @@ -1776,9 +1799,9 @@ dependencies = [ [[package]] name = "macro_magic" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aee866bfee30d2d7e83835a4574aad5b45adba4cc807f2a3bbba974e5d4383c9" +checksum = "e03844fc635e92f3a0067e25fa4bf3e3dbf3f2927bf3aa01bb7bc8f1c428949d" dependencies = [ "macro_magic_core", "macro_magic_macros", @@ -1788,9 +1811,9 @@ dependencies = [ [[package]] name = "macro_magic_core" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e766a20fd9c72bab3e1e64ed63f36bd08410e75803813df210d1ce297d7ad00" +checksum = "468155613a44cfd825f1fb0ffa532b018253920d404e6fca1e8d43155198a46d" dependencies = [ "const-random", "derive-syn-parse", @@ -1802,9 +1825,9 @@ dependencies = [ [[package]] name = "macro_magic_core_macros" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d710e1214dffbab3b5dacb21475dde7d6ed84c69ff722b3a47a782668d44fbac" +checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", @@ -1813,9 +1836,9 @@ dependencies = [ [[package]] name = "macro_magic_macros" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" +checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", @@ -2076,7 +2099,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "frame-benchmarking", "frame-support", @@ -2233,7 +2256,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "docify", "frame-benchmarking", @@ -2253,7 +2276,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "frame-benchmarking", "frame-support", @@ -2434,9 +2457,9 @@ dependencies = [ [[package]] name = "proc-macro-warning" -version = "0.4.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" +checksum = "9b698b0b09d40e9b7c1a47b132d66a8b54bcd20583d9b6d06e4535e383b4405c" dependencies = [ "proc-macro2", "quote", @@ -2639,7 +2662,7 @@ dependencies = [ [[package]] name = "ring" version = "0.1.0" -source = "git+https://github.com/w3f/ring-proof?rev=8657210#86572101f4210647984ab4efedba6b3fcc890895" +source = "git+https://github.com/w3f/ring-proof#edd1e90b847e560bf60fc2e8712235ccfa11a9a9" dependencies = [ "ark-ec", "ark-ff", @@ -2980,7 +3003,7 @@ checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "hash-db", "log", @@ -3001,7 +3024,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "Inflector", "blake2", @@ -3015,7 +3038,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "parity-scale-codec", "scale-info", @@ -3028,7 +3051,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "integer-sqrt", "num-traits", @@ -3042,7 +3065,7 @@ dependencies = [ [[package]] name = "sp-core" version = "21.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "array-bytes", "bandersnatch_vrfs", @@ -3082,13 +3105,14 @@ dependencies = [ "thiserror", "tiny-bip39", "tracing", + "w3f-bls", "zeroize", ] [[package]] name = "sp-core-hashing" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "blake2b_simd", "byteorder", @@ -3101,7 +3125,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "quote", "sp-core-hashing", @@ -3111,7 +3135,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "proc-macro2", "quote", @@ -3121,7 +3145,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "environmental", "parity-scale-codec", @@ -3132,7 +3156,7 @@ dependencies = [ [[package]] name = "sp-genesis-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "serde_json", "sp-api", @@ -3143,7 +3167,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -3157,7 +3181,7 @@ dependencies = [ [[package]] name = "sp-io" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "bytes", "ed25519-dalek", @@ -3181,7 +3205,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.27.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "parity-scale-codec", "parking_lot", @@ -3193,7 +3217,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -3204,7 +3228,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "backtrace", "lazy_static", @@ -3214,7 +3238,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "either", "hash256-std-hasher", @@ -3236,7 +3260,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -3254,7 +3278,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "Inflector", "proc-macro-crate", @@ -3266,7 +3290,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -3280,7 +3304,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.28.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "hash-db", "log", @@ -3301,12 +3325,12 @@ dependencies = [ [[package]] name = "sp-std" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" [[package]] name = "sp-storage" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3319,7 +3343,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "async-trait", "parity-scale-codec", @@ -3332,7 +3356,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "parity-scale-codec", "sp-std", @@ -3344,7 +3368,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "ahash 0.8.6", "hash-db", @@ -3354,6 +3378,7 @@ dependencies = [ "nohash-hasher", "parity-scale-codec", "parking_lot", + "rand 0.8.5", "scale-info", "schnellru", "sp-core", @@ -3367,7 +3392,7 @@ dependencies = [ [[package]] name = "sp-version" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3384,7 +3409,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3395,7 +3420,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -3408,7 +3433,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.2.0#72c453563937c36b895c543bc5e852e213a54f19" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "parity-scale-codec", "scale-info", @@ -3809,6 +3834,30 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "w3f-bls" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7335e4c132c28cc43caef6adb339789e599e39adbe78da0c4d547fad48cbc331" +dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-serialize-derive", + "arrayref", + "constcat", + "digest 0.10.7", + "rand 0.8.5", + "rand_chacha 0.3.1", + "rand_core 0.6.4", + "sha2 0.10.8", + "sha3", + "thiserror", + "zeroize", +] + [[package]] name = "walkdir" version = "2.4.0" diff --git a/pallets/afloat/Cargo.toml b/pallets/afloat/Cargo.toml index d9947668..9532d211 100644 --- a/pallets/afloat/Cargo.toml +++ b/pallets/afloat/Cargo.toml @@ -19,24 +19,24 @@ serde = { version = "1.0.140", default-features = false, features = ["derive"] } scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } pallet-fruniques = { path = "../fruniques", default-features = false, version = "0.1.0-dev" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } pallet-gated-marketplace = { path = "../gated-marketplace/", default-features = false, version = "4.0.0-dev" } pallet-mapped-assets = { path = "../mapped-assets/", default-features = false, version = "4.0.0-dev" } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } -sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } [features] default = ["std"] diff --git a/pallets/bitcoin-vaults/Cargo.toml b/pallets/bitcoin-vaults/Cargo.toml index ff3c78c6..3fc596e3 100644 --- a/pallets/bitcoin-vaults/Cargo.toml +++ b/pallets/bitcoin-vaults/Cargo.toml @@ -20,17 +20,17 @@ lite-json = { version = "0.2", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } -sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } +frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } [dev-dependencies] -pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [features] default = ["std"] diff --git a/pallets/confidential-docs/Cargo.toml b/pallets/confidential-docs/Cargo.toml index 1c75179b..9e75c9be 100644 --- a/pallets/confidential-docs/Cargo.toml +++ b/pallets/confidential-docs/Cargo.toml @@ -17,15 +17,15 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } -sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } +sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [features] default = ["std"] diff --git a/pallets/fruniques/Cargo.toml b/pallets/fruniques/Cargo.toml index 95aa24b2..388a9d36 100644 --- a/pallets/fruniques/Cargo.toml +++ b/pallets/fruniques/Cargo.toml @@ -18,18 +18,18 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = scale-info = { default-features = false, version = "2.5.0", features = [ "derive", ] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", optional = true } -sp-runtime = { version = "24.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -pallet-uniques = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0", optional = true } +sp-runtime = { version = "24.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +pallet-uniques = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [dev-dependencies] -sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -sp-io = { version = "23.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +sp-io = { version = "23.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } [features] default = ["std"] diff --git a/pallets/fund-admin-records/Cargo.toml b/pallets/fund-admin-records/Cargo.toml index e87f9288..628bd0df 100644 --- a/pallets/fund-admin-records/Cargo.toml +++ b/pallets/fund-admin-records/Cargo.toml @@ -18,16 +18,16 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = scale-info = { version = "2.0.1", default-features = false, features = [ "derive", ] } -frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", optional = true } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0", optional = true } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } [features] default = ["std"] diff --git a/pallets/fund-admin/Cargo.toml b/pallets/fund-admin/Cargo.toml index d61a25eb..070981ab 100644 --- a/pallets/fund-admin/Cargo.toml +++ b/pallets/fund-admin/Cargo.toml @@ -18,18 +18,18 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = scale-info = { version = "2.0.1", default-features = false, features = [ "derive", ] } -frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", optional = true } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0", optional = true } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } pallet-rbac = { default-features = false, version = "4.0.0-dev", path = "../rbac/" } -pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } [features] default = ["std"] diff --git a/pallets/gated-marketplace/Cargo.toml b/pallets/gated-marketplace/Cargo.toml index fe39ef6c..4a2a8460 100644 --- a/pallets/gated-marketplace/Cargo.toml +++ b/pallets/gated-marketplace/Cargo.toml @@ -19,22 +19,22 @@ serde = { version = "1.0.140", default-features = false, features = ["derive"] } scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } pallet-fruniques = { path = "../fruniques", default-features = false, version = "0.1.0-dev" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } pallet-mapped-assets = { path = "../mapped-assets/", default-features = false, version = "4.0.0-dev" } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [features] default = ["std"] diff --git a/pallets/mapped-assets/Cargo.toml b/pallets/mapped-assets/Cargo.toml index 40ba2e97..2a8c287d 100644 --- a/pallets/mapped-assets/Cargo.toml +++ b/pallets/mapped-assets/Cargo.toml @@ -18,22 +18,22 @@ log = { version = "0.4.17", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } # Needed for various traits. In our case, `OnFinalize`. -sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } # Needed for type-safe access to storage DB. -frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } # `system` module provides us with all sorts of useful stuff and macros depend on it being around. -frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } -sp-core = { version = "21.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } +sp-core = { version = "21.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } pallet-rbac = { default-features = false, version = "4.0.0-dev", path = "../rbac/" } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [dev-dependencies] -sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } [features] default = ["std"] diff --git a/pallets/rbac/Cargo.toml b/pallets/rbac/Cargo.toml index b78b202b..029a7ce3 100644 --- a/pallets/rbac/Cargo.toml +++ b/pallets/rbac/Cargo.toml @@ -18,16 +18,16 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false, optional = true } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } [features] default = ["std"] diff --git a/pallets/template/Cargo.toml b/pallets/template/Cargo.toml index 114a13cf..ab5da8e2 100644 --- a/pallets/template/Cargo.toml +++ b/pallets/template/Cargo.toml @@ -18,16 +18,16 @@ log = { version = "0.4.14", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } -frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0", optional = true } -sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", optional = true } +sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } -sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.2.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } [features] default = ["std"] From 6466cef820257e6d26571aba413bf278093710ac Mon Sep 17 00:00:00 2001 From: Sebastian Montero Date: Thu, 2 Nov 2023 18:37:43 -0600 Subject: [PATCH 25/34] Pallet balances added RuntimeFreezeReason type, added definition for it to mocks of all pallets. --- pallets/afloat/src/mock.rs | 1 + pallets/bitcoin-vaults/src/mock.rs | 1 + pallets/fruniques/src/mock.rs | 1 + pallets/fund-admin/src/mock.rs | 1 + pallets/gated-marketplace/src/mock.rs | 1 + pallets/mapped-assets/src/mock.rs | 1 + 6 files changed, 6 insertions(+) diff --git a/pallets/afloat/src/mock.rs b/pallets/afloat/src/mock.rs index 0543bbb3..a3c3696a 100644 --- a/pallets/afloat/src/mock.rs +++ b/pallets/afloat/src/mock.rs @@ -167,6 +167,7 @@ impl pallet_balances::Config for Test { type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); + type RuntimeFreezeReason = (); } parameter_types! { diff --git a/pallets/bitcoin-vaults/src/mock.rs b/pallets/bitcoin-vaults/src/mock.rs index d9b909f4..d37cd5ef 100644 --- a/pallets/bitcoin-vaults/src/mock.rs +++ b/pallets/bitcoin-vaults/src/mock.rs @@ -42,6 +42,7 @@ impl pallet_balances::Config for Test { type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); + type RuntimeFreezeReason = (); } parameter_types! { diff --git a/pallets/fruniques/src/mock.rs b/pallets/fruniques/src/mock.rs index 75f73bee..0201f318 100644 --- a/pallets/fruniques/src/mock.rs +++ b/pallets/fruniques/src/mock.rs @@ -106,6 +106,7 @@ impl pallet_balances::Config for Test { type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); + type RuntimeFreezeReason = (); } parameter_types! { diff --git a/pallets/fund-admin/src/mock.rs b/pallets/fund-admin/src/mock.rs index fe0f7611..1bac50bf 100644 --- a/pallets/fund-admin/src/mock.rs +++ b/pallets/fund-admin/src/mock.rs @@ -36,6 +36,7 @@ impl pallet_balances::Config for Test { type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); + type RuntimeFreezeReason = (); } parameter_types! { diff --git a/pallets/gated-marketplace/src/mock.rs b/pallets/gated-marketplace/src/mock.rs index 0ae7a47c..bc6e916f 100644 --- a/pallets/gated-marketplace/src/mock.rs +++ b/pallets/gated-marketplace/src/mock.rs @@ -158,6 +158,7 @@ impl pallet_balances::Config for Test { type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); + type RuntimeFreezeReason = (); } parameter_types! { diff --git a/pallets/mapped-assets/src/mock.rs b/pallets/mapped-assets/src/mock.rs index ef8eb605..9590913b 100644 --- a/pallets/mapped-assets/src/mock.rs +++ b/pallets/mapped-assets/src/mock.rs @@ -110,6 +110,7 @@ impl pallet_balances::Config for Test { type FreezeIdentifier = (); type MaxHolds = (); type MaxFreezes = (); + type RuntimeFreezeReason = (); } pub struct AssetsCallbackHandle; From 6f90b30e58de956d678a1f773b779088b9e3b9f8 Mon Sep 17 00:00:00 2001 From: Sebastian Montero Date: Tue, 14 Nov 2023 09:18:58 -0600 Subject: [PATCH 26/34] Updated confidential docs pallet storage version. --- pallets/confidential-docs/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/confidential-docs/src/lib.rs b/pallets/confidential-docs/src/lib.rs index 2bdae371..a4d7c0b3 100644 --- a/pallets/confidential-docs/src/lib.rs +++ b/pallets/confidential-docs/src/lib.rs @@ -24,7 +24,7 @@ pub mod pallet { use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); #[pallet::config] pub trait Config: frame_system::Config { From d35fcfacb5ee1ea6c28d122ee242d2005523a36a Mon Sep 17 00:00:00 2001 From: Sebastian Montero Date: Wed, 15 Nov 2023 08:38:53 -0600 Subject: [PATCH 27/34] Updated dependencies to use tag instead of branch --- Cargo.lock | 76 +++++++++++++-------------- pallets/afloat/Cargo.toml | 24 ++++----- pallets/bitcoin-vaults/Cargo.toml | 18 +++---- pallets/confidential-docs/Cargo.toml | 14 ++--- pallets/fruniques/Cargo.toml | 18 +++---- pallets/fund-admin-records/Cargo.toml | 16 +++--- pallets/fund-admin/Cargo.toml | 18 +++---- pallets/gated-marketplace/Cargo.toml | 22 ++++---- pallets/mapped-assets/Cargo.toml | 20 +++---- pallets/rbac/Cargo.toml | 16 +++--- pallets/template/Cargo.toml | 16 +++--- 11 files changed, 129 insertions(+), 129 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8f56949..4d949c70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1108,7 +1108,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "frame-support", "frame-support-procedural", @@ -1145,7 +1145,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "aquamarine", "bitflags 1.3.2", @@ -1185,7 +1185,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "Inflector", "cfg-expr", @@ -1204,7 +1204,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1216,7 +1216,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "proc-macro2", "quote", @@ -1226,7 +1226,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "cfg-if", "frame-support", @@ -2099,7 +2099,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "frame-benchmarking", "frame-support", @@ -2256,7 +2256,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "docify", "frame-benchmarking", @@ -2276,7 +2276,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "frame-benchmarking", "frame-support", @@ -3003,7 +3003,7 @@ checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "hash-db", "log", @@ -3024,7 +3024,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "Inflector", "blake2", @@ -3038,7 +3038,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "parity-scale-codec", "scale-info", @@ -3051,7 +3051,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "integer-sqrt", "num-traits", @@ -3065,7 +3065,7 @@ dependencies = [ [[package]] name = "sp-core" version = "21.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "array-bytes", "bandersnatch_vrfs", @@ -3112,7 +3112,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "blake2b_simd", "byteorder", @@ -3125,7 +3125,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "quote", "sp-core-hashing", @@ -3135,7 +3135,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "proc-macro2", "quote", @@ -3145,7 +3145,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "environmental", "parity-scale-codec", @@ -3156,7 +3156,7 @@ dependencies = [ [[package]] name = "sp-genesis-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "serde_json", "sp-api", @@ -3167,7 +3167,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -3181,7 +3181,7 @@ dependencies = [ [[package]] name = "sp-io" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "bytes", "ed25519-dalek", @@ -3205,7 +3205,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.27.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "parity-scale-codec", "parking_lot", @@ -3217,7 +3217,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -3228,7 +3228,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "backtrace", "lazy_static", @@ -3238,7 +3238,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "either", "hash256-std-hasher", @@ -3260,7 +3260,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -3278,7 +3278,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "Inflector", "proc-macro-crate", @@ -3290,7 +3290,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -3304,7 +3304,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.28.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "hash-db", "log", @@ -3325,12 +3325,12 @@ dependencies = [ [[package]] name = "sp-std" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" [[package]] name = "sp-storage" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3343,7 +3343,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "async-trait", "parity-scale-codec", @@ -3356,7 +3356,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "parity-scale-codec", "sp-std", @@ -3368,7 +3368,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "ahash 0.8.6", "hash-db", @@ -3392,7 +3392,7 @@ dependencies = [ [[package]] name = "sp-version" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3409,7 +3409,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "8.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3420,7 +3420,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -3433,7 +3433,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.3.0#7c9fd83805cc446983a7698c7a3281677cf655c8" +source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "parity-scale-codec", "scale-info", diff --git a/pallets/afloat/Cargo.toml b/pallets/afloat/Cargo.toml index 9532d211..e344d424 100644 --- a/pallets/afloat/Cargo.toml +++ b/pallets/afloat/Cargo.toml @@ -19,24 +19,24 @@ serde = { version = "1.0.140", default-features = false, features = ["derive"] } scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, optional = true } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } pallet-fruniques = { path = "../fruniques", default-features = false, version = "0.1.0-dev" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } pallet-gated-marketplace = { path = "../gated-marketplace/", default-features = false, version = "4.0.0-dev" } pallet-mapped-assets = { path = "../mapped-assets/", default-features = false, version = "4.0.0-dev" } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } -sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } +sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } [features] default = ["std"] diff --git a/pallets/bitcoin-vaults/Cargo.toml b/pallets/bitcoin-vaults/Cargo.toml index 3fc596e3..ff18ca2a 100644 --- a/pallets/bitcoin-vaults/Cargo.toml +++ b/pallets/bitcoin-vaults/Cargo.toml @@ -20,17 +20,17 @@ lite-json = { version = "0.2", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } -sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } +frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, optional = true } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-std = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, optional = true } [dev-dependencies] -pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [features] default = ["std"] diff --git a/pallets/confidential-docs/Cargo.toml b/pallets/confidential-docs/Cargo.toml index 9e75c9be..c0dc16e0 100644 --- a/pallets/confidential-docs/Cargo.toml +++ b/pallets/confidential-docs/Cargo.toml @@ -17,15 +17,15 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } -sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, optional = true } +sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [features] default = ["std"] diff --git a/pallets/fruniques/Cargo.toml b/pallets/fruniques/Cargo.toml index 388a9d36..4a83df0c 100644 --- a/pallets/fruniques/Cargo.toml +++ b/pallets/fruniques/Cargo.toml @@ -18,18 +18,18 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = scale-info = { default-features = false, version = "2.5.0", features = [ "derive", ] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0", optional = true } -sp-runtime = { version = "24.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -pallet-uniques = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1", optional = true } +sp-runtime = { version = "24.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +pallet-uniques = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [dev-dependencies] -sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -sp-io = { version = "23.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +sp-io = { version = "23.0.0", default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } [features] default = ["std"] diff --git a/pallets/fund-admin-records/Cargo.toml b/pallets/fund-admin-records/Cargo.toml index 628bd0df..d24e30a9 100644 --- a/pallets/fund-admin-records/Cargo.toml +++ b/pallets/fund-admin-records/Cargo.toml @@ -18,16 +18,16 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = scale-info = { version = "2.0.1", default-features = false, features = [ "derive", ] } -frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0", optional = true } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1", optional = true } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } [features] default = ["std"] diff --git a/pallets/fund-admin/Cargo.toml b/pallets/fund-admin/Cargo.toml index 070981ab..9fe0a40c 100644 --- a/pallets/fund-admin/Cargo.toml +++ b/pallets/fund-admin/Cargo.toml @@ -18,18 +18,18 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = scale-info = { version = "2.0.1", default-features = false, features = [ "derive", ] } -frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0", optional = true } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1", optional = true } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +pallet-timestamp = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } pallet-rbac = { default-features = false, version = "4.0.0-dev", path = "../rbac/" } -pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.3.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.3.0-rc1" } [features] default = ["std"] diff --git a/pallets/gated-marketplace/Cargo.toml b/pallets/gated-marketplace/Cargo.toml index 4a2a8460..061dfbce 100644 --- a/pallets/gated-marketplace/Cargo.toml +++ b/pallets/gated-marketplace/Cargo.toml @@ -19,22 +19,22 @@ serde = { version = "1.0.140", default-features = false, features = ["derive"] } scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, optional = true } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } pallet-fruniques = { path = "../fruniques", default-features = false, version = "0.1.0-dev" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } pallet-mapped-assets = { path = "../mapped-assets/", default-features = false, version = "4.0.0-dev" } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [features] default = ["std"] diff --git a/pallets/mapped-assets/Cargo.toml b/pallets/mapped-assets/Cargo.toml index 2a8c287d..9c259a03 100644 --- a/pallets/mapped-assets/Cargo.toml +++ b/pallets/mapped-assets/Cargo.toml @@ -18,22 +18,22 @@ log = { version = "0.4.17", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } # Needed for various traits. In our case, `OnFinalize`. -sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-runtime = { version = "24.0.0", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } # Needed for type-safe access to storage DB. -frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } # `system` module provides us with all sorts of useful stuff and macros depend on it being around. -frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } -sp-core = { version = "21.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, optional = true } +sp-core = { version = "21.0.0", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } pallet-rbac = { default-features = false, version = "4.0.0-dev", path = "../rbac/" } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [dev-dependencies] -sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +sp-std = { version = "8.0.0", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-io = { version = "23.0.0", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } [features] default = ["std"] diff --git a/pallets/rbac/Cargo.toml b/pallets/rbac/Cargo.toml index 029a7ce3..193d2d70 100644 --- a/pallets/rbac/Cargo.toml +++ b/pallets/rbac/Cargo.toml @@ -18,16 +18,16 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features = scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false, optional = true } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, optional = true } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-std = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } [features] default = ["std"] diff --git a/pallets/template/Cargo.toml b/pallets/template/Cargo.toml index ab5da8e2..a4e07e33 100644 --- a/pallets/template/Cargo.toml +++ b/pallets/template/Cargo.toml @@ -18,16 +18,16 @@ log = { version = "0.4.14", default-features = false } scale-info = { version = "2.5.0", default-features = false, features = [ "derive", ] } -frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } -frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } -frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0", optional = true } -sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +frame-support = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } +frame-system = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } +frame-benchmarking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", optional = true } +sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } [dev-dependencies] -sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } -sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } -sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.3.0" } +sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } +sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } +sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1" } [features] default = ["std"] From 73cd1343482918ee959a83fbebaedf999dc14961 Mon Sep 17 00:00:00 2001 From: Sebastian Montero Date: Wed, 15 Nov 2023 16:55:54 -0600 Subject: [PATCH 28/34] Updated storage version for those pallets that dont have migrations to be 0. Removed the migration from the mapped assets pallet as the pallet was created after the migration code. --- pallets/afloat/src/lib.rs | 2 +- pallets/bitcoin-vaults/src/lib.rs | 2 +- pallets/fruniques/src/lib.rs | 2 +- pallets/fund-admin-records/src/lib.rs | 2 +- pallets/gated-marketplace/src/lib.rs | 2 +- pallets/mapped-assets/src/lib.rs | 3 +- pallets/mapped-assets/src/migration.rs | 138 ------------------------- pallets/rbac/src/lib.rs | 2 +- 8 files changed, 7 insertions(+), 146 deletions(-) delete mode 100644 pallets/mapped-assets/src/migration.rs diff --git a/pallets/afloat/src/lib.rs b/pallets/afloat/src/lib.rs index 23cf5d40..d08de702 100644 --- a/pallets/afloat/src/lib.rs +++ b/pallets/afloat/src/lib.rs @@ -20,7 +20,7 @@ pub mod pallet { use frame_system::{pallet_prelude::*, RawOrigin}; use pallet_fruniques::types::{Attributes, CollectionDescription, FruniqueRole, ParentInfo}; use pallet_gated_marketplace::types::*; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); use crate::types::*; use pallet_rbac::types::RoleBasedAccessControl; diff --git a/pallets/bitcoin-vaults/src/lib.rs b/pallets/bitcoin-vaults/src/lib.rs index 0d20894e..6c66f641 100644 --- a/pallets/bitcoin-vaults/src/lib.rs +++ b/pallets/bitcoin-vaults/src/lib.rs @@ -35,7 +35,7 @@ pub mod pallet { transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction}, }; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); /* --- Genesis Structs Section --- */ diff --git a/pallets/fruniques/src/lib.rs b/pallets/fruniques/src/lib.rs index b862cfa1..30b1c3ea 100644 --- a/pallets/fruniques/src/lib.rs +++ b/pallets/fruniques/src/lib.rs @@ -24,7 +24,7 @@ pub mod pallet { // use frame_support::PalletId; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); use pallet_rbac::types::RoleBasedAccessControl; /// Configure the pallet by specifying the parameters and types on which it depends. diff --git a/pallets/fund-admin-records/src/lib.rs b/pallets/fund-admin-records/src/lib.rs index d5490756..e065b242 100644 --- a/pallets/fund-admin-records/src/lib.rs +++ b/pallets/fund-admin-records/src/lib.rs @@ -21,7 +21,7 @@ pub mod pallet { use sp_runtime::traits::Scale; use crate::types::*; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); #[pallet::config] pub trait Config: frame_system::Config { diff --git a/pallets/gated-marketplace/src/lib.rs b/pallets/gated-marketplace/src/lib.rs index 756fcd99..edca593b 100644 --- a/pallets/gated-marketplace/src/lib.rs +++ b/pallets/gated-marketplace/src/lib.rs @@ -20,7 +20,7 @@ pub mod pallet { use frame_system::pallet_prelude::*; use sp_runtime::{traits::Scale, Permill}; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); use crate::types::*; use pallet_rbac::types::RoleBasedAccessControl; diff --git a/pallets/mapped-assets/src/lib.rs b/pallets/mapped-assets/src/lib.rs index eed01494..e5622ad1 100644 --- a/pallets/mapped-assets/src/lib.rs +++ b/pallets/mapped-assets/src/lib.rs @@ -142,7 +142,6 @@ #[cfg(feature = "runtime-benchmarks")] mod benchmarking; -pub mod migration; #[cfg(test)] pub mod mock; #[cfg(test)] @@ -210,7 +209,7 @@ pub mod pallet { use frame_system::pallet_prelude::*; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); #[pallet::pallet] #[pallet::storage_version(STORAGE_VERSION)] diff --git a/pallets/mapped-assets/src/migration.rs b/pallets/mapped-assets/src/migration.rs deleted file mode 100644 index efe77714..00000000 --- a/pallets/mapped-assets/src/migration.rs +++ /dev/null @@ -1,138 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use super::*; -use frame_support::traits::OnRuntimeUpgrade; -use log; - -#[cfg(feature = "try-runtime")] -use sp_runtime::TryRuntimeError; - -pub mod v1 { - use frame_support::{pallet_prelude::*, weights::Weight}; - - use super::*; - - #[derive(Decode)] - pub struct OldAssetDetails { - pub owner: AccountId, - pub issuer: AccountId, - pub admin: AccountId, - pub freezer: AccountId, - pub supply: Balance, - pub deposit: DepositBalance, - pub min_balance: Balance, - pub is_sufficient: bool, - pub accounts: u32, - pub sufficients: u32, - pub approvals: u32, - pub is_frozen: bool, - } - - impl OldAssetDetails { - fn migrate_to_v1(self) -> AssetDetails { - let status = if self.is_frozen { AssetStatus::Frozen } else { AssetStatus::Live }; - - AssetDetails { - owner: self.owner, - issuer: self.issuer, - admin: self.admin, - freezer: self.freezer, - supply: self.supply, - deposit: self.deposit, - min_balance: self.min_balance, - is_sufficient: self.is_sufficient, - accounts: self.accounts, - sufficients: self.sufficients, - approvals: self.approvals, - status, - } - } - } - - pub struct MigrateToV1(sp_std::marker::PhantomData); - impl OnRuntimeUpgrade for MigrateToV1 { - fn on_runtime_upgrade() -> Weight { - let current_version = Pallet::::current_storage_version(); - let onchain_version = Pallet::::on_chain_storage_version(); - if onchain_version == 0 && current_version == 1 { - let mut translated = 0u64; - Asset::::translate::< - OldAssetDetails>, - _, - >(|_key, old_value| { - translated.saturating_inc(); - Some(old_value.migrate_to_v1()) - }); - current_version.put::>(); - log::info!( - target: LOG_TARGET, - "Upgraded {} pools, storage to version {:?}", - translated, - current_version - ); - T::DbWeight::get().reads_writes(translated + 1, translated + 1) - } else { - log::info!( - target: LOG_TARGET, - "Migration did not execute. This probably should be removed" - ); - T::DbWeight::get().reads(1) - } - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, TryRuntimeError> { - frame_support::ensure!( - Pallet::::on_chain_storage_version() == 0, - "must upgrade linearly" - ); - let prev_count = Asset::::iter().count(); - Ok((prev_count as u32).encode()) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(prev_count: Vec) -> Result<(), TryRuntimeError> { - let prev_count: u32 = Decode::decode(&mut prev_count.as_slice()).expect( - "the state parameter should be something that was generated by pre_upgrade", - ); - let post_count = Asset::::iter().count() as u32; - ensure!( - prev_count == post_count, - "the asset count before and after the migration should be the same" - ); - - let current_version = Pallet::::current_storage_version(); - let onchain_version = Pallet::::on_chain_storage_version(); - - frame_support::ensure!(current_version == 1, "must_upgrade"); - ensure!( - current_version == onchain_version, - "after migration, the current_version and onchain_version should be the same" - ); - - Asset::::iter().try_for_each(|(_id, asset)| -> Result<(), TryRuntimeError> { - ensure!( - asset.status == AssetStatus::Live || asset.status == AssetStatus::Frozen, - "assets should only be live or frozen. None should be in destroying status, or undefined state" - ); - Ok(()) - })?; - Ok(()) - } - } -} diff --git a/pallets/rbac/src/lib.rs b/pallets/rbac/src/lib.rs index 94916a24..d8dcfde6 100644 --- a/pallets/rbac/src/lib.rs +++ b/pallets/rbac/src/lib.rs @@ -24,7 +24,7 @@ pub mod pallet { use frame_system::pallet_prelude::*; use sp_runtime::sp_std::vec::Vec; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); #[pallet::config] pub trait Config: frame_system::Config { From 1cca49115ea6f07cfccc794ce53716258696c47c Mon Sep 17 00:00:00 2001 From: Sebastian Montero Date: Mon, 4 Dec 2023 14:02:24 -0600 Subject: [PATCH 29/34] Developed migration fro the fruniques pallet. Incremented fruniques pallet storage version. --- pallets/fruniques/src/lib.rs | 3 +- pallets/fruniques/src/migration.rs | 68 ++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 pallets/fruniques/src/migration.rs diff --git a/pallets/fruniques/src/lib.rs b/pallets/fruniques/src/lib.rs index 30b1c3ea..785aca56 100644 --- a/pallets/fruniques/src/lib.rs +++ b/pallets/fruniques/src/lib.rs @@ -12,6 +12,7 @@ mod tests; // mod benchmarking; mod functions; +pub mod migration; pub mod types; #[frame_support::pallet] @@ -24,7 +25,7 @@ pub mod pallet { // use frame_support::PalletId; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); use pallet_rbac::types::RoleBasedAccessControl; /// Configure the pallet by specifying the parameters and types on which it depends. diff --git a/pallets/fruniques/src/migration.rs b/pallets/fruniques/src/migration.rs new file mode 100644 index 00000000..032f12b3 --- /dev/null +++ b/pallets/fruniques/src/migration.rs @@ -0,0 +1,68 @@ +use crate::{ + types::{CollectionId, ItemId}, + *, +}; +use frame_support::{pallet_prelude::*, traits::OnRuntimeUpgrade}; + +#[cfg(feature = "try-runtime")] +use sp_runtime::TryRuntimeError; + +/// The log target. +const TARGET: &'static str = "runtime::fruniques::migration"; + +pub mod v0 { + use super::*; + /// The actual type isn't important, as we only delete the key in the state. + #[frame_support::storage_alias] + pub(super) type FruniqueCnt = StorageValue, (), ValueQuery>; + + /// The actual type isn't important, as we only delete the key in the state. + #[frame_support::storage_alias] + pub(super) type FruniqueParent = StorageDoubleMap< + Pallet, + Blake2_128Concat, + CollectionId, + Blake2_128Concat, + ItemId, // FruniqueId + (), // ParentId and flag if it inherit attributes + ValueQuery, + >; + + /// The actual type isn't important, as we only delete the key in the state. + #[frame_support::storage_alias] + pub(super) type FruniqueChild = StorageDoubleMap< + Pallet, + Blake2_128Concat, + CollectionId, + Blake2_128Concat, + ItemId, + (), + ValueQuery, + >; + + pub struct MigrateToV1(sp_runtime::sp_std::marker::PhantomData); + + impl OnRuntimeUpgrade for MigrateToV1 { + fn on_runtime_upgrade() -> Weight { + let onchain_version = Pallet::::on_chain_storage_version(); + let mut writes = 0; + if onchain_version < 1 { + FruniqueCnt::::kill(); + let result = FruniqueParent::::clear(1, None); //Assuming that the storage is empty + if result.maybe_cursor.is_some() { + log::info!(target: TARGET, "Failed to kill FruniqueParent storage item"); + } + let result = FruniqueChild::::clear(1, None); //Assuming that the storage is empty + if result.maybe_cursor.is_some() { + log::info!(target: TARGET, "Failed to kill FruniqueChild storage item"); + } + StorageVersion::new(1).put::>(); + writes = 4; + log::info!(target: TARGET, "Migrated storage to version 1"); + } else { + log::info!(target: TARGET, "Upgrade not run as pallet version is: {:?}", onchain_version); + } + T::DbWeight::get().reads_writes(writes, 1) + } + } +} From f99076bfa63d17a66d486d6f64b3180cb62d5a1b Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Thu, 7 Dec 2023 17:22:04 -0600 Subject: [PATCH 30/34] =?UTF-8?q?=F0=9F=90=9B=20fix(afloat):=20update=20pa?= =?UTF-8?q?llet-timestamp=20dependency=20version=20to=20"4.0.0-dev"=20to?= =?UTF-8?q?=20resolve=20compatibility=20issue=20=F0=9F=90=9B=20fix(afloat)?= =?UTF-8?q?:=20remove=20unused=20trait=20import=20UnixTime=20from=20functi?= =?UTF-8?q?ons.rs=20=F0=9F=90=9B=20fix(afloat):=20remove=20TimeProvider=20?= =?UTF-8?q?associated=20type=20from=20pallet=20configuration=20in=20lib.rs?= =?UTF-8?q?=20=F0=9F=90=9B=20fix(afloat):=20remove=20TimeProvider=20associ?= =?UTF-8?q?ated=20type=20from=20pallet=20configuration=20in=20mock.rs=20?= =?UTF-8?q?=E2=9C=A8=20feat(afloat):=20add=20error=20event=20TimestampErro?= =?UTF-8?q?r=20to=20handle=20incorrect=20timestamp=20generation=20?= =?UTF-8?q?=E2=9C=A8=20feat(afloat):=20update=20created=5Fdate=20and=20las?= =?UTF-8?q?t=5Fmodified=5Fdate=20fields=20in=20UserInfo=20struct=20to=20us?= =?UTF-8?q?e=20pallet=5Fgated=5Fmarketplace::Pallet::get=5Ftimestamp=5Fin?= =?UTF-8?q?=5Fmilliseconds()=20to=20ensure=20consistent=20timestamp=20gene?= =?UTF-8?q?ration=20=E2=9C=A8=20feat(afloat):=20update=20creation=5Fdate?= =?UTF-8?q?=20and=20last=5Fmodified=5Fdate=20fields=20in=20create=5Foffer?= =?UTF-8?q?=20and=20edit=5Foffer=20functions=20to=20use=20T::Timestamp::no?= =?UTF-8?q?w().into()=20to=20ensure=20consistent=20timestamp=20generation?= =?UTF-8?q?=20=E2=9C=A8=20feat(afloat):=20update=20cancellation=5Fdate=20f?= =?UTF-8?q?ield=20in=20cancel=5Foffer=20function=20to=20use=20pallet=5Fgat?= =?UTF-8?q?ed=5Fmarketplace::Pallet::get=5Ftimestamp=5Fin=5Fmilliseconds()?= =?UTF-8?q?=20to=20ensure=20consistent=20timestamp=20generation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/afloat/Cargo.toml | 2 +- pallets/afloat/src/functions.rs | 32 ++++++++++++++++---------------- pallets/afloat/src/lib.rs | 7 +++++-- pallets/afloat/src/mock.rs | 1 - 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/pallets/afloat/Cargo.toml b/pallets/afloat/Cargo.toml index e344d424..a36bc6ee 100644 --- a/pallets/afloat/Cargo.toml +++ b/pallets/afloat/Cargo.toml @@ -25,7 +25,7 @@ frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } -pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false } +pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", tag = "v1.3.0-rc1", default-features = false, version = "4.0.0-dev" } pallet-fruniques = { path = "../fruniques", default-features = false, version = "0.1.0-dev" } pallet-rbac = { path = "../rbac/", default-features = false, version = "4.0.0-dev" } pallet-gated-marketplace = { path = "../gated-marketplace/", default-features = false, version = "4.0.0-dev" } diff --git a/pallets/afloat/src/functions.rs b/pallets/afloat/src/functions.rs index d4b90665..bdd94a23 100644 --- a/pallets/afloat/src/functions.rs +++ b/pallets/afloat/src/functions.rs @@ -1,6 +1,6 @@ use super::*; use crate::types::*; -use frame_support::{pallet_prelude::*, traits::UnixTime}; +use frame_support::{pallet_prelude::*}; use frame_system::{pallet_prelude::*, RawOrigin}; use pallet_fruniques::types::{Attributes, CollectionDescription, FruniqueRole, ParentInfo}; use pallet_gated_marketplace::types::{Marketplace, MarketplaceRole}; @@ -104,9 +104,9 @@ impl Pallet { cid_creator: ShortString::try_from(b"HCD:afloat".to_vec()).unwrap(), group: ShortString::try_from(b"afloat".to_vec()).unwrap(), created_by: Some(creator.clone()), - created_date: Some(T::TimeProvider::now().as_secs()), + created_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), last_modified_by: Some(creator.clone()), - last_modified_date: Some(T::TimeProvider::now().as_secs()), + last_modified_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), }; >::insert(creator.clone(), creator_user); Self::give_role_to_user(creator.clone(), AfloatRole::Owner)?; @@ -117,9 +117,9 @@ impl Pallet { cid_creator: ShortString::try_from(b"afloat".to_vec()).unwrap(), group: ShortString::try_from(b"afloat".to_vec()).unwrap(), created_by: Some(admin.clone()), - created_date: Some(T::TimeProvider::now().as_secs()), + created_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), last_modified_by: Some(admin.clone()), - last_modified_date: Some(T::TimeProvider::now().as_secs()), + last_modified_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), }; >::insert(admin.clone(), admin_user); Self::give_role_to_user(admin, AfloatRole::Admin)?; @@ -161,9 +161,9 @@ impl Pallet { cid_creator, group, created_by: Some(actor.clone()), - created_date: Some(T::TimeProvider::now().as_secs()), + created_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), last_modified_by: Some(actor.clone()), - last_modified_date: Some(T::TimeProvider::now().as_secs()), + last_modified_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), }; >::insert(user_address.clone(), user); Self::give_role_to_user(user_address.clone(), AfloatRole::BuyerOrSeller)?; @@ -175,9 +175,9 @@ impl Pallet { cid_creator, group, created_by: Some(actor.clone()), - created_date: Some(T::TimeProvider::now().as_secs()), + created_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), last_modified_by: Some(actor.clone()), - last_modified_date: Some(T::TimeProvider::now().as_secs()), + last_modified_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), }; >::insert(user_address.clone(), user); Self::give_role_to_user(user_address.clone(), AfloatRole::CPA)?; @@ -225,7 +225,7 @@ impl Pallet { >::try_mutate::<_, _, DispatchError, _>(user_address.clone(), |user| { let user = user.as_mut().ok_or(Error::::FailedToEditUserAccount)?; - user.last_modified_date = Some(T::TimeProvider::now().as_secs()); + user.last_modified_date = pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); user.last_modified_by = Some(actor.clone()); user.cid = cid; user.cid_creator = cid_creator; @@ -246,7 +246,7 @@ impl Pallet { >::try_mutate::<_, _, DispatchError, _>(user_address.clone(), |user| { let user = user.as_mut().ok_or(Error::::FailedToEditUserAccount)?; - user.last_modified_date = Some(T::TimeProvider::now().as_secs()); + user.last_modified_date = pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); user.last_modified_by = Some(actor.clone()); user.cid = cid; user.cid_creator = cid_creator; @@ -339,7 +339,7 @@ impl Pallet { tax_credit_amount, tax_credit_amount_remaining: tax_credit_amount.into(), price_per_credit: price, - creation_date: T::TimeProvider::now().as_secs(), + creation_date: T::Timestamp::now().into(), expiration_date, tax_credit_id: item_id, creator_id: authority.clone(), @@ -373,7 +373,7 @@ impl Pallet { tax_credit_amount, tax_credit_amount_remaining: tax_credit_amount.into(), price_per_credit: price, - creation_date: T::TimeProvider::now().as_secs(), + creation_date: T::Timestamp::now().into(), expiration_date, tax_credit_id: item_id, creator_id: authority.clone(), @@ -447,7 +447,7 @@ impl Pallet { //ensure offer is a sell offer ensure!(offer.offer_type == OfferType::Sell, Error::::WrongOfferType); //ensure offer is not expired - ensure!(offer.expiration_date > T::TimeProvider::now().as_secs(), Error::::OfferExpired); + ensure!(offer.expiration_date > T::Timestamp::now().into(), Error::::OfferExpired); //ensure offer is not cancelled ensure!(offer.cancellation_date.is_none(), Error::::OfferCancelled); //ensure offer is not taken @@ -963,7 +963,7 @@ impl Pallet { OfferStatus::CREATED => { >::try_mutate(order_id, |offer| -> DispatchResult { let offer = offer.as_mut().ok_or(Error::::OfferNotFound)?; - offer.cancellation_date = Some(T::TimeProvider::now().as_secs()); + offer.cancellation_date = pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); offer.status = OfferStatus::CANCELLED; Ok(()) })?; @@ -972,7 +972,7 @@ impl Pallet { OfferStatus::TF_PENDING_SIGNATURE => { >::try_mutate(order_id, |offer| -> DispatchResult { let offer = offer.as_mut().ok_or(Error::::OfferNotFound)?; - offer.cancellation_date = Some(T::TimeProvider::now().as_secs()); + offer.cancellation_date = pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); offer.status = OfferStatus::CANCELLED; Ok(()) })?; diff --git a/pallets/afloat/src/lib.rs b/pallets/afloat/src/lib.rs index 68e90191..a54c7398 100644 --- a/pallets/afloat/src/lib.rs +++ b/pallets/afloat/src/lib.rs @@ -15,9 +15,10 @@ pub mod types; pub mod pallet { use frame_support::{ pallet_prelude::*, - traits::{Currency, UnixTime}, + traits::{Currency, Time}, }; use frame_system::{pallet_prelude::*, RawOrigin}; + use sp_runtime::traits::Scale; use pallet_fruniques::types::{Attributes, CollectionDescription, FruniqueRole, ParentInfo}; use pallet_gated_marketplace::types::*; const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); @@ -37,7 +38,7 @@ pub mod pallet { + pallet_uniques::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; - type TimeProvider: UnixTime; + type Rbac: RoleBasedAccessControl; // type RemoveOrigin: EnsureOrigin; type Currency: Currency; @@ -54,6 +55,8 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { + /// Timestamp was not generated correctly + TimestampError, // New user created NewUser(T::AccountId), // User edited diff --git a/pallets/afloat/src/mock.rs b/pallets/afloat/src/mock.rs index 8b1eec3c..b3edb9bb 100644 --- a/pallets/afloat/src/mock.rs +++ b/pallets/afloat/src/mock.rs @@ -68,7 +68,6 @@ impl system::Config for Test { impl pallet_afloat::Config for Test { type RuntimeEvent = RuntimeEvent; - type TimeProvider = pallet_timestamp::Pallet; //type RemoveOrigin = frame_system::EnsureSigned; type Currency = pallet_balances::Pallet; type Rbac = RBAC; From 571230833ac787da0285ec1e6d2cb1f1e66da0f3 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Thu, 7 Dec 2023 17:22:28 -0600 Subject: [PATCH 31/34] =?UTF-8?q?=F0=9F=90=9B=20fix(functions.rs):=20fix?= =?UTF-8?q?=20import=20statement=20formatting=20to=20follow=20conventions?= =?UTF-8?q?=20=E2=9C=A8=20feat(functions.rs):=20add=20support=20for=20last?= =?UTF-8?q?=5Fmodified=5Fdate=20field=20to=20be=20set=20to=20current=20tim?= =?UTF-8?q?estamp=20when=20creating=20or=20editing=20user=20info=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(functions.rs):=20fix=20formatting=20of=20cre?= =?UTF-8?q?ated=5Fdate=20field=20to=20follow=20conventions=20=F0=9F=90=9B?= =?UTF-8?q?=20fix(functions.rs):=20fix=20formatting=20of=20last=5Fmodified?= =?UTF-8?q?=5Fdate=20field=20to=20follow=20conventions=20=F0=9F=90=9B=20fi?= =?UTF-8?q?x(functions.rs):=20fix=20formatting=20of=20created=5Fdate=20fie?= =?UTF-8?q?ld=20to=20follow=20conventions=20=F0=9F=90=9B=20fix(functions.r?= =?UTF-8?q?s):=20fix=20formatting=20of=20last=5Fmodified=5Fdate=20field=20?= =?UTF-8?q?to=20follow=20conventions=20=F0=9F=90=9B=20fix(functions.rs):?= =?UTF-8?q?=20fix=20formatting=20of=20created=5Fdate=20field=20to=20follow?= =?UTF-8?q?=20conventions=20=F0=9F=90=9B=20fix(functions.rs):=20fix=20form?= =?UTF-8?q?atting=20of=20last=5Fmodified=5Fdate=20field=20to=20follow=20co?= =?UTF-8?q?nventions=20=F0=9F=90=9B=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/afloat/src/functions.rs | 35 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/pallets/afloat/src/functions.rs b/pallets/afloat/src/functions.rs index bdd94a23..6a0c05c7 100644 --- a/pallets/afloat/src/functions.rs +++ b/pallets/afloat/src/functions.rs @@ -1,6 +1,6 @@ use super::*; use crate::types::*; -use frame_support::{pallet_prelude::*}; +use frame_support::pallet_prelude::*; use frame_system::{pallet_prelude::*, RawOrigin}; use pallet_fruniques::types::{Attributes, CollectionDescription, FruniqueRole, ParentInfo}; use pallet_gated_marketplace::types::{Marketplace, MarketplaceRole}; @@ -106,7 +106,8 @@ impl Pallet { created_by: Some(creator.clone()), created_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), last_modified_by: Some(creator.clone()), - last_modified_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), + last_modified_date: + pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), }; >::insert(creator.clone(), creator_user); Self::give_role_to_user(creator.clone(), AfloatRole::Owner)?; @@ -117,9 +118,11 @@ impl Pallet { cid_creator: ShortString::try_from(b"afloat".to_vec()).unwrap(), group: ShortString::try_from(b"afloat".to_vec()).unwrap(), created_by: Some(admin.clone()), - created_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), + created_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds( + ), last_modified_by: Some(admin.clone()), - last_modified_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), + last_modified_date: + pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), }; >::insert(admin.clone(), admin_user); Self::give_role_to_user(admin, AfloatRole::Admin)?; @@ -161,9 +164,11 @@ impl Pallet { cid_creator, group, created_by: Some(actor.clone()), - created_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), + created_date: + pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), last_modified_by: Some(actor.clone()), - last_modified_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), + last_modified_date: + pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), }; >::insert(user_address.clone(), user); Self::give_role_to_user(user_address.clone(), AfloatRole::BuyerOrSeller)?; @@ -175,9 +180,11 @@ impl Pallet { cid_creator, group, created_by: Some(actor.clone()), - created_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), + created_date: + pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), last_modified_by: Some(actor.clone()), - last_modified_date: pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), + last_modified_date: + pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(), }; >::insert(user_address.clone(), user); Self::give_role_to_user(user_address.clone(), AfloatRole::CPA)?; @@ -225,7 +232,8 @@ impl Pallet { >::try_mutate::<_, _, DispatchError, _>(user_address.clone(), |user| { let user = user.as_mut().ok_or(Error::::FailedToEditUserAccount)?; - user.last_modified_date = pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); + user.last_modified_date = + pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); user.last_modified_by = Some(actor.clone()); user.cid = cid; user.cid_creator = cid_creator; @@ -246,7 +254,8 @@ impl Pallet { >::try_mutate::<_, _, DispatchError, _>(user_address.clone(), |user| { let user = user.as_mut().ok_or(Error::::FailedToEditUserAccount)?; - user.last_modified_date = pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); + user.last_modified_date = + pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); user.last_modified_by = Some(actor.clone()); user.cid = cid; user.cid_creator = cid_creator; @@ -963,7 +972,8 @@ impl Pallet { OfferStatus::CREATED => { >::try_mutate(order_id, |offer| -> DispatchResult { let offer = offer.as_mut().ok_or(Error::::OfferNotFound)?; - offer.cancellation_date = pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); + offer.cancellation_date = + pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); offer.status = OfferStatus::CANCELLED; Ok(()) })?; @@ -972,7 +982,8 @@ impl Pallet { OfferStatus::TF_PENDING_SIGNATURE => { >::try_mutate(order_id, |offer| -> DispatchResult { let offer = offer.as_mut().ok_or(Error::::OfferNotFound)?; - offer.cancellation_date = pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); + offer.cancellation_date = + pallet_gated_marketplace::Pallet::::get_timestamp_in_milliseconds(); offer.status = OfferStatus::CANCELLED; Ok(()) })?; From 8ddb1369e295eabe3d483c4fd8f919f7c3784932 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Thu, 7 Dec 2023 17:23:02 -0600 Subject: [PATCH 32/34] =?UTF-8?q?=F0=9F=94=A7=20chore(lib.rs):=20reorder?= =?UTF-8?q?=20import=20statements=20for=20better=20readability=20and=20con?= =?UTF-8?q?sistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/afloat/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/afloat/src/lib.rs b/pallets/afloat/src/lib.rs index a54c7398..7bbf98f7 100644 --- a/pallets/afloat/src/lib.rs +++ b/pallets/afloat/src/lib.rs @@ -18,9 +18,9 @@ pub mod pallet { traits::{Currency, Time}, }; use frame_system::{pallet_prelude::*, RawOrigin}; - use sp_runtime::traits::Scale; use pallet_fruniques::types::{Attributes, CollectionDescription, FruniqueRole, ParentInfo}; use pallet_gated_marketplace::types::*; + use sp_runtime::traits::Scale; const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); use crate::types::*; From 3e7ff6c62f8969a7f4478ee55bdf56703a050560 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Thu, 7 Dec 2023 17:23:13 -0600 Subject: [PATCH 33/34] =?UTF-8?q?=F0=9F=94=92=20chore(functions.rs):=20cha?= =?UTF-8?q?nge=20visibility=20of=20get=5Ftimestamp=5Fin=5Fmilliseconds=20f?= =?UTF-8?q?unction=20from=20private=20to=20public=20to=20allow=20external?= =?UTF-8?q?=20usage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/gated-marketplace/src/functions.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/gated-marketplace/src/functions.rs b/pallets/gated-marketplace/src/functions.rs index fffca8e8..f3ad44aa 100644 --- a/pallets/gated-marketplace/src/functions.rs +++ b/pallets/gated-marketplace/src/functions.rs @@ -1162,7 +1162,7 @@ impl Pallet { Ok(()) } - fn get_timestamp_in_milliseconds() -> Option { + pub fn get_timestamp_in_milliseconds() -> Option { let timestamp: u64 = T::Timestamp::now().into(); Some(timestamp) From 9bfc1529715c6a28b26df44eca6ad478c7ef7ae7 Mon Sep 17 00:00:00 2001 From: Tlalocman Date: Thu, 7 Dec 2023 17:23:29 -0600 Subject: [PATCH 34/34] update dep --- Cargo.lock | 407 +++++++++++++++++++---------------------------------- 1 file changed, 147 insertions(+), 260 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index efeea4a3..4d949c70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,7 +27,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "gimli 0.28.1", + "gimli 0.28.0", ] [[package]] @@ -42,7 +42,7 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.10", "once_cell", "version_check", ] @@ -54,7 +54,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", - "getrandom 0.2.11", + "getrandom 0.2.10", "once_cell", "version_check", "zerocopy", @@ -307,9 +307,9 @@ dependencies = [ [[package]] name = "array-bytes" -version = "6.2.0" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de17a919934ad8c5cc99a1a74de4e2dab95d6121a8f27f94755ff525b630382c" +checksum = "d9b1c5a481ec30a5abd8dfbd94ab5cf1bb4e9a66be7f1b3b322f2f1170c200fd" [[package]] name = "arrayref" @@ -337,7 +337,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -588,7 +588,7 @@ dependencies = [ [[package]] name = "common" version = "0.1.0" -source = "git+https://github.com/w3f/ring-proof#61e7b528bc0170d6bf541be32440d569b784425d" +source = "git+https://github.com/w3f/ring-proof#edd1e90b847e560bf60fc2e8712235ccfa11a9a9" dependencies = [ "ark-ec", "ark-ff", @@ -596,7 +596,6 @@ dependencies = [ "ark-serialize", "ark-std", "fflonk", - "getrandom_or_panic", "merlin 3.0.0", "rand_chacha 0.3.1", ] @@ -615,9 +614,9 @@ checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "const-random" -version = "0.1.17" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a" +checksum = "11df32a13d7892ec42d51d3d175faba5211ffe13ed25d4fb348ac9e9ce835593" dependencies = [ "const-random-macro", ] @@ -628,7 +627,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.10", "once_cell", "tiny-keccak", ] @@ -647,9 +646,9 @@ checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpp_demangle" @@ -695,9 +694,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.5.5" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" dependencies = [ "generic-array 0.14.7", "rand_core 0.6.4", @@ -786,7 +785,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -881,18 +880,18 @@ dependencies = [ [[package]] name = "docify" -version = "0.2.7" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc4fd38aaa9fb98ac70794c82a00360d1e165a87fbf96a8a91f9dfc602aaee2" +checksum = "4235e9b248e2ba4b92007fe9c646f3adf0ffde16dc74713eacc92b8bc58d8d2f" dependencies = [ "docify_macros", ] [[package]] name = "docify_macros" -version = "0.2.7" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63fa215f3a0d40fb2a221b3aa90d8e1fbb8379785a990cb60d62ac71ebdc6460" +checksum = "47020e12d7c7505670d1363dd53d6c23724f71a90a3ae32ff8eba40de8404626" dependencies = [ "common-path", "derive-syn-parse", @@ -900,7 +899,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.39", + "syn 2.0.38", "termcolor", "toml", "walkdir", @@ -929,15 +928,15 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.16" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" +checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" [[package]] name = "ecdsa" -version = "0.16.9" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" dependencies = [ "der", "digest 0.10.7", @@ -959,14 +958,14 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.1.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" +checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ + "curve25519-dalek 4.1.1", "ed25519", "serde", "sha2 0.10.8", - "subtle", "zeroize", ] @@ -992,9 +991,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" -version = "0.13.8" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" dependencies = [ "base16ct", "crypto-bigint", @@ -1023,12 +1022,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] @@ -1041,7 +1040,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -1069,7 +1068,7 @@ dependencies = [ [[package]] name = "fflonk" version = "0.1.0" -source = "git+https://github.com/w3f/fflonk#95f3a57d1f4252fe95310c1567d153f25f3066b4" +source = "git+https://github.com/w3f/fflonk#e141d4b6f42fb481aefe1b479788694945b6940d" dependencies = [ "ark-ec", "ark-ff", @@ -1081,9 +1080,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.5" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" +checksum = "a481586acf778f1b1455424c343f71124b048ffa5f4fc3f8f6ae9dc432dcb3c7" [[package]] name = "fixed-hash" @@ -1099,9 +1098,9 @@ dependencies = [ [[package]] name = "form_urlencoded" -version = "1.2.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1199,7 +1198,7 @@ dependencies = [ "proc-macro2", "quote", "sp-core-hashing", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -1208,10 +1207,10 @@ version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "frame-support-procedural-tools-derive", - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -1221,7 +1220,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd838 dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -1245,12 +1244,9 @@ dependencies = [ [[package]] name = "fs-err" -version = "2.11.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41" -dependencies = [ - "autocfg", -] +checksum = "0845fa252299212f0389d64ba26f34fa32cfe41588355f21ed507c59a0f64541" [[package]] name = "funty" @@ -1315,7 +1311,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -1381,24 +1377,15 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", "wasi 0.11.0+wasi-snapshot-preview1", ] -[[package]] -name = "getrandom_or_panic" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea1015b5a70616b688dc230cfe50c8af89d972cb132d5a622814d29773b10b9" -dependencies = [ - "rand_core 0.6.4", -] - [[package]] name = "gimli" version = "0.27.3" @@ -1412,9 +1399,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "group" @@ -1462,9 +1449,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "hermit-abi" @@ -1543,9 +1530,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.5.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1612,12 +1599,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.2", ] [[package]] @@ -1657,18 +1644,18 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] [[package]] name = "k256" -version = "0.13.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", "ecdsa", @@ -1694,9 +1681,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libsecp256k1" @@ -1763,9 +1750,9 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lite-json" @@ -1819,7 +1806,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -1833,7 +1820,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -1844,7 +1831,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -1855,7 +1842,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -1889,7 +1876,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.26", + "rustix 0.38.21", ] [[package]] @@ -2303,9 +2290,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.9" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" +checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" dependencies = [ "arrayvec 0.7.4", "bitvec", @@ -2318,11 +2305,11 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.9" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" +checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ - "proc-macro-crate 2.0.0", + "proc-macro-crate", "proc-macro2", "quote", "syn 1.0.109", @@ -2383,9 +2370,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" @@ -2411,9 +2398,9 @@ dependencies = [ [[package]] name = "platforms" -version = "3.2.0" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" [[package]] name = "ppv-lite86" @@ -2441,16 +2428,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit 0.19.15", -] - -[[package]] -name = "proc-macro-crate" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" -dependencies = [ - "toml_edit 0.20.7", + "toml_edit", ] [[package]] @@ -2485,14 +2463,14 @@ checksum = "9b698b0b09d40e9b7c1a47b132d66a8b54bcd20583d9b6d06e4535e383b4405c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -2580,7 +2558,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.10", ] [[package]] @@ -2624,7 +2602,7 @@ checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -2684,7 +2662,7 @@ dependencies = [ [[package]] name = "ring" version = "0.1.0" -source = "git+https://github.com/w3f/ring-proof#61e7b528bc0170d6bf541be32440d569b784425d" +source = "git+https://github.com/w3f/ring-proof#edd1e90b847e560bf60fc2e8712235ccfa11a9a9" dependencies = [ "ark-ec", "ark-ff", @@ -2740,15 +2718,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.26" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys 0.4.12", - "windows-sys 0.52.0", + "linux-raw-sys 0.4.10", + "windows-sys 0.48.0", ] [[package]] @@ -2801,7 +2779,7 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 1.0.109", @@ -2891,22 +2869,22 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -2986,9 +2964,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.2.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ "digest 0.10.7", "rand_core 0.6.4", @@ -3018,9 +2996,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "sp-api" @@ -3051,10 +3029,10 @@ dependencies = [ "Inflector", "blake2", "expander", - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -3151,7 +3129,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd838 dependencies = [ "quote", "sp-core-hashing", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -3161,7 +3139,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd838 dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -3303,10 +3281,10 @@ version = "11.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?tag=v1.3.0-rc1#7c9fd83805cc446983a7698c7a3281677cf655c8" dependencies = [ "Inflector", - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -3436,7 +3414,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -3469,9 +3447,9 @@ dependencies = [ [[package]] name = "spki" -version = "0.7.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", "der", @@ -3479,9 +3457,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.44.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35935738370302d5e33963665b77541e4b990a3e919ec904c837a56cfc891de1" +checksum = "5e6915280e2d0db8911e5032a5c275571af6bdded2916abd691a659be25d3439" dependencies = [ "Inflector", "num-format", @@ -3506,9 +3484,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "substrate-bip39" -version = "0.4.5" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e620c7098893ba667438b47169c00aacdd9e7c10e042250ce2b60b087ec97328" +checksum = "49eee6965196b32f882dd2ee85a92b1dbead41b04e53907f269de3b0dc04733c" dependencies = [ "hmac 0.11.0", "pbkdf2 0.8.0", @@ -3536,9 +3514,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -3559,9 +3537,9 @@ checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" [[package]] name = "termcolor" -version = "1.4.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] @@ -3583,7 +3561,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -3641,14 +3619,14 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "toml" -version = "0.8.8" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.0", + "toml_edit", ] [[package]] @@ -3666,29 +3644,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", - "toml_datetime", - "winnow", -] - -[[package]] -name = "toml_edit" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" -dependencies = [ - "indexmap 2.1.0", - "toml_datetime", - "winnow", -] - -[[package]] -name = "toml_edit" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" -dependencies = [ - "indexmap 2.1.0", + "indexmap 2.0.2", "serde", "serde_spanned", "toml_datetime", @@ -3714,7 +3670,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] @@ -3857,9 +3813,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "url" -version = "2.5.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -3926,9 +3882,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3936,24 +3892,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3961,22 +3917,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasmparser" @@ -4159,10 +4115,7 @@ dependencies = [ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" @@ -4191,15 +4144,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", -] - [[package]] name = "windows-targets" version = "0.42.2" @@ -4230,21 +4174,6 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", -] - [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -4257,12 +4186,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -4275,12 +4198,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -4293,12 +4210,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -4311,12 +4222,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -4329,12 +4234,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -4347,12 +4246,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -4365,17 +4258,11 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" - [[package]] name = "winnow" -version = "0.5.23" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38cf28f534400ca4195b18033e02c5dd7c36b1138a56f2cfebca48112b528f63" +checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" dependencies = [ "memchr", ] @@ -4391,29 +4278,29 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.28" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e" +checksum = "dd66a62464e3ffd4e37bd09950c2b9dd6c4f8767380fabba0d523f9a775bc85a" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.28" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b" +checksum = "255c4596d41e6916ced49cfafea18727b24d67878fa180ddfd69b9df34fd1726" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" dependencies = [ "zeroize_derive", ] @@ -4426,5 +4313,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.38", ]