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.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/>.1617import {IKeyringPair} from '@polkadot/types/types';18import {usingPlaygrounds, expect, itSub} from './util';1920describe('Integration Test changeCollectionOwner(collection_id, new_owner):', () => {21 let alice: IKeyringPair;22 let bob: IKeyringPair;2324 before(async () => {25 await usingPlaygrounds(async (helper, privateKey) => {26 const donor = await privateKey({url: import.meta.url});27 [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);28 });29 });3031 itSub('Changing owner changes owner address', async ({helper}) => {32 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});33 const beforeChanging = await helper.collection.getData(collection.collectionId);34 expect(beforeChanging?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(alice.address));3536 await collection.changeOwner(alice, bob.address);37 const afterChanging = await helper.collection.getData(collection.collectionId);38 expect(afterChanging?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(bob.address));39 });40});4142describe('Integration Test changeCollectionOwner(collection_id, new_owner) special checks for exOwner:', () => {43 let alice: IKeyringPair;44 let bob: IKeyringPair;45 let charlie: IKeyringPair;4647 before(async () => {48 await usingPlaygrounds(async (helper, privateKey) => {49 const donor = await privateKey({url: import.meta.url});50 [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);51 });52 });5354 itSub('Changing the owner of the collection is not allowed for the former owner', async ({helper}) => {55 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});5657 await collection.changeOwner(alice, bob.address);5859 const changeOwnerTx = () => collection.changeOwner(alice, alice.address);60 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);6162 const afterChanging = await helper.collection.getData(collection.collectionId);63 expect(afterChanging?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(bob.address));64 });6566 itSub('New collectionOwner has access to sponsorship management operations in the collection', async ({helper}) => {67 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});68 await collection.changeOwner(alice, bob.address);6970 const afterChanging = await helper.collection.getData(collection.collectionId);71 expect(afterChanging?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(bob.address));7273 await collection.setSponsor(bob, charlie.address);74 await collection.confirmSponsorship(charlie);75 await collection.removeSponsor(bob);76 const limits = {77 accountTokenOwnershipLimit: 1,78 tokenLimit: 1,79 sponsorTransferTimeout: 1,80 ownerCanDestroy: true,81 ownerCanTransfer: true,82 };8384 await collection.setLimits(bob, limits);85 const gotLimits = await collection.getEffectiveLimits();86 expect(gotLimits).to.be.deep.contains(limits);8788 await collection.setPermissions(bob, {access: 'AllowList', mintMode: true});8990 await collection.burn(bob);91 const collectionData = await helper.collection.getData(collection.collectionId);92 expect(collectionData).to.be.null;93 });9495 itSub('New collectionOwner has access to changeCollectionOwner', async ({helper}) => {96 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});97 await collection.changeOwner(alice, bob.address);98 await collection.changeOwner(bob, charlie.address);99 const collectionData = await collection.getData();100 expect(collectionData?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(charlie.address));101 });102});103104describe('Negative Integration Test changeCollectionOwner(collection_id, new_owner):', () => {105 let alice: IKeyringPair;106 let bob: IKeyringPair;107 let charlie: IKeyringPair;108109 before(async () => {110 await usingPlaygrounds(async (helper, privateKey) => {111 const donor = await privateKey({url: import.meta.url});112 [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);113 });114 });115116 itSub('Not owner can\'t change owner.', async ({helper}) => {117 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});118 const changeOwnerTx = () => collection.changeOwner(bob, bob.address);119 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);120 });121122 itSub('Collection admin can\'t change owner.', async ({helper}) => {123 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});124 await collection.addAdmin(alice, {Substrate: bob.address});125 const changeOwnerTx = () => collection.changeOwner(bob, bob.address);126 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);127 });128129 itSub('Can\'t change owner of a non-existing collection.', async ({helper}) => {130 const collectionId = (1 << 32) - 1;131 const changeOwnerTx = () => helper.collection.changeOwner(bob, collectionId, bob.address);132 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.CollectionNotFound/);133 });134135 itSub('Former collectionOwner not allowed to sponsorship management operations in the collection', async ({helper}) => {136 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});137 await collection.changeOwner(alice, bob.address);138139 const changeOwnerTx = () => collection.changeOwner(alice, alice.address);140 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);141142 const afterChanging = await helper.collection.getData(collection.collectionId);143 expect(afterChanging?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(bob.address));144145 const setSponsorTx = () => collection.setSponsor(alice, charlie.address);146 const confirmSponsorshipTx = () => collection.confirmSponsorship(alice);147 const removeSponsorTx = () => collection.removeSponsor(alice);148 await expect(setSponsorTx()).to.be.rejectedWith(/common\.NoPermission/);149 await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.ConfirmSponsorshipFail/);150 await expect(removeSponsorTx()).to.be.rejectedWith(/common\.NoPermission/);151152 const limits = {153 accountTokenOwnershipLimit: 1,154 tokenLimit: 1,155 sponsorTransferTimeout: 1,156 ownerCanDestroy: true,157 ownerCanTransfer: true,158 };159160 const setLimitsTx = () => collection.setLimits(alice, limits);161 await expect(setLimitsTx()).to.be.rejectedWith(/common\.NoPermission/);162163 const setPermissionTx = () => collection.setPermissions(alice, {access: 'AllowList', mintMode: true});164 await expect(setPermissionTx()).to.be.rejectedWith(/common\.NoPermission/);165166 const burnTx = () => collection.burn(alice);167 await expect(burnTx()).to.be.rejectedWith(/common\.NoPermission/);168 });169});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/>.1617import {IKeyringPair} from '@polkadot/types/types';18import {usingPlaygrounds, expect, itSub} from './util';19import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';2021describe('Integration Test changeCollectionOwner(collection_id, new_owner):', () => {22 let alice: IKeyringPair;23 let bob: IKeyringPair;2425 before(async () => {26 await usingPlaygrounds(async (helper, privateKey) => {27 const donor = await privateKey({url: import.meta.url});28 [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);29 });30 });3132 itSub('Changing owner changes owner address', async ({helper}) => {33 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});34 const beforeChanging = await helper.collection.getData(collection.collectionId);35 expect(beforeChanging?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(alice.address));3637 await collection.changeOwner(alice, bob.address);38 const afterChanging = await helper.collection.getData(collection.collectionId);39 expect(afterChanging?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(bob.address));40 });41});4243describe('Integration Test changeCollectionOwner(collection_id, new_owner) special checks for exOwner:', () => {44 let alice: IKeyringPair;45 let bob: IKeyringPair;46 let charlie: IKeyringPair;4748 before(async () => {49 await usingPlaygrounds(async (helper, privateKey) => {50 const donor = await privateKey({url: import.meta.url});51 [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);52 });53 });5455 itSub('Changing the owner of the collection is not allowed for the former owner', async ({helper}) => {56 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});5758 await collection.changeOwner(alice, bob.address);5960 const changeOwnerTx = () => collection.changeOwner(alice, alice.address);61 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);6263 const afterChanging = await helper.collection.getData(collection.collectionId);64 expect(afterChanging?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(bob.address));65 });6667 itSub('New collectionOwner has access to sponsorship management operations in the collection', async ({helper}) => {68 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});69 await collection.changeOwner(alice, bob.address);7071 const afterChanging = await helper.collection.getData(collection.collectionId);72 expect(afterChanging?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(bob.address));7374 await collection.setSponsor(bob, charlie.address);75 await collection.confirmSponsorship(charlie);76 await collection.removeSponsor(bob);77 const limits = {78 accountTokenOwnershipLimit: 1,79 tokenLimit: 1,80 sponsorTransferTimeout: 1,81 ownerCanDestroy: true,82 ownerCanTransfer: true,83 };8485 await collection.setLimits(bob, limits);86 const gotLimits = await collection.getEffectiveLimits();87 expect(gotLimits).to.be.deep.contains(limits);8889 await collection.setPermissions(bob, {access: 'AllowList', mintMode: true});9091 await collection.burn(bob);92 const collectionData = await helper.collection.getData(collection.collectionId);93 expect(collectionData).to.be.null;94 });9596 itSub('New collectionOwner has access to changeCollectionOwner', async ({helper}) => {97 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});98 await collection.changeOwner(alice, bob.address);99 await collection.changeOwner(bob, charlie.address);100 const collectionData = await collection.getData();101 expect(collectionData?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(charlie.address));102 });103});104105describe('Negative Integration Test changeCollectionOwner(collection_id, new_owner):', () => {106 let alice: IKeyringPair;107 let bob: IKeyringPair;108 let charlie: IKeyringPair;109110 before(async () => {111 await usingPlaygrounds(async (helper, privateKey) => {112 const donor = await privateKey({url: import.meta.url});113 [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);114 });115 });116117 itSub('Not owner can\'t change owner.', async ({helper}) => {118 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});119 const changeOwnerTx = () => collection.changeOwner(bob, bob.address);120 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);121 });122123 itSub('Collection admin can\'t change owner.', async ({helper}) => {124 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});125 await collection.addAdmin(alice, {Substrate: bob.address});126 const changeOwnerTx = () => collection.changeOwner(bob, bob.address);127 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);128 });129130 itSub('Can\'t change owner of a non-existing collection.', async ({helper}) => {131 const collectionId = NON_EXISTENT_COLLECTION_ID;132 const changeOwnerTx = () => helper.collection.changeOwner(bob, collectionId, bob.address);133 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.CollectionNotFound/);134 });135136 itSub('Former collectionOwner not allowed to sponsorship management operations in the collection', async ({helper}) => {137 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});138 await collection.changeOwner(alice, bob.address);139140 const changeOwnerTx = () => collection.changeOwner(alice, alice.address);141 await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);142143 const afterChanging = await helper.collection.getData(collection.collectionId);144 expect(afterChanging?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(bob.address));145146 const setSponsorTx = () => collection.setSponsor(alice, charlie.address);147 const confirmSponsorshipTx = () => collection.confirmSponsorship(alice);148 const removeSponsorTx = () => collection.removeSponsor(alice);149 await expect(setSponsorTx()).to.be.rejectedWith(/common\.NoPermission/);150 await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.ConfirmSponsorshipFail/);151 await expect(removeSponsorTx()).to.be.rejectedWith(/common\.NoPermission/);152153 const limits = {154 accountTokenOwnershipLimit: 1,155 tokenLimit: 1,156 sponsorTransferTimeout: 1,157 ownerCanDestroy: true,158 ownerCanTransfer: true,159 };160161 const setLimitsTx = () => collection.setLimits(alice, limits);162 await expect(setLimitsTx()).to.be.rejectedWith(/common\.NoPermission/);163164 const setPermissionTx = () => collection.setPermissions(alice, {access: 'AllowList', mintMode: true});165 await expect(setPermissionTx()).to.be.rejectedWith(/common\.NoPermission/);166167 const burnTx = () => collection.burn(alice);168 await expect(burnTx()).to.be.rejectedWith(/common\.NoPermission/);169 });170});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.tsdiffbeforeafterboth--- a/tests/src/setCollectionLimits.test.ts
+++ b/tests/src/setCollectionLimits.test.ts
@@ -17,6 +17,7 @@
// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
const accountTokenOwnershipLimit = 0;
const sponsoredDataSize = 0;
@@ -110,7 +111,7 @@
});
itSub('execute setCollectionLimits for not exists collection', async ({helper}) => {
- const nonExistentCollectionId = (1 << 32) - 1;
+ const nonExistentCollectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.setLimits(
alice,
nonExistentCollectionId,
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;