difftreelog
Merge branch 'develop' into feature/CORE-37
in: master
4 files changed
pallets/nft/src/lib.rsdiffbeforeafterboth--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -255,6 +255,11 @@
.max(Self::create_item_fungible())
.max(Self::create_item_refungible(data))
}
+ fn create_multiple_items(amount: u32) -> Weight {
+ Self::create_multiple_items_nft(amount)
+ .max(Self::create_multiple_items_fungible(amount))
+ .max(Self::create_multiple_items_refungible(amount))
+ }
fn burn_item() -> Weight {
// TODO: refungible, fungible
Self::burn_item_nft()
@@ -901,9 +906,7 @@
/// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
///
/// * owner: Address, initial owner of the NFT.
- #[weight = <SelfWeightOf<T>>::create_item(items_data.iter()
- .map(|data| { data.data_size() as u32 })
- .sum())]
+ #[weight = <SelfWeightOf<T>>::create_multiple_items(items_data.len() as u32)]
#[transactional]
pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResult {
@@ -929,7 +932,7 @@
/// * collection_id: ID of the collection.
///
/// * value: New flag value.
- #[weight = <SelfWeightOf<T>>::burn_item()]
+ #[weight = <SelfWeightOf<T>>::set_transfers_enabled_flag()]
#[transactional]
pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {
tests/src/pallet-presence.test.tsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { ApiPromise } from '@polkadot/api';7import { expect } from 'chai';8import usingApi from './substrate/substrate-api';910function getModuleNames(api: ApiPromise): string[] {11 return api.runtimeMetadata.asLatest.modules.map(m => m.name.toString().toLowerCase());12}1314// Pallets that must always be present15const requiredPallets = [16 'balances',17 'randomnesscollectiveflip',18 'timestamp',19 'transactionpayment',20 'treasury',21 'system',22 'vesting',23 'parachainsystem',24 'parachaininfo',25 'evm',26 'evmcodersubstrate',27 'evmcontracthelpers',28 'evmtransactionpayment',29 'ethereum',30 'xcmpqueue',31 'polkadotxcm',32 'cumulusxcm',33 'dmpqueue',34 'inflation',35 'nft',36 'scheduler',37 'nftpayment',38 'charging',39];4041// Pallets that depend on consensus and governance configuration42const consensusPallets = [43 'sudo',44 'aura',45 'auraext',46];4748describe('Pallet presence', () => {49 it('Required pallets are present', async () => {50 await usingApi(async api => {51 for (let i=0; i<requiredPallets.length; i++) {52 expect(getModuleNames(api)).to.include(requiredPallets[i]);53 }54 });55 });56 it('Governance and consensus pallets are present', async () => {57 await usingApi(async api => {58 for (let i=0; i<consensusPallets.length; i++) {59 expect(getModuleNames(api)).to.include(consensusPallets[i]);60 }61 });62 });63 it('No extra pallets are included', async () => {64 await usingApi(async api => {65 expect(getModuleNames(api).sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());66 });67 });68});1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { ApiPromise } from '@polkadot/api';7import { expect } from 'chai';8import usingApi from './substrate/substrate-api';910function getModuleNames(api: ApiPromise): string[] {11 return api.runtimeMetadata.asLatest.modules.map(m => m.name.toString().toLowerCase());12}1314// Pallets that must always be present15const requiredPallets = [16 'balances',17 'randomnesscollectiveflip',18 'timestamp',19 'transactionpayment',20 'treasury',21 'system',22 'vesting',23 'parachainsystem',24 'parachaininfo',25 'evm',26 'evmcodersubstrate',27 'evmcontracthelpers',28 'evmmigration',29 'evmtransactionpayment',30 'ethereum',31 'xcmpqueue',32 'polkadotxcm',33 'cumulusxcm',34 'dmpqueue',35 'inflation',36 'nft',37 'scheduler',38 'nftpayment',39 'charging',40];4142// Pallets that depend on consensus and governance configuration43const consensusPallets = [44 'sudo',45 'aura',46 'auraext',47];4849describe('Pallet presence', () => {50 it('Required pallets are present', async () => {51 await usingApi(async api => {52 for (let i=0; i<requiredPallets.length; i++) {53 expect(getModuleNames(api)).to.include(requiredPallets[i]);54 }55 });56 });57 it('Governance and consensus pallets are present', async () => {58 await usingApi(async api => {59 for (let i=0; i<consensusPallets.length; i++) {60 expect(getModuleNames(api)).to.include(consensusPallets[i]);61 }62 });63 });64 it('No extra pallets are included', async () => {65 await usingApi(async api => {66 expect(getModuleNames(api).sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());67 });68 });69});tests/src/setChainLimits.test.tsdiffbeforeafterboth--- a/tests/src/setChainLimits.test.ts
+++ b/tests/src/setChainLimits.test.ts
@@ -13,7 +13,7 @@
IChainLimits,
} from './util/helpers';
-describe('Negative Integration Test setChainLimits', () => {
+describe.skip('Negative Integration Test setChainLimits', () => {
let alice: IKeyringPair;
let bob: IKeyringPair;
let dave: IKeyringPair;
tests/src/transfer.test.tsdiffbeforeafterboth--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -60,7 +60,7 @@
// tslint:disable-next-line:no-unused-expression
expect(result.success).to.be.false;
};
- expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees , e.g. account balance too low');
+ await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees , e.g. account balance too low');
});
});