difftreelog
fix tests and weights
in: master
16 files changed
pallets/balances-adapter/src/erc.rsdiffbeforeafterboth--- a/pallets/balances-adapter/src/erc.rs
+++ b/pallets/balances-adapter/src/erc.rs
@@ -1,6 +1,7 @@
-use crate::{Config, NativeFungibleHandle};
+use crate::{Config, NativeFungibleHandle, SelfWeightOf};
use evm_coder::{abi::AbiType, ToLog, generate_stubgen, solidity_interface, types::*};
use frame_support::traits::{Currency, ExistenceRequirement};
+use pallet_balances::WeightInfo;
use pallet_common::{
erc::{CommonEvmHandler, CrossAccountId, PrecompileHandle, PrecompileResult},
eth::CrossAddress,
@@ -73,7 +74,7 @@
Ok(total.into())
}
- // #[weight(<SelfWeightOf<T>>::transfer())]
+ #[weight(<SelfWeightOf<T>>::transfer())]
fn transfer(&mut self, caller: Caller, to: Address, amount: U256) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
@@ -93,7 +94,7 @@
Ok(true)
}
- // #[weight(<SelfWeightOf<T>>::transfer_from())]
+ #[weight(<SelfWeightOf<T>>::transfer())]
fn transfer_from(
&mut self,
caller: Caller,
@@ -138,7 +139,7 @@
Ok(balance.into())
}
- // #[weight(<SelfWeightOf<T>>::transfer())]
+ #[weight(<SelfWeightOf<T>>::transfer())]
fn transfer_cross(&mut self, caller: Caller, to: CrossAddress, amount: U256) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
let to = to.into_sub_cross_account::<T>()?;
@@ -158,7 +159,7 @@
Ok(true)
}
- // #[weight(<SelfWeightOf<T>>::transfer_from())]
+ #[weight(<SelfWeightOf<T>>::transfer())]
fn transfer_from_cross(
&mut self,
caller: Caller,
pallets/balances-adapter/src/lib.rsdiffbeforeafterboth--- a/pallets/balances-adapter/src/lib.rs
+++ b/pallets/balances-adapter/src/lib.rs
@@ -11,6 +11,8 @@
pub mod common;
pub mod erc;
+pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
+
pub struct NativeFungibleHandle<T: Config>(SubstrateRecorder<T>);
impl<T: Config> NativeFungibleHandle<T> {
pub fn new() -> NativeFungibleHandle<T> {
@@ -34,6 +36,7 @@
pub mod pallet {
use alloc::string::String;
use frame_support::{traits::Get, sp_runtime::DispatchResult};
+ use pallet_balances::WeightInfo;
use sp_core::U256;
#[pallet::config]
@@ -49,6 +52,8 @@
type Decimals: Get<u8>;
type Name: Get<String>;
type Symbol: Get<String>;
+
+ type WeightInfo: WeightInfo;
}
#[pallet::pallet]
pub struct Pallet<T>(_);
runtime/common/config/pallets/mod.rsdiffbeforeafterboth--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -94,6 +94,7 @@
type Decimals = Decimals;
type Name = Name;
type Symbol = Symbol;
+ type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;
}
parameter_types! {
tests/src/addCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/addCollectionAdmin.test.ts
+++ b/tests/src/addCollectionAdmin.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test addCollectionAdmin(collection_id, new_admin_id):', () => {
let donor: IKeyringPair;
@@ -82,7 +83,7 @@
itSub("Can't add collection admin of not existing collection.", async ({helper}) => {
const [alice, bob] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.addAdmin(alice, collectionId, {Substrate: bob.address})).to.be.rejectedWith(/common\.CollectionNotFound/);
tests/src/allowLists.test.tsdiffbeforeafterboth--- a/tests/src/allowLists.test.ts
+++ b/tests/src/allowLists.test.ts
@@ -16,7 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {usingPlaygrounds, expect, itSub} from './util';
-import {ICollectionPermissions} from './util/playgrounds/types';
+import {ICollectionPermissions, NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test ext. Allow list tests', () => {
let alice: IKeyringPair;
@@ -60,7 +60,7 @@
describe('Negative', () => {
itSub('Nobody can add address to allow list of non-existing collection', async ({helper}) => {
- const collectionId = (1<<32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.nft.addToAllowList(bob, collectionId, {Substrate: charlie.address}))
.to.be.rejectedWith(/common\.CollectionNotFound/);
});
@@ -140,7 +140,7 @@
});
itSub('Nobody can remove address from allow list of non-existing collection', async ({helper}) => {
- const collectionId = (1<<32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.removeFromAllowList(bob, collectionId, {Substrate: charlie.address}))
.to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/change-collection-owner.test.tsdiffbeforeafterboth--- a/tests/src/change-collection-owner.test.ts
+++ b/tests/src/change-collection-owner.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {usingPlaygrounds, expect, itSub} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test changeCollectionOwner(collection_id, new_owner):', () => {
let alice: IKeyringPair;
@@ -127,7 +128,7 @@
});
itSub('Can\'t change owner of a non-existing collection.', async ({helper}) => {
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
const changeOwnerTx = () => helper.collection.changeOwner(bob, collectionId, bob.address);
await expect(changeOwnerTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/confirmSponsorship.test.tsdiffbeforeafterboth--- a/tests/src/confirmSponsorship.test.ts
+++ b/tests/src/confirmSponsorship.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {usingPlaygrounds, expect, itSub, Pallets} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
async function setSponsorHelper(collection: any, signer: IKeyringPair, sponsorAddress: string) {
await collection.setSponsor(signer, sponsorAddress);
@@ -198,7 +199,7 @@
});
itSub('(!negative test!) Confirm sponsorship for a collection that never existed', async ({helper}) => {
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
const confirmSponsorshipTx = () => helper.collection.confirmSponsorship(bob, collectionId);
await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/types.ts
+++ b/tests/src/eth/util/playgrounds/types.ts
@@ -48,5 +48,3 @@
field: CollectionLimitField,
value: OptionUint,
}
-
-export const NON_EXISTENT_COLLECTION_ID = 4_294_967_295;
\ No newline at end of file
tests/src/removeCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/removeCollectionAdmin.test.ts
+++ b/tests/src/removeCollectionAdmin.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test removeCollectionAdmin(collection_id, account_id):', () => {
let alice: IKeyringPair;
@@ -68,7 +69,7 @@
});
itSub('Can\'t remove collection admin from not existing collection', async ({helper}) => {
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.removeAdmin(alice, collectionId, {Substrate: bob.address}))
.to.be.rejectedWith(/common\.CollectionNotFound/);
tests/src/removeCollectionSponsor.test.tsdiffbeforeafterboth--- a/tests/src/removeCollectionSponsor.test.ts
+++ b/tests/src/removeCollectionSponsor.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('integration test: ext. removeCollectionSponsor():', () => {
let donor: IKeyringPair;
@@ -91,7 +92,7 @@
});
itSub('(!negative test!) Remove sponsor for a collection that never existed', async ({helper}) => {
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.removeSponsor(alice, collectionId)).to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/setCollectionLimits.test.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits18import {IKeyringPair} from '@polkadot/types/types';19import {itSub, usingPlaygrounds, expect} from './util';2021const accountTokenOwnershipLimit = 0;22const sponsoredDataSize = 0;23const sponsorTransferTimeout = 1;24const tokenLimit = 10;2526describe('setCollectionLimits positive', () => {27 let alice: IKeyringPair;28 let bob: IKeyringPair;2930 before(async () => {31 await usingPlaygrounds(async (helper, privateKey) => {32 const donor = await privateKey({url: import.meta.url});33 [alice, bob] = await helper.arrange.createAccounts([20n, 10n], donor);34 });35 });3637 itSub('execute setCollectionLimits with predefined params', async ({helper}) => {38 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-1', tokenPrefix: 'SCL'});3940 await collection.setLimits(41 alice,42 {43 accountTokenOwnershipLimit,44 sponsoredDataSize,45 tokenLimit,46 sponsorTransferTimeout,47 ownerCanTransfer: true,48 ownerCanDestroy: true,49 },50 );5152 // get collection limits defined previously53 const collectionInfo = await collection.getEffectiveLimits();5455 expect(collectionInfo.accountTokenOwnershipLimit).to.be.equal(accountTokenOwnershipLimit);56 expect(collectionInfo.sponsoredDataSize).to.be.equal(sponsoredDataSize);57 expect(collectionInfo.tokenLimit).to.be.equal(tokenLimit);58 expect(collectionInfo.sponsorTransferTimeout).to.be.equal(sponsorTransferTimeout);59 expect(collectionInfo.ownerCanTransfer).to.be.true;60 expect(collectionInfo.ownerCanDestroy).to.be.true;61 });6263 itSub('Set the same token limit twice', async ({helper}) => {64 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-2', tokenPrefix: 'SCL'});6566 const collectionLimits = {67 accountTokenOwnershipLimit,68 sponsoredDataSize,69 tokenLimit,70 sponsorTransferTimeout,71 ownerCanTransfer: true,72 ownerCanDestroy: true,73 };7475 await collection.setLimits(alice, collectionLimits);7677 const collectionInfo1 = await collection.getEffectiveLimits();7879 expect(collectionInfo1.tokenLimit).to.be.equal(tokenLimit);8081 await collection.setLimits(alice, collectionLimits);82 const collectionInfo2 = await collection.getEffectiveLimits();83 expect(collectionInfo2.tokenLimit).to.be.equal(tokenLimit);84 });8586 itSub('execute setCollectionLimits from admin collection', async ({helper}) => {87 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-3', tokenPrefix: 'SCL'});88 await collection.addAdmin(alice, {Substrate: bob.address});8990 const collectionLimits = {91 accountTokenOwnershipLimit,92 sponsoredDataSize,93 // sponsoredMintSize,94 tokenLimit,95 };9697 await expect(collection.setLimits(alice, collectionLimits)).to.not.be.rejected;98 });99});100101describe('setCollectionLimits negative', () => {102 let alice: IKeyringPair;103 let bob: IKeyringPair;104105 before(async () => {106 await usingPlaygrounds(async (helper, privateKey) => {107 const donor = await privateKey({url: import.meta.url});108 [alice, bob] = await helper.arrange.createAccounts([20n, 10n], donor);109 });110 });111112 itSub('execute setCollectionLimits for not exists collection', async ({helper}) => {113 const nonExistentCollectionId = (1 << 32) - 1;114 await expect(helper.collection.setLimits(115 alice,116 nonExistentCollectionId,117 {118 accountTokenOwnershipLimit,119 sponsoredDataSize,120 // sponsoredMintSize,121 tokenLimit,122 },123 )).to.be.rejectedWith(/common\.CollectionNotFound/);124 });125126 itSub('execute setCollectionLimits from user who is not owner of this collection', async ({helper}) => {127 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-Neg-1', tokenPrefix: 'SCL'});128129 await expect(collection.setLimits(bob, {130 accountTokenOwnershipLimit,131 sponsoredDataSize,132 // sponsoredMintSize,133 tokenLimit,134 })).to.be.rejectedWith(/common\.NoPermission/);135 });136137 itSub('fails when trying to enable OwnerCanTransfer after it was disabled', async ({helper}) => {138 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-Neg-2', tokenPrefix: 'SCL'});139140 await collection.setLimits(alice, {141 accountTokenOwnershipLimit,142 sponsoredDataSize,143 tokenLimit,144 sponsorTransferTimeout,145 ownerCanTransfer: false,146 ownerCanDestroy: true,147 });148149 await expect(collection.setLimits(alice, {150 accountTokenOwnershipLimit,151 sponsoredDataSize,152 tokenLimit,153 sponsorTransferTimeout,154 ownerCanTransfer: true,155 ownerCanDestroy: true,156 })).to.be.rejectedWith(/common\.OwnerPermissionsCantBeReverted/);157 });158159 itSub('fails when trying to enable OwnerCanDestroy after it was disabled', async ({helper}) => {160 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-Neg-3', tokenPrefix: 'SCL'});161162 await collection.setLimits(alice, {163 accountTokenOwnershipLimit,164 sponsoredDataSize,165 tokenLimit,166 sponsorTransferTimeout,167 ownerCanTransfer: true,168 ownerCanDestroy: false,169 });170171 await expect(collection.setLimits(alice, {172 accountTokenOwnershipLimit,173 sponsoredDataSize,174 tokenLimit,175 sponsorTransferTimeout,176 ownerCanTransfer: true,177 ownerCanDestroy: true,178 })).to.be.rejectedWith(/common\.OwnerPermissionsCantBeReverted/);179 });180181 itSub('Setting the higher token limit fails', async ({helper}) => {182 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-Neg-4', tokenPrefix: 'SCL'});183184 const collectionLimits = {185 accountTokenOwnershipLimit: accountTokenOwnershipLimit,186 sponsoredMintSize: sponsoredDataSize,187 tokenLimit: tokenLimit,188 sponsorTransferTimeout,189 ownerCanTransfer: true,190 ownerCanDestroy: true,191 };192193 // The first time194 await collection.setLimits(alice, collectionLimits);195196 // The second time - higher token limit197 collectionLimits.tokenLimit += 1;198 await expect(collection.setLimits(alice, collectionLimits)).to.be.rejectedWith(/common\.CollectionTokenLimitExceeded/);199 });200});1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits18import {IKeyringPair} from '@polkadot/types/types';19import {itSub, usingPlaygrounds, expect} from './util';20import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';2122const accountTokenOwnershipLimit = 0;23const sponsoredDataSize = 0;24const sponsorTransferTimeout = 1;25const tokenLimit = 10;2627describe('setCollectionLimits positive', () => {28 let alice: IKeyringPair;29 let bob: IKeyringPair;3031 before(async () => {32 await usingPlaygrounds(async (helper, privateKey) => {33 const donor = await privateKey({url: import.meta.url});34 [alice, bob] = await helper.arrange.createAccounts([20n, 10n], donor);35 });36 });3738 itSub('execute setCollectionLimits with predefined params', async ({helper}) => {39 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-1', tokenPrefix: 'SCL'});4041 await collection.setLimits(42 alice,43 {44 accountTokenOwnershipLimit,45 sponsoredDataSize,46 tokenLimit,47 sponsorTransferTimeout,48 ownerCanTransfer: true,49 ownerCanDestroy: true,50 },51 );5253 // get collection limits defined previously54 const collectionInfo = await collection.getEffectiveLimits();5556 expect(collectionInfo.accountTokenOwnershipLimit).to.be.equal(accountTokenOwnershipLimit);57 expect(collectionInfo.sponsoredDataSize).to.be.equal(sponsoredDataSize);58 expect(collectionInfo.tokenLimit).to.be.equal(tokenLimit);59 expect(collectionInfo.sponsorTransferTimeout).to.be.equal(sponsorTransferTimeout);60 expect(collectionInfo.ownerCanTransfer).to.be.true;61 expect(collectionInfo.ownerCanDestroy).to.be.true;62 });6364 itSub('Set the same token limit twice', async ({helper}) => {65 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-2', tokenPrefix: 'SCL'});6667 const collectionLimits = {68 accountTokenOwnershipLimit,69 sponsoredDataSize,70 tokenLimit,71 sponsorTransferTimeout,72 ownerCanTransfer: true,73 ownerCanDestroy: true,74 };7576 await collection.setLimits(alice, collectionLimits);7778 const collectionInfo1 = await collection.getEffectiveLimits();7980 expect(collectionInfo1.tokenLimit).to.be.equal(tokenLimit);8182 await collection.setLimits(alice, collectionLimits);83 const collectionInfo2 = await collection.getEffectiveLimits();84 expect(collectionInfo2.tokenLimit).to.be.equal(tokenLimit);85 });8687 itSub('execute setCollectionLimits from admin collection', async ({helper}) => {88 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-3', tokenPrefix: 'SCL'});89 await collection.addAdmin(alice, {Substrate: bob.address});9091 const collectionLimits = {92 accountTokenOwnershipLimit,93 sponsoredDataSize,94 // sponsoredMintSize,95 tokenLimit,96 };9798 await expect(collection.setLimits(alice, collectionLimits)).to.not.be.rejected;99 });100});101102describe('setCollectionLimits negative', () => {103 let alice: IKeyringPair;104 let bob: IKeyringPair;105106 before(async () => {107 await usingPlaygrounds(async (helper, privateKey) => {108 const donor = await privateKey({url: import.meta.url});109 [alice, bob] = await helper.arrange.createAccounts([20n, 10n], donor);110 });111 });112113 itSub('execute setCollectionLimits for not exists collection', async ({helper}) => {114 const nonExistentCollectionId = NON_EXISTENT_COLLECTION_ID;115 await expect(helper.collection.setLimits(116 alice,117 nonExistentCollectionId,118 {119 accountTokenOwnershipLimit,120 sponsoredDataSize,121 // sponsoredMintSize,122 tokenLimit,123 },124 )).to.be.rejectedWith(/common\.CollectionNotFound/);125 });126127 itSub('execute setCollectionLimits from user who is not owner of this collection', async ({helper}) => {128 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-Neg-1', tokenPrefix: 'SCL'});129130 await expect(collection.setLimits(bob, {131 accountTokenOwnershipLimit,132 sponsoredDataSize,133 // sponsoredMintSize,134 tokenLimit,135 })).to.be.rejectedWith(/common\.NoPermission/);136 });137138 itSub('fails when trying to enable OwnerCanTransfer after it was disabled', async ({helper}) => {139 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-Neg-2', tokenPrefix: 'SCL'});140141 await collection.setLimits(alice, {142 accountTokenOwnershipLimit,143 sponsoredDataSize,144 tokenLimit,145 sponsorTransferTimeout,146 ownerCanTransfer: false,147 ownerCanDestroy: true,148 });149150 await expect(collection.setLimits(alice, {151 accountTokenOwnershipLimit,152 sponsoredDataSize,153 tokenLimit,154 sponsorTransferTimeout,155 ownerCanTransfer: true,156 ownerCanDestroy: true,157 })).to.be.rejectedWith(/common\.OwnerPermissionsCantBeReverted/);158 });159160 itSub('fails when trying to enable OwnerCanDestroy after it was disabled', async ({helper}) => {161 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-Neg-3', tokenPrefix: 'SCL'});162163 await collection.setLimits(alice, {164 accountTokenOwnershipLimit,165 sponsoredDataSize,166 tokenLimit,167 sponsorTransferTimeout,168 ownerCanTransfer: true,169 ownerCanDestroy: false,170 });171172 await expect(collection.setLimits(alice, {173 accountTokenOwnershipLimit,174 sponsoredDataSize,175 tokenLimit,176 sponsorTransferTimeout,177 ownerCanTransfer: true,178 ownerCanDestroy: true,179 })).to.be.rejectedWith(/common\.OwnerPermissionsCantBeReverted/);180 });181182 itSub('Setting the higher token limit fails', async ({helper}) => {183 const collection = await helper.nft.mintCollection(alice, {name: 'SetCollectionLimits-Neg-4', tokenPrefix: 'SCL'});184185 const collectionLimits = {186 accountTokenOwnershipLimit: accountTokenOwnershipLimit,187 sponsoredMintSize: sponsoredDataSize,188 tokenLimit: tokenLimit,189 sponsorTransferTimeout,190 ownerCanTransfer: true,191 ownerCanDestroy: true,192 };193194 // The first time195 await collection.setLimits(alice, collectionLimits);196197 // The second time - higher token limit198 collectionLimits.tokenLimit += 1;199 await expect(collection.setLimits(alice, collectionLimits)).to.be.rejectedWith(/common\.CollectionTokenLimitExceeded/);200 });201});tests/src/setCollectionSponsor.test.tsdiffbeforeafterboth--- a/tests/src/setCollectionSponsor.test.ts
+++ b/tests/src/setCollectionSponsor.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect, Pallets} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('integration test: ext. setCollectionSponsor():', () => {
let alice: IKeyringPair;
@@ -105,7 +106,7 @@
});
itSub('(!negative test!) Add sponsor to a collection that never existed', async ({helper}) => {
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.setSponsor(alice, collectionId, bob.address))
.to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/setPermissions.test.tsdiffbeforeafterboth--- a/tests/src/setPermissions.test.ts
+++ b/tests/src/setPermissions.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test: Set Permissions', () => {
let alice: IKeyringPair;
@@ -85,7 +86,7 @@
});
itSub('fails on not existing collection', async ({helper}) => {
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.setPermissions(alice, collectionId, {access: 'AllowList', mintMode: true}))
.to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/transfer.test.tsdiffbeforeafterboth--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -17,7 +17,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itEth, usingEthPlaygrounds} from './eth/util';
import {itSub, Pallets, usingPlaygrounds, expect} from './util';
-import {NON_EXISTENT_COLLECTION_ID} from './eth/util/playgrounds/types';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test Transfer(recipient, collection_id, item_id, value)', () => {
let donor: IKeyringPair;
tests/src/transferFrom.test.tsdiffbeforeafterboth--- a/tests/src/transferFrom.test.ts
+++ b/tests/src/transferFrom.test.ts
@@ -16,7 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, Pallets, usingPlaygrounds, expect} from './util';
-import {NON_EXISTENT_COLLECTION_ID} from './eth/util/playgrounds/types';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test transferFrom(from, recipient, collection_id, item_id, value):', () => {
let alice: IKeyringPair;
tests/src/util/playgrounds/types.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/types.ts
+++ b/tests/src/util/playgrounds/types.ts
@@ -3,6 +3,8 @@
import {IKeyringPair} from '@polkadot/types/types';
+export const NON_EXISTENT_COLLECTION_ID = 4_294_967_295;
+
export interface IEvent {
section: string;
method: string;