diff --git a/tests/package-lock.json b/tests/package-lock.json index 005c57a45b3..4c2fc88e288 100644 --- a/tests/package-lock.json +++ b/tests/package-lock.json @@ -256,11 +256,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" } } }, @@ -397,11 +392,6 @@ "@babel/runtime": "^7.14.6", "@polkadot/x-global": "6.11.1" } - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" } } }, @@ -840,6 +830,11 @@ "lodash.merge": "^4.6.2" } }, + "@noble/hashes": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-0.4.1.tgz", + "integrity": "sha512-Qxy9mZoDf5SyFrQ8hpWHeMZ2Scmb9BAz/lt23sKdr/QHnACW9dD6S+/WVJHd3R/BPoNHcUYWXoXXe74cxSEYoA==" + }, "@open-web3/orml-type-definitions": { "version": "1.0.2-2", "resolved": "https://registry.npmjs.org/@open-web3/orml-type-definitions/-/orml-type-definitions-1.0.2-2.tgz", @@ -864,6 +859,14 @@ "@polkadot/types": "^5.7.1" }, "dependencies": { + "@polkadot/networks": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-7.9.2.tgz", + "integrity": "sha512-4obI1RdW5/7TFwbwKA9oqw8aggVZ65JAUvIFMd2YmMC2T4+NiZLnok0WhRkhZkUnqjLIHXYNwq7Ho1i39dte0g==", + "requires": { + "@babel/runtime": "^7.16.3" + } + }, "@polkadot/types": { "version": "5.9.1", "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-5.9.1.tgz", @@ -874,76 +877,116 @@ "@polkadot/util-crypto": "^7.3.1", "rxjs": "^7.3.0" } + }, + "@polkadot/util": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-7.9.2.tgz", + "integrity": "sha512-6ABY6ErgkCsM4C6+X+AJSY4pBGwbKlHZmUtHftaiTvbaj4XuA4nTo3GU28jw8wY0Jh2cJZJvt6/BJ5GVkm5tBA==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-textdecoder": "7.9.2", + "@polkadot/x-textencoder": "7.9.2", + "@types/bn.js": "^4.11.6", + "bn.js": "^4.12.0", + "camelcase": "^6.2.1", + "ip-regex": "^4.3.0" + } + }, + "@polkadot/util-crypto": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-7.9.2.tgz", + "integrity": "sha512-nNwqUwP44eCH9jKKcPie+IHLKkg9LMe6H7hXo91hy3AtoslnNrT51tP3uAm5yllhLvswJfnAgnlHq7ybCgqeFw==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/networks": "7.9.2", + "@polkadot/util": "7.9.2", + "@polkadot/wasm-crypto": "^4.4.1", + "@polkadot/x-randomvalues": "7.9.2", + "blakejs": "^1.1.1", + "bn.js": "^4.12.0", + "create-hash": "^1.2.0", + "ed2curve": "^0.3.0", + "elliptic": "^6.5.4", + "hash.js": "^1.1.7", + "js-sha3": "^0.8.0", + "micro-base": "^0.9.0", + "scryptsy": "^2.1.0", + "tweetnacl": "^1.0.3", + "xxhashjs": "^0.2.2" + } + }, + "@polkadot/x-global": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-7.9.2.tgz", + "integrity": "sha512-JX5CrGWckHf1P9xKXq4vQCAuMUbL81l2hOWX7xeP8nv4caHEpmf5T1wD1iMdQBL5PFifo6Pg0V6/oZBB+bts7A==", + "requires": { + "@babel/runtime": "^7.16.3" + } + }, + "@polkadot/x-randomvalues": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-7.9.2.tgz", + "integrity": "sha512-svQfG31yCXf6yVyIgP0NgCzEy7oc3Lw054ZspkaqjOivxYdrXaf5w3JSSUyM/MRjI2+nk+B/EyJoMYcfSwTfsQ==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "@polkadot/x-textdecoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-7.9.2.tgz", + "integrity": "sha512-wfwbSHXPhrOAl12QvlIOGNkMH/N/h8PId2ytIjvM/8zPPFB5Il6DWSFLtVapOGEpIFjEWbd5t8Td4pHBVXIEbg==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "@polkadot/x-textencoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-7.9.2.tgz", + "integrity": "sha512-A19wwYINuZwU2dUyQ/mMzB0ISjyfc4cISfL4zCMUAVgj7xVoXMYV2GfjNdMpA8Wsjch3su6pxLbtJ2wU03sRTQ==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "camelcase": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz", + "integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==" } } }, "@polkadot/api": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-6.8.1.tgz", - "integrity": "sha512-XJmSx5NYKrrj1FJmt8AQEhI7TW+5bb5Y3tnFTYc6D1QemxLKt1bP1H+z1zfTO3TWvS0PUtSN36dvrgn4xPELHw==", + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-6.10.3.tgz", + "integrity": "sha512-ueduq+sR43PyFr3mzcfKZMrmVo9MBKCJGre3EUvH0XgLmao3GbH+LvJNpOCs5tqaD0eCiIX1SpxVDXHGe0GpWg==", "requires": { - "@babel/runtime": "^7.16.0", - "@polkadot/api-derive": "6.8.1", - "@polkadot/keyring": "^7.8.2", - "@polkadot/rpc-core": "6.8.1", - "@polkadot/rpc-provider": "6.8.1", - "@polkadot/types": "6.8.1", - "@polkadot/types-known": "6.8.1", - "@polkadot/util": "^7.8.2", - "@polkadot/util-crypto": "^7.8.2", + "@babel/runtime": "^7.16.3", + "@polkadot/api-derive": "6.10.3", + "@polkadot/keyring": "^8.0.4", + "@polkadot/rpc-core": "6.10.3", + "@polkadot/rpc-provider": "6.10.3", + "@polkadot/types": "6.10.3", + "@polkadot/types-known": "6.10.3", + "@polkadot/util": "^8.0.4", + "@polkadot/util-crypto": "^8.0.4", "eventemitter3": "^4.0.7", "rxjs": "^7.4.0" - }, - "dependencies": { - "@polkadot/types": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-6.8.1.tgz", - "integrity": "sha512-MX7OQhGCaDLu29mu+uRkZhufqel1tCZKaPEBM5uk+mud6UCdZ5NHQb0wfr7d5oYxpj9GmWxALCmNMlRQa0172g==", - "requires": { - "@babel/runtime": "^7.16.0", - "@polkadot/util": "^7.8.2", - "@polkadot/util-crypto": "^7.8.2", - "rxjs": "^7.4.0" - } - }, - "@polkadot/types-known": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-6.8.1.tgz", - "integrity": "sha512-Vhcd0ZOf0eOzPJI+IX/oYQjHw5VEcGuhH0up+SlUsxLlZvSFtZhrf7nchfZoAGKDTWPT4RIzxLLsWhjjYhAu6A==", - "requires": { - "@babel/runtime": "^7.16.0", - "@polkadot/networks": "^7.8.2", - "@polkadot/types": "6.8.1", - "@polkadot/util": "^7.8.2" - } - } } }, "@polkadot/api-derive": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-6.8.1.tgz", - "integrity": "sha512-PKSXHZXScPejhkWOdFE/B30zyZ7Zkieq6ImDl3ramVPWvj6acqadsyrFvcbTCh2fb0Bc1loa+VnkH1O03weU/w==", + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-6.10.3.tgz", + "integrity": "sha512-NBg3xi9n+QceCnRAimCa7pfXA2ONSa6LtKFpsXJns2AXhHjaAZr7H//VPztVvglZ23Vxpr7sq8ApeA/tgYm2zg==", "requires": { - "@babel/runtime": "^7.16.0", - "@polkadot/api": "6.8.1", - "@polkadot/rpc-core": "6.8.1", - "@polkadot/types": "6.8.1", - "@polkadot/util": "^7.8.2", - "@polkadot/util-crypto": "^7.8.2", + "@babel/runtime": "^7.16.3", + "@polkadot/api": "6.10.3", + "@polkadot/rpc-core": "6.10.3", + "@polkadot/types": "6.10.3", + "@polkadot/util": "^8.0.4", + "@polkadot/util-crypto": "^8.0.4", "rxjs": "^7.4.0" - }, - "dependencies": { - "@polkadot/types": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-6.8.1.tgz", - "integrity": "sha512-MX7OQhGCaDLu29mu+uRkZhufqel1tCZKaPEBM5uk+mud6UCdZ5NHQb0wfr7d5oYxpj9GmWxALCmNMlRQa0172g==", - "requires": { - "@babel/runtime": "^7.16.0", - "@polkadot/util": "^7.8.2", - "@polkadot/util-crypto": "^7.8.2", - "rxjs": "^7.4.0" - } - } } }, "@polkadot/apps-config": { @@ -977,16 +1020,26 @@ "moonbeam-types-bundle": "1.2.7", "pontem-types-bundle": "1.0.15", "rxjs": "^7.4.0" + }, + "dependencies": { + "@polkadot/networks": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-7.9.2.tgz", + "integrity": "sha512-4obI1RdW5/7TFwbwKA9oqw8aggVZ65JAUvIFMd2YmMC2T4+NiZLnok0WhRkhZkUnqjLIHXYNwq7Ho1i39dte0g==", + "requires": { + "@babel/runtime": "^7.16.3" + } + } } }, "@polkadot/keyring": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-7.9.2.tgz", - "integrity": "sha512-6UGoIxhiTyISkYEZhUbCPpgVxaneIfb/DBVlHtbvaABc8Mqh1KuqcTIq19Mh9wXlBuijl25rw4lUASrE/9sBqg==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-8.0.4.tgz", + "integrity": "sha512-7enL2t4s9KtkgEjKUH9dVmB3cbIWnjQe/EA6zVZBdEwj8ykkcxNJLbTpkXf3I7XKGkQM6LvpjIOc2+BPrxQplg==", "requires": { "@babel/runtime": "^7.16.3", - "@polkadot/util": "7.9.2", - "@polkadot/util-crypto": "7.9.2" + "@polkadot/util": "8.0.4", + "@polkadot/util-crypto": "8.0.4" } }, "@polkadot/metadata": { @@ -1107,145 +1160,96 @@ "@babel/runtime": "^7.14.6", "@polkadot/x-global": "6.11.1" } - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" } } }, "@polkadot/networks": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-7.9.2.tgz", - "integrity": "sha512-4obI1RdW5/7TFwbwKA9oqw8aggVZ65JAUvIFMd2YmMC2T4+NiZLnok0WhRkhZkUnqjLIHXYNwq7Ho1i39dte0g==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-8.0.4.tgz", + "integrity": "sha512-Ve41RZdZyeqDhSzYH+CRnh06XH2kJsm/epiKkMJ1hQPcUwDhzjw8tH5yoLryYsPCjJEZgU8SHcGgXi4aSxPsFw==", "requires": { "@babel/runtime": "^7.16.3" } }, "@polkadot/rpc-core": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-6.8.1.tgz", - "integrity": "sha512-GblH3bTLDo7RCvHlazH+A/rWNyqgUvdOz5hZzMpshBxo2fJCNhPi3jA36C3IewK/pN73P3NLmzC392htuJelBg==", + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-6.10.3.tgz", + "integrity": "sha512-wJy2czDa4LP+4tGCzw1g5TSzScMVrCL6WVye36jgy2h1VazOM+xzMocUP6YFTq0FBg/4Z1NlxUM7gkvdF7KkNg==", "requires": { - "@babel/runtime": "^7.16.0", - "@polkadot/rpc-provider": "6.8.1", - "@polkadot/types": "6.8.1", - "@polkadot/util": "^7.8.2", + "@babel/runtime": "^7.16.3", + "@polkadot/rpc-provider": "6.10.3", + "@polkadot/types": "6.10.3", + "@polkadot/util": "^8.0.4", "rxjs": "^7.4.0" - }, - "dependencies": { - "@polkadot/types": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-6.8.1.tgz", - "integrity": "sha512-MX7OQhGCaDLu29mu+uRkZhufqel1tCZKaPEBM5uk+mud6UCdZ5NHQb0wfr7d5oYxpj9GmWxALCmNMlRQa0172g==", - "requires": { - "@babel/runtime": "^7.16.0", - "@polkadot/util": "^7.8.2", - "@polkadot/util-crypto": "^7.8.2", - "rxjs": "^7.4.0" - } - } } }, "@polkadot/rpc-provider": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-6.8.1.tgz", - "integrity": "sha512-j8G3ZGaKn4gC/xoUORjMps30QzL8O+iKnS/D3v2ysKGf6PqQ/DDEii0pfJzS4LEvSqIXqo/O2sm5rFY8SfJHNg==", + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-6.10.3.tgz", + "integrity": "sha512-7z3t7byNoYoCN4jd/ul3lBEjmmHexVDUkhX90vkxzzTDT5uVbfwx8h6J2h3mp2LbVoLvjAo8V1Q+0OrN7c3zQA==", "requires": { - "@babel/runtime": "^7.16.0", - "@polkadot/types": "6.8.1", - "@polkadot/util": "^7.8.2", - "@polkadot/util-crypto": "^7.8.2", - "@polkadot/x-fetch": "^7.8.2", - "@polkadot/x-global": "^7.8.2", - "@polkadot/x-ws": "^7.8.2", + "@babel/runtime": "^7.16.3", + "@polkadot/types": "6.10.3", + "@polkadot/util": "^8.0.4", + "@polkadot/util-crypto": "^8.0.4", + "@polkadot/x-fetch": "^8.0.4", + "@polkadot/x-global": "^8.0.4", + "@polkadot/x-ws": "^8.0.4", "eventemitter3": "^4.0.7" - }, - "dependencies": { - "@polkadot/types": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-6.8.1.tgz", - "integrity": "sha512-MX7OQhGCaDLu29mu+uRkZhufqel1tCZKaPEBM5uk+mud6UCdZ5NHQb0wfr7d5oYxpj9GmWxALCmNMlRQa0172g==", - "requires": { - "@babel/runtime": "^7.16.0", - "@polkadot/util": "^7.8.2", - "@polkadot/util-crypto": "^7.8.2", - "rxjs": "^7.4.0" - } - } } }, "@polkadot/types": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-6.8.1.tgz", - "integrity": "sha512-MX7OQhGCaDLu29mu+uRkZhufqel1tCZKaPEBM5uk+mud6UCdZ5NHQb0wfr7d5oYxpj9GmWxALCmNMlRQa0172g==", + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-6.10.3.tgz", + "integrity": "sha512-HcgK9uqTaVjuTW20K+vMgOULURJjosKK2drbiXAxf/rrlGDJ29HCP4XhUI8x1Vp0ZAUt+V0LqMIfA9eTHBCr8w==", "requires": { - "@babel/runtime": "^7.16.0", - "@polkadot/util": "^7.8.2", - "@polkadot/util-crypto": "^7.8.2", + "@babel/runtime": "^7.16.3", + "@polkadot/types-known": "6.10.3", + "@polkadot/util": "^8.0.4", + "@polkadot/util-crypto": "^8.0.4", "rxjs": "^7.4.0" } }, "@polkadot/types-known": { - "version": "6.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-6.9.2.tgz", - "integrity": "sha512-u3mpiyG6xeLV9YVdVWzXMlFjB/1qjFedZWtE400c5/s/rWLWbF92JIkA9QV/K6wDbM7bz8xXO7iRj7LlNMU1Ew==", + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-6.10.3.tgz", + "integrity": "sha512-AWZJ7zZQAeYQlmJxOgsIFIJZ0M50WyVTGGqfhPbvV3ioPTaKebxjcJEU8r35BfFS7LhLMsjGfqw/DF8m7lJ9Eg==", "requires": { "@babel/runtime": "^7.16.3", - "@polkadot/networks": "^7.9.2", - "@polkadot/types": "6.9.2", - "@polkadot/util": "^7.9.2" - }, - "dependencies": { - "@polkadot/types": { - "version": "6.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-6.9.2.tgz", - "integrity": "sha512-GOFlMFv9627uojTyQwyJyg3oWvI0nE7HONakPfXE3pMrnYfM+nBxrh3mH3ETHSyVj9QqrPNqenFmTUdCy0awGg==", - "requires": { - "@babel/runtime": "^7.16.3", - "@polkadot/util": "^7.9.2", - "@polkadot/util-crypto": "^7.9.2", - "rxjs": "^7.4.0" - } - } + "@polkadot/networks": "^8.0.4", + "@polkadot/types": "6.10.3", + "@polkadot/util": "^8.0.4" } }, "@polkadot/util": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-7.9.2.tgz", - "integrity": "sha512-6ABY6ErgkCsM4C6+X+AJSY4pBGwbKlHZmUtHftaiTvbaj4XuA4nTo3GU28jw8wY0Jh2cJZJvt6/BJ5GVkm5tBA==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-8.0.4.tgz", + "integrity": "sha512-E9c0mTFTbqPBzCOkWAqIzVxx0e27BjPubSqZ4I6yj34o9JNcabhyHJPVMd1jwu00Ew2iGFDvY2I97hEtCHQkBQ==", "requires": { "@babel/runtime": "^7.16.3", - "@polkadot/x-textdecoder": "7.9.2", - "@polkadot/x-textencoder": "7.9.2", + "@polkadot/x-textdecoder": "8.0.4", + "@polkadot/x-textencoder": "8.0.4", "@types/bn.js": "^4.11.6", "bn.js": "^4.12.0", - "camelcase": "^6.2.1", "ip-regex": "^4.3.0" } }, "@polkadot/util-crypto": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-7.9.2.tgz", - "integrity": "sha512-nNwqUwP44eCH9jKKcPie+IHLKkg9LMe6H7hXo91hy3AtoslnNrT51tP3uAm5yllhLvswJfnAgnlHq7ybCgqeFw==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-8.0.4.tgz", + "integrity": "sha512-/umJGifnFnE3sGXgzcbUPAvItxyajP4IkBWoOsIcKYcFJNm7E8dUfjOLIM0kpa9XUulUOATpOLYi+R8oNUZRNw==", "requires": { "@babel/runtime": "^7.16.3", - "@polkadot/networks": "7.9.2", - "@polkadot/util": "7.9.2", + "@noble/hashes": "0.4.1", + "@polkadot/networks": "8.0.4", + "@polkadot/util": "8.0.4", "@polkadot/wasm-crypto": "^4.4.1", - "@polkadot/x-randomvalues": "7.9.2", - "blakejs": "^1.1.1", + "@polkadot/x-randomvalues": "8.0.4", "bn.js": "^4.12.0", - "create-hash": "^1.2.0", "ed2curve": "^0.3.0", "elliptic": "^6.5.4", - "hash.js": "^1.1.7", - "js-sha3": "^0.8.0", "micro-base": "^0.9.0", - "scryptsy": "^2.1.0", - "tweetnacl": "^1.0.3", - "xxhashjs": "^0.2.2" + "tweetnacl": "^1.0.3" } }, "@polkadot/wasm-crypto": { @@ -1275,31 +1279,31 @@ } }, "@polkadot/x-fetch": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-7.9.2.tgz", - "integrity": "sha512-zutLkFJVaLVpY3cIGYJD0AReLfAnPr2J82Ca4pvy/BxqwwGYuGLcn36A4m6nliGBP2lcH4oYY+mcCqIwoPWQUQ==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-8.0.4.tgz", + "integrity": "sha512-DQ15kgyy9sr02YC2aOwak28jxdWQQErJg0vjpzK974EYltNRN5FP3FtFm2pidkIQ0URPpmQOh6QmVL1geOXCSQ==", "requires": { "@babel/runtime": "^7.16.3", - "@polkadot/x-global": "7.9.2", + "@polkadot/x-global": "8.0.4", "@types/node-fetch": "^2.5.12", "node-fetch": "^2.6.6" } }, "@polkadot/x-global": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-7.9.2.tgz", - "integrity": "sha512-JX5CrGWckHf1P9xKXq4vQCAuMUbL81l2hOWX7xeP8nv4caHEpmf5T1wD1iMdQBL5PFifo6Pg0V6/oZBB+bts7A==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-8.0.4.tgz", + "integrity": "sha512-OrdjQrC5Qby3r8upAVNmOPjvvB+rXFmptdKduWhLjWfgLs5ocWOa4OaxGqhDo7A7vBXBgD3WGob/81WDxtuhHw==", "requires": { "@babel/runtime": "^7.16.3" } }, "@polkadot/x-randomvalues": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-7.9.2.tgz", - "integrity": "sha512-svQfG31yCXf6yVyIgP0NgCzEy7oc3Lw054ZspkaqjOivxYdrXaf5w3JSSUyM/MRjI2+nk+B/EyJoMYcfSwTfsQ==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-8.0.4.tgz", + "integrity": "sha512-jonPnCys+SOI6XDpZs61LiCtizqh8eKStp/I5i+t3Go1tOBDArVb5AoRsspPLE0C3KOV/YHcczJePyuRUHf8TA==", "requires": { "@babel/runtime": "^7.16.3", - "@polkadot/x-global": "7.9.2" + "@polkadot/x-global": "8.0.4" } }, "@polkadot/x-rxjs": { @@ -1327,30 +1331,30 @@ } }, "@polkadot/x-textdecoder": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-7.9.2.tgz", - "integrity": "sha512-wfwbSHXPhrOAl12QvlIOGNkMH/N/h8PId2ytIjvM/8zPPFB5Il6DWSFLtVapOGEpIFjEWbd5t8Td4pHBVXIEbg==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-8.0.4.tgz", + "integrity": "sha512-Tks7uwU+q5UCGRO7izms4nLDse12eQUtombbIROjpaFrVwcEOpcJeIfpc83axN9O/npaC0hpYKGOqBGWIsYf6g==", "requires": { "@babel/runtime": "^7.16.3", - "@polkadot/x-global": "7.9.2" + "@polkadot/x-global": "8.0.4" } }, "@polkadot/x-textencoder": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-7.9.2.tgz", - "integrity": "sha512-A19wwYINuZwU2dUyQ/mMzB0ISjyfc4cISfL4zCMUAVgj7xVoXMYV2GfjNdMpA8Wsjch3su6pxLbtJ2wU03sRTQ==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-8.0.4.tgz", + "integrity": "sha512-SGPmHY+q2sKHTe2AWcDvj7+er4Tgo4naY6AG0R/DKpGrLPIInFO6FybqOKwC51GPVfXgV0qAdL5x5v0pxH9PBQ==", "requires": { "@babel/runtime": "^7.16.3", - "@polkadot/x-global": "7.9.2" + "@polkadot/x-global": "8.0.4" } }, "@polkadot/x-ws": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-7.9.2.tgz", - "integrity": "sha512-+yppMsZtvDztVOSmkqAQuhR6TfV1Axa6ergAsWb52DrfXvFP5geqtARsI6ZdDgMsE3qHSVQTcJz8vgNOr5+ztQ==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-8.0.4.tgz", + "integrity": "sha512-KDeZRTHlMeXsfqLjyQhU1k0r+pM0+0haKTeDvCuil7SZbdp7SYI/HEs9ixpwfffFblZkD7PqZt7IonA+CWD7gA==", "requires": { "@babel/runtime": "^7.16.3", - "@polkadot/x-global": "7.9.2", + "@polkadot/x-global": "8.0.4", "@types/websocket": "^1.0.4", "websocket": "^1.0.34" } @@ -1399,6 +1403,24 @@ "@polkadot/types": "^5.3.2" }, "dependencies": { + "@polkadot/keyring": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-7.9.2.tgz", + "integrity": "sha512-6UGoIxhiTyISkYEZhUbCPpgVxaneIfb/DBVlHtbvaABc8Mqh1KuqcTIq19Mh9wXlBuijl25rw4lUASrE/9sBqg==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/util": "7.9.2", + "@polkadot/util-crypto": "7.9.2" + } + }, + "@polkadot/networks": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-7.9.2.tgz", + "integrity": "sha512-4obI1RdW5/7TFwbwKA9oqw8aggVZ65JAUvIFMd2YmMC2T4+NiZLnok0WhRkhZkUnqjLIHXYNwq7Ho1i39dte0g==", + "requires": { + "@babel/runtime": "^7.16.3" + } + }, "@polkadot/types": { "version": "5.9.1", "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-5.9.1.tgz", @@ -1409,6 +1431,83 @@ "@polkadot/util-crypto": "^7.3.1", "rxjs": "^7.3.0" } + }, + "@polkadot/util": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-7.9.2.tgz", + "integrity": "sha512-6ABY6ErgkCsM4C6+X+AJSY4pBGwbKlHZmUtHftaiTvbaj4XuA4nTo3GU28jw8wY0Jh2cJZJvt6/BJ5GVkm5tBA==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-textdecoder": "7.9.2", + "@polkadot/x-textencoder": "7.9.2", + "@types/bn.js": "^4.11.6", + "bn.js": "^4.12.0", + "camelcase": "^6.2.1", + "ip-regex": "^4.3.0" + } + }, + "@polkadot/util-crypto": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-7.9.2.tgz", + "integrity": "sha512-nNwqUwP44eCH9jKKcPie+IHLKkg9LMe6H7hXo91hy3AtoslnNrT51tP3uAm5yllhLvswJfnAgnlHq7ybCgqeFw==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/networks": "7.9.2", + "@polkadot/util": "7.9.2", + "@polkadot/wasm-crypto": "^4.4.1", + "@polkadot/x-randomvalues": "7.9.2", + "blakejs": "^1.1.1", + "bn.js": "^4.12.0", + "create-hash": "^1.2.0", + "ed2curve": "^0.3.0", + "elliptic": "^6.5.4", + "hash.js": "^1.1.7", + "js-sha3": "^0.8.0", + "micro-base": "^0.9.0", + "scryptsy": "^2.1.0", + "tweetnacl": "^1.0.3", + "xxhashjs": "^0.2.2" + } + }, + "@polkadot/x-global": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-7.9.2.tgz", + "integrity": "sha512-JX5CrGWckHf1P9xKXq4vQCAuMUbL81l2hOWX7xeP8nv4caHEpmf5T1wD1iMdQBL5PFifo6Pg0V6/oZBB+bts7A==", + "requires": { + "@babel/runtime": "^7.16.3" + } + }, + "@polkadot/x-randomvalues": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-7.9.2.tgz", + "integrity": "sha512-svQfG31yCXf6yVyIgP0NgCzEy7oc3Lw054ZspkaqjOivxYdrXaf5w3JSSUyM/MRjI2+nk+B/EyJoMYcfSwTfsQ==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "@polkadot/x-textdecoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-7.9.2.tgz", + "integrity": "sha512-wfwbSHXPhrOAl12QvlIOGNkMH/N/h8PId2ytIjvM/8zPPFB5Il6DWSFLtVapOGEpIFjEWbd5t8Td4pHBVXIEbg==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "@polkadot/x-textencoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-7.9.2.tgz", + "integrity": "sha512-A19wwYINuZwU2dUyQ/mMzB0ISjyfc4cISfL4zCMUAVgj7xVoXMYV2GfjNdMpA8Wsjch3su6pxLbtJ2wU03sRTQ==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "camelcase": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz", + "integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==" } } }, @@ -1439,19 +1538,6 @@ "@polkadot/types-known": "^6.0.5", "@subsocial/utils": "^0.6.4-dev.2", "cids": "^0.7.1" - }, - "dependencies": { - "@polkadot/types": { - "version": "6.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-6.9.2.tgz", - "integrity": "sha512-GOFlMFv9627uojTyQwyJyg3oWvI0nE7HONakPfXE3pMrnYfM+nBxrh3mH3ETHSyVj9QqrPNqenFmTUdCy0awGg==", - "requires": { - "@babel/runtime": "^7.16.3", - "@polkadot/util": "^7.9.2", - "@polkadot/util-crypto": "^7.9.2", - "rxjs": "^7.4.0" - } - } } }, "@subsocial/utils": { @@ -1497,6 +1583,16 @@ "@polkadot/apps-config": "0.98.2-70", "@polkadot/networks": "^7.8.2", "@substrate/txwrapper-core": "^1.2.21" + }, + "dependencies": { + "@polkadot/networks": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-7.9.2.tgz", + "integrity": "sha512-4obI1RdW5/7TFwbwKA9oqw8aggVZ65JAUvIFMd2YmMC2T4+NiZLnok0WhRkhZkUnqjLIHXYNwq7Ho1i39dte0g==", + "requires": { + "@babel/runtime": "^7.16.3" + } + } } }, "@substrate/txwrapper-substrate": { @@ -1570,9 +1666,9 @@ "integrity": "sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==" }, "@types/node": { - "version": "16.11.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.9.tgz", - "integrity": "sha512-MKmdASMf3LtPzwLyRrFjtFFZ48cMf8jmX5VRYrDQiJa8Ybu5VAmkqBWqKU8fdCwD8ysw4mQ9nrEHvzg6gunR7A==" + "version": "16.11.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.11.tgz", + "integrity": "sha512-KB0sixD67CeecHC33MYn+eYARkqTheIRNuu97y2XMjR7Wu3XibO1vaY6VBV6O/a89SPI81cEUIYT87UqUWlZNw==" }, "@types/node-fetch": { "version": "2.5.12", @@ -1916,6 +2012,11 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, + "camelcase": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz", + "integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==" + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2139,9 +2240,9 @@ } }, "camelcase": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz", - "integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==" + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, "caseless": { "version": "0.12.0", @@ -2529,9 +2630,9 @@ } }, "debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", "requires": { "ms": "2.1.2" }, @@ -3882,9 +3983,9 @@ "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" }, "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" }, "json-schema-traverse": { "version": "0.4.1", @@ -3905,13 +4006,13 @@ } }, "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", - "json-schema": "0.2.3", + "json-schema": "0.4.0", "verror": "1.10.0" } }, @@ -4478,6 +4579,24 @@ "typescript": "^4.3.5" }, "dependencies": { + "@polkadot/keyring": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-7.9.2.tgz", + "integrity": "sha512-6UGoIxhiTyISkYEZhUbCPpgVxaneIfb/DBVlHtbvaABc8Mqh1KuqcTIq19Mh9wXlBuijl25rw4lUASrE/9sBqg==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/util": "7.9.2", + "@polkadot/util-crypto": "7.9.2" + } + }, + "@polkadot/networks": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-7.9.2.tgz", + "integrity": "sha512-4obI1RdW5/7TFwbwKA9oqw8aggVZ65JAUvIFMd2YmMC2T4+NiZLnok0WhRkhZkUnqjLIHXYNwq7Ho1i39dte0g==", + "requires": { + "@babel/runtime": "^7.16.3" + } + }, "@polkadot/types": { "version": "5.9.1", "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-5.9.1.tgz", @@ -4488,6 +4607,83 @@ "@polkadot/util-crypto": "^7.3.1", "rxjs": "^7.3.0" } + }, + "@polkadot/util": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-7.9.2.tgz", + "integrity": "sha512-6ABY6ErgkCsM4C6+X+AJSY4pBGwbKlHZmUtHftaiTvbaj4XuA4nTo3GU28jw8wY0Jh2cJZJvt6/BJ5GVkm5tBA==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-textdecoder": "7.9.2", + "@polkadot/x-textencoder": "7.9.2", + "@types/bn.js": "^4.11.6", + "bn.js": "^4.12.0", + "camelcase": "^6.2.1", + "ip-regex": "^4.3.0" + } + }, + "@polkadot/util-crypto": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-7.9.2.tgz", + "integrity": "sha512-nNwqUwP44eCH9jKKcPie+IHLKkg9LMe6H7hXo91hy3AtoslnNrT51tP3uAm5yllhLvswJfnAgnlHq7ybCgqeFw==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/networks": "7.9.2", + "@polkadot/util": "7.9.2", + "@polkadot/wasm-crypto": "^4.4.1", + "@polkadot/x-randomvalues": "7.9.2", + "blakejs": "^1.1.1", + "bn.js": "^4.12.0", + "create-hash": "^1.2.0", + "ed2curve": "^0.3.0", + "elliptic": "^6.5.4", + "hash.js": "^1.1.7", + "js-sha3": "^0.8.0", + "micro-base": "^0.9.0", + "scryptsy": "^2.1.0", + "tweetnacl": "^1.0.3", + "xxhashjs": "^0.2.2" + } + }, + "@polkadot/x-global": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-7.9.2.tgz", + "integrity": "sha512-JX5CrGWckHf1P9xKXq4vQCAuMUbL81l2hOWX7xeP8nv4caHEpmf5T1wD1iMdQBL5PFifo6Pg0V6/oZBB+bts7A==", + "requires": { + "@babel/runtime": "^7.16.3" + } + }, + "@polkadot/x-randomvalues": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-7.9.2.tgz", + "integrity": "sha512-svQfG31yCXf6yVyIgP0NgCzEy7oc3Lw054ZspkaqjOivxYdrXaf5w3JSSUyM/MRjI2+nk+B/EyJoMYcfSwTfsQ==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "@polkadot/x-textdecoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-7.9.2.tgz", + "integrity": "sha512-wfwbSHXPhrOAl12QvlIOGNkMH/N/h8PId2ytIjvM/8zPPFB5Il6DWSFLtVapOGEpIFjEWbd5t8Td4pHBVXIEbg==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "@polkadot/x-textencoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-7.9.2.tgz", + "integrity": "sha512-A19wwYINuZwU2dUyQ/mMzB0ISjyfc4cISfL4zCMUAVgj7xVoXMYV2GfjNdMpA8Wsjch3su6pxLbtJ2wU03sRTQ==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "camelcase": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz", + "integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==" } } }, @@ -4890,15 +5086,95 @@ "yargs": "^15.4.1" }, "dependencies": { + "@polkadot/networks": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-7.9.2.tgz", + "integrity": "sha512-4obI1RdW5/7TFwbwKA9oqw8aggVZ65JAUvIFMd2YmMC2T4+NiZLnok0WhRkhZkUnqjLIHXYNwq7Ho1i39dte0g==", + "requires": { + "@babel/runtime": "^7.16.3" + } + }, + "@polkadot/util": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-7.9.2.tgz", + "integrity": "sha512-6ABY6ErgkCsM4C6+X+AJSY4pBGwbKlHZmUtHftaiTvbaj4XuA4nTo3GU28jw8wY0Jh2cJZJvt6/BJ5GVkm5tBA==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-textdecoder": "7.9.2", + "@polkadot/x-textencoder": "7.9.2", + "@types/bn.js": "^4.11.6", + "bn.js": "^4.12.0", + "camelcase": "^6.2.1", + "ip-regex": "^4.3.0" + } + }, + "@polkadot/util-crypto": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-7.9.2.tgz", + "integrity": "sha512-nNwqUwP44eCH9jKKcPie+IHLKkg9LMe6H7hXo91hy3AtoslnNrT51tP3uAm5yllhLvswJfnAgnlHq7ybCgqeFw==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/networks": "7.9.2", + "@polkadot/util": "7.9.2", + "@polkadot/wasm-crypto": "^4.4.1", + "@polkadot/x-randomvalues": "7.9.2", + "blakejs": "^1.1.1", + "bn.js": "^4.12.0", + "create-hash": "^1.2.0", + "ed2curve": "^0.3.0", + "elliptic": "^6.5.4", + "hash.js": "^1.1.7", + "js-sha3": "^0.8.0", + "micro-base": "^0.9.0", + "scryptsy": "^2.1.0", + "tweetnacl": "^1.0.3", + "xxhashjs": "^0.2.2" + } + }, + "@polkadot/x-global": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-7.9.2.tgz", + "integrity": "sha512-JX5CrGWckHf1P9xKXq4vQCAuMUbL81l2hOWX7xeP8nv4caHEpmf5T1wD1iMdQBL5PFifo6Pg0V6/oZBB+bts7A==", + "requires": { + "@babel/runtime": "^7.16.3" + } + }, + "@polkadot/x-randomvalues": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-7.9.2.tgz", + "integrity": "sha512-svQfG31yCXf6yVyIgP0NgCzEy7oc3Lw054ZspkaqjOivxYdrXaf5w3JSSUyM/MRjI2+nk+B/EyJoMYcfSwTfsQ==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "@polkadot/x-textdecoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-7.9.2.tgz", + "integrity": "sha512-wfwbSHXPhrOAl12QvlIOGNkMH/N/h8PId2ytIjvM/8zPPFB5Il6DWSFLtVapOGEpIFjEWbd5t8Td4pHBVXIEbg==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "@polkadot/x-textencoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-7.9.2.tgz", + "integrity": "sha512-A19wwYINuZwU2dUyQ/mMzB0ISjyfc4cISfL4zCMUAVgj7xVoXMYV2GfjNdMpA8Wsjch3su6pxLbtJ2wU03sRTQ==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz", + "integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==" }, "cliui": { "version": "6.0.0", @@ -5011,6 +5287,13 @@ "requires": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" + }, + "dependencies": { + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + } } } } @@ -5025,16 +5308,100 @@ "typescript": "^4.4.3" }, "dependencies": { - "@polkadot/types": { - "version": "6.9.2", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-6.9.2.tgz", - "integrity": "sha512-GOFlMFv9627uojTyQwyJyg3oWvI0nE7HONakPfXE3pMrnYfM+nBxrh3mH3ETHSyVj9QqrPNqenFmTUdCy0awGg==", + "@polkadot/keyring": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-7.9.2.tgz", + "integrity": "sha512-6UGoIxhiTyISkYEZhUbCPpgVxaneIfb/DBVlHtbvaABc8Mqh1KuqcTIq19Mh9wXlBuijl25rw4lUASrE/9sBqg==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/util": "7.9.2", + "@polkadot/util-crypto": "7.9.2" + } + }, + "@polkadot/networks": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-7.9.2.tgz", + "integrity": "sha512-4obI1RdW5/7TFwbwKA9oqw8aggVZ65JAUvIFMd2YmMC2T4+NiZLnok0WhRkhZkUnqjLIHXYNwq7Ho1i39dte0g==", + "requires": { + "@babel/runtime": "^7.16.3" + } + }, + "@polkadot/util": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-7.9.2.tgz", + "integrity": "sha512-6ABY6ErgkCsM4C6+X+AJSY4pBGwbKlHZmUtHftaiTvbaj4XuA4nTo3GU28jw8wY0Jh2cJZJvt6/BJ5GVkm5tBA==", "requires": { "@babel/runtime": "^7.16.3", - "@polkadot/util": "^7.9.2", - "@polkadot/util-crypto": "^7.9.2", - "rxjs": "^7.4.0" + "@polkadot/x-textdecoder": "7.9.2", + "@polkadot/x-textencoder": "7.9.2", + "@types/bn.js": "^4.11.6", + "bn.js": "^4.12.0", + "camelcase": "^6.2.1", + "ip-regex": "^4.3.0" + } + }, + "@polkadot/util-crypto": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-7.9.2.tgz", + "integrity": "sha512-nNwqUwP44eCH9jKKcPie+IHLKkg9LMe6H7hXo91hy3AtoslnNrT51tP3uAm5yllhLvswJfnAgnlHq7ybCgqeFw==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/networks": "7.9.2", + "@polkadot/util": "7.9.2", + "@polkadot/wasm-crypto": "^4.4.1", + "@polkadot/x-randomvalues": "7.9.2", + "blakejs": "^1.1.1", + "bn.js": "^4.12.0", + "create-hash": "^1.2.0", + "ed2curve": "^0.3.0", + "elliptic": "^6.5.4", + "hash.js": "^1.1.7", + "js-sha3": "^0.8.0", + "micro-base": "^0.9.0", + "scryptsy": "^2.1.0", + "tweetnacl": "^1.0.3", + "xxhashjs": "^0.2.2" + } + }, + "@polkadot/x-global": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-7.9.2.tgz", + "integrity": "sha512-JX5CrGWckHf1P9xKXq4vQCAuMUbL81l2hOWX7xeP8nv4caHEpmf5T1wD1iMdQBL5PFifo6Pg0V6/oZBB+bts7A==", + "requires": { + "@babel/runtime": "^7.16.3" + } + }, + "@polkadot/x-randomvalues": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-7.9.2.tgz", + "integrity": "sha512-svQfG31yCXf6yVyIgP0NgCzEy7oc3Lw054ZspkaqjOivxYdrXaf5w3JSSUyM/MRjI2+nk+B/EyJoMYcfSwTfsQ==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "@polkadot/x-textdecoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-7.9.2.tgz", + "integrity": "sha512-wfwbSHXPhrOAl12QvlIOGNkMH/N/h8PId2ytIjvM/8zPPFB5Il6DWSFLtVapOGEpIFjEWbd5t8Td4pHBVXIEbg==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + } + }, + "@polkadot/x-textencoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-7.9.2.tgz", + "integrity": "sha512-A19wwYINuZwU2dUyQ/mMzB0ISjyfc4cISfL4zCMUAVgj7xVoXMYV2GfjNdMpA8Wsjch3su6pxLbtJ2wU03sRTQ==", + "requires": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" } + }, + "camelcase": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz", + "integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==" } } }, @@ -6879,6 +7246,13 @@ "decamelize": "^4.0.0", "flat": "^5.0.2", "is-plain-obj": "^2.1.0" + }, + "dependencies": { + "camelcase": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz", + "integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==" + } } }, "yn": { diff --git a/tests/package.json b/tests/package.json index a948bc55d6b..9f0c0e6a216 100644 --- a/tests/package.json +++ b/tests/package.json @@ -47,8 +47,8 @@ "author": "", "license": "ISC", "dependencies": { - "@polkadot/api": "^6.8.1", - "@polkadot/types": "^6.8.1", + "@polkadot/api": "^6.10.3", + "@polkadot/types": "^6.10.3", "@substrate/txwrapper-core": "^1.2.17", "@substrate/txwrapper-registry": "^1.2.17", "@substrate/txwrapper-substrate": "^1.2.17", diff --git a/tests/tests/test-balance/test-balance-extrinsics.ts b/tests/tests/test-balance/test-balance-extrinsics.ts index 8c5075c4ae6..57ab5f399a2 100644 --- a/tests/tests/test-balance/test-balance-extrinsics.ts +++ b/tests/tests/test-balance/test-balance-extrinsics.ts @@ -1,13 +1,13 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createTransfer } from "../../util/transactions"; -describeDevMoonbeam("Balance extrinsics", (context) => { +describeDevMoonbeamAllEthTxTypes("Balance extrinsics", (context) => { it("should appear after transfer", async function () { const testAddress = "0x1111111111111111111111111111111111111111"; await context.createBlock({ - transactions: [await createTransfer(context.web3, testAddress, 512)], + transactions: [await createTransfer(context, testAddress, 512)], }); const blockHash = await context.polkadotApi.rpc.chain.getBlockHash(1); diff --git a/tests/tests/test-balance/test-balance-transfer.ts b/tests/tests/test-balance/test-balance-transfer.ts index 72ca8729154..9296bd58423 100644 --- a/tests/tests/test-balance/test-balance-transfer.ts +++ b/tests/tests/test-balance/test-balance-transfer.ts @@ -1,14 +1,14 @@ import { expect } from "chai"; import { GENESIS_ACCOUNT, GENESIS_ACCOUNT_BALANCE } from "../../util/constants"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createTransfer } from "../../util/transactions"; -describeDevMoonbeam("Balance transfer cost", (context) => { +describeDevMoonbeamAllEthTxTypes("Balance transfer cost", (context) => { it("should cost 21000 * 1_000_000_000", async function () { const testAccount = "0x1111111111111111111111111111111111111111"; await context.createBlock({ - transactions: [await createTransfer(context.web3, testAccount, 0)], + transactions: [await createTransfer(context, testAccount, 0)], }); expect(await context.web3.eth.getBalance(GENESIS_ACCOUNT, 1)).to.equal( @@ -17,11 +17,11 @@ describeDevMoonbeam("Balance transfer cost", (context) => { }); }); -describeDevMoonbeam("Balance transfer", (context) => { +describeDevMoonbeamAllEthTxTypes("Balance transfer", (context) => { const TEST_ACCOUNT = "0x1111111111111111111111111111111111111111"; before("Create block with transfer to test account of 512", async () => { await context.createBlock({ - transactions: [await createTransfer(context.web3, TEST_ACCOUNT, 512)], + transactions: [await createTransfer(context, TEST_ACCOUNT, 512)], }); }); diff --git a/tests/tests/test-block/test-block-gas.ts b/tests/tests/test-block/test-block-gas.ts index e9c9ad90e27..40ef968c7ee 100644 --- a/tests/tests/test-block/test-block-gas.ts +++ b/tests/tests/test-block/test-block-gas.ts @@ -1,13 +1,13 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { EXTRINSIC_GAS_LIMIT } from "../../util/constants"; import { createContract } from "../../util/transactions"; import { customWeb3Request } from "../../util/providers"; -describeDevMoonbeam("Block Gas - Limit", (context) => { +describeDevMoonbeamAllEthTxTypes("Block Gas - Limit", (context) => { it("should be allowed to the max block gas", async function () { - const { rawTx } = await createContract(context.web3, "TestContract", { + const { rawTx } = await createContract(context, "TestContract", { gas: EXTRINSIC_GAS_LIMIT, }); const { txResults } = await context.createBlock({ transactions: [rawTx] }); @@ -18,9 +18,9 @@ describeDevMoonbeam("Block Gas - Limit", (context) => { }); }); -describeDevMoonbeam("Block Gas - Limit", (context) => { +describeDevMoonbeamAllEthTxTypes("Block Gas - Limit", (context) => { it("should fail setting it over the max block gas", async function () { - const { rawTx } = await createContract(context.web3, "TestContract", { + const { rawTx } = await createContract(context, "TestContract", { gas: EXTRINSIC_GAS_LIMIT + 1, }); @@ -34,7 +34,7 @@ describeDevMoonbeam("Block Gas - Limit", (context) => { describeDevMoonbeam("Block Gas - Limit", (context) => { // TODO: Joshy to fix block gas access in smart contract it.skip("should be accessible within a contract", async function () { - const { contract, rawTx } = await createContract(context.web3, "CheckBlockVariables"); + const { contract, rawTx } = await createContract(context, "CheckBlockVariables"); await context.createBlock({ transactions: [rawTx] }); expect((await contract.methods.gaslimit().call()) !== "0").to.eq(true); diff --git a/tests/tests/test-contract/test-contract-creation.ts b/tests/tests/test-contract/test-contract-creation.ts index 9acebb4da24..514994498e9 100644 --- a/tests/tests/test-contract/test-contract-creation.ts +++ b/tests/tests/test-contract/test-contract-creation.ts @@ -1,10 +1,10 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; -describeDevMoonbeam("Contract creation", (context) => { +describeDevMoonbeamAllEthTxTypes("Contract creation", (context) => { it("should return the transaction hash", async () => { - const { rawTx } = await createContract(context.web3, "TestContract"); + const { rawTx } = await createContract(context, "TestContract"); const { txResults } = await context.createBlock({ transactions: [rawTx] }); expect( @@ -14,15 +14,15 @@ describeDevMoonbeam("Contract creation", (context) => { }); }); -describeDevMoonbeam("Contract creation", (context) => { +describeDevMoonbeamAllEthTxTypes("Contract creation", (context) => { it("should not contain contract at genesis", async function () { - const { contract, rawTx } = await createContract(context.web3, "TestContract"); + const { contract } = await createContract(context, "TestContract"); expect(await context.web3.eth.getCode(contract.options.address)).to.deep.equal("0x"); }); it("should store the code on chain", async function () { - const { contract, rawTx } = await createContract(context.web3, "TestContract"); - const { txResults } = await context.createBlock({ transactions: [rawTx] }); + const { contract, rawTx } = await createContract(context, "TestContract"); + await context.createBlock({ transactions: [rawTx] }); expect(await context.web3.eth.getCode(contract.options.address)).to.deep.equal( "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063c6888fa114610030575b" + diff --git a/tests/tests/test-contract/test-contract-error.ts b/tests/tests/test-contract/test-contract-error.ts index 0becdc68cb9..a34368778e2 100644 --- a/tests/tests/test-contract/test-contract-error.ts +++ b/tests/tests/test-contract/test-contract-error.ts @@ -1,13 +1,13 @@ import { expect } from "chai"; import { TransactionReceipt } from "web3-core"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract, createContractExecution } from "../../util/transactions"; -describeDevMoonbeam("Contract loop error", (context) => { +describeDevMoonbeamAllEthTxTypes("Contract loop error", (context) => { it("should return OutOfGas on inifinite loop call", async function () { - const { contract, rawTx } = await createContract(context.web3, "InfiniteContract"); + const { contract, rawTx } = await createContract(context, "InfiniteContract"); await context.createBlock({ transactions: [rawTx] }); await contract.methods @@ -20,11 +20,11 @@ describeDevMoonbeam("Contract loop error", (context) => { }); }); -describeDevMoonbeam("Contract loop error", (context) => { +describeDevMoonbeamAllEthTxTypes("Contract loop error", (context) => { it("should fail with OutOfGas on infinite loop transaction", async function () { - const { contract, rawTx } = await createContract(context.web3, "InfiniteContract"); + const { contract, rawTx } = await createContract(context, "InfiniteContract"); const infiniteTx = await createContractExecution( - context.web3, + context, { contract, contractCall: contract.methods.infinite(), diff --git a/tests/tests/test-contract/test-contract-incr-loop.ts b/tests/tests/test-contract/test-contract-incr-loop.ts index 969a25e0a33..f81cae729ae 100644 --- a/tests/tests/test-contract/test-contract-incr-loop.ts +++ b/tests/tests/test-contract/test-contract-incr-loop.ts @@ -1,24 +1,23 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract, createContractExecution } from "../../util/transactions"; -describeDevMoonbeam("Contract loop creation", (context) => { +describeDevMoonbeamAllEthTxTypes("Contract loop creation", (context) => { it("Should be initialized at 0", async () => { - const { contract, rawTx } = await createContract(context.web3, "TestContractIncr"); + const { contract, rawTx } = await createContract(context, "TestContractIncr"); await context.createBlock({ transactions: [rawTx] }); expect(await contract.methods.count().call()).to.eq("0"); }); }); -describeDevMoonbeam("Contract loop increment", (context) => { +describeDevMoonbeamAllEthTxTypes("Contract loop increment", (context) => { it("should increment contract state", async function () { - const { contract, rawTx } = await createContract(context.web3, "TestContractIncr"); + const { contract, rawTx, contractAddress } = await createContract(context, "TestContractIncr"); await context.createBlock({ transactions: [rawTx] }); - await context.createBlock({ transactions: [ - await createContractExecution(context.web3, { + await createContractExecution(context, { contract, contractCall: contract.methods.incr(), }), diff --git a/tests/tests/test-contract/test-contract-loop-cost.ts b/tests/tests/test-contract/test-contract-loop-cost.ts index 166c3d95224..a4d4e807a33 100644 --- a/tests/tests/test-contract/test-contract-loop-cost.ts +++ b/tests/tests/test-contract/test-contract-loop-cost.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract, createContractExecution } from "../../util/transactions"; [ @@ -16,13 +16,13 @@ import { createContract, createContractExecution } from "../../util/transactions gas: 1269054, }, ].forEach(({ loop, gas }) => { - describeDevMoonbeam("Contract loop", (context) => { + describeDevMoonbeamAllEthTxTypes("Contract loop", (context) => { it(`should consume ${gas} for ${loop} loop`, async function () { - const { contract, rawTx } = await createContract(context.web3, "FiniteLoopContract"); + const { contract, rawTx } = await createContract(context, "FiniteLoopContract"); await context.createBlock({ transactions: [rawTx] }); await context.createBlock({ transactions: [ - await createContractExecution(context.web3, { + await createContractExecution(context, { contract, contractCall: contract.methods.incr(loop), }), diff --git a/tests/tests/test-contract/test-contract-methods.ts b/tests/tests/test-contract/test-contract-methods.ts index 2e652905e82..9034a93277c 100644 --- a/tests/tests/test-contract/test-contract-methods.ts +++ b/tests/tests/test-contract/test-contract-methods.ts @@ -1,14 +1,14 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; import { Contract } from "web3-eth-contract"; -describeDevMoonbeam("Contract creation", (context) => { +describeDevMoonbeamAllEthTxTypes("Contract creation", (context) => { let testContract: Contract; let testContractTx: string; before("Setup: Create the contract", async function () { - const { contract, rawTx } = await createContract(context.web3, "TestContract"); + const { contract, rawTx } = await createContract(context, "TestContract"); const { txResults } = await context.createBlock({ transactions: [rawTx] }); testContract = contract; testContractTx = txResults[0].result; @@ -29,6 +29,7 @@ describeDevMoonbeam("Contract creation", (context) => { expect(await testContract.methods.multiply(3).call()).to.equal("21"); }); + // TODO: when web3 supports eip1559 and eip2930, this test should be adapted it("should fail for call method with missing parameters", async function () { // Create a fake contract based on origin deployed contract. // It make the multiply method supposed to have 0 arguments diff --git a/tests/tests/test-contract/test-contract-variables.ts b/tests/tests/test-contract/test-contract-variables.ts index ed3a026495d..019543054e3 100644 --- a/tests/tests/test-contract/test-contract-variables.ts +++ b/tests/tests/test-contract/test-contract-variables.ts @@ -7,7 +7,7 @@ describeDevMoonbeam("Block Contract - Block variables", (context) => { let blockContract: Contract; before("Setup: Creating contract with block variables", async function () { - const { contract, rawTx } = await createContract(context.web3, "CheckBlockVariables"); + const { contract, rawTx } = await createContract(context, "CheckBlockVariables"); await context.createBlock({ transactions: [rawTx] }); blockContract = contract; }); diff --git a/tests/tests/test-deal-fees.ts b/tests/tests/test-deal-fees.ts index ae46d0a6c9a..601eab5b650 100644 --- a/tests/tests/test-deal-fees.ts +++ b/tests/tests/test-deal-fees.ts @@ -1,10 +1,10 @@ import { expect } from "chai"; import Keyring from "@polkadot/keyring"; import { TREASURY_ACCOUNT } from "../util/constants"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { createTransfer } from "../util/transactions"; -describeDevMoonbeam("20% of the fees should go to treasury", (context) => { +describeDevMoonbeamAllEthTxTypes("20% of the fees should go to treasury", (context) => { const TEST_ACCOUNT = "0x1111111111111111111111111111111111111111"; const keyring = new Keyring({ type: "ethereum" }); @@ -14,7 +14,7 @@ describeDevMoonbeam("20% of the fees should go to treasury", (context) => { // We make an ethereum transaction, 20% of the fees should go to treasury. await context.createBlock({ - transactions: [await createTransfer(context.web3, TEST_ACCOUNT, 128)], + transactions: [await createTransfer(context, TEST_ACCOUNT, 128)], }); expect(await context.web3.eth.getBalance(TREASURY_ACCOUNT, 1)).to.equal("4200000000000"); }); diff --git a/tests/tests/test-ethpool/test-ethpool-multiple.ts b/tests/tests/test-ethpool/test-ethpool-multiple.ts index 17cec6f2e82..9e51c24fb4c 100644 --- a/tests/tests/test-ethpool/test-ethpool-multiple.ts +++ b/tests/tests/test-ethpool/test-ethpool-multiple.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; import { customWeb3Request } from "../../util/providers"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; import { Transaction } from "web3-core"; @@ -14,13 +14,13 @@ import { Transaction } from "web3-core"; - We resolve multiple promises in parallel that will read from this collection on the rpc-side - We can get the final transaction data once it leaves the pending collection */ -describeDevMoonbeam("EthPool - Multiple pending transactions", (context) => { +describeDevMoonbeamAllEthTxTypes("EthPool - Multiple pending transactions", (context) => { let txHashes: string[]; before("Setup: Sending 10 transactions", async function () { txHashes = await Promise.all( new Array(10).map(async (_, i) => { - const { rawTx } = await createContract(context.web3, "TestContract", { nonce: i }); + const { rawTx } = await createContract(context, "TestContract", { nonce: i }); return (await customWeb3Request(context.web3, "eth_sendRawTransaction", [rawTx])).result; }) ); @@ -58,13 +58,13 @@ describeDevMoonbeam("EthPool - Multiple pending transactions", (context) => { }); }); -describeDevMoonbeam("EthPool - Multiple produced transactions", (context) => { +describeDevMoonbeamAllEthTxTypes("EthPool - Multiple produced transactions", (context) => { let txHashes: string[]; before("Setup: Sending 10 transactions", async function () { txHashes = await Promise.all( new Array(10).map(async (_, i) => { - const { rawTx } = await createContract(context.web3, "TestContract", { nonce: i }); + const { rawTx } = await createContract(context, "TestContract", { nonce: i }); return (await customWeb3Request(context.web3, "eth_sendRawTransaction", [rawTx])).result; }) ); diff --git a/tests/tests/test-ethpool/test-ethpool-nonce-future.ts b/tests/tests/test-ethpool/test-ethpool-nonce-future.ts index dfcf6296ce5..53631fcef33 100644 --- a/tests/tests/test-ethpool/test-ethpool-nonce-future.ts +++ b/tests/tests/test-ethpool/test-ethpool-nonce-future.ts @@ -1,13 +1,13 @@ import { expect } from "chai"; import { createContract, createTransfer } from "../../util/transactions"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { customWeb3Request } from "../../util/providers"; -describeDevMoonbeam("EthPool - Future Ethereum transaction", (context) => { +describeDevMoonbeamAllEthTxTypes("EthPool - Future Ethereum transaction", (context) => { let txHash; before("Setup: Create a block with transaction", async () => { - const { rawTx } = await createContract(context.web3, "TestContract", { + const { rawTx } = await createContract(context, "TestContract", { nonce: 1, }); const { txResults } = await context.createBlock({ transactions: [rawTx] }); @@ -27,10 +27,10 @@ describeDevMoonbeam("EthPool - Future Ethereum transaction", (context) => { }); }); -describeDevMoonbeam("EthPool - Future Ethereum transaction", (context) => { +describeDevMoonbeamAllEthTxTypes("EthPool - Future Ethereum transaction", (context) => { let txHash; before("Setup: Create a block with transaction", async () => { - const { rawTx } = await createContract(context.web3, "TestContract", { + const { rawTx } = await createContract(context, "TestContract", { nonce: 1, }); const { txResults } = await context.createBlock({ transactions: [rawTx] }); @@ -41,7 +41,7 @@ describeDevMoonbeam("EthPool - Future Ethereum transaction", (context) => { // Create block including transaction with nonce 0 await context.createBlock({ transactions: [ - await createTransfer(context.web3, "0x1111111111111111111111111111111111111111", 512, { + await createTransfer(context, "0x1111111111111111111111111111111111111111", 512, { nonce: 0, }), ], diff --git a/tests/tests/test-event.ts b/tests/tests/test-event.ts index bc9df55fb47..c56cc2c5ace 100644 --- a/tests/tests/test-event.ts +++ b/tests/tests/test-event.ts @@ -1,11 +1,11 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { createContract } from "../util/transactions"; import { GENESIS_ACCOUNT } from "../util/constants"; -describeDevMoonbeam("Event - Contract", (context) => { +describeDevMoonbeamAllEthTxTypes("Event - Contract", (context) => { it("should contain event", async function () { - const { rawTx } = await createContract(context.web3, "SingleEventContract", { + const { rawTx } = await createContract(context, "SingleEventContract", { from: GENESIS_ACCOUNT, }); const { txResults } = await context.createBlock({ transactions: [rawTx] }); diff --git a/tests/tests/test-existential-deposit.ts b/tests/tests/test-existential-deposit.ts index 91c981d6fc7..bab6ed3e6f5 100644 --- a/tests/tests/test-existential-deposit.ts +++ b/tests/tests/test-existential-deposit.ts @@ -1,14 +1,14 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { createTransfer } from "../util/transactions"; import { GENESIS_ACCOUNT, GENESIS_ACCOUNT_BALANCE } from "../util/constants"; -describeDevMoonbeam("Existential Deposit", (context) => { +describeDevMoonbeamAllEthTxTypes("Existential Deposit", (context) => { it("should be disabled (no reaped account on 0 balance)", async function () { await context.createBlock({ transactions: [ await createTransfer( - context.web3, + context, "0x1111111111111111111111111111111111111111", GENESIS_ACCOUNT_BALANCE - 21000n * 1_000_000_000n, { diff --git a/tests/tests/test-fibonacci.ts b/tests/tests/test-fibonacci.ts index 94e7674729b..3e08756b143 100644 --- a/tests/tests/test-fibonacci.ts +++ b/tests/tests/test-fibonacci.ts @@ -1,10 +1,10 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { createContract, createContractExecution } from "../util/transactions"; -describeDevMoonbeam("Fibonacci", (context) => { +describeDevMoonbeamAllEthTxTypes("Fibonacci", (context) => { it("should be able to call fibonacci", async function () { - const { contract, rawTx } = await createContract(context.web3, "Fibonacci"); + const { contract, rawTx } = await createContract(context, "Fibonacci"); await context.createBlock({ transactions: [rawTx] }); expect(await contract.methods.fib2(0).call()).to.equal("" + 0); @@ -24,10 +24,10 @@ describeDevMoonbeam("Fibonacci", (context) => { }); it("should be able to call fibonacci[370] in txn", async function () { - const { contract, rawTx } = await createContract(context.web3, "Fibonacci"); + const { contract, rawTx } = await createContract(context, "Fibonacci"); await context.createBlock({ transactions: [rawTx] }); - const tx = await createContractExecution(context.web3, { + const tx = await createContractExecution(context, { contract, contractCall: contract.methods.fib2(370), }); diff --git a/tests/tests/test-filter/test-filter-api-creation.ts b/tests/tests/test-filter/test-filter-api-creation.ts index ca667b514fd..4069945c986 100644 --- a/tests/tests/test-filter/test-filter-api-creation.ts +++ b/tests/tests/test-filter/test-filter-api-creation.ts @@ -1,11 +1,11 @@ import { expect } from "chai"; import { customWeb3Request } from "../../util/providers"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; -describeDevMoonbeam("Filter API", (context) => { +describeDevMoonbeamAllEthTxTypes("Filter API", (context) => { it("should be able to create a Log filter", async function () { - const { contract, rawTx } = await createContract(context.web3, "SingleEventContract"); + const { contract, rawTx } = await createContract(context, "SingleEventContract"); await context.createBlock({ transactions: [rawTx] }); const createFilter = await customWeb3Request(context.web3, "eth_newFilter", [ @@ -23,9 +23,9 @@ describeDevMoonbeam("Filter API", (context) => { }); }); -describeDevMoonbeam("Filter API - Creating", (context) => { +describeDevMoonbeamAllEthTxTypes("Filter API - Creating", (context) => { it("should increment filter id", async function () { - const { contract, rawTx } = await createContract(context.web3, "SingleEventContract"); + const { contract, rawTx } = await createContract(context, "SingleEventContract"); await context.createBlock({ transactions: [rawTx] }); const createFilter = await customWeb3Request(context.web3, "eth_newFilter", [ diff --git a/tests/tests/test-filter/test-filter-api-polling.ts b/tests/tests/test-filter/test-filter-api-polling.ts index 1c47734e639..9d07a3d610b 100644 --- a/tests/tests/test-filter/test-filter-api-polling.ts +++ b/tests/tests/test-filter/test-filter-api-polling.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; import { customWeb3Request } from "../../util/providers"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; describeDevMoonbeam("Filter Block API - Polling", (context) => { @@ -57,9 +57,9 @@ describeDevMoonbeam("Filter Block API - Polling", (context) => { }); }); -describeDevMoonbeam("Filter Block API - Polling", (context) => { +describeDevMoonbeamAllEthTxTypes("Filter Block API - Polling", (context) => { it("should support filtering created contract", async function () { - const { contract, rawTx } = await createContract(context.web3, "SingleEventContract"); + const { contract, rawTx } = await createContract(context, "SingleEventContract"); const { txResults } = await context.createBlock({ transactions: [rawTx] }); const receipt = await context.web3.eth.getTransactionReceipt(txResults[0].result); diff --git a/tests/tests/test-fork-chain.ts b/tests/tests/test-fork-chain.ts index 70b5437aba6..f230588443c 100644 --- a/tests/tests/test-fork-chain.ts +++ b/tests/tests/test-fork-chain.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeam, describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { createTransfer } from "../util/transactions"; import { TEST_ACCOUNT } from "../util/constants"; @@ -30,13 +30,13 @@ describeDevMoonbeam("Fork", (context) => { }); }); -describeDevMoonbeam("Fork", (context) => { +describeDevMoonbeamAllEthTxTypes("Fork", (context) => { it("should re-insert Tx from retracted fork on new canonical chain", async function () { // Creation of the best chain so far, with blocks 0-1-2 and a transfer in block 2 await context.createBlock({ finalize: false }); const { txResults } = await context.createBlock({ finalize: false, - transactions: [await createTransfer(context.web3, TEST_ACCOUNT, 512)], + transactions: [await createTransfer(context, TEST_ACCOUNT, 512)], }); const insertedTx = txResults[0].result; const retractedTx = await context.web3.eth.getTransaction(insertedTx); diff --git a/tests/tests/test-gas/test-gas-estimation.ts b/tests/tests/test-gas/test-gas-estimation.ts index 5f09ca9d8ea..84646a2f450 100644 --- a/tests/tests/test-gas/test-gas-estimation.ts +++ b/tests/tests/test-gas/test-gas-estimation.ts @@ -1,7 +1,7 @@ import { expect, use as chaiUse } from "chai"; import chaiAsPromised from "chai-as-promised"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { TransactionReceipt } from "web3-core"; import { getCompiled } from "../../util/contracts"; @@ -12,11 +12,11 @@ import { Contract } from "web3-eth-contract"; chaiUse(chaiAsPromised); -describeDevMoonbeam("Estimate Gas - Multiply", (context) => { +describeDevMoonbeamAllEthTxTypes("Estimate Gas - Multiply", (context) => { let multContract: Contract; before("Setup: Create simple context", async function () { - const { contract, rawTx } = await createContract(context.web3, "TestContract"); + const { contract, rawTx } = await createContract(context, "TestContract"); await context.createBlock({ transactions: [rawTx] }); multContract = contract; }); @@ -58,7 +58,7 @@ describeDevMoonbeam("Estimate Gas - Multiply", (context) => { }); }); -describeDevMoonbeam("Estimate Gas - Supplied estimate is sufficient", (context) => { +describeDevMoonbeamAllEthTxTypes("Estimate Gas - Supplied estimate is sufficient", (context) => { it("should estimate sufficient gas for creation", async function () { const contract = await getCompiled("Incrementer"); // ask RPC for an gas estimate of deploying this contract @@ -68,7 +68,7 @@ describeDevMoonbeam("Estimate Gas - Supplied estimate is sufficient", (context) }); // attempt a transaction with our estimated gas - const { rawTx } = await createContract(context.web3, "Incrementer", { gas: estimate }); + const { rawTx } = await createContract(context, "Incrementer", { gas: estimate }); const { txResults } = await context.createBlock({ transactions: [rawTx] }); const receipt: TransactionReceipt = await context.web3.eth.getTransactionReceipt( txResults[0].result diff --git a/tests/tests/test-gas/test-gas-estimation2.ts b/tests/tests/test-gas/test-gas-estimation2.ts index 0e7ec0e1033..dd4cfe5e71e 100644 --- a/tests/tests/test-gas/test-gas-estimation2.ts +++ b/tests/tests/test-gas/test-gas-estimation2.ts @@ -1,15 +1,15 @@ import { expect, use as chaiUse } from "chai"; import chaiAsPromised from "chai-as-promised"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; chaiUse(chaiAsPromised); -describeDevMoonbeam("Estimate Gas - infinite loop", (context) => { +describeDevMoonbeamAllEthTxTypes("Estimate Gas - infinite loop", (context) => { it("Should be able to estimate gas of infinite loop call", async function () { - const { contract, rawTx } = await createContract(context.web3, "InfiniteContract"); + const { contract, rawTx } = await createContract(context, "InfiniteContract"); await context.createBlock({ transactions: [rawTx] }); await expect( diff --git a/tests/tests/test-log-filtering.ts b/tests/tests/test-log-filtering.ts index 72ffdccd13d..50e0bf52e88 100644 --- a/tests/tests/test-log-filtering.ts +++ b/tests/tests/test-log-filtering.ts @@ -1,11 +1,11 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { customWeb3Request } from "../util/providers"; import { createContract } from "../util/transactions"; import { GENESIS_ACCOUNT } from "../util/constants"; import { TransactionReceipt } from "web3-core"; -describeDevMoonbeam("Log - Filter out non-matching", (context) => { +describeDevMoonbeamAllEthTxTypes("Log - Filter out non-matching", (context) => { let non_matching_cases = null; function getNonMatchingCases(receipt: TransactionReceipt) { return [ @@ -38,7 +38,7 @@ describeDevMoonbeam("Log - Filter out non-matching", (context) => { ]; } before("Setup: Create block with transfer", async () => { - const { rawTx } = await createContract(context.web3, "SingleEventContract", { + const { rawTx } = await createContract(context, "SingleEventContract", { from: GENESIS_ACCOUNT, }); const { txResults } = await context.createBlock({ transactions: [rawTx] }); diff --git a/tests/tests/test-nonce.ts b/tests/tests/test-nonce.ts index 232b70bf605..055445dcf7e 100644 --- a/tests/tests/test-nonce.ts +++ b/tests/tests/test-nonce.ts @@ -18,7 +18,7 @@ describeDevMoonbeam("Nonce - Initial", (context) => { it("should stay at 0 before block is created", async function () { await customWeb3Request(context.web3, "eth_sendRawTransaction", [ - await createTransfer(context.web3, GENESIS_ACCOUNT, 512), + await createTransfer(context, GENESIS_ACCOUNT, 512), ]); expect(await context.web3.eth.getTransactionCount(GENESIS_ACCOUNT)).to.eq(0); }); @@ -28,7 +28,7 @@ describeDevMoonbeam("Nonce - Previous block", (context) => { before("Setup: Create block with transfer", async () => { await context.createBlock({ transactions: [ - await createTransfer(context.web3, "0x1111111111111111111111111111111111111111", 512), + await createTransfer(context, "0x1111111111111111111111111111111111111111", 512), ], }); }); @@ -40,7 +40,7 @@ describeDevMoonbeam("Nonce - Previous block", (context) => { describeDevMoonbeam("Nonce - Pending transaction", (context) => { before("Setup: Create block with transfer", async () => { await customWeb3Request(context.web3, "eth_sendRawTransaction", [ - await createTransfer(context.web3, "0x1111111111111111111111111111111111111111", 512), + await createTransfer(context, "0x1111111111111111111111111111111111111111", 512), ]); }); it("should not increase transaction count", async function () { @@ -58,7 +58,7 @@ describeDevMoonbeam("Nonce - Transferring", (context) => { it("Setup: Sending token", async function () { await context.createBlock({ transactions: [ - await createTransfer(context.web3, "0x1111111111111111111111111111111111111111", 512), + await createTransfer(context, "0x1111111111111111111111111111111111111111", 512), ], }); }); diff --git a/tests/tests/test-precompile-assets-erc20.ts b/tests/tests/test-precompile-assets-erc20.ts index e0cc10ff7e3..48139e160dc 100644 --- a/tests/tests/test-precompile-assets-erc20.ts +++ b/tests/tests/test-precompile-assets-erc20.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { customWeb3Request } from "../util/providers"; import { GENESIS_ACCOUNT, @@ -108,7 +108,7 @@ const SELECTORS = { }; const GAS_PRICE = "0x" + (1_000_000_000).toString(16); -describeDevMoonbeam( +describeDevMoonbeamAllEthTxTypes( "Precompiles - Assets-ERC20 Wasm", (context) => { let sudoAccount, assetId, iFace; @@ -138,7 +138,7 @@ describeDevMoonbeam( const contractData = await getCompiled("ERC20Instance"); iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "ERC20Instance"); + const { contract, rawTx } = await createContract(context, "ERC20Instance"); const address = contract.options.address; await context.createBlock({ transactions: [rawTx] }); }); @@ -266,7 +266,7 @@ describeDevMoonbeam( true ); -describeDevMoonbeam( +describeDevMoonbeamAllEthTxTypes( "Precompiles - Assets-ERC20 Wasm", (context) => { let sudoAccount, assetId, iFace; @@ -292,7 +292,7 @@ describeDevMoonbeam( const contractData = await getCompiled("ERC20Instance"); iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "ERC20Instance"); + const { contract, rawTx } = await createContract(context, "ERC20Instance"); const address = contract.options.address; await context.createBlock({ transactions: [rawTx] }); }); @@ -303,7 +303,7 @@ describeDevMoonbeam( [BALTATHAR, 1000] ); - const tx = await createTransaction(context.web3, { + const tx = await createTransaction(context, { from: ALITH, privateKey: ALITH_PRIV_KEY, value: "0x0", @@ -358,7 +358,7 @@ describeDevMoonbeam( true ); -describeDevMoonbeam( +describeDevMoonbeamAllEthTxTypes( "Precompiles - Assets-ERC20 Wasm", (context) => { let sudoAccount, assetId, iFace, contractInstanceAddress; @@ -384,7 +384,7 @@ describeDevMoonbeam( const contractData = await getCompiled("ERC20Instance"); iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "ERC20Instance"); + const { contract, rawTx } = await createContract(context, "ERC20Instance"); contractInstanceAddress = contract.options.address; await context.createBlock({ transactions: [rawTx] }); }); @@ -396,7 +396,7 @@ describeDevMoonbeam( [BALTATHAR, 1000] ); - let tx = await createTransaction(context.web3, { + let tx = await createTransaction(context, { from: ALITH, privateKey: ALITH_PRIV_KEY, value: "0x0", @@ -424,7 +424,7 @@ describeDevMoonbeam( [ALITH, CHARLETH, 1000] ); - tx = await createTransaction(context.web3, { + tx = await createTransaction(context, { from: BALTATHAR, privateKey: BALTATHAR_PRIV_KEY, value: "0x0", @@ -464,7 +464,7 @@ describeDevMoonbeam( true ); -describeDevMoonbeam( +describeDevMoonbeamAllEthTxTypes( "Precompiles - Assets-ERC20 Wasm", (context) => { let sudoAccount, assetId, iFace; @@ -490,7 +490,7 @@ describeDevMoonbeam( const contractData = await getCompiled("ERC20Instance"); iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "ERC20Instance"); + const { contract, rawTx } = await createContract(context, "ERC20Instance"); const address = contract.options.address; await context.createBlock({ transactions: [rawTx] }); }); @@ -502,7 +502,7 @@ describeDevMoonbeam( [BALTATHAR, 1000] ); - let tx = await createTransaction(context.web3, { + let tx = await createTransaction(context, { from: ALITH, privateKey: ALITH_PRIV_KEY, value: "0x0", @@ -530,7 +530,7 @@ describeDevMoonbeam( true ); -describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - Assets-ERC20 Wasm", (context) => { let sudoAccount, assetId, iFace, contractInstanceAddress; before("Setup contract and mock balance", async () => { const keyring = new Keyring({ type: "ethereum" }); @@ -554,7 +554,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { const contractData = await getCompiled("ERC20Instance"); iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "ERC20Instance"); + const { contract, rawTx } = await createContract(context, "ERC20Instance"); contractInstanceAddress = contract.options.address; await context.createBlock({ transactions: [rawTx] }); }); @@ -566,7 +566,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { [BALTATHAR, 1000] ); - let tx = await createTransaction(context.web3, { + let tx = await createTransaction(context, { from: ALITH, privateKey: ALITH_PRIV_KEY, value: "0x0", @@ -602,7 +602,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { [ALITH, CHARLETH, 1000] ); - tx = await createTransaction(context.web3, { + tx = await createTransaction(context, { from: BALTATHAR, privateKey: BALTATHAR_PRIV_KEY, value: "0x0", @@ -637,7 +637,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { }); }); -describeDevMoonbeam( +describeDevMoonbeamAllEthTxTypes( "Precompiles - Assets-ERC20 Wasm", (context) => { let sudoAccount, assetId, iFace, contractInstanceAddress; @@ -663,7 +663,7 @@ describeDevMoonbeam( const contractData = await getCompiled("ERC20Instance"); iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "ERC20Instance"); + const { contract, rawTx } = await createContract(context, "ERC20Instance"); contractInstanceAddress = contract.options.address; await context.createBlock({ transactions: [rawTx] }); }); @@ -675,7 +675,7 @@ describeDevMoonbeam( [BALTATHAR, 1000] ); - let tx = await createTransaction(context.web3, { + let tx = await createTransaction(context, { from: ALITH, privateKey: ALITH_PRIV_KEY, value: "0x0", @@ -703,7 +703,7 @@ describeDevMoonbeam( true ); -describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - Assets-ERC20 Wasm", (context) => { let sudoAccount, assetId, iFace, contractInstanceAddress; before("Setup contract and mock balance", async () => { const keyring = new Keyring({ type: "ethereum" }); @@ -725,7 +725,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { const contractData = await getCompiled("ERC20Instance"); iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "ERC20Instance"); + const { contract, rawTx } = await createContract(context, "ERC20Instance"); contractInstanceAddress = contract.options.address; // We fund the contract address with this test await mockAssetBalance( @@ -747,7 +747,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { [BALTATHAR, 1000] ); - let tx = await createTransaction(context.web3, { + let tx = await createTransaction(context, { from: ALITH, privateKey: ALITH_PRIV_KEY, value: "0x0", @@ -785,7 +785,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { [contractInstanceAddress, CHARLETH, 1000] ); - tx = await createTransaction(context.web3, { + tx = await createTransaction(context, { from: BALTATHAR, privateKey: BALTATHAR_PRIV_KEY, value: "0x0", @@ -813,7 +813,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { expect(approvals.unwrap().amount.eq(new BN(1000))).to.equal(true); // this time we call directly from Baltathar the ERC20 contract - tx = await createTransaction(context.web3, { + tx = await createTransaction(context, { from: BALTATHAR, privateKey: BALTATHAR_PRIV_KEY, value: "0x0", @@ -846,7 +846,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { }); }); -describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - Assets-ERC20 Wasm", (context) => { let sudoAccount, assetId, iFace, contractInstanceAddress; before("Setup contract and mock balance", async () => { const keyring = new Keyring({ type: "ethereum" }); @@ -868,7 +868,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { const contractData = await getCompiled("ERC20Instance"); iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "ERC20Instance"); + const { contract, rawTx } = await createContract(context, "ERC20Instance"); contractInstanceAddress = contract.options.address; // We fund Alith with this test await mockAssetBalance(context, assetBalance, assetDetails, sudoAccount, assetId, ALITH); @@ -883,7 +883,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { [contractInstanceAddress, 1000] ); - let tx = await createTransaction(context.web3, { + let tx = await createTransaction(context, { from: ALITH, privateKey: ALITH_PRIV_KEY, value: "0x0", @@ -920,7 +920,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { [ALITH, CHARLETH, 1000] ); - tx = await createTransaction(context.web3, { + tx = await createTransaction(context, { from: BALTATHAR, privateKey: BALTATHAR_PRIV_KEY, value: "0x0", @@ -953,7 +953,7 @@ describeDevMoonbeam("Precompiles - Assets-ERC20 Wasm", (context) => { }); }); -describeDevMoonbeam( +describeDevMoonbeamAllEthTxTypes( "Precompiles - Assets-ERC20 Wasm", (context) => { let sudoAccount, assetId, iFace, contractInstanceAddress; @@ -977,7 +977,7 @@ describeDevMoonbeam( const contractData = await getCompiled("ERC20Instance"); iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "ERC20Instance"); + const { contract, rawTx } = await createContract(context, "ERC20Instance"); contractInstanceAddress = contract.options.address; await mockAssetBalance( context, @@ -998,7 +998,7 @@ describeDevMoonbeam( [BALTATHAR, 1000] ); - let tx = await createTransaction(context.web3, { + let tx = await createTransaction(context, { from: ALITH, privateKey: ALITH_PRIV_KEY, value: "0x0", diff --git a/tests/tests/test-precompile-blake2.ts b/tests/tests/test-precompile-blake2.ts index afc41fc7aeb..d8f3a764814 100644 --- a/tests/tests/test-precompile-blake2.ts +++ b/tests/tests/test-precompile-blake2.ts @@ -1,10 +1,10 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { createContract } from "../util/transactions"; -describeDevMoonbeam("Precompiles - Blake2", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - Blake2", (context) => { it("should be accessible from a smart contract", async function () { - const { contract, rawTx } = await createContract(context.web3, "Blake2Check"); + const { contract, rawTx } = await createContract(context, "Blake2Check"); const { txResults } = await context.createBlock({ transactions: [rawTx] }); // The contract should deploy successfully and the receipt should show success. diff --git a/tests/tests/test-precompile/test-precompile-bn128add.ts b/tests/tests/test-precompile/test-precompile-bn128add.ts index a10926b4eda..57e215e48fd 100644 --- a/tests/tests/test-precompile/test-precompile-bn128add.ts +++ b/tests/tests/test-precompile/test-precompile-bn128add.ts @@ -1,10 +1,10 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; -describeDevMoonbeam("Precompiles - bn128add", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - bn128add", (context) => { it("should be accessible from a smart contract", async function () { - const { rawTx } = await createContract(context.web3, "Bn128Addition"); + const { rawTx } = await createContract(context, "Bn128Addition"); await context.createBlock({ transactions: [rawTx] }); // Because the call to bn128add is in the constructor of HashRipmd160, verifying the code diff --git a/tests/tests/test-precompile/test-precompile-bn128mul.ts b/tests/tests/test-precompile/test-precompile-bn128mul.ts index 720c5514c33..2178cbecac0 100644 --- a/tests/tests/test-precompile/test-precompile-bn128mul.ts +++ b/tests/tests/test-precompile/test-precompile-bn128mul.ts @@ -1,10 +1,10 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; -describeDevMoonbeam("Precompiles - bn128mul", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - bn128mul", (context) => { it("should be accessible from a smart contract", async function () { - const { rawTx } = await createContract(context.web3, "Bn128Multiply"); + const { rawTx } = await createContract(context, "Bn128Multiply"); await context.createBlock({ transactions: [rawTx] }); // Because the call to bn128mul is in the constructor of HashRipmd160, verifying the code diff --git a/tests/tests/test-precompile/test-precompile-bn128pairing.ts b/tests/tests/test-precompile/test-precompile-bn128pairing.ts index 7b34bb540e3..ff29ae90b0f 100644 --- a/tests/tests/test-precompile/test-precompile-bn128pairing.ts +++ b/tests/tests/test-precompile/test-precompile-bn128pairing.ts @@ -1,10 +1,10 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; -describeDevMoonbeam("Precompiles - bn128Pairing", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - bn128Pairing", (context) => { it("should be accessible from a smart contract", async function () { - const { rawTx } = await createContract(context.web3, "Bn128Pairing"); + const { rawTx } = await createContract(context, "Bn128Pairing"); await context.createBlock({ transactions: [rawTx] }); // Because the call to bn128mul is in the constructor of HashRipmd160, verifying the code diff --git a/tests/tests/test-precompile/test-precompile-dummy-bytecode.ts b/tests/tests/test-precompile/test-precompile-dummy-bytecode.ts index b378fdc525a..b5f95069fed 100644 --- a/tests/tests/test-precompile/test-precompile-dummy-bytecode.ts +++ b/tests/tests/test-precompile/test-precompile-dummy-bytecode.ts @@ -1,7 +1,7 @@ import { expect } from "chai"; import { GENESIS_ACCOUNT } from "../../util/constants"; import { customWeb3Request } from "../../util/providers"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract, createTransaction } from "../../util/transactions"; import * as RLP from "rlp"; @@ -17,7 +17,7 @@ const DEPLOYED_BYTECODE = "0x60006000fd"; // const INIT_CODE = "0x600580600B6000396000F360006000fd"; -describeDevMoonbeam("Precompiles - precompiles dummy bytecode", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - precompiles dummy bytecode", (context) => { it("should return dummy bytecode for every precompiles", async function () { [ "0x0000000000000000000000000000000000000001", @@ -43,7 +43,7 @@ describeDevMoonbeam("Precompiles - precompiles dummy bytecode", (context) => { it("should revert when dummy bytecode is called", async function () { // we deploy a new contract with the same bytecode to be able to // execute the bytecode instead of executing a precompile. - const createTx = await createTransaction(context.web3, { + const createTx = await createTransaction(context, { data: INIT_CODE, }); @@ -63,7 +63,7 @@ describeDevMoonbeam("Precompiles - precompiles dummy bytecode", (context) => { expect(code).to.equal(DEPLOYED_BYTECODE); // try to call contract (with empty data, shouldn't matter) - const callTx = await createTransaction(context.web3, { + const callTx = await createTransaction(context, { data: "0x", to: contractAddress, }); diff --git a/tests/tests/test-precompile/test-precompile-erc20.ts b/tests/tests/test-precompile/test-precompile-erc20.ts index 58f39829254..d95974f0d8f 100644 --- a/tests/tests/test-precompile/test-precompile-erc20.ts +++ b/tests/tests/test-precompile/test-precompile-erc20.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { customWeb3Request } from "../../util/providers"; import { GENESIS_ACCOUNT, @@ -34,7 +34,7 @@ async function sendApprove(context, from, fromPrivate, spender, amount) { const fromData = from.slice(2).padStart(64, "0").toLowerCase(); //web3 rpc returns lowercase const spenderData = spender.slice(2).padStart(64, "0").toLowerCase(); - const tx = await createTransaction(context.web3, { + const tx = await createTransaction(context, { from: from, privateKey: fromPrivate, value: "0x0", @@ -77,7 +77,7 @@ async function checkAllowance(context, owner, spender, amount) { expect(request.result).equals(`0x${amount.padStart(64, "0")}`); } -describeDevMoonbeam("Precompiles - ERC20 Native", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - ERC20 Native", (context) => { it("allows to call getBalance", async function () { const address = ALITH.slice(2).padStart(64, "0"); @@ -116,7 +116,7 @@ describeDevMoonbeam("Precompiles - ERC20 Native", (context) => { }); }); -describeDevMoonbeam("Precompiles - ERC20 Native", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - ERC20 Native", (context) => { it("allows to approve transfers, and allowance matches", async function () { const amount = `1000000000000`.padStart(64, "0"); @@ -126,12 +126,12 @@ describeDevMoonbeam("Precompiles - ERC20 Native", (context) => { }); }); -describeDevMoonbeam("Precompiles - ERC20 Native", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - ERC20 Native", (context) => { it("allows to call transfer", async function () { const amount = `400000000000`.padStart(64, "0"); const to = CHARLETH.slice(2).padStart(64, "0"); - const tx = await createTransaction(context.web3, { + const tx = await createTransaction(context, { from: ALITH, privateKey: ALITH_PRIV_KEY, value: "0x0", @@ -159,7 +159,7 @@ describeDevMoonbeam("Precompiles - ERC20 Native", (context) => { }); }); -describeDevMoonbeam("Precompiles - ERC20 Native", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - ERC20 Native", (context) => { it("allows to approve transfer and use transferFrom", async function () { const allowedAmount = `1000000000000`.padStart(64, "0"); const transferAmount = `400000000000`.padStart(64, "0"); @@ -172,7 +172,7 @@ describeDevMoonbeam("Precompiles - ERC20 Native", (context) => { const to = CHARLETH.slice(2).padStart(64, "0").toLowerCase(); const gas_price = await context.web3.eth.getGasPrice(); - const tx = await createTransaction(context.web3, { + const tx = await createTransaction(context, { from: BALTATHAR, privateKey: BALTATHAR_PRIV_KEY, value: "0x0", @@ -213,7 +213,7 @@ describeDevMoonbeam("Precompiles - ERC20 Native", (context) => { }); }); -describeDevMoonbeam("Precompiles - ERC20", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - ERC20", (context) => { it("refuses to transferFrom more than allowed", async function () { const allowedAmount = `1000000000000`.padStart(64, "0"); const transferAmount = `1400000000000`.padStart(64, "0"); @@ -226,7 +226,7 @@ describeDevMoonbeam("Precompiles - ERC20", (context) => { let to = CHARLETH.slice(2).padStart(64, "0"); const gas_price = await context.web3.eth.getGasPrice(); - let tx = await createTransaction(context.web3, { + let tx = await createTransaction(context, { from: BALTATHAR, privateKey: BALTATHAR_PRIV_KEY, value: "0x0", diff --git a/tests/tests/test-precompile/test-precompile-modexp.ts b/tests/tests/test-precompile/test-precompile-modexp.ts index 6d62fc3ba3c..05f0bd9f158 100644 --- a/tests/tests/test-precompile/test-precompile-modexp.ts +++ b/tests/tests/test-precompile/test-precompile-modexp.ts @@ -1,12 +1,12 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; -describeDevMoonbeam("Precompiles - ModExp", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - ModExp", (context) => { it("should be accessible from a smart contract", async function () { // See also the ModExp unit tests at // github.com/paritytech/frontier/blob/378221a4/frame/evm/precompile/modexp/src/lib.rs#L101 - const { contract, rawTx } = await createContract(context.web3, "ModularCheck"); + const { contract, rawTx } = await createContract(context, "ModularCheck"); const { txResults } = await context.createBlock({ transactions: [rawTx] }); // The contract should deploy successfully and the receipt should show success. diff --git a/tests/tests/test-precompile/test-precompile-relay-encoder.ts b/tests/tests/test-precompile/test-precompile-relay-encoder.ts index 69182201007..aeab92a8d56 100644 --- a/tests/tests/test-precompile/test-precompile-relay-encoder.ts +++ b/tests/tests/test-precompile/test-precompile-relay-encoder.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { customWeb3Request } from "../../util/providers"; import { ethers } from "ethers"; import { getCompiled } from "../../util/contracts"; @@ -13,7 +13,7 @@ const BOB_HEX = "0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26 const GAS_PRICE = "0x" + (1_000_000_000).toString(16); -describeDevMoonbeam("Precompiles - relay-encoder", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - relay-encoder", (context) => { let iFace; let contractData; before("Deploy contract", async () => { diff --git a/tests/tests/test-precompile/test-precompile-revert-attack.ts b/tests/tests/test-precompile/test-precompile-revert-attack.ts index f23d67e066d..cfc20015d53 100644 --- a/tests/tests/test-precompile/test-precompile-revert-attack.ts +++ b/tests/tests/test-precompile/test-precompile-revert-attack.ts @@ -10,7 +10,7 @@ // We have to make sure that's not possible import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { GENESIS_ACCOUNT, MIN_GLMR_STAKING } from "../../util/constants"; import { getCompiled } from "../../util/contracts"; @@ -21,45 +21,48 @@ import { } from "../../util/transactions"; import { numberToHex } from "@polkadot/util"; -describeDevMoonbeam("Precompiles - test revert attack on state modifier", (context) => { - it("should return contract creation gas cost", async function () { - // Check initial balance - const initialBalance = await context.web3.eth.getBalance(GENESIS_ACCOUNT); - // Deploy atatck contract - const { contract, rawTx } = await createContract(context.web3, "StakingDelegationAttaker"); - await context.createBlock({ transactions: [rawTx] }); +describeDevMoonbeamAllEthTxTypes( + "Precompiles - test revert attack on state modifier", + (context) => { + it("should return contract creation gas cost", async function () { + // Check initial balance + const initialBalance = await context.web3.eth.getBalance(GENESIS_ACCOUNT); + // Deploy atatck contract + const { contract, rawTx } = await createContract(context, "StakingDelegationAttaker"); + await context.createBlock({ transactions: [rawTx] }); - // call the payable function, which should revert - const block = await context.createBlock({ - transactions: [ - await createContractExecution( - context.web3, - { - contract, - contractCall: contract.methods.score_a_free_delegation(), - }, - { - ...GENESIS_TRANSACTION, - value: numberToHex(Number(MIN_GLMR_STAKING)), - } - ), - ], - }); + // call the payable function, which should revert + const block = await context.createBlock({ + transactions: [ + await createContractExecution( + context, + { + contract, + contractCall: contract.methods.score_a_free_delegation(), + }, + { + ...GENESIS_TRANSACTION, + value: numberToHex(Number(MIN_GLMR_STAKING)), + } + ), + ], + }); - // TX should be included but fail - const receipt = await context.web3.eth.getTransactionReceipt(block.txResults[0].result); - expect(receipt.status).to.eq(false); + // TX should be included but fail + const receipt = await context.web3.eth.getTransactionReceipt(block.txResults[0].result); + expect(receipt.status).to.eq(false); - // Delegation shouldn't have passed - const nominatorsAfter = await context.polkadotApi.query.parachainStaking.delegatorState( - GENESIS_ACCOUNT - ); - expect(nominatorsAfter.toHuman()).to.eq(null); + // Delegation shouldn't have passed + const nominatorsAfter = await context.polkadotApi.query.parachainStaking.delegatorState( + GENESIS_ACCOUNT + ); + expect(nominatorsAfter.toHuman()).to.eq(null); - // balance dif should only be tx fee, not MIN_GLMR_STAKING - expect( - Number(initialBalance) - Number(await context.web3.eth.getBalance(GENESIS_ACCOUNT)) < - Number(MIN_GLMR_STAKING) - ).to.eq(true); - }); -}); + // balance dif should only be tx fee, not MIN_GLMR_STAKING + expect( + Number(initialBalance) - Number(await context.web3.eth.getBalance(GENESIS_ACCOUNT)) < + Number(MIN_GLMR_STAKING) + ).to.eq(true); + }); + } +); diff --git a/tests/tests/test-precompile/test-precompile-ripemd160.ts b/tests/tests/test-precompile/test-precompile-ripemd160.ts index fe7dc5a098c..ca406f797ba 100644 --- a/tests/tests/test-precompile/test-precompile-ripemd160.ts +++ b/tests/tests/test-precompile/test-precompile-ripemd160.ts @@ -1,10 +1,10 @@ import { expect } from "chai"; import { GENESIS_ACCOUNT } from "../../util/constants"; import { customWeb3Request } from "../../util/providers"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; -describeDevMoonbeam("Precompiles - ripemd160 ", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - ripemd160 ", (context) => { it("should be valid", async function () { const txCall = await customWeb3Request(context.web3, "eth_call", [ { @@ -23,9 +23,9 @@ describeDevMoonbeam("Precompiles - ripemd160 ", (context) => { }); }); -describeDevMoonbeam("Precompiles - ripemd160 ", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - ripemd160 ", (context) => { it("should be accessible from a smart contract", async function () { - const { contract, rawTx } = await createContract(context.web3, "HashRipmd160"); + const { contract, rawTx } = await createContract(context, "HashRipmd160"); await context.createBlock({ transactions: [rawTx] }); // Because the call to ripemd160 is in the constructor of HashRipmd160, verifying the code diff --git a/tests/tests/test-precompile/test-precompile-sha3fips.ts b/tests/tests/test-precompile/test-precompile-sha3fips.ts index a76db219658..3aa61e695bb 100644 --- a/tests/tests/test-precompile/test-precompile-sha3fips.ts +++ b/tests/tests/test-precompile/test-precompile-sha3fips.ts @@ -1,9 +1,9 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { customWeb3Request } from "../../util/providers"; import { GENESIS_ACCOUNT } from "../../util/constants"; -describeDevMoonbeam("Precompiles - sha3fips", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - sha3fips", (context) => { // Test taken from https://github.com/binance-chain/bsc/pull/118 it("sha3fips should be valid", async function () { const tx_call = await customWeb3Request(context.web3, "eth_call", [ diff --git a/tests/tests/test-precompile/test-precompile-staking.ts b/tests/tests/test-precompile/test-precompile-staking.ts index 6b0b696c519..7ab522b2de1 100644 --- a/tests/tests/test-precompile/test-precompile-staking.ts +++ b/tests/tests/test-precompile/test-precompile-staking.ts @@ -13,7 +13,11 @@ import { ALITH_PRIV_KEY, } from "../../util/constants"; import { blake2AsHex, randomAsHex } from "@polkadot/util-crypto"; -import { describeDevMoonbeam, DevTestContext } from "../../util/setup-dev-tests"; +import { + describeDevMoonbeam, + describeDevMoonbeamAllEthTxTypes, + DevTestContext, +} from "../../util/setup-dev-tests"; import { numberToHex, stringToHex } from "@polkadot/util"; import Web3 from "web3"; import { customWeb3Request } from "../../util/providers"; @@ -70,7 +74,7 @@ describeDevMoonbeam("Staking - Genesis", (context) => { }); }); -describeDevMoonbeam("Staking - Join Candidates", (context) => { +describeDevMoonbeamAllEthTxTypes("Staking - Join Candidates", (context) => { it("should successfully call joinCandidates on ETHAN", async function () { const block = await sendPrecompileTx( context, @@ -103,7 +107,7 @@ describeDevMoonbeam("Staking - Join Candidates", (context) => { }); }); -describeDevMoonbeam("Staking - Join Delegators", (context) => { +describeDevMoonbeamAllEthTxTypes("Staking - Join Delegators", (context) => { beforeEach("should successfully call delegate for ETHAN to ALITH", async function () { await sendPrecompileTx(context, ADDRESS_STAKING, SELECTORS, ETHAN, ETHAN_PRIVKEY, "nominate", [ ALITH, diff --git a/tests/tests/test-precompile/test-precompile-xcm-transactor.ts b/tests/tests/test-precompile/test-precompile-xcm-transactor.ts index abdca0cfd95..8de802d44d6 100644 --- a/tests/tests/test-precompile/test-precompile-xcm-transactor.ts +++ b/tests/tests/test-precompile/test-precompile-xcm-transactor.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { customWeb3Request } from "../../util/providers"; import { ethers } from "ethers"; import { getCompiled } from "../../util/contracts"; @@ -84,7 +84,7 @@ const sourceLocationRelayVersioned = { v1: { parents: 1, interior: "Here" } }; const sourceLocationRelayAssetType = { XCM: { parents: 1, interior: "Here" } }; -describeDevMoonbeam("Precompiles - xcm transactor", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - xcm transactor", (context) => { let sudoAccount, iFace, alith; before("Setup genesis account and relay accounts", async () => { const keyring = new Keyring({ type: "ethereum" }); @@ -111,7 +111,7 @@ describeDevMoonbeam("Precompiles - xcm transactor", (context) => { const contractData = await getCompiled("XcmTransactorInstance"); iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "XcmTransactorInstance"); + const { contract, rawTx } = await createContract(context, "XcmTransactorInstance"); const address = contract.options.address; await context.createBlock({ transactions: [rawTx] }); alith = keyring.addFromUri(ALITH_PRIV_KEY, null, "ethereum"); @@ -218,7 +218,7 @@ describeDevMoonbeam("Precompiles - xcm transactor", (context) => { "transact_through_derivative_multilocation", [transactor, index, asset, weight, transact_call] ); - const tx = await createTransaction(context.web3, { + const tx = await createTransaction(context, { from: ALITH, privateKey: ALITH_PRIV_KEY, value: "0x0", @@ -247,7 +247,7 @@ describeDevMoonbeam("Precompiles - xcm transactor", (context) => { }); }); -describeDevMoonbeam("Precompiles - xcm transactor", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - xcm transactor", (context) => { let sudoAccount, iFace, alith; before("Setup genesis account and relay accounts", async () => { const keyring = new Keyring({ type: "ethereum" }); @@ -274,7 +274,7 @@ describeDevMoonbeam("Precompiles - xcm transactor", (context) => { const contractData = await getCompiled("XcmTransactorInstance"); iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "XcmTransactorInstance"); + const { contract, rawTx } = await createContract(context, "XcmTransactorInstance"); const address = contract.options.address; await context.createBlock({ transactions: [rawTx] }); alith = keyring.addFromUri(ALITH_PRIV_KEY, null, "ethereum"); @@ -324,7 +324,7 @@ describeDevMoonbeam("Precompiles - xcm transactor", (context) => { [transactor, index, asset, weight, transact_call] ); - const tx = await createTransaction(context.web3, { + const tx = await createTransaction(context, { from: ALITH, privateKey: ALITH_PRIV_KEY, value: "0x0", diff --git a/tests/tests/test-precompile/test-precompile-xtokens.ts b/tests/tests/test-precompile/test-precompile-xtokens.ts index 5b3ee8f5a29..186d9f4c104 100644 --- a/tests/tests/test-precompile/test-precompile-xtokens.ts +++ b/tests/tests/test-precompile/test-precompile-xtokens.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { customWeb3Request } from "../../util/providers"; import { ethers } from "ethers"; import { getCompiled } from "../../util/contracts"; @@ -23,11 +23,11 @@ async function getBalance(context, blockHeight, address) { return account.data.free; } -describeDevMoonbeam("Precompiles - xtokens", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - xtokens", (context) => { it("allows to issue transfer xtokens", async function () { const contractData = await getCompiled("XtokensInstance"); const iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "XtokensInstance"); + const { contract, rawTx } = await createContract(context, "XtokensInstance"); const address = contract.options.address; await context.createBlock({ transactions: [rawTx] }); // Junction::AccountId32 @@ -70,12 +70,14 @@ describeDevMoonbeam("Precompiles - xtokens", (context) => { ] ); - const tx = await createTransaction(context.web3, { + const base_fee = await context.web3.eth.getGasPrice(); + + const tx = await createTransaction(context, { from: GENESIS_ACCOUNT, privateKey: GENESIS_ACCOUNT_PRIVATE_KEY, value: "0x0", gas: "0x200000", - gasPrice: GAS_PRICE, + gasPrice: base_fee, to: ADDRESS_XTOKENS, data, }); @@ -85,7 +87,7 @@ describeDevMoonbeam("Precompiles - xtokens", (context) => { }); const receipt = await context.web3.eth.getTransactionReceipt(block.txResults[0].result); - const fees = BigInt(receipt.gasUsed) * BigInt(GAS_PRICE); + const fees = BigInt(receipt.gasUsed) * BigInt(base_fee); // our tokens + fees should have been spent expect(BigInt(await getBalance(context, 2, GENESIS_ACCOUNT))).to.equal( @@ -96,11 +98,11 @@ describeDevMoonbeam("Precompiles - xtokens", (context) => { }); }); -describeDevMoonbeam("Precompiles - xtokens", (context) => { +describeDevMoonbeamAllEthTxTypes("Precompiles - xtokens", (context) => { it("allows to issue transfer_multiasset xtokens", async function () { const contractData = await getCompiled("XtokensInstance"); const iFace = new ethers.utils.Interface(contractData.contract.abi); - const { contract, rawTx } = await createContract(context.web3, "XtokensInstance"); + const { contract, rawTx } = await createContract(context, "XtokensInstance"); const address = contract.options.address; await context.createBlock({ transactions: [rawTx] }); // Junction::AccountId32 @@ -164,13 +166,15 @@ describeDevMoonbeam("Precompiles - xtokens", (context) => { ] ); + const base_fee = await context.web3.eth.getGasPrice(); + // create tx - const tx = await createTransaction(context.web3, { + const tx = await createTransaction(context, { from: GENESIS_ACCOUNT, privateKey: GENESIS_ACCOUNT_PRIVATE_KEY, value: "0x0", gas: "0x200000", - gasPrice: GAS_PRICE, + gasPrice: base_fee, to: ADDRESS_XTOKENS, data, }); @@ -180,7 +184,7 @@ describeDevMoonbeam("Precompiles - xtokens", (context) => { }); const receipt = await context.web3.eth.getTransactionReceipt(block.txResults[0].result); - const fees = BigInt(receipt.gasUsed) * BigInt(GAS_PRICE); + const fees = BigInt(receipt.gasUsed) * BigInt(base_fee); // our tokens + fees should have been spent expect(BigInt(await getBalance(context, 2, GENESIS_ACCOUNT))).to.equal( diff --git a/tests/tests/test-receipt/test-receipt-revert.ts b/tests/tests/test-receipt/test-receipt-revert.ts index 1f7bbe7677b..c4f4ffbacfe 100644 --- a/tests/tests/test-receipt/test-receipt-revert.ts +++ b/tests/tests/test-receipt/test-receipt-revert.ts @@ -1,11 +1,11 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; -describeDevMoonbeam("Receipt - Revert", (context) => { +describeDevMoonbeamAllEthTxTypes("Receipt - Revert", (context) => { it("should generate a receipt", async function () { - const { rawTx } = await createContract(context.web3, "FailContract"); + const { rawTx } = await createContract(context, "FailContract"); const { txResults } = await context.createBlock({ transactions: [rawTx] }); const receipt = await context.web3.eth.getTransactionReceipt(txResults[0].result); diff --git a/tests/tests/test-receipt/test-receipt.ts b/tests/tests/test-receipt/test-receipt.ts index b999dc74227..7dd52d6630d 100644 --- a/tests/tests/test-receipt/test-receipt.ts +++ b/tests/tests/test-receipt/test-receipt.ts @@ -1,13 +1,13 @@ import { expect } from "chai"; -import { describeDevMoonbeam } from "../../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../../util/setup-dev-tests"; import { createContract } from "../../util/transactions"; import { GENESIS_ACCOUNT } from "../../util/constants"; -describeDevMoonbeam("Receipt - Contract", (context) => { +describeDevMoonbeamAllEthTxTypes("Receipt - Contract", (context) => { let txHash; let eventContract; before("Setup: Create block with contract", async () => { - const { contract, rawTx } = await createContract(context.web3, "SingleEventContract", { + const { contract, rawTx } = await createContract(context, "SingleEventContract", { from: GENESIS_ACCOUNT, }); const { txResults } = await context.createBlock({ transactions: [rawTx] }); diff --git a/tests/tests/test-resubmit-txn.ts b/tests/tests/test-resubmit-txn.ts index eb84946bedc..421ee12bf8c 100644 --- a/tests/tests/test-resubmit-txn.ts +++ b/tests/tests/test-resubmit-txn.ts @@ -13,8 +13,8 @@ describeDevMoonbeam("Resubmit transations", (context) => { const optionsHighGas = { nonce: 0, gasPrice: 1 }; const transactions = [ - await createTransfer(context.web3, testAccount, 1, optionsLowGas), - await createTransfer(context.web3, testAccount, 2, optionsHighGas), + await createTransfer(context, testAccount, 1, optionsLowGas), + await createTransfer(context, testAccount, 2, optionsHighGas), ]; await context.createBlock({ transactions }); @@ -28,8 +28,8 @@ describeDevMoonbeam("Resubmit transations", (context) => { const optionsHighGas = { nonce: 0, gasPrice: 1 }; const transactions = [ - await createTransfer(context.web3, testAccount, 3, optionsHighGas), - await createTransfer(context.web3, testAccount, 1, optionsLowGas), + await createTransfer(context, testAccount, 3, optionsHighGas), + await createTransfer(context, testAccount, 1, optionsLowGas), ]; await context.createBlock({ transactions }); @@ -44,8 +44,8 @@ describeDevMoonbeam("Resubmit transations", (context) => { const optionsHighGas = { nonce: 0, gasPrice: 1, gas: 0x10000 }; const transactions = [ - await createTransfer(context.web3, testAccount, 1, optionsLowGas), - await createTransfer(context.web3, testAccount, 2, optionsHighGas), + await createTransfer(context, testAccount, 1, optionsLowGas), + await createTransfer(context, testAccount, 2, optionsHighGas), ]; await context.createBlock({ transactions }); @@ -60,15 +60,15 @@ describeDevMoonbeam("Resubmit transations", (context) => { let transactions = []; for (let i = 1; i < 20; i++) { const options = { nonce: 0, gasPrice: i }; - transactions.push(await createTransfer(context.web3, testAccount, i * 10, options)); + transactions.push(await createTransfer(context, testAccount, i * 10, options)); } // our expected txn... - transactions.push(await createTransfer(context.web3, testAccount, 42, optionsHighGas)); + transactions.push(await createTransfer(context, testAccount, 42, optionsHighGas)); for (let i = 1; i < 20; i++) { const options = { nonce: 0, gasPrice: i + 30 }; - transactions.push(await createTransfer(context.web3, testAccount, i * 100, options)); + transactions.push(await createTransfer(context, testAccount, i * 100, options)); } await context.createBlock({ transactions }); diff --git a/tests/tests/test-subscription/test-subscription-logs.ts b/tests/tests/test-subscription/test-subscription-logs.ts index 4b72f60fcf1..8cdc49c29b4 100644 --- a/tests/tests/test-subscription/test-subscription-logs.ts +++ b/tests/tests/test-subscription/test-subscription-logs.ts @@ -21,7 +21,7 @@ describeDevMoonbeam("Subscription - Logs", (context) => { subscription.once("data", resolve); }); - const { rawTx } = await createContract(context.web3, "SingleEventContract"); + const { rawTx } = await createContract(context, "SingleEventContract"); await context.createBlock({ transactions: [rawTx], }); @@ -146,7 +146,7 @@ describeDevMoonbeam("Subscription - Logs", (context) => { subTopicMultiCondPromise = subData(subTopicMultiCond); subTopicWildAndCondPromise = subData(subTopicWildAndCond); - const { rawTx } = await createContract(context.web3, "SingleEventContract"); + const { rawTx } = await createContract(context, "SingleEventContract"); await context.createBlock({ transactions: [rawTx], }); @@ -203,7 +203,7 @@ describeDevMoonbeam("Subscription - Reverted transaction", (context) => { }); // Expected to fail because of not enough fund to pay the deployment - const { rawTx } = await createContract(context.web3, "SingleEventContract", { + const { rawTx } = await createContract(context, "SingleEventContract", { from: "0x1111111111111111111111111111111111111111", }); await context.createBlock({ diff --git a/tests/tests/test-subscription/test-subscription-past-events.ts b/tests/tests/test-subscription/test-subscription-past-events.ts index bb90d585a1a..8b6b6699687 100644 --- a/tests/tests/test-subscription/test-subscription-past-events.ts +++ b/tests/tests/test-subscription/test-subscription-past-events.ts @@ -9,16 +9,16 @@ describeDevMoonbeam("Subscription - Past Events", (context) => { before("Setup: Create 4 blocks with transfer", async () => { web3Ws = await context.createWeb3("ws"); - const { rawTx: rawTx1 } = await createContract(context.web3, "SingleEventContract", { + const { rawTx: rawTx1 } = await createContract(context, "SingleEventContract", { nonce: 0, }); - const { rawTx: rawTx2 } = await createContract(context.web3, "SingleEventContract", { + const { rawTx: rawTx2 } = await createContract(context, "SingleEventContract", { nonce: 1, }); - const { rawTx: rawTx3 } = await createContract(context.web3, "SingleEventContract", { + const { rawTx: rawTx3 } = await createContract(context, "SingleEventContract", { nonce: 2, }); - const { rawTx: rawTx4 } = await createContract(context.web3, "SingleEventContract", { + const { rawTx: rawTx4 } = await createContract(context, "SingleEventContract", { nonce: 3, }); diff --git a/tests/tests/test-subscription/test-subscription.ts b/tests/tests/test-subscription/test-subscription.ts index e757b6d1fc8..a27747b8364 100644 --- a/tests/tests/test-subscription/test-subscription.ts +++ b/tests/tests/test-subscription/test-subscription.ts @@ -36,7 +36,7 @@ describeDevMoonbeam("Subscription - Block headers", (context) => { await context.createBlock({ transactions: [ - await createTransfer(context.web3, "0x1111111111111111111111111111111111111111", 0), + await createTransfer(context, "0x1111111111111111111111111111111111111111", 0), ], }); @@ -78,7 +78,7 @@ describeDevMoonbeam("Subscription - Pending transactions", (context) => { }); const { result } = await customWeb3Request(context.web3, "eth_sendRawTransaction", [ - await createTransfer(context.web3, "0x1111111111111111111111111111111111111111", 0), + await createTransfer(context, "0x1111111111111111111111111111111111111111", 0), ]); // This test passes if you produce the block diff --git a/tests/tests/test-txpool/test-txpool-future.ts b/tests/tests/test-txpool/test-txpool-future.ts index 509cfea5c17..7717168d38c 100644 --- a/tests/tests/test-txpool/test-txpool-future.ts +++ b/tests/tests/test-txpool/test-txpool-future.ts @@ -9,7 +9,7 @@ import { customWeb3Request } from "../../util/providers"; describeDevMoonbeam("TxPool - Future Ethereum transaction", (context) => { let txHash; before("Setup: Create transaction", async () => { - const { rawTx } = await createContract(context.web3, "TestContract", { + const { rawTx } = await createContract(context, "TestContract", { gas: 1048576, nonce: 1, // future nonce }); diff --git a/tests/tests/test-txpool/test-txpool-pending.ts b/tests/tests/test-txpool/test-txpool-pending.ts index 8363ed779e0..5b9610f3e4d 100644 --- a/tests/tests/test-txpool/test-txpool-pending.ts +++ b/tests/tests/test-txpool/test-txpool-pending.ts @@ -9,7 +9,7 @@ import { customWeb3Request } from "../../util/providers"; describeDevMoonbeam("TxPool - Pending Ethereum transaction", (context) => { let txHash; before("Setup: Create transaction", async () => { - const { rawTx } = await createContract(context.web3, "TestContract", { + const { rawTx } = await createContract(context, "TestContract", { gas: 1048576, }); txHash = (await customWeb3Request(context.web3, "eth_sendRawTransaction", [rawTx])).result; @@ -58,7 +58,7 @@ describeDevMoonbeam("TxPool - Ethereum Contract Call", (context) => { let testContract: Contract, txHash; before("Setup: Create contract block and add call transaction", async () => { - const { contract, rawTx } = await createContract(context.web3, "TestContract", { + const { contract, rawTx } = await createContract(context, "TestContract", { gas: 1048576, }); testContract = contract; @@ -66,7 +66,7 @@ describeDevMoonbeam("TxPool - Ethereum Contract Call", (context) => { txHash = ( await customWeb3Request(context.web3, "eth_sendRawTransaction", [ - await createContractExecution(context.web3, { + await createContractExecution(context, { contract, contractCall: contract.methods.multiply(5), }), diff --git a/tests/tests/test-txpool/test-txpool-reset.ts b/tests/tests/test-txpool/test-txpool-reset.ts index ed5e19b7f0b..2a1f51afd27 100644 --- a/tests/tests/test-txpool/test-txpool-reset.ts +++ b/tests/tests/test-txpool/test-txpool-reset.ts @@ -15,7 +15,7 @@ describeDevMoonbeam("TxPool - Genesis", (context) => { describeDevMoonbeam("TxPool - New block", (context) => { before("Setup: Create transaction and empty block", async () => { - const { rawTx } = await createContract(context.web3, "TestContract", { + const { rawTx } = await createContract(context, "TestContract", { gas: 1048576, }); await context.createBlock({ transactions: [rawTx] }); diff --git a/tests/tracing-tests/test-trace-concurrency.ts b/tests/tracing-tests/test-trace-concurrency.ts index 37169e1fca0..f05d621d8ed 100644 --- a/tests/tracing-tests/test-trace-concurrency.ts +++ b/tests/tracing-tests/test-trace-concurrency.ts @@ -1,17 +1,17 @@ import { expect } from "chai"; import { customWeb3Request } from "../util/providers"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { createContract, createContractExecution } from "../util/transactions"; -describeDevMoonbeam("Trace filter - Concurrency", (context) => { +describeDevMoonbeamAllEthTxTypes("Trace filter - Concurrency", (context) => { before("Setup: Create 50 blocks with 1 contract loop execution each", async function () { - const { contract, rawTx } = await createContract(context.web3, "FiniteLoopContract"); + const { contract, rawTx } = await createContract(context, "FiniteLoopContract"); await context.createBlock({ transactions: [rawTx] }); for (let i = 0; i < 50; i++) { await context.createBlock({ transactions: [ - await createContractExecution(context.web3, { + await createContractExecution(context, { contract, contractCall: contract.methods.incr(2000), }), diff --git a/tests/tracing-tests/test-trace-filter-reorg.ts b/tests/tracing-tests/test-trace-filter-reorg.ts index fd1a0ac07d1..409b366ee9b 100644 --- a/tests/tracing-tests/test-trace-filter-reorg.ts +++ b/tests/tracing-tests/test-trace-filter-reorg.ts @@ -1,10 +1,10 @@ import { expect } from "chai"; import { customWeb3Request } from "../util/providers"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { createContract, createContractExecution, createTransfer } from "../util/transactions"; import { GENESIS_ACCOUNT, TEST_ACCOUNT } from "../util/constants"; -describeDevMoonbeam("Trace filter reorg", (context) => { +describeDevMoonbeamAllEthTxTypes("Trace filter reorg", (context) => { it("succesfully reorg", async function () { this.timeout(150000000); @@ -12,7 +12,7 @@ describeDevMoonbeam("Trace filter reorg", (context) => { const block1 = await context.createBlock({}); // Create a first branch including a transaction. - const tx = await createTransfer(context.web3, TEST_ACCOUNT, "0x200"); // nonce 0 + const tx = await createTransfer(context, TEST_ACCOUNT, "0x200"); // nonce 0 const block2 = await context.createBlock({ parentHash: block1.block.hash, finalize: false, @@ -21,7 +21,7 @@ describeDevMoonbeam("Trace filter reorg", (context) => { // Contains nonce 0. // Create a branch. - const tx2 = await createTransfer(context.web3, TEST_ACCOUNT, "0x300", { nonce: 1 }); // nonce 1 + const tx2 = await createTransfer(context, TEST_ACCOUNT, "0x300", { nonce: 1 }); // nonce 1 const block2a = await context.createBlock({ parentHash: block1.block.hash, finalize: false, diff --git a/tests/tracing-tests/test-trace-filter.ts b/tests/tracing-tests/test-trace-filter.ts index 3a89edd9177..de17a9a54b3 100644 --- a/tests/tracing-tests/test-trace-filter.ts +++ b/tests/tracing-tests/test-trace-filter.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; import { customWeb3Request } from "../util/providers"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { createContract, createContractExecution } from "../util/transactions"; import { GENESIS_ACCOUNT } from "../util/constants"; @@ -10,23 +10,21 @@ const GENESIS_CONTRACT_ADDRESSES = [ "0xf8cef78e923919054037a1d03662bbd884ff4edf", ]; -describeDevMoonbeam("Trace filter - Contract creation ", (context) => { +describeDevMoonbeamAllEthTxTypes("Trace filter - Contract creation ", (context) => { before("Setup: Create 4 blocks with TraceFilter contracts", async function () { - const { contract, rawTx } = await createContract(context.web3, "TraceFilter", {}, [false]); + const { contract, rawTx } = await createContract(context, "TraceFilter", {}, [false]); await context.createBlock({ transactions: [rawTx] }); - const { rawTx: rawTx2 } = await createContract(context.web3, "TraceFilter", {}, [true]); + const { rawTx: rawTx2 } = await createContract(context, "TraceFilter", {}, [true]); await context.createBlock({ transactions: [rawTx2] }); - const { rawTx: rawTx3 } = await createContract(context.web3, "TraceFilter", {}, [false]); - const { rawTx: rawTx4 } = await createContract(context.web3, "TraceFilter", { nonce: 3 }, [ - false, - ]); + const { rawTx: rawTx3 } = await createContract(context, "TraceFilter", {}, [false]); + const { rawTx: rawTx4 } = await createContract(context, "TraceFilter", { nonce: 3 }, [false]); await context.createBlock({ transactions: [rawTx3, rawTx4] }); await context.createBlock({ transactions: [ - await createContractExecution(context.web3, { + await createContractExecution(context, { contract, contractCall: contract.methods.subcalls( GENESIS_CONTRACT_ADDRESSES[1], diff --git a/tests/tracing-tests/test-trace-gas.ts b/tests/tracing-tests/test-trace-gas.ts index c53f26348c1..1599b524539 100644 --- a/tests/tracing-tests/test-trace-gas.ts +++ b/tests/tracing-tests/test-trace-gas.ts @@ -1,9 +1,9 @@ import { expect } from "chai"; import { customWeb3Request } from "../util/providers"; -import { describeDevMoonbeam } from "../util/setup-dev-tests"; +import { describeDevMoonbeamAllEthTxTypes } from "../util/setup-dev-tests"; import { createContract, createContractExecution } from "../util/transactions"; -describeDevMoonbeam("Trace filter - Gas Loop", (context) => { +describeDevMoonbeamAllEthTxTypes("Trace filter - Gas Loop", (context) => { const testLoops: { count: number; txHash?: string; @@ -16,7 +16,7 @@ describeDevMoonbeam("Trace filter - Gas Loop", (context) => { ]; before("Setup: Create 4 blocks with 1 contract loop execution each", async function () { - const { contract, rawTx } = await createContract(context.web3, "FiniteLoopContract"); + const { contract, rawTx } = await createContract(context, "FiniteLoopContract"); await context.createBlock({ transactions: [rawTx] }); // For each loop, create a block with the contract execution. @@ -26,7 +26,7 @@ describeDevMoonbeam("Trace filter - Gas Loop", (context) => { const loop = testLoops[i]; const { txResults } = await context.createBlock({ transactions: [ - await createContractExecution(context.web3, { + await createContractExecution(context, { contract, contractCall: contract.methods.incr(loop.count), }), @@ -38,7 +38,7 @@ describeDevMoonbeam("Trace filter - Gas Loop", (context) => { }); it("should return 21630 gasUsed for 0 loop", async function () { - const { rawTx } = await createContract(context.web3, "FiniteLoopContract"); + const { rawTx } = await createContract(context, "FiniteLoopContract"); await context.createBlock({ transactions: [rawTx] }); const trace = await customWeb3Request(context.web3, "trace_filter", [ @@ -55,7 +55,7 @@ describeDevMoonbeam("Trace filter - Gas Loop", (context) => { }); it("should return 245542 gasUsed for 100 loop", async function () { - const { rawTx } = await createContract(context.web3, "FiniteLoopContract"); + const { rawTx } = await createContract(context, "FiniteLoopContract"); await context.createBlock({ transactions: [rawTx] }); const trace = await customWeb3Request(context.web3, "trace_filter", [ @@ -72,7 +72,7 @@ describeDevMoonbeam("Trace filter - Gas Loop", (context) => { }); it("should return 2068654 gasUsed for 1000 loop", async function () { - const { rawTx } = await createContract(context.web3, "FiniteLoopContract"); + const { rawTx } = await createContract(context, "FiniteLoopContract"); await context.createBlock({ transactions: [rawTx] }); const trace = await customWeb3Request(context.web3, "trace_filter", [ diff --git a/tests/tracing-tests/test-trace.ts b/tests/tracing-tests/test-trace.ts index 563185f0bb8..7e75af6b6f6 100644 --- a/tests/tracing-tests/test-trace.ts +++ b/tests/tracing-tests/test-trace.ts @@ -9,14 +9,14 @@ const BS_TRACER = require("../util/tracer/blockscout_tracer.min.json"); async function createContracts(context) { let nonce = await context.web3.eth.getTransactionCount(GENESIS_ACCOUNT); const { contract: callee, rawTx: rawTx1 } = await createContract( - context.web3, + context, "Callee", { nonce: nonce++ }, [] ); const { contract: caller, rawTx: rawTx2 } = await createContract( - context.web3, + context, "Caller", { nonce: nonce++ }, [] @@ -69,9 +69,7 @@ describeDevMoonbeam( // "Allocator ran out of space"'. it("should not overflow Wasm memory", async function () { this.timeout(15000); - const { contract, rawTx } = await createContract(context.web3, "OverflowingTrace", {}, [ - false, - ]); + const { contract, rawTx } = await createContract(context, "OverflowingTrace", {}, [false]); const { txResults } = await context.createBlock({ transactions: [rawTx], }); @@ -98,7 +96,7 @@ describeDevMoonbeam( }); it("should replay over an intermediate state", async function () { - const { contract, rawTx } = await createContract(context.web3, "Incrementer", {}, [false]); + const { contract, rawTx } = await createContract(context, "Incrementer", {}, [false]); const { txResults } = await context.createBlock({ transactions: [rawTx], }); @@ -208,6 +206,7 @@ describeDevMoonbeam( expect(resCallee.traceAddress[0]).to.be.eq(0); }); }, + "Legacy", true ); @@ -215,7 +214,7 @@ describeDevMoonbeam("Trace", (context) => { it("should trace correctly out of gas transaction execution (Blockscout)", async function () { this.timeout(10000); - const { contract, rawTx } = await createContract(context.web3, "InfiniteContract"); + const { contract, rawTx } = await createContract(context, "InfiniteContract"); await context.createBlock({ transactions: [rawTx] }); let callTx = await context.web3.eth.accounts.signTransaction( @@ -324,7 +323,7 @@ describeDevMoonbeam("Trace", (context) => { it("should format as request (callTrace Create)", async function () { let nonce = await context.web3.eth.getTransactionCount(GENESIS_ACCOUNT); const { contract: callee, rawTx: rawTx1 } = await createContract( - context.web3, + context, "Callee", { nonce: nonce++ }, [] diff --git a/tests/util/setup-dev-tests.ts b/tests/util/setup-dev-tests.ts index 3cc40724e1f..aee98709832 100644 --- a/tests/util/setup-dev-tests.ts +++ b/tests/util/setup-dev-tests.ts @@ -41,6 +41,7 @@ export interface DevTestContext { ethers: ethers.providers.JsonRpcProvider; polkadotApi: ApiPromise; rpcPort: number; + ethTransactionType?: EthTransactionType; } interface InternalDevTestContext extends DevTestContext { @@ -48,9 +49,12 @@ interface InternalDevTestContext extends DevTestContext { _web3Providers: HttpProvider[]; } +type EthTransactionType = "Legacy" | "EIP2930" | "EIP1559"; + export function describeDevMoonbeam( title: string, cb: (context: DevTestContext) => void, + ethTransactionType: EthTransactionType = "Legacy", withWasm?: boolean ) { describe(title, function () { @@ -59,7 +63,7 @@ export function describeDevMoonbeam( // The context is initialized empty to allow passing a reference // and to be filled once the node information is retrieved - let context: InternalDevTestContext = {} as InternalDevTestContext; + let context: InternalDevTestContext = { ethTransactionType } as InternalDevTestContext; // The currently running node for this describe let moonbeamProcess: ChildProcess; @@ -148,3 +152,14 @@ export function describeDevMoonbeam( cb(context); }); } + +export function describeDevMoonbeamAllEthTxTypes( + title: string, + cb: (context: DevTestContext) => void, + withWasm?: boolean +) { + let wasm = withWasm !== undefined ? withWasm : false; + describeDevMoonbeam(title + " (Legacy)", cb, "Legacy", wasm); + describeDevMoonbeam(title + " (EIP1559)", cb, "EIP1559", wasm); + describeDevMoonbeam(title + " (EIP2930)", cb, "EIP2930", wasm); +} diff --git a/tests/util/transactions.ts b/tests/util/transactions.ts index ac6e69cbc3c..ba65a6e7688 100644 --- a/tests/util/transactions.ts +++ b/tests/util/transactions.ts @@ -6,6 +6,9 @@ import { Contract } from "web3-eth-contract"; import fetch from "node-fetch"; import { DevTestContext } from "./setup-dev-tests"; import { customWeb3Request } from "./providers"; +// Ethers is used to handle post-london transactions +import { ethers } from "ethers"; +import { AccessListish } from "@ethersproject/transactions"; const debug = require("debug")("test:transaction"); export interface TransactionOptions { @@ -15,8 +18,11 @@ export interface TransactionOptions { nonce?: number; gas?: string | number; gasPrice?: string | number; + maxFeePerGas?: string | number; + maxPriorityFeePerGas?: string | number; value?: string | number | BigInt; data?: string; + accessList?: AccessListish; // AccessList | Array<[string, Array]> } export const GENESIS_TRANSACTION: TransactionOptions = { @@ -29,33 +35,86 @@ export const GENESIS_TRANSACTION: TransactionOptions = { }; export const createTransaction = async ( - web3: Web3, + context: DevTestContext, options: TransactionOptions ): Promise => { + const isLegacy = context.ethTransactionType === "Legacy"; + const isEip2930 = context.ethTransactionType === "EIP2930"; + const isEip1559 = context.ethTransactionType === "EIP1559"; + const gas = options.gas || 12_000_000; const gasPrice = options.gasPrice !== undefined ? options.gasPrice : 1_000_000_000; + const maxPriorityFeePerGas = + options.maxPriorityFeePerGas !== undefined ? options.maxPriorityFeePerGas : 0; const value = options.value !== undefined ? options.value : "0x00"; const from = options.from || GENESIS_ACCOUNT; const privateKey = options.privateKey !== undefined ? options.privateKey : GENESIS_ACCOUNT_PRIVATE_KEY; - const data = { - from, - to: options.to, - value: value && value.toString(), - gasPrice, - gas, - nonce: options.nonce, - data: options.data, - }; + const maxFeePerGas = options.maxFeePerGas || 1_000_000_000; + const accessList = options.accessList || []; + const nonce = options.nonce || context.web3.eth.getTransactionCount(from, "pending"); + + let data, rawTransaction; + if (isLegacy) { + data = { + from, + to: options.to, + value: value && value.toString(), + gasPrice, + gas, + nonce: nonce, + data: options.data, + }; + const tx = await context.web3.eth.accounts.signTransaction(data, privateKey); + rawTransaction = tx.rawTransaction; + } else { + const signer = new ethers.Wallet(privateKey, context.ethers); + const chainId = await context.web3.eth.getChainId(); + if (isEip2930) { + data = { + from, + to: options.to, + value: value && value.toString(), + gasPrice, + gasLimit: gas, + nonce: nonce, + data: options.data, + accessList, + chainId, + type: 1, + }; + } else if (isEip1559) { + data = { + from, + to: options.to, + value: value && value.toString(), + maxFeePerGas, + maxPriorityFeePerGas, + gasLimit: gas, + nonce: nonce, + data: options.data, + accessList, + chainId, + type: 2, + }; + } + rawTransaction = await signer.signTransaction(data); + } + debug( - `Tx [${/:([0-9]+)$/.exec((web3.currentProvider as any).host)[1]}] ` + + `Tx [${/:([0-9]+)$/.exec((context.web3.currentProvider as any).host)[1]}] ` + `from: ${data.from.substr(0, 5) + "..." + data.from.substr(data.from.length - 3)}, ` + (data.to ? `to: ${data.to.substr(0, 5) + "..." + data.to.substr(data.to.length - 3)}, ` : "") + (data.value ? `value: ${data.value.toString()}, ` : "") + - `gasPrice: ${data.gasPrice.toString()}, ` + + (data.gasPrice ? `gasPrice: ${data.gasPrice.toString()}, ` : "") + + (data.maxFeePerGas ? `maxFeePerGas: ${data.maxFeePerGas.toString()}, ` : "") + + (data.maxPriorityFeePerGas + ? `maxPriorityFeePerGas: ${data.maxPriorityFeePerGas.toString()}, ` + : "") + + (data.accessList ? `accessList: ${data.accessList.toString()}, ` : "") + (data.gas ? `gas: ${data.gas.toString()}, ` : "") + (data.nonce ? `nonce: ${data.nonce.toString()}, ` : "") + (!data.data @@ -66,39 +125,38 @@ export const createTransaction = async ( : data.data.substr(0, 5) + "..." + data.data.substr(data.data.length - 3) }`) ); - const tx = await web3.eth.accounts.signTransaction(data, privateKey); - return tx.rawTransaction; + return rawTransaction; }; export const createTransfer = async ( - web3: Web3, + context: DevTestContext, to: string, value: number | string | BigInt, options: TransactionOptions = GENESIS_TRANSACTION ): Promise => { - return await createTransaction(web3, { ...options, value, to }); + return await createTransaction(context, { ...options, value, to }); }; // Will create the transaction to deploy a contract. // This requires to compute the nonce. It can't be used multiple times in the same block from the // same from export async function createContract( - web3: Web3, + context: DevTestContext, contractName: string, options: TransactionOptions = GENESIS_TRANSACTION, contractArguments: any[] = [] ): Promise<{ rawTx: string; contract: Contract; contractAddress: string }> { const contractCompiled = await getCompiled(contractName); const from = options.from !== undefined ? options.from : GENESIS_ACCOUNT; - const nonce = options.nonce || (await web3.eth.getTransactionCount(from)); + const nonce = options.nonce || (await context.web3.eth.getTransactionCount(from)); const contractAddress = "0x" + - web3.utils + context.web3.utils .sha3(RLP.encode([from, nonce]) as any) .slice(12) .substring(14); - const contract = new web3.eth.Contract(contractCompiled.contract.abi, contractAddress); + const contract = new context.web3.eth.Contract(contractCompiled.contract.abi, contractAddress); const data = contract .deploy({ data: contractCompiled.byteCode, @@ -106,7 +164,7 @@ export async function createContract( }) .encodeABI(); - const rawTx = await createTransaction(web3, { ...options, from, nonce, data }); + const rawTx = await createTransaction(context, { ...options, from, nonce, data }); return { rawTx, @@ -119,20 +177,20 @@ export async function createContract( // This requires to compute the nonce. It can't be used multiple times in the same block from the // same from export async function createContractExecution( - web3: Web3, + context: DevTestContext, execution: { contract: Contract; contractCall: any; }, options: TransactionOptions = GENESIS_TRANSACTION ) { - const tx = await createTransaction(web3, { + const rawTx = await createTransaction(context, { ...options, to: execution.contract.options.address, data: execution.contractCall.encodeABI(), }); - return tx; + return rawTx; } /** @@ -183,7 +241,7 @@ export async function sendPrecompileTx( data += para.slice(2).padStart(64, "0"); }); - const tx = await createTransaction(context.web3, { + const tx = await createTransaction(context, { from, privateKey, value: "0x0",