difftreelog
tests(preimage + maintenance)
in: master
6 files changed
tests/package.jsondiffbeforeafterboth1{2 "name": "unique-tests",3 "version": "1.0.0",4 "description": "Unique Chain Tests",5 "main": "",6 "devDependencies": {7 "@polkadot/typegen": "9.10.2",8 "@types/chai": "^4.3.3",9 "@types/chai-as-promised": "^7.1.5",10 "@types/chai-like": "^1.1.1",11 "@types/chai-subset": "^1.3.3",12 "@types/mocha": "^10.0.0",13 "@types/node": "^18.11.2",14 "@typescript-eslint/eslint-plugin": "^5.47.0",15 "@typescript-eslint/parser": "^5.47.0",16 "chai": "^4.3.6",17 "chai-subset": "^1.6.0",18 "eslint": "^8.25.0",19 "eslint-plugin-mocha": "^10.1.0",20 "mocha": "^10.1.0",21 "ts-node": "^10.9.1",22 "typescript": "^4.8.4"23 },24 "mocha": {25 "timeout": 9999999,26 "require": [27 "ts-node/register"28 ]29 },30 "scripts": {31 "lint": "eslint --ext .ts,.js src/",32 "fix": "eslint --ext .ts,.js src/ --fix",33 "setup": "ts-node ./src/util/globalSetup.ts",34 "setIdentities": "ts-node ./src/util/identitySetter.ts",35 "checkRelayIdentities": "ts-node ./src/util/relayIdentitiesChecker.ts",36 "test": "yarn setup && mocha --timeout 9999999 -r ts-node/register './src/**/*.*test.ts'",37 "testParallelFull": "yarn testParallel && yarn testSequential",38 "testParallel": "yarn setup && mocha --parallel --timeout 9999999 -r ts-node/register './src/**/*.test.ts'",39 "testSequential": "yarn setup && mocha --timeout 9999999 -r ts-node/register './src/**/*.seqtest.ts'",40 "testStructure": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/nesting/*.*test.ts",41 "testEth": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/**/*.*test.ts'",42 "testEthNesting": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/nesting/**/*.*test.ts'",43 "testEthFractionalizer": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/fractionalizer/**/*.*test.ts'",44 "testEthMarketplace": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/marketplace/**/*.*test.ts'",45 "testEvent": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./src/check-event/*.*test.ts",46 "testEthPayable": "mocha --timeout 9999999 -r ts-node/register './**/eth/payable.test.ts'",47 "testEvmCoder": "mocha --timeout 9999999 -r ts-node/register './**/eth/evmCoder.test.ts'",48 "testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",49 "testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",50 "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/collectionProperties.*test.ts ./**/tokenProperties.*test.ts ./**/getPropertiesRpc.test.ts",51 "testCollectionProperties": "mocha --timeout 9999999 -r ts-node/register ./**/collectionProperties.*test.ts",52 "testTokenProperties": "mocha --timeout 9999999 -r ts-node/register ./**/tokenProperties.*test.ts",53 "testMigration": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/migration-check.test.ts",54 "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",55 "testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",56 "testChangeCollectionOwner": "mocha --timeout 9999999 -r ts-node/register ./**/change-collection-owner.test.ts",57 "testSetCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionSponsor.test.ts",58 "testConfirmSponsorship": "mocha --timeout 9999999 --parallel -r ts-node/register ./**/confirmSponsorship.test.ts",59 "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",60 "testRemoveCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionSponsor.test.ts",61 "testAllowLists": "mocha --timeout 9999999 -r ts-node/register ./**/allowLists.test.ts",62 "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",63 "testContracts": "mocha --timeout 9999999 -r ts-node/register ./**/contracts.test.ts",64 "testCreateItem": "mocha --timeout 9999999 -r ts-node/register ./**/createItem.test.ts",65 "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",66 "testCreateMultipleItemsEx": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItemsEx.test.ts",67 "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",68 "testTransferFrom": "mocha --timeout 9999999 -r ts-node/register ./**/transferFrom.test.ts",69 "testCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",70 "testDestroyCollection": "mocha --timeout 9999999 -r ts-node/register ./**/destroyCollection.test.ts",71 "testToggleContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/toggleContractAllowList.test.ts",72 "testAddToContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/addToContractAllowList.test.ts",73 "testTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/transfer.test.ts",74 "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts",75 "testAdminTransferAndBurn": "mocha --timeout 9999999 -r ts-node/register ./**/adminTransferAndBurn.test.ts",76 "testSetPermissions": "mocha --timeout 9999999 -r ts-node/register ./**/setPermissions.test.ts",77 "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.seqtest.ts",78 "testContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/eth/contractSponsoring.test.ts",79 "testEnableContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/enableContractSponsoring.test.ts",80 "testRemoveFromContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromContractAllowList.test.ts",81 "testSetContractSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setContractSponsoringRateLimit.test.ts",82 "testSetOffchainSchema": "mocha --timeout 9999999 -r ts-node/register ./**/setOffchainSchema.test.ts",83 "testNextSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/nextSponsoring.test.ts",84 "testOverflow": "mocha --timeout 9999999 -r ts-node/register ./**/overflow.test.ts",85 "testMaintenance": "mocha --timeout 9999999 -r ts-node/register ./**/maintenanceMode.seqtest.ts",86 "testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.seqtest.ts",87 "testScheduler": "mocha --timeout 9999999 -r ts-node/register ./**/scheduler.seqtest.ts",88 "testSchedulingEVM": "mocha --timeout 9999999 -r ts-node/register ./**/eth/scheduling.test.ts",89 "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",90 "testCollators": "RUN_COLLATOR_TESTS=1 mocha --timeout 49999999 -r ts-node/register ./**/collator-selection/**.*test.ts",91 "testCollatorSelection": "RUN_COLLATOR_TESTS=1 mocha --timeout 49999999 -r ts-node/register ./**/collatorSelection.*test.ts",92 "testIdentity": "RUN_COLLATOR_TESTS=1 mocha --timeout 49999999 -r ts-node/register ./**/identity.*test.ts",93 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",94 "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",95 "testEthCreateNFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createNFTCollection.test.ts",96 "testEthCreateRFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createRFTCollection.test.ts",97 "testEthNFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/nonFungible.test.ts",98 "testRFT": "mocha --timeout 9999999 -r ts-node/register ./**/refungible.test.ts",99 "testEthRFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/reFungible.test.ts ./**/eth/reFungibleToken.test.ts",100 "testFT": "mocha --timeout 9999999 -r ts-node/register ./**/fungible.test.ts",101 "testEthFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/fungible.test.ts",102 "testRPC": "mocha --timeout 9999999 -r ts-node/register ./**/rpc.test.ts",103 "testPromotion": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/appPromotion/*test.ts",104 "testXcmUnique": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmUnique.test.ts",105 "testXcmQuartz": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmQuartz.test.ts",106 "testXcmOpal": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmOpal.test.ts",107 "testXcmTransferAcala": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferAcala.test.ts acalaId=2000 uniqueId=5000",108 "testXcmTransferStatemine": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferStatemine.test.ts statemineId=1000 uniqueId=5000",109 "testXcmTransferMoonbeam": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferMoonbeam.test.ts",110 "benchMintingFee": "ts-node src/benchmarks/mintFee/benchmark.ts",111 "testApiConsts": "mocha --timeout 9999999 -r ts-node/register ./**/apiConsts.test.ts",112 "load": "mocha --timeout 9999999 -r ts-node/register './**/*.load.ts'",113 "loadTransfer": "ts-node src/transfer.nload.ts",114 "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",115 "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",116 "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",117 "polkadot-types": "echo \"export default {}\" > src/interfaces/lookup.ts && yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"118 },119 "author": "",120 "license": "SEE LICENSE IN ../LICENSE",121 "homepage": "",122 "dependencies": {123 "@polkadot/api": "9.10.2",124 "@polkadot/util": "10.2.1",125 "@polkadot/util-crypto": "10.2.1",126 "chai-as-promised": "^7.1.1",127 "chai-like": "^1.1.1",128 "csv-writer": "^1.6.0",129 "find-process": "^1.4.7",130 "solc": "0.8.17",131 "web3": "1.8.2"132 },133 "resolutions": {134 "decode-uri-component": "^0.2.1"135 }136}1{2 "name": "unique-tests",3 "version": "1.0.0",4 "description": "Unique Chain Tests",5 "main": "",6 "devDependencies": {7 "@polkadot/typegen": "9.10.2",8 "@types/chai": "^4.3.3",9 "@types/chai-as-promised": "^7.1.5",10 "@types/chai-like": "^1.1.1",11 "@types/chai-subset": "^1.3.3",12 "@types/mocha": "^10.0.0",13 "@types/node": "^18.11.2",14 "@typescript-eslint/eslint-plugin": "^5.47.0",15 "@typescript-eslint/parser": "^5.47.0",16 "chai": "^4.3.6",17 "chai-subset": "^1.6.0",18 "eslint": "^8.25.0",19 "eslint-plugin-mocha": "^10.1.0",20 "mocha": "^10.1.0",21 "ts-node": "^10.9.1",22 "typescript": "^4.8.4"23 },24 "mocha": {25 "timeout": 9999999,26 "require": [27 "ts-node/register"28 ]29 },30 "scripts": {31 "lint": "eslint --ext .ts,.js src/",32 "fix": "eslint --ext .ts,.js src/ --fix",33 "setup": "ts-node ./src/util/globalSetup.ts",34 "setIdentities": "ts-node ./src/util/identitySetter.ts",35 "checkRelayIdentities": "ts-node ./src/util/relayIdentitiesChecker.ts",36 "test": "yarn setup && mocha --timeout 9999999 -r ts-node/register './src/**/*.*test.ts'",37 "testParallelFull": "yarn testParallel && yarn testSequential",38 "testParallel": "yarn setup && mocha --parallel --timeout 9999999 -r ts-node/register './src/**/*.test.ts'",39 "testSequential": "yarn setup && mocha --timeout 9999999 -r ts-node/register './src/**/*.seqtest.ts'",40 "testStructure": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/nesting/*.*test.ts",41 "testEth": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/**/*.*test.ts'",42 "testEthNesting": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/nesting/**/*.*test.ts'",43 "testEthFractionalizer": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/fractionalizer/**/*.*test.ts'",44 "testEthMarketplace": "yarn setup && mocha --timeout 9999999 -r ts-node/register './**/eth/marketplace/**/*.*test.ts'",45 "testEvent": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./src/check-event/*.*test.ts",46 "testEthPayable": "mocha --timeout 9999999 -r ts-node/register './**/eth/payable.test.ts'",47 "testEvmCoder": "mocha --timeout 9999999 -r ts-node/register './**/eth/evmCoder.test.ts'",48 "testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",49 "testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",50 "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/collectionProperties.*test.ts ./**/tokenProperties.*test.ts ./**/getPropertiesRpc.test.ts",51 "testCollectionProperties": "mocha --timeout 9999999 -r ts-node/register ./**/collectionProperties.*test.ts",52 "testTokenProperties": "mocha --timeout 9999999 -r ts-node/register ./**/tokenProperties.*test.ts",53 "testMigration": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/migration-check.test.ts",54 "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",55 "testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",56 "testChangeCollectionOwner": "mocha --timeout 9999999 -r ts-node/register ./**/change-collection-owner.test.ts",57 "testSetCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionSponsor.test.ts",58 "testConfirmSponsorship": "mocha --timeout 9999999 --parallel -r ts-node/register ./**/confirmSponsorship.test.ts",59 "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",60 "testRemoveCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionSponsor.test.ts",61 "testAllowLists": "mocha --timeout 9999999 -r ts-node/register ./**/allowLists.test.ts",62 "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",63 "testContracts": "mocha --timeout 9999999 -r ts-node/register ./**/contracts.test.ts",64 "testCreateItem": "mocha --timeout 9999999 -r ts-node/register ./**/createItem.test.ts",65 "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",66 "testCreateMultipleItemsEx": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItemsEx.test.ts",67 "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",68 "testTransferFrom": "mocha --timeout 9999999 -r ts-node/register ./**/transferFrom.test.ts",69 "testCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",70 "testDestroyCollection": "mocha --timeout 9999999 -r ts-node/register ./**/destroyCollection.test.ts",71 "testToggleContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/toggleContractAllowList.test.ts",72 "testAddToContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/addToContractAllowList.test.ts",73 "testTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/transfer.test.ts",74 "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts",75 "testAdminTransferAndBurn": "mocha --timeout 9999999 -r ts-node/register ./**/adminTransferAndBurn.test.ts",76 "testSetPermissions": "mocha --timeout 9999999 -r ts-node/register ./**/setPermissions.test.ts",77 "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.seqtest.ts",78 "testContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/eth/contractSponsoring.test.ts",79 "testEnableContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/enableContractSponsoring.test.ts",80 "testRemoveFromContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromContractAllowList.test.ts",81 "testSetContractSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setContractSponsoringRateLimit.test.ts",82 "testSetOffchainSchema": "mocha --timeout 9999999 -r ts-node/register ./**/setOffchainSchema.test.ts",83 "testNextSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/nextSponsoring.test.ts",84 "testOverflow": "mocha --timeout 9999999 -r ts-node/register ./**/overflow.test.ts",85 "testMaintenance": "mocha --timeout 9999999 -r ts-node/register ./**/maintenance.seqtest.ts",86 "testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.seqtest.ts",87 "testScheduler": "mocha --timeout 9999999 -r ts-node/register ./**/scheduler.seqtest.ts",88 "testSchedulingEVM": "mocha --timeout 9999999 -r ts-node/register ./**/eth/scheduling.test.ts",89 "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",90 "testCollators": "RUN_COLLATOR_TESTS=1 mocha --timeout 49999999 -r ts-node/register ./**/collator-selection/**.*test.ts",91 "testCollatorSelection": "RUN_COLLATOR_TESTS=1 mocha --timeout 49999999 -r ts-node/register ./**/collatorSelection.*test.ts",92 "testIdentity": "RUN_COLLATOR_TESTS=1 mocha --timeout 49999999 -r ts-node/register ./**/identity.*test.ts",93 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",94 "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",95 "testEthCreateNFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createNFTCollection.test.ts",96 "testEthCreateRFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createRFTCollection.test.ts",97 "testEthNFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/nonFungible.test.ts",98 "testRFT": "mocha --timeout 9999999 -r ts-node/register ./**/refungible.test.ts",99 "testEthRFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/reFungible.test.ts ./**/eth/reFungibleToken.test.ts",100 "testFT": "mocha --timeout 9999999 -r ts-node/register ./**/fungible.test.ts",101 "testEthFT": "mocha --timeout 9999999 -r ts-node/register ./**/eth/fungible.test.ts",102 "testRPC": "mocha --timeout 9999999 -r ts-node/register ./**/rpc.test.ts",103 "testPromotion": "yarn setup && mocha --timeout 9999999 -r ts-node/register ./**/appPromotion/*test.ts",104 "testXcmUnique": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmUnique.test.ts",105 "testXcmQuartz": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmQuartz.test.ts",106 "testXcmOpal": "RUN_XCM_TESTS=1 mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmOpal.test.ts",107 "testXcmTransferAcala": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferAcala.test.ts acalaId=2000 uniqueId=5000",108 "testXcmTransferStatemine": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferStatemine.test.ts statemineId=1000 uniqueId=5000",109 "testXcmTransferMoonbeam": "mocha --timeout 9999999 -r ts-node/register ./**/xcm/xcmTransferMoonbeam.test.ts",110 "benchMintingFee": "ts-node src/benchmarks/mintFee/benchmark.ts",111 "testApiConsts": "mocha --timeout 9999999 -r ts-node/register ./**/apiConsts.test.ts",112 "load": "mocha --timeout 9999999 -r ts-node/register './**/*.load.ts'",113 "loadTransfer": "ts-node src/transfer.nload.ts",114 "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",115 "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",116 "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",117 "polkadot-types": "echo \"export default {}\" > src/interfaces/lookup.ts && yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"118 },119 "author": "",120 "license": "SEE LICENSE IN ../LICENSE",121 "homepage": "",122 "dependencies": {123 "@polkadot/api": "9.10.2",124 "@polkadot/util": "10.2.1",125 "@polkadot/util-crypto": "10.2.1",126 "chai-as-promised": "^7.1.1",127 "chai-like": "^1.1.1",128 "csv-writer": "^1.6.0",129 "find-process": "^1.4.7",130 "solc": "0.8.17",131 "web3": "1.8.2"132 },133 "resolutions": {134 "decode-uri-component": "^0.2.1"135 }136}tests/src/maintenance.seqtest.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/maintenance.seqtest.ts
@@ -0,0 +1,338 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {IKeyringPair} from '@polkadot/types/types';
+import {ApiPromise} from '@polkadot/api';
+import {expect, itSched, itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds} from './util';
+import {itEth} from './eth/util';
+
+async function maintenanceEnabled(api: ApiPromise): Promise<boolean> {
+ return (await api.query.maintenance.enabled()).toJSON() as boolean;
+}
+
+describe('Integration Test: Maintenance Functionality', () => {
+ let superuser: IKeyringPair;
+ let donor: IKeyringPair;
+ let bob: IKeyringPair;
+
+ before(async function() {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ requirePalletsOrSkip(this, helper, [Pallets.Maintenance]);
+ superuser = await privateKey('//Alice');
+ donor = await privateKey({filename: __filename});
+ [bob] = await helper.arrange.createAccounts([10000n], donor);
+
+ });
+ });
+
+ describe('Maintenance Mode', () => {
+ before(async function() {
+ await usingPlaygrounds(async (helper) => {
+ if (await maintenanceEnabled(helper.getApi())) {
+ console.warn('\tMaintenance mode was left enabled BEFORE the test suite! Disabling it now.');
+ await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', [])).to.be.fulfilled;
+ }
+ });
+ });
+
+ itSub('Allows superuser to enable and disable maintenance mode - and disallows anyone else', async ({helper}) => {
+ // Make sure non-sudo can't enable maintenance mode
+ await expect(helper.executeExtrinsic(superuser, 'api.tx.maintenance.enable', []), 'on commoner enabling MM')
+ .to.be.rejectedWith(/BadOrigin/);
+
+ // Set maintenance mode
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
+
+ // Make sure non-sudo can't disable maintenance mode
+ await expect(helper.executeExtrinsic(bob, 'api.tx.maintenance.disable', []), 'on commoner disabling MM')
+ .to.be.rejectedWith(/BadOrigin/);
+
+ // Disable maintenance mode
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
+ });
+
+ itSub('MM blocks unique pallet calls', async ({helper}) => {
+ // Can create an NFT collection before enabling the MM
+ const nftCollection = await helper.nft.mintCollection(bob, {
+ tokenPropertyPermissions: [{key: 'test', permission: {
+ collectionAdmin: true,
+ tokenOwner: true,
+ mutable: true,
+ }}],
+ });
+
+ // Can mint an NFT before enabling the MM
+ const nft = await nftCollection.mintToken(bob);
+
+ // Can create an FT collection before enabling the MM
+ const ftCollection = await helper.ft.mintCollection(superuser);
+
+ // Can mint an FT before enabling the MM
+ await expect(ftCollection.mint(superuser)).to.be.fulfilled;
+
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
+
+ // Unable to create a collection when the MM is enabled
+ await expect(helper.nft.mintCollection(superuser), 'cudo forbidden stuff')
+ .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
+
+ // Unable to set token properties when the MM is enabled
+ await expect(nft.setProperties(
+ bob,
+ [{key: 'test', value: 'test-val'}],
+ )).to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
+
+ // Unable to mint an NFT when the MM is enabled
+ await expect(nftCollection.mintToken(superuser))
+ .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
+
+ // Unable to mint an FT when the MM is enabled
+ await expect(ftCollection.mint(superuser))
+ .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
+
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
+
+ // Can create a collection after disabling the MM
+ await expect(helper.nft.mintCollection(bob), 'MM is disabled, the collection should be created').to.be.fulfilled;
+
+ // Can set token properties after disabling the MM
+ await nft.setProperties(bob, [{key: 'test', value: 'test-val'}]);
+
+ // Can mint an NFT after disabling the MM
+ await nftCollection.mintToken(bob);
+
+ // Can mint an FT after disabling the MM
+ await ftCollection.mint(superuser);
+ });
+
+ itSub.ifWithPallets('MM blocks unique pallet calls (Re-Fungible)', [Pallets.ReFungible], async ({helper}) => {
+ // Can create an RFT collection before enabling the MM
+ const rftCollection = await helper.rft.mintCollection(superuser);
+
+ // Can mint an RFT before enabling the MM
+ await expect(rftCollection.mintToken(superuser)).to.be.fulfilled;
+
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
+
+ // Unable to mint an RFT when the MM is enabled
+ await expect(rftCollection.mintToken(superuser))
+ .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
+
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
+
+ // Can mint an RFT after disabling the MM
+ await rftCollection.mintToken(superuser);
+ });
+
+ itSub('MM allows native token transfers and RPC calls', async ({helper}) => {
+ // We can use RPC before the MM is enabled
+ const totalCount = await helper.collection.getTotalCount();
+
+ // We can transfer funds before the MM is enabled
+ await expect(helper.balance.transferToSubstrate(superuser, bob.address, 2n)).to.be.fulfilled;
+
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
+
+ // RPCs work while in maintenance
+ expect(await helper.collection.getTotalCount()).to.be.deep.equal(totalCount);
+
+ // We still able to transfer funds
+ await expect(helper.balance.transferToSubstrate(bob, superuser.address, 1n)).to.be.fulfilled;
+
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
+
+ // RPCs work after maintenance
+ expect(await helper.collection.getTotalCount()).to.be.deep.equal(totalCount);
+
+ // Transfers work after maintenance
+ await expect(helper.balance.transferToSubstrate(bob, superuser.address, 1n)).to.be.fulfilled;
+ });
+
+ itSched.ifWithPallets('MM blocks scheduled calls and the scheduler itself', [Pallets.Scheduler], async (scheduleKind, {helper}) => {
+ const collection = await helper.nft.mintCollection(bob);
+
+ const nftBeforeMM = await collection.mintToken(bob);
+ const nftDuringMM = await collection.mintToken(bob);
+ const nftAfterMM = await collection.mintToken(bob);
+
+ const [
+ scheduledIdBeforeMM,
+ scheduledIdDuringMM,
+ scheduledIdBunkerThroughMM,
+ scheduledIdAttemptDuringMM,
+ scheduledIdAfterMM,
+ ] = scheduleKind == 'named'
+ ? helper.arrange.makeScheduledIds(5)
+ : new Array(5);
+
+ const blocksToWait = 6;
+
+ // Scheduling works before the maintenance
+ await nftBeforeMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdBeforeMM})
+ .transfer(bob, {Substrate: superuser.address});
+
+ await helper.wait.newBlocks(blocksToWait + 1);
+ expect(await nftBeforeMM.getOwner()).to.be.deep.equal({Substrate: superuser.address});
+
+ // Schedule a transaction that should occur *during* the maintenance
+ await nftDuringMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdDuringMM})
+ .transfer(bob, {Substrate: superuser.address});
+
+ // Schedule a transaction that should occur *after* the maintenance
+ await nftDuringMM.scheduleAfter(blocksToWait * 2, {scheduledId: scheduledIdBunkerThroughMM})
+ .transfer(bob, {Substrate: superuser.address});
+
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
+
+ await helper.wait.newBlocks(blocksToWait + 1);
+ // The owner should NOT change since the scheduled transaction should be rejected
+ expect(await nftDuringMM.getOwner()).to.be.deep.equal({Substrate: bob.address});
+
+ // Any attempts to schedule a tx during the MM should be rejected
+ await expect(nftDuringMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAttemptDuringMM})
+ .transfer(bob, {Substrate: superuser.address}))
+ .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
+
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
+
+ // Scheduling works after the maintenance
+ await nftAfterMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAfterMM})
+ .transfer(bob, {Substrate: superuser.address});
+
+ await helper.wait.newBlocks(blocksToWait + 1);
+
+ expect(await nftAfterMM.getOwner()).to.be.deep.equal({Substrate: superuser.address});
+ // The owner of the token scheduled for transaction *before* maintenance should now change *after* maintenance
+ expect(await nftDuringMM.getOwner()).to.be.deep.equal({Substrate: superuser.address});
+ });
+
+ itEth('Disallows Ethereum transactions to execute while in maintenance', async ({helper}) => {
+ const owner = await helper.eth.createAccountWithBalance(donor);
+ const receiver = helper.eth.createAccount();
+
+ const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'A', 'B', 'C', '');
+
+ // Set maintenance mode
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
+
+ const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+ const tokenId = await contract.methods.nextTokenId().call();
+ expect(tokenId).to.be.equal('1');
+
+ await expect(contract.methods.mintWithTokenURI(receiver, 'Test URI').send())
+ .to.be.rejectedWith(/Returned error: unknown error/);
+
+ await expect(contract.methods.ownerOf(tokenId).call()).rejectedWith(/token not found/);
+
+ // Disable maintenance mode
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
+ });
+
+ itSub('Allows to enable and disable MM repeatedly', async ({helper}) => {
+ // Set maintenance mode
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
+
+ // Disable maintenance mode
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
+ expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
+ });
+
+ afterEach(async () => {
+ await usingPlaygrounds(async helper => {
+ if (helper.fetchMissingPalletNames([Pallets.Maintenance]).length != 0) return;
+ if (await maintenanceEnabled(helper.getApi())) {
+ console.warn('\tMaintenance mode was left enabled AFTER a test has finished! Be careful. Disabling it now.');
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
+ }
+ expect(await maintenanceEnabled(helper.getApi()), 'Disastrous! Exited the test suite with maintenance mode on.').to.be.false;
+ });
+ });
+ });
+
+ describe('Preimage Execution', () => {
+ let preimageHash: string;
+
+ before(async function() {
+ await usingPlaygrounds(async (helper) => {
+ requirePalletsOrSkip(this, helper, [Pallets.Preimage, Pallets.Maintenance]);
+
+ // create a preimage to be operated with in the tests
+ const randomAccounts = await helper.arrange.createCrowd(10, 0n, superuser);
+ const randomIdentities = randomAccounts.map((acc, i) => [
+ acc.address, {
+ deposit: 0n,
+ judgements: [],
+ info: {
+ display: {
+ raw: `Random Account #${i}`,
+ },
+ },
+ },
+ ]);
+ const preimage = helper.constructApiCall('api.tx.identity.forceInsertIdentities', [randomIdentities]).method.toHex();
+ const result = await helper.preimage.notePreimage(bob, preimage);
+ const events = result.result.events.filter(x => x.event.method === 'Noted' && x.event.section === 'preimage');
+ preimageHash = events[0].event.data[0].toHuman();
+ });
+ });
+
+ itSub('Successfully executes call in a preimage', async ({helper}) => {
+ const result = await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.executePreimage', [preimageHash]))
+ .to.be.fulfilled;
+
+ // preimage is executed, and an appropriate event is present
+ const events = result.result.events.filter((x: any) => x.event.method === 'IdentitiesInserted' && x.event.section === 'identity');
+ expect(events.length).to.be.equal(1);
+
+ // the preimage goes back to being unrequested
+ expect(await helper.preimage.getPreimageInfo(preimageHash)).to.have.property('unrequested');
+ });
+
+ itSub('Does not allow preimage execution with non-root', async ({helper}) => {
+ await expect(helper.executeExtrinsic(bob, 'api.tx.maintenance.executePreimage', [preimageHash]))
+ .to.be.rejectedWith(/BadOrigin/);
+ });
+
+ itSub('Does not allow execution of non-existent preimages', async ({helper}) => {
+ await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.executePreimage', [
+ '0x1010101010101010101010101010101010101010101010101010101010101010',
+ ])).to.be.rejectedWith(/Unavailable/);
+ });
+
+ after(async function() {
+ await usingPlaygrounds(async (helper) => {
+ if (helper.fetchMissingPalletNames([Pallets.Preimage, Pallets.Maintenance]).length != 0) return;
+
+ await helper.preimage.unnotePreimage(bob, preimageHash);
+ });
+ });
+ });
+});
tests/src/maintenanceMode.seqtest.tsdiffbeforeafterboth--- a/tests/src/maintenanceMode.seqtest.ts
+++ /dev/null
@@ -1,270 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-import {IKeyringPair} from '@polkadot/types/types';
-import {ApiPromise} from '@polkadot/api';
-import {expect, itSched, itSub, Pallets, usingPlaygrounds} from './util';
-import {itEth} from './eth/util';
-
-async function maintenanceEnabled(api: ApiPromise): Promise<boolean> {
- return (await api.query.maintenance.enabled()).toJSON() as boolean;
-}
-
-describe('Integration Test: Maintenance Mode', () => {
- let superuser: IKeyringPair;
- let donor: IKeyringPair;
- let bob: IKeyringPair;
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- superuser = await privateKey('//Alice');
- donor = await privateKey({filename: __filename});
- [bob] = await helper.arrange.createAccounts([100n], donor);
-
- if (await maintenanceEnabled(helper.getApi())) {
- console.warn('\tMaintenance mode was left enabled BEFORE the test suite! Disabling it now.');
- await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', [])).to.be.fulfilled;
- }
- });
- });
-
- itSub('Allows superuser to enable and disable maintenance mode - and disallows anyone else', async ({helper}) => {
- // Make sure non-sudo can't enable maintenance mode
- await expect(helper.executeExtrinsic(superuser, 'api.tx.maintenance.enable', []), 'on commoner enabling MM')
- .to.be.rejectedWith(/BadOrigin/);
-
- // Set maintenance mode
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
-
- // Make sure non-sudo can't disable maintenance mode
- await expect(helper.executeExtrinsic(bob, 'api.tx.maintenance.disable', []), 'on commoner disabling MM')
- .to.be.rejectedWith(/BadOrigin/);
-
- // Disable maintenance mode
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
- });
-
- itSub('MM blocks unique pallet calls', async ({helper}) => {
- // Can create an NFT collection before enabling the MM
- const nftCollection = await helper.nft.mintCollection(bob, {
- tokenPropertyPermissions: [{key: 'test', permission: {
- collectionAdmin: true,
- tokenOwner: true,
- mutable: true,
- }}],
- });
-
- // Can mint an NFT before enabling the MM
- const nft = await nftCollection.mintToken(bob);
-
- // Can create an FT collection before enabling the MM
- const ftCollection = await helper.ft.mintCollection(superuser);
-
- // Can mint an FT before enabling the MM
- await expect(ftCollection.mint(superuser)).to.be.fulfilled;
-
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
-
- // Unable to create a collection when the MM is enabled
- await expect(helper.nft.mintCollection(superuser), 'cudo forbidden stuff')
- .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
-
- // Unable to set token properties when the MM is enabled
- await expect(nft.setProperties(
- bob,
- [{key: 'test', value: 'test-val'}],
- )).to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
-
- // Unable to mint an NFT when the MM is enabled
- await expect(nftCollection.mintToken(superuser))
- .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
-
- // Unable to mint an FT when the MM is enabled
- await expect(ftCollection.mint(superuser))
- .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
-
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
-
- // Can create a collection after disabling the MM
- await expect(helper.nft.mintCollection(bob), 'MM is disabled, the collection should be created').to.be.fulfilled;
-
- // Can set token properties after disabling the MM
- await nft.setProperties(bob, [{key: 'test', value: 'test-val'}]);
-
- // Can mint an NFT after disabling the MM
- await nftCollection.mintToken(bob);
-
- // Can mint an FT after disabling the MM
- await ftCollection.mint(superuser);
- });
-
- itSub.ifWithPallets('MM blocks unique pallet calls (Re-Fungible)', [Pallets.ReFungible], async ({helper}) => {
- // Can create an RFT collection before enabling the MM
- const rftCollection = await helper.rft.mintCollection(superuser);
-
- // Can mint an RFT before enabling the MM
- await expect(rftCollection.mintToken(superuser)).to.be.fulfilled;
-
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
-
- // Unable to mint an RFT when the MM is enabled
- await expect(rftCollection.mintToken(superuser))
- .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
-
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
-
- // Can mint an RFT after disabling the MM
- await rftCollection.mintToken(superuser);
- });
-
- itSub('MM allows native token transfers and RPC calls', async ({helper}) => {
- // We can use RPC before the MM is enabled
- const totalCount = await helper.collection.getTotalCount();
-
- // We can transfer funds before the MM is enabled
- await expect(helper.balance.transferToSubstrate(superuser, bob.address, 2n)).to.be.fulfilled;
-
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
-
- // RPCs work while in maintenance
- expect(await helper.collection.getTotalCount()).to.be.deep.equal(totalCount);
-
- // We still able to transfer funds
- await expect(helper.balance.transferToSubstrate(bob, superuser.address, 1n)).to.be.fulfilled;
-
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
-
- // RPCs work after maintenance
- expect(await helper.collection.getTotalCount()).to.be.deep.equal(totalCount);
-
- // Transfers work after maintenance
- await expect(helper.balance.transferToSubstrate(bob, superuser.address, 1n)).to.be.fulfilled;
- });
-
- itSched.ifWithPallets('MM blocks scheduled calls and the scheduler itself', [Pallets.Scheduler], async (scheduleKind, {helper}) => {
- const collection = await helper.nft.mintCollection(bob);
-
- const nftBeforeMM = await collection.mintToken(bob);
- const nftDuringMM = await collection.mintToken(bob);
- const nftAfterMM = await collection.mintToken(bob);
-
- const [
- scheduledIdBeforeMM,
- scheduledIdDuringMM,
- scheduledIdBunkerThroughMM,
- scheduledIdAttemptDuringMM,
- scheduledIdAfterMM,
- ] = scheduleKind == 'named'
- ? helper.arrange.makeScheduledIds(5)
- : new Array(5);
-
- const blocksToWait = 6;
-
- // Scheduling works before the maintenance
- await nftBeforeMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdBeforeMM})
- .transfer(bob, {Substrate: superuser.address});
-
- await helper.wait.newBlocks(blocksToWait + 1);
- expect(await nftBeforeMM.getOwner()).to.be.deep.equal({Substrate: superuser.address});
-
- // Schedule a transaction that should occur *during* the maintenance
- await nftDuringMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdDuringMM})
- .transfer(bob, {Substrate: superuser.address});
-
- // Schedule a transaction that should occur *after* the maintenance
- await nftDuringMM.scheduleAfter(blocksToWait * 2, {scheduledId: scheduledIdBunkerThroughMM})
- .transfer(bob, {Substrate: superuser.address});
-
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
-
- await helper.wait.newBlocks(blocksToWait + 1);
- // The owner should NOT change since the scheduled transaction should be rejected
- expect(await nftDuringMM.getOwner()).to.be.deep.equal({Substrate: bob.address});
-
- // Any attempts to schedule a tx during the MM should be rejected
- await expect(nftDuringMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAttemptDuringMM})
- .transfer(bob, {Substrate: superuser.address}))
- .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);
-
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
-
- // Scheduling works after the maintenance
- await nftAfterMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAfterMM})
- .transfer(bob, {Substrate: superuser.address});
-
- await helper.wait.newBlocks(blocksToWait + 1);
-
- expect(await nftAfterMM.getOwner()).to.be.deep.equal({Substrate: superuser.address});
- // The owner of the token scheduled for transaction *before* maintenance should now change *after* maintenance
- expect(await nftDuringMM.getOwner()).to.be.deep.equal({Substrate: superuser.address});
- });
-
- itEth('Disallows Ethereum transactions to execute while in maintenance', async ({helper}) => {
- const owner = await helper.eth.createAccountWithBalance(donor);
- const receiver = helper.eth.createAccount();
-
- const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'A', 'B', 'C', '');
-
- // Set maintenance mode
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
-
- const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
- const tokenId = await contract.methods.nextTokenId().call();
- expect(tokenId).to.be.equal('1');
-
- await expect(contract.methods.mintWithTokenURI(receiver, 'Test URI').send())
- .to.be.rejectedWith(/Returned error: unknown error/);
-
- await expect(contract.methods.ownerOf(tokenId).call()).rejectedWith(/token not found/);
-
- // Disable maintenance mode
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
- });
-
- itSub('Allows to enable and disable MM repeatedly', async ({helper}) => {
- // Set maintenance mode
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;
-
- // Disable maintenance mode
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
- expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;
- });
-
- afterEach(async () => {
- await usingPlaygrounds(async helper => {
- if (await maintenanceEnabled(helper.getApi())) {
- console.warn('\tMaintenance mode was left enabled AFTER a test has finished! Be careful. Disabling it now.');
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);
- }
- expect(await maintenanceEnabled(helper.getApi()), 'Disastrous! Exited the test suite with maintenance mode on.').to.be.false;
- });
- });
-});
tests/src/pallet-presence.test.tsdiffbeforeafterboth--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -66,6 +66,7 @@
const foreignAssets = 'foreignassets';
const appPromotion = 'apppromotion';
const collatorSelection = ['authorship', 'session', 'collatorselection', 'identity'];
+ const governance = ['preimage'];
const testUtils = 'testutils';
if (chain.eq('OPAL by UNIQUE')) {
@@ -75,6 +76,7 @@
appPromotion,
testUtils,
...collatorSelection,
+ ...governance,
);
} else if (chain.eq('QUARTZ by UNIQUE') || chain.eq('SAPPHIRE by UNIQUE')) {
requiredPallets.push(
@@ -82,6 +84,7 @@
appPromotion,
foreignAssets,
...collatorSelection,
+ ...governance,
);
} else if (chain.eq('UNIQUE')) {
// Insert Unique additional pallets here
tests/src/util/index.tsdiffbeforeafterboth--- a/tests/src/util/index.ts
+++ b/tests/src/util/index.ts
@@ -114,6 +114,8 @@
CollatorSelection = 'collatorselection',
Session = 'session',
Identity = 'identity',
+ Preimage = 'preimage',
+ Maintenance = 'maintenance',
TestUtils = 'testutils',
}
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -2869,6 +2869,55 @@
}
}
+class PreimageGroup extends HelperGroup<UniqueHelper> {
+ async getPreimageInfo(h256: string) {
+ return (await this.helper.callRpc('api.query.preimage.statusFor', [h256])).toJSON();
+ }
+
+ /**
+ * Create a preimage with a hex or a byte array.
+ * @param signer keyring of the signer.
+ * @param bytes preimage encoded in hex or a byte array, e.g. an extrinsic call.
+ * @example await notePreimage(preimageMaker,
+ * helper.constructApiCall('api.tx.identity.forceInsertIdentities', [identitiesToAdd]).method.toHex()
+ * );
+ * @returns promise of extrinsic execution.
+ */
+ notePreimage(signer: TSigner, bytes: string | Uint8Array) {
+ return this.helper.executeExtrinsic(signer, 'api.tx.preimage.notePreimage', [bytes]);
+ }
+
+ /**
+ * Delete an existing preimage and return the deposit.
+ * @param signer keyring of the signer - either the owner or the preimage manager (sudo).
+ * @param h256 hash of the preimage.
+ * @returns promise of extrinsic execution.
+ */
+ unnotePreimage(signer: TSigner, h256: string) {
+ return this.helper.executeExtrinsic(signer, 'api.tx.preimage.unnotePreimage', [h256]);
+ }
+
+ /**
+ * Request a preimage be uploaded to the chain without paying any fees or deposits.
+ * @param signer keyring of the signer - either the owner or the preimage manager (sudo).
+ * @param h256 hash of the preimage.
+ * @returns promise of extrinsic execution.
+ */
+ requestPreimage(signer: TSigner, h256: string) {
+ return this.helper.executeExtrinsic(signer, 'api.tx.preimage.requestPreimage', [h256]);
+ }
+
+ /**
+ * Clear a previously made request for a preimage.
+ * @param signer keyring of the signer - either the owner or the preimage manager (sudo).
+ * @param h256 hash of the preimage.
+ * @returns promise of extrinsic execution.
+ */
+ unrequestPreimage(signer: TSigner, h256: string) {
+ return this.helper.executeExtrinsic(signer, 'api.tx.preimage.unrequestPreimage', [h256]);
+ }
+}
+
class ForeignAssetsGroup extends HelperGroup<UniqueHelper> {
async register(signer: TSigner, ownerAddress: TSubstrateAccount, location: any, metadata: IForeignAssetMetadata) {
await this.helper.executeExtrinsic(
@@ -3094,6 +3143,7 @@
staking: StakingGroup;
scheduler: SchedulerGroup;
collatorSelection: CollatorSelectionGroup;
+ preimage: PreimageGroup;
foreignAssets: ForeignAssetsGroup;
xcm: XcmGroup<UniqueHelper>;
xTokens: XTokensGroup<UniqueHelper>;
@@ -3110,6 +3160,7 @@
this.staking = new StakingGroup(this);
this.scheduler = new SchedulerGroup(this);
this.collatorSelection = new CollatorSelectionGroup(this);
+ this.preimage = new PreimageGroup(this);
this.foreignAssets = new ForeignAssetsGroup(this);
this.xcm = new XcmGroup(this, 'polkadotXcm');
this.xTokens = new XTokensGroup(this);