git.delta.rocks / unique-network / refs/commits / 313d9317ef02

difftreelog

test fix integration

Yaroslav Bolyukin2023-05-31parent: #8545aff.patch.diff
in: master

6 files changed

modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
516 const owner = await helper.eth.createAccountWithBalance(donor);516 const owner = await helper.eth.createAccountWithBalance(donor);
517 const sponsor = await helper.eth.createAccountWithBalance(donor);517 const sponsor = await helper.eth.createAccountWithBalance(donor);
518 const user = await helper.eth.createAccountWithBalance(donor);518 const user = await helper.eth.createAccountWithBalance(donor);
519 const helpers = await helper.ethNativeContract.contractHelpers(owner);519 const helpers = helper.ethNativeContract.contractHelpers(owner);
520520
521 const testContract = await deployTestContract(helper, owner);521 const testContract = await deployTestContract(helper, owner);
522522
531 await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 2_000_000n * gasPrice).send();531 await helpers.methods.setSponsoringFeeLimit(testContract.options.address, 2_000_000n * gasPrice).send();
532532
533 const originalUserBalance = await helper.balance.getEthereum(user);533 const originalUserBalance = await helper.balance.getEthereum(user);
534 await testContract.methods.test(100).send({from: user, gas: 2_000_000});534 await testContract.methods.test(100).send({from: user, gas: 2_000_000, maxFeePerGas: gasPrice.toString()});
535 expect(await helper.balance.getEthereum(user)).to.be.equal(originalUserBalance);535 expect(await helper.balance.getEthereum(user)).to.be.equal(originalUserBalance);
536536
537 await testContract.methods.test(100).send({from: user, gas: 2_100_000});537 await testContract.methods.test(100).send({from: user, gas: 2_100_000, maxFeePerGas: gasPrice.toString()});
538 expect(await helper.balance.getEthereum(user)).to.not.be.equal(originalUserBalance);538 expect(await helper.balance.getEthereum(user)).to.not.be.equal(originalUserBalance);
539 });539 });
540540
modifiedtests/src/eth/ethFeesAreCorrect.test.tsdiffbeforeafterboth
41 const {tokenId: tokenB} = await collection.mintToken(minter, {Ethereum: aliceEth});41 const {tokenId: tokenB} = await collection.mintToken(minter, {Ethereum: aliceEth});
4242
43 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);43 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
44 const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);44 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
4545
46 const balanceBeforeWeb3Transfer = await helper.balance.getEthereum(owner);46 const balanceBeforeWeb3Transfer = await helper.balance.getEthereum(owner);
47 await contract.methods.transfer(receiver, tokenA).send({from: owner});47 await contract.methods.transfer(receiver, tokenA).send({from: owner, maxFeePerGas: (await helper.eth.getGasPrice()).toString()});
48 const balanceAfterWeb3Transfer = await helper.balance.getEthereum(owner);48 const balanceAfterWeb3Transfer = await helper.balance.getEthereum(owner);
49 const web3Diff = balanceBeforeWeb3Transfer - balanceAfterWeb3Transfer;49 const web3Diff = balanceBeforeWeb3Transfer - balanceAfterWeb3Transfer;
5050
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
674 requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);674 requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
675675
676 donor = await privateKey({url: import.meta.url});676 donor = await privateKey({url: import.meta.url});
677 [alice] = await helper.arrange.createAccounts([20n], donor);677 [alice] = await helper.arrange.createAccounts([1000n], donor);
678 });678 });
679 });679 });
680680
699 },699 },
700 );700 );
701701
702 const contract = await helper.ethNativeContract.collectionById(collection.collectionId, 'rft', caller);702 const contract = helper.ethNativeContract.collectionById(collection.collectionId, 'rft', caller);
703 const name = await contract.methods.name().call();703 const name = await contract.methods.name().call();
704 expect(name).to.equal('Leviathan');704 expect(name).to.equal('Leviathan');
705 });705 });
modifiedtests/src/maintenance.seqtest.tsdiffbeforeafterboth
342 itSub('Does not allow preimage execution with non-root', async ({helper}) => {342 itSub('Does not allow preimage execution with non-root', async ({helper}) => {
343 await expect(helper.executeExtrinsic(bob, 'api.tx.maintenance.executePreimage', [343 await expect(helper.executeExtrinsic(bob, 'api.tx.maintenance.executePreimage', [
344 preimageHashes[0], {refTime: 10000000000, proofSize: 10000},344 preimageHashes[0], {refTime: 10000000000, proofSize: 10000},
345 ])).to.be.rejectedWith(/BadOrigin/);345 ])).to.be.rejectedWith(/^Misc: BadOrigin$/);
346 });346 });
347347
348 itSub('Does not allow execution of non-existent preimages', async ({helper}) => {348 itSub('Does not allow execution of non-existent preimages', async ({helper}) => {
349 await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.executePreimage', [349 await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.executePreimage', [
350 '0x1010101010101010101010101010101010101010101010101010101010101010', {refTime: 10000000000, proofSize: 10000},350 '0x1010101010101010101010101010101010101010101010101010101010101010', {refTime: 10000000000, proofSize: 10000},
351 ])).to.be.rejectedWith(/Unavailable/);351 ])).to.be.rejectedWith(/^Misc: Unavailable$/);
352 });352 });
353353
354 itSub('Does not allow preimage execution with less than minimum weights', async ({helper}) => {354 itSub('Does not allow preimage execution with less than minimum weights', async ({helper}) => {
355 await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.executePreimage', [355 await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.executePreimage', [
356 preimageHashes[0], {refTime: 1000, proofSize: 100},356 preimageHashes[0], {refTime: 1000, proofSize: 100},
357 ])).to.be.rejectedWith(/Exhausted/);357 ])).to.be.rejectedWith(/^Misc: Exhausted$/);
358 });358 });
359359
360 after(async function() {360 after(async function() {
modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
24 'timestamp',24 'timestamp',
25 'transactionpayment',25 'transactionpayment',
26 'treasury',26 'treasury',
27 'statetriemigration',
27 'structure',28 'structure',
28 'system',29 'system',
29 'vesting',30 'vesting',
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
591 const errorMeta = dispatchError.registry.findMetaError(modErr);591 const errorMeta = dispatchError.registry.findMetaError(modErr);
592592
593 moduleError = `${errorMeta.section}.${errorMeta.name}`;593 moduleError = `${errorMeta.section}.${errorMeta.name}`;
594 } else {594 } else if (dispatchError.isToken) {
595 moduleError = dispatchError.toHuman();595 moduleError = `Token: ${dispatchError.asToken}`;
596 }596 } else {
597 // May be [object Object] in case of unhandled non-unit enum
598 moduleError = `Misc: ${dispatchError.toHuman()}`;
599 }
597 } else {600 } else {
598 this.logger.log(result, this.logger.level.ERROR);601 this.logger.log(result, this.logger.level.ERROR);
599 }602 }
3480 } else if (data.asErr.isToken) {3483 } else if (data.asErr.isToken) {
3481 throw new Error(`Token: ${data.asErr.asToken}`);3484 throw new Error(`Token: ${data.asErr.asToken}`);
3482 }3485 }
3486 // May be [object Object] in case of unhandled non-unit enum
3487 throw new Error(`Misc: ${data.asErr.toHuman()}`);
3483 }3488 }
3484 return result;3489 return result;
3485 }3490 }