git.delta.rocks / unique-network / refs/commits / 0e237807a727

difftreelog

Merge branch 'develop' into tests/feed-alices

Fahrrader2022-10-07parents: #a5bd6fa #ba7ab8a.patch.diff
in: master

5 files changed

modifiedtests/package.jsondiffbeforeafterboth
4040
41 "testEthPayable": "mocha --timeout 9999999 -r ts-node/register './**/eth/payable.test.ts'",41 "testEthPayable": "mocha --timeout 9999999 -r ts-node/register './**/eth/payable.test.ts'",
42 "testEthTokenProperties": "mocha --timeout 9999999 -r ts-node/register ./**/eth/tokenProperties.test.ts",42 "testEthTokenProperties": "mocha --timeout 9999999 -r ts-node/register ./**/eth/tokenProperties.test.ts",
43 "testEvmCoder": "mocha --timeout 9999999 -r ts-node/register './**/eth/evmCoder.test.ts'",
43 "testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",44 "testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",
44 "testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",45 "testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",
45 "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/properties.test.ts ./**/getPropertiesRpc.test.ts",46 "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/properties.test.ts ./**/getPropertiesRpc.test.ts",
68 "testAdminTransferAndBurn": "mocha --timeout 9999999 -r ts-node/register ./**/adminTransferAndBurn.test.ts",69 "testAdminTransferAndBurn": "mocha --timeout 9999999 -r ts-node/register ./**/adminTransferAndBurn.test.ts",
69 "testSetPermissions": "mocha --timeout 9999999 -r ts-node/register ./**/setPermissions.test.ts",70 "testSetPermissions": "mocha --timeout 9999999 -r ts-node/register ./**/setPermissions.test.ts",
70 "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.test.ts",71 "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.test.ts",
71 "testContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/contractSponsoring.test.ts",72 "testContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/eth/contractSponsoring.test.ts",
72 "testEnableContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/enableContractSponsoring.test.ts",73 "testEnableContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/enableContractSponsoring.test.ts",
73 "testRemoveFromContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromContractAllowList.test.ts",74 "testRemoveFromContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromContractAllowList.test.ts",
74 "testSetContractSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setContractSponsoringRateLimit.test.ts",75 "testSetContractSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setContractSponsoringRateLimit.test.ts",
modifiedtests/src/app-promotion.test.tsdiffbeforeafterboth
557 557
558 // caller payed for call558 // caller payed for call
559 expect(1000n * nominal > callerBalance).to.be.true;559 expect(1000n * nominal > callerBalance).to.be.true;
560 // todo:playgrounds look into. why did it work before with 1000n, and is now 100n?
560 expect(contractBalanceAfter).to.be.equal(100n * nominal);561 expect(contractBalanceAfter).to.be.equal(100n * nominal);
561 });562 });
562 563
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17import {IKeyringPair} from '@polkadot/types/types';17import {IKeyringPair} from '@polkadot/types/types';
18import * as solc from 'solc';
19import {EthUniqueHelper} from './util/playgrounds/unique.dev';18import {EthUniqueHelper} from './util/playgrounds/unique.dev';
20import {itEth, expect, SponsoringMode, usingEthPlaygrounds} from '../eth/util/playgrounds';19import {itEth, expect, SponsoringMode, usingEthPlaygrounds} from '../eth/util/playgrounds';
21import {usingPlaygrounds} from '../util/playgrounds';20import {usingPlaygrounds} from '../util/playgrounds';
455describe('Sponsoring Fee Limit', () => {454describe('Sponsoring Fee Limit', () => {
456 let donor: IKeyringPair;455 let donor: IKeyringPair;
457 let alice: IKeyringPair;456 let alice: IKeyringPair;
458 let DEFAULT_GAS: number;457 let testContract: CompiledContract;
459458
460 function compileTestContract() {459 async function compileTestContract(helper: EthUniqueHelper) {
461 if (!testContract) {460 if (!testContract) {
462 const input = {
463 language: 'Solidity',
464 sources: {
465 ['TestContract.sol']: {
466 content:
467 `
468 // SPDX-License-Identifier: MIT
469 pragma solidity ^0.8.0;
470
471 contract TestContract {
472 event Result(bool);
473
474 function test(uint32 cycles) public {
475 uint256 counter = 0;
476 while(true) {
477 counter ++;
478 if (counter > cycles){
479 break;
480 }
481 }
482 emit Result(true);
483 }
484 }
485 `,
486 },
487 },
488 settings: {
489 outputSelection: {
490 '*': {
491 '*': ['*'],
492 },
493 },
494 },
495 };
496 const json = JSON.parse(solc.compile(JSON.stringify(input)));
497 const out = json.contracts['TestContract.sol']['TestContract'];
498
499 testContract = {461 testContract = await helper.ethContract.compile(
500 abi: out.abi,462 'TestContract',
501 object: '0x' + out.evm.bytecode.object,463 `
464 // SPDX-License-Identifier: MIT
465 pragma solidity ^0.8.0;
466
467 contract TestContract {
468 event Result(bool);
469
470 function test(uint32 cycles) public {
471 uint256 counter = 0;
472 while(true) {
473 counter ++;
474 if (counter > cycles){
475 break;
476 }
477 }
478 emit Result(true);
479 }
480 }
481 `,
502 };482 );
503 }483 }
504 return testContract;484 return testContract;
505 }485 }
506 486
507 async function deployTestContract(helper: EthUniqueHelper, owner: string) {487 async function deployTestContract(helper: EthUniqueHelper, owner: string) {
508 const web3 = helper.getWeb3();
509 const compiled = compileTestContract();488 const compiled = await compileTestContract(helper);
510 const testContract = new web3.eth.Contract(compiled.abi, undefined, {489 return await helper.ethContract.deployByAbi(owner, compiled.abi, compiled.object);
511 data: compiled.object,
512 from: owner,
513 gas: DEFAULT_GAS,
514 });
515 return await testContract.deploy({data: compiled.object}).send({from: owner});
516 }490 }
517491
518 before(async () => {492 before(async () => {
519 await usingEthPlaygrounds(async (helper, privateKey) => {493 await usingEthPlaygrounds(async (helper, privateKey) => {
520 donor = await privateKey({filename: __filename});494 donor = await privateKey({filename: __filename});
521 [alice] = await helper.arrange.createAccounts([100n], donor);495 [alice] = await helper.arrange.createAccounts([100n], donor);
522 DEFAULT_GAS = helper.eth.DEFAULT_GAS;
523 });496 });
524 });497 });
525
526 let testContract: CompiledContract;
527498
528 itEth('Default fee limit', async ({helper}) => {499 itEth('Default fee limit', async ({helper}) => {
529 const owner = await helper.eth.createAccountWithBalance(donor);500 const owner = await helper.eth.createAccountWithBalance(donor);
addedtests/src/eth/evmCoder.test.tsdiffbeforeafterboth

no changes

deletedtests/src/evmCoder.test.tsdiffbeforeafterboth

no changes