From cfe6d02e45363a937cd23ba9a06198871a7ee5a5 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Fri, 3 May 2024 15:00:25 +0100 Subject: [PATCH] test transient storage (eip-1153) --- .../contracts/src/dancun/TransientStorage.sol | 57 ++++ test/package.json | 2 +- test/pnpm-lock.yaml | 264 ++++++++++++------ .../moonbase/test-contract/test-eip1153.ts | 37 +++ 4 files changed, 270 insertions(+), 90 deletions(-) create mode 100644 test/contracts/src/dancun/TransientStorage.sol create mode 100644 test/suites/dev/moonbase/test-contract/test-eip1153.ts diff --git a/test/contracts/src/dancun/TransientStorage.sol b/test/contracts/src/dancun/TransientStorage.sol new file mode 100644 index 0000000000..d17238c0a2 --- /dev/null +++ b/test/contracts/src/dancun/TransientStorage.sol @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +contract ReentrancyProtected { + // A constant key for the reentrancy guard stored in Transient Storage. + // This acts as a unique identifier for the reentrancy lock. + bytes32 constant REENTRANCY_GUARD = keccak256("REENTRANCY_GUARD"); + + // Modifier to prevent reentrant calls. + // It checks if the reentrancy guard is set (indicating an ongoing execution) + // and sets the guard before proceeding with the function execution. + // After the function executes, it resets the guard to allow future calls. + modifier nonReentrant() { + // Ensure the guard is not set (i.e., no ongoing execution). + require(tload(REENTRANCY_GUARD) == 0, "Reentrant call detected."); + + // Set the guard to block reentrant calls. + tstore(REENTRANCY_GUARD, 1); + + _; // Execute the function body. + + // Reset the guard after execution to allow future calls. + tstore(REENTRANCY_GUARD, 0); + } + + // Uses inline assembly to access the Transient Storage's tstore operation. + function tstore(bytes32 location, uint value) private { + assembly { + tstore(location, value) + } + } + + // Uses inline assembly to access the Transient Storage's tload operation. + // Returns the value stored at the given location. + function tload(bytes32 location) private returns (uint value) { + assembly { + value := tload(location) + } + } + + function nonReentrantMethod() public nonReentrant { + (bool success, bytes memory result) = msg.sender.call(""); + if (!success) { + assembly { + revert(add(32, result), mload(result)) + } + } + } + + function test() external { + this.nonReentrantMethod(); + } + + receive() external payable { + this.nonReentrantMethod(); + } +} diff --git a/test/package.json b/test/package.json index f612fa6fd6..add8429e70 100644 --- a/test/package.json +++ b/test/package.json @@ -46,7 +46,7 @@ "randomness": "1.6.8", "rlp": "3.0.0", "semver": "7.6.0", - "solc": "0.8.21", + "solc": "0.8.25", "tsx": "4.7.2", "viem": "2.9.9", "vitest": "1.4.0", diff --git a/test/pnpm-lock.yaml b/test/pnpm-lock.yaml index cdf3273330..50ab4c077f 100644 --- a/test/pnpm-lock.yaml +++ b/test/pnpm-lock.yaml @@ -96,8 +96,8 @@ dependencies: specifier: 7.6.0 version: 7.6.0 solc: - specifier: 0.8.21 - version: 0.8.21(debug@4.3.4) + specifier: 0.8.25 + version: 0.8.25(debug@4.3.4) tsx: specifier: 4.7.2 version: 4.7.2 @@ -1563,18 +1563,39 @@ packages: dev: false optional: true + /@polkadot-api/json-rpc-provider-proxy@0.0.1: + resolution: {integrity: sha512-gmVDUP8LpCH0BXewbzqXF2sdHddq1H1q+XrAW2of+KZj4woQkIGBRGTJHeBEVHe30EB+UejR1N2dT4PO/RvDdg==} + requiresBuild: true + dev: false + optional: true + /@polkadot-api/json-rpc-provider-proxy@0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0: resolution: {integrity: sha512-0hZ8vtjcsyCX8AyqP2sqUHa1TFFfxGWmlXJkit0Nqp9b32MwZqn5eaUAiV2rNuEpoglKOdKnkGtUF8t5MoodKw==} requiresBuild: true dev: false optional: true + /@polkadot-api/json-rpc-provider@0.0.1: + resolution: {integrity: sha512-/SMC/l7foRjpykLTUTacIH05H3mr9ip8b5xxfwXlVezXrNVLp3Cv0GX6uItkKd+ZjzVPf3PFrDF2B2/HLSNESA==} + requiresBuild: true + dev: false + optional: true + /@polkadot-api/json-rpc-provider@0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0: resolution: {integrity: sha512-EaUS9Fc3wsiUr6ZS43PQqaRScW7kM6DYbuM/ou0aYjm8N9MBqgDbGm2oL6RE1vAVmOfEuHcXZuZkhzWtyvQUtA==} requiresBuild: true dev: false optional: true + /@polkadot-api/metadata-builders@0.0.1: + resolution: {integrity: sha512-GCI78BHDzXAF/L2pZD6Aod/yl82adqQ7ftNmKg51ixRL02JpWUA+SpUKTJE5MY1p8kiJJIo09P2um24SiJHxNA==} + requiresBuild: true + dependencies: + '@polkadot-api/substrate-bindings': 0.0.1 + '@polkadot-api/utils': 0.0.1 + dev: false + optional: true + /@polkadot-api/metadata-builders@0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0: resolution: {integrity: sha512-BD7rruxChL1VXt0icC2gD45OtT9ofJlql0qIllHSRYgama1CR2Owt+ApInQxB+lWqM+xNOznZRpj8CXNDvKIMg==} requiresBuild: true @@ -1584,6 +1605,31 @@ packages: dev: false optional: true + /@polkadot-api/observable-client@0.1.0(rxjs@7.8.1): + resolution: {integrity: sha512-GBCGDRztKorTLna/unjl/9SWZcRmvV58o9jwU2Y038VuPXZcr01jcw/1O3x+yeAuwyGzbucI/mLTDa1QoEml3A==} + requiresBuild: true + peerDependencies: + rxjs: '>=7.8.0' + dependencies: + '@polkadot-api/metadata-builders': 0.0.1 + '@polkadot-api/substrate-bindings': 0.0.1 + '@polkadot-api/substrate-client': 0.0.1 + '@polkadot-api/utils': 0.0.1 + rxjs: 7.8.1 + dev: false + optional: true + + /@polkadot-api/substrate-bindings@0.0.1: + resolution: {integrity: sha512-bAe7a5bOPnuFVmpv7y4BBMRpNTnMmE0jtTqRUw/+D8ZlEHNVEJQGr4wu3QQCl7k1GnSV1wfv3mzIbYjErEBocg==} + requiresBuild: true + dependencies: + '@noble/hashes': 1.4.0 + '@polkadot-api/utils': 0.0.1 + '@scure/base': 1.1.6 + scale-ts: 1.6.0 + dev: false + optional: true + /@polkadot-api/substrate-bindings@0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0: resolution: {integrity: sha512-N4vdrZopbsw8k57uG58ofO7nLXM4Ai7835XqakN27MkjXMp5H830A1KJE0L9sGQR7ukOCDEIHHcwXVrzmJ/PBg==} requiresBuild: true @@ -1595,12 +1641,24 @@ packages: dev: false optional: true + /@polkadot-api/substrate-client@0.0.1: + resolution: {integrity: sha512-9Bg9SGc3AwE+wXONQoW8GC00N3v6lCZLW74HQzqB6ROdcm5VAHM4CB/xRzWSUF9CXL78ugiwtHx3wBcpx4H4Wg==} + requiresBuild: true + dev: false + optional: true + /@polkadot-api/substrate-client@0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0: resolution: {integrity: sha512-lcdvd2ssUmB1CPzF8s2dnNOqbrDa+nxaaGbuts+Vo8yjgSKwds2Lo7Oq+imZN4VKW7t9+uaVcKFLMF7PdH0RWw==} requiresBuild: true dev: false optional: true + /@polkadot-api/utils@0.0.1: + resolution: {integrity: sha512-3j+pRmlF9SgiYDabSdZsBSsN5XHbpXOAce1lWj56IEEaFZVjsiCaxDOA7C9nCcgfVXuvnbxqqEGQvnY+QfBAUw==} + requiresBuild: true + dev: false + optional: true + /@polkadot-api/utils@0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0: resolution: {integrity: sha512-0CYaCjfLQJTCRCiYvZ81OncHXEKPzAexCMoVloR+v2nl/O2JRya/361MtPkeNLC6XBoaEgLAG9pWQpH3WePzsw==} requiresBuild: true @@ -1624,15 +1682,15 @@ packages: - utf-8-validate dev: false - /@polkadot/api-augment@10.13.1: - resolution: {integrity: sha512-IAKaCp19QxgOG4HKk9RAgUgC/VNVqymZ2GXfMNOZWImZhxRIbrK+raH5vN2MbWwtVHpjxyXvGsd1RRhnohI33A==} + /@polkadot/api-augment@11.0.2: + resolution: {integrity: sha512-Icrwk9DxcWlMxl0UFhIthYX+TzFGhxC2zwCaIgUbE5l1hoRFWl+K4BbLOtNdGTr6jkEkJizdnzbXvxWMYHZEOA==} engines: {node: '>=18'} dependencies: - '@polkadot/api-base': 10.13.1 - '@polkadot/rpc-augment': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/types-augment': 10.13.1 - '@polkadot/types-codec': 10.13.1 + '@polkadot/api-base': 11.0.2 + '@polkadot/rpc-augment': 11.0.2 + '@polkadot/types': 11.0.2 + '@polkadot/types-augment': 11.0.2 + '@polkadot/types-codec': 11.0.2 '@polkadot/util': 12.6.2 tslib: 2.6.2 transitivePeerDependencies: @@ -1689,12 +1747,12 @@ packages: - utf-8-validate dev: false - /@polkadot/api-base@10.13.1: - resolution: {integrity: sha512-Okrw5hjtEjqSMOG08J6qqEwlUQujTVClvY1/eZkzKwNzPelWrtV6vqfyJklB7zVhenlxfxqhZKKcY7zWSW/q5Q==} + /@polkadot/api-base@11.0.2: + resolution: {integrity: sha512-Sz1z6KHe+AyiQRxwSXU2KM0KSKZ97sc1WBEhqqkGuR3YdaV2Pt++ixSJe1FXt5/YyMI/KU0W8GSciK6Kydgxgw==} engines: {node: '>=18'} dependencies: - '@polkadot/rpc-core': 10.13.1 - '@polkadot/types': 10.13.1 + '@polkadot/rpc-core': 11.0.2 + '@polkadot/types': 11.0.2 '@polkadot/util': 12.6.2 rxjs: 7.8.1 tslib: 2.6.2 @@ -1753,16 +1811,16 @@ packages: - utf-8-validate dev: false - /@polkadot/api-derive@10.13.1: - resolution: {integrity: sha512-ef0H0GeCZ4q5Om+c61eLLLL29UxFC2/u/k8V1K2JOIU+2wD5LF7sjAoV09CBMKKHfkLenRckVk2ukm4rBqFRpg==} + /@polkadot/api-derive@11.0.2: + resolution: {integrity: sha512-1E3alBICLBbsNJ4HvJkyIuCznuOgksS6cQ+H57K0d9NCC4xZcCqreHm+VTlZh3HZjDgw4CPDRvhgCDvDOP8KpA==} engines: {node: '>=18'} dependencies: - '@polkadot/api': 10.13.1 - '@polkadot/api-augment': 10.13.1 - '@polkadot/api-base': 10.13.1 - '@polkadot/rpc-core': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/types-codec': 10.13.1 + '@polkadot/api': 11.0.2 + '@polkadot/api-augment': 11.0.2 + '@polkadot/api-base': 11.0.2 + '@polkadot/rpc-core': 11.0.2 + '@polkadot/types': 11.0.2 + '@polkadot/types-codec': 11.0.2 '@polkadot/util': 12.6.2 '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) rxjs: 7.8.1 @@ -1839,22 +1897,22 @@ packages: - utf-8-validate dev: false - /@polkadot/api@10.13.1: - resolution: {integrity: sha512-YrKWR4TQR5CDyGkF0mloEUo7OsUA+bdtENpJGOtNavzOQUDEbxFE0PVzokzZfVfHhHX2CojPVmtzmmLxztyJkg==} + /@polkadot/api@11.0.2: + resolution: {integrity: sha512-LG4gwlev+SC2WolWMX0CaUZJyZWxXbsCe5h58zFxXucQuiPAvkn0QrnSTC3hB3qywsxK6aeuQ9E2vrQYcN7EMg==} engines: {node: '>=18'} dependencies: - '@polkadot/api-augment': 10.13.1 - '@polkadot/api-base': 10.13.1 - '@polkadot/api-derive': 10.13.1 + '@polkadot/api-augment': 11.0.2 + '@polkadot/api-base': 11.0.2 + '@polkadot/api-derive': 11.0.2 '@polkadot/keyring': 12.6.2(@polkadot/util-crypto@12.6.2)(@polkadot/util@12.6.2) - '@polkadot/rpc-augment': 10.13.1 - '@polkadot/rpc-core': 10.13.1 - '@polkadot/rpc-provider': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/types-augment': 10.13.1 - '@polkadot/types-codec': 10.13.1 - '@polkadot/types-create': 10.13.1 - '@polkadot/types-known': 10.13.1 + '@polkadot/rpc-augment': 11.0.2 + '@polkadot/rpc-core': 11.0.2 + '@polkadot/rpc-provider': 11.0.2 + '@polkadot/types': 11.0.2 + '@polkadot/types-augment': 11.0.2 + '@polkadot/types-codec': 11.0.2 + '@polkadot/types-create': 11.0.2 + '@polkadot/types-known': 11.0.2 '@polkadot/util': 12.6.2 '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) eventemitter3: 5.0.1 @@ -2140,13 +2198,13 @@ packages: - utf-8-validate dev: false - /@polkadot/rpc-augment@10.13.1: - resolution: {integrity: sha512-iLsWUW4Jcx3DOdVrSHtN0biwxlHuTs4QN2hjJV0gd0jo7W08SXhWabZIf9mDmvUJIbR7Vk+9amzvegjRyIf5+A==} + /@polkadot/rpc-augment@11.0.2: + resolution: {integrity: sha512-QcT9U2hINcjynJhHC4AhoHNgZR5JymDkuhAIOVYsNb1BUcDzoud5lvfK+ISfw2kVPAyCdx3kHodFPhdNdPGHUg==} engines: {node: '>=18'} dependencies: - '@polkadot/rpc-core': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/types-codec': 10.13.1 + '@polkadot/rpc-core': 11.0.2 + '@polkadot/types': 11.0.2 + '@polkadot/types-codec': 11.0.2 '@polkadot/util': 12.6.2 tslib: 2.6.2 transitivePeerDependencies: @@ -2200,13 +2258,13 @@ packages: - utf-8-validate dev: false - /@polkadot/rpc-core@10.13.1: - resolution: {integrity: sha512-eoejSHa+/tzHm0vwic62/aptTGbph8vaBpbvLIK7gd00+rT813ROz5ckB1CqQBFB23nHRLuzzX/toY8ID3xrKw==} + /@polkadot/rpc-core@11.0.2: + resolution: {integrity: sha512-kC+85+WIc/uKColIGzrnRjM47N+AjbujRkTf0n9ldwtAIYJnq+B09R3Qjmk+kXrdW5fes85L/WigqwkohMfNkw==} engines: {node: '>=18'} dependencies: - '@polkadot/rpc-augment': 10.13.1 - '@polkadot/rpc-provider': 10.13.1 - '@polkadot/types': 10.13.1 + '@polkadot/rpc-augment': 11.0.2 + '@polkadot/rpc-provider': 11.0.2 + '@polkadot/types': 11.0.2 '@polkadot/util': 12.6.2 rxjs: 7.8.1 tslib: 2.6.2 @@ -2271,13 +2329,13 @@ packages: - utf-8-validate dev: false - /@polkadot/rpc-provider@10.13.1: - resolution: {integrity: sha512-oJ7tatVXYJ0L7NpNiGd69D558HG5y5ZDmH2Bp9Dd4kFTQIiV8A39SlWwWUPCjSsen9lqSvvprNLnG/VHTpenbw==} + /@polkadot/rpc-provider@11.0.2: + resolution: {integrity: sha512-EHoWs27r+V8NKexawcTkDzSJtYAXmkz8/zge+Ctm0PzdxtP740U9xvbK7uZ0INXeLIPdKKk7n9lGib3fhnXRvQ==} engines: {node: '>=18'} dependencies: '@polkadot/keyring': 12.6.2(@polkadot/util-crypto@12.6.2)(@polkadot/util@12.6.2) - '@polkadot/types': 10.13.1 - '@polkadot/types-support': 10.13.1 + '@polkadot/types': 11.0.2 + '@polkadot/types-support': 11.0.2 '@polkadot/util': 12.6.2 '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) '@polkadot/x-fetch': 12.6.2 @@ -2288,7 +2346,7 @@ packages: nock: 13.5.4 tslib: 2.6.2 optionalDependencies: - '@substrate/connect': 0.8.8 + '@substrate/connect': 0.8.10 transitivePeerDependencies: - bufferutil - supports-color @@ -2351,12 +2409,12 @@ packages: tslib: 2.6.2 dev: false - /@polkadot/types-augment@10.13.1: - resolution: {integrity: sha512-TcrLhf95FNFin61qmVgOgayzQB/RqVsSg9thAso1Fh6pX4HSbvI35aGPBAn3SkA6R+9/TmtECirpSNLtIGFn0g==} + /@polkadot/types-augment@11.0.2: + resolution: {integrity: sha512-36C1LNWrd/IJu4y4xJFsklw7qmyBMnH16WLkIoma7W7tCkPyuvKpl9btTcNpY9UE0FLb3AEhO0shrz3KUANk/g==} engines: {node: '>=18'} dependencies: - '@polkadot/types': 10.13.1 - '@polkadot/types-codec': 10.13.1 + '@polkadot/types': 11.0.2 + '@polkadot/types-codec': 11.0.2 '@polkadot/util': 12.6.2 tslib: 2.6.2 dev: false @@ -2390,8 +2448,8 @@ packages: tslib: 2.6.2 dev: false - /@polkadot/types-codec@10.13.1: - resolution: {integrity: sha512-AiQ2Vv2lbZVxEdRCN8XSERiWlOWa2cTDLnpAId78EnCtx4HLKYQSd+Jk9Y4BgO35R79mchK4iG+w6gZ+ukG2bg==} + /@polkadot/types-codec@11.0.2: + resolution: {integrity: sha512-OL7jM9JNzmRo+gLNIWllvyv3I4k+2dywKchC9gw/D5OCkFD+B5T3oHUw99zzER0C/r7/vTH9RM3w79yeW0UYKA==} engines: {node: '>=18'} dependencies: '@polkadot/util': 12.6.2 @@ -2425,11 +2483,11 @@ packages: tslib: 2.6.2 dev: false - /@polkadot/types-create@10.13.1: - resolution: {integrity: sha512-Usn1jqrz35SXgCDAqSXy7mnD6j4RvB4wyzTAZipFA6DGmhwyxxIgOzlWQWDb+1PtPKo9vtMzen5IJ+7w5chIeA==} + /@polkadot/types-create@11.0.2: + resolution: {integrity: sha512-yx5Gef3QkbJjzbEGoyOxv74XslGEK1Uo0IC8qSmwHsqO2+QoAEU7uJ9QpSNxHAcRrjx1W3+MdJAsfXtnwOiOeQ==} engines: {node: '>=18'} dependencies: - '@polkadot/types-codec': 10.13.1 + '@polkadot/types-codec': 11.0.2 '@polkadot/util': 12.6.2 tslib: 2.6.2 dev: false @@ -2464,14 +2522,14 @@ packages: tslib: 2.6.2 dev: false - /@polkadot/types-known@10.13.1: - resolution: {integrity: sha512-uHjDW05EavOT5JeU8RbiFWTgPilZ+odsCcuEYIJGmK+es3lk/Qsdns9Zb7U7NJl7eJ6OWmRtyrWsLs+bU+jjIQ==} + /@polkadot/types-known@11.0.2: + resolution: {integrity: sha512-c89H2y2mMCjuf5X9tTadwHpJtnQvfVxlJLTlrGElfImzWNgRetIjH65Zgy/uh/I9LqTxRlk5y3ZhBMZgL/ybbg==} engines: {node: '>=18'} dependencies: '@polkadot/networks': 12.6.2 - '@polkadot/types': 10.13.1 - '@polkadot/types-codec': 10.13.1 - '@polkadot/types-create': 10.13.1 + '@polkadot/types': 11.0.2 + '@polkadot/types-codec': 11.0.2 + '@polkadot/types-create': 11.0.2 '@polkadot/util': 12.6.2 tslib: 2.6.2 dev: false @@ -2528,8 +2586,8 @@ packages: tslib: 2.6.2 dev: false - /@polkadot/types-support@10.13.1: - resolution: {integrity: sha512-4gEPfz36XRQIY7inKq0HXNVVhR6HvXtm7yrEmuBuhM86LE0lQQBkISUSgR358bdn2OFSLMxMoRNoh3kcDvdGDQ==} + /@polkadot/types-support@11.0.2: + resolution: {integrity: sha512-p26QwtEniCyqUX9WoMtEp5LRdrmvvUf8s8Dx6P3W8/lU+hYeKQjeGCudWoudSXIYpsfTliLEowoxmjx4Wn4GIw==} engines: {node: '>=18'} dependencies: '@polkadot/util': 12.6.2 @@ -2566,14 +2624,14 @@ packages: tslib: 2.6.2 dev: false - /@polkadot/types@10.13.1: - resolution: {integrity: sha512-Hfvg1ZgJlYyzGSAVrDIpp3vullgxrjOlh/CSThd/PI4TTN1qHoPSFm2hs77k3mKkOzg+LrWsLE0P/LP2XddYcw==} + /@polkadot/types@11.0.2: + resolution: {integrity: sha512-jYORxnbR9cOoLW2KI7OAbHlC8bQr+Anj34CqgtlEikRSZBlmmx1CLD08hZSnSHkVAQgqHB6SLfFIW5VTI2YaqA==} engines: {node: '>=18'} dependencies: '@polkadot/keyring': 12.6.2(@polkadot/util-crypto@12.6.2)(@polkadot/util@12.6.2) - '@polkadot/types-augment': 10.13.1 - '@polkadot/types-codec': 10.13.1 - '@polkadot/types-create': 10.13.1 + '@polkadot/types-augment': 11.0.2 + '@polkadot/types-codec': 11.0.2 + '@polkadot/types-create': 11.0.2 '@polkadot/util': 12.6.2 '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) rxjs: 7.8.1 @@ -3470,7 +3528,7 @@ packages: /@subsocial/definitions@0.8.14: resolution: {integrity: sha512-K/8ZYGMyy15QI16bxgi0GfxP3JsnKeNAyPlwom1kDE89RGGs5O++PuWbXxVMMSVYfh9zn9qJYKiThBYIj/Vohg==} dependencies: - '@polkadot/api': 10.13.1 + '@polkadot/api': 11.0.2 lodash.camelcase: 4.3.0 transitivePeerDependencies: - bufferutil @@ -3494,6 +3552,12 @@ packages: dev: false optional: true + /@substrate/connect-known-chains@1.1.4: + resolution: {integrity: sha512-iT+BdKqvKl/uBLd8BAJysFM1BaMZXRkaXBP2B7V7ob/EyNs5h0EMhTVbO6MJxV/IEOg5OKsyl6FUqQK7pKnqyw==} + requiresBuild: true + dev: false + optional: true + /@substrate/connect@0.7.0-alpha.0: resolution: {integrity: sha512-fvO7w++M8R95R/pGJFW9+cWOt8OYnnTfgswxtlPqSgzqX4tta8xcNQ51crC72FcL5agwSGkA1gc2/+eyTj7O8A==} dependencies: @@ -3517,6 +3581,20 @@ packages: dev: false optional: true + /@substrate/connect@0.8.10: + resolution: {integrity: sha512-DIyQ13DDlXqVFnLV+S6/JDgiGowVRRrh18kahieJxhgvzcWicw5eLc6jpfQ0moVVLBYkO7rctB5Wreldwpva8w==} + requiresBuild: true + dependencies: + '@substrate/connect-extension-protocol': 2.0.0 + '@substrate/connect-known-chains': 1.1.4 + '@substrate/light-client-extension-helpers': 0.0.6(smoldot@2.0.22) + smoldot: 2.0.22 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + optional: true + /@substrate/connect@0.8.8: resolution: {integrity: sha512-zwaxuNEVI9bGt0rT8PEJiXOyebLIo6QN1SyiAHRPBOl6g3Sy0KKdSN8Jmyn++oXhVRD8aIe75/V8ZkS81T+BPQ==} requiresBuild: true @@ -3548,6 +3626,23 @@ packages: dev: false optional: true + /@substrate/light-client-extension-helpers@0.0.6(smoldot@2.0.22): + resolution: {integrity: sha512-girltEuxQ1BvkJWmc8JJlk4ZxnlGXc/wkLcNguhY+UoDEMBK0LsdtfzQKIfrIehi4QdeSBlFEFBoI4RqPmsZzA==} + requiresBuild: true + peerDependencies: + smoldot: 2.x + dependencies: + '@polkadot-api/json-rpc-provider': 0.0.1 + '@polkadot-api/json-rpc-provider-proxy': 0.0.1 + '@polkadot-api/observable-client': 0.1.0(rxjs@7.8.1) + '@polkadot-api/substrate-client': 0.0.1 + '@substrate/connect-extension-protocol': 2.0.0 + '@substrate/connect-known-chains': 1.1.4 + rxjs: 7.8.1 + smoldot: 2.0.22 + dev: false + optional: true + /@substrate/smoldot-light@0.6.8: resolution: {integrity: sha512-9lVwbG6wrtss0sd6013BJGe4WN4taujsGG49pwyt1Lj36USeL2Sb164TTUxmZF/g2NQEqDPwPROBdekQ2gFmgg==} dependencies: @@ -6110,18 +6205,6 @@ packages: /flatted@3.3.1: resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} - /follow-redirects@1.15.4(debug@4.3.4): - resolution: {integrity: sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - dependencies: - debug: 4.3.4(supports-color@8.1.1) - dev: false - /follow-redirects@1.15.6(debug@4.3.4): resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} engines: {node: '>=4.0'} @@ -9405,14 +9488,14 @@ packages: dev: false optional: true - /solc@0.8.21(debug@4.3.4): - resolution: {integrity: sha512-N55ogy2dkTRwiONbj4e6wMZqUNaLZkiRcjGyeafjLYzo/tf/IvhHY5P5wpe+H3Fubh9idu071i8eOGO31s1ylg==} + /solc@0.8.25(debug@4.3.4): + resolution: {integrity: sha512-7P0TF8gPeudl1Ko3RGkyY6XVCxe2SdD/qQhtns1vl3yAbK/PDifKDLHGtx1t7mX3LgR7ojV7Fg/Kc6Q9D2T8UQ==} engines: {node: '>=10.0.0'} hasBin: true dependencies: command-exists: 1.2.9 commander: 8.3.0 - follow-redirects: 1.15.4(debug@4.3.4) + follow-redirects: 1.15.6(debug@4.3.4) js-sha3: 0.8.0 memorystream: 0.3.1 semver: 5.7.2 @@ -9449,6 +9532,9 @@ packages: /sqlite3@5.1.7: resolution: {integrity: sha512-GGIyOiFaG+TUra3JIfkI/zGP8yZYLPQ0pl1bH+ODjiX57sPhrLU5sQJn1y9bDKZUFYkX1crlrPfSYt0BKKdkog==} requiresBuild: true + peerDependenciesMeta: + node-gyp: + optional: true dependencies: bindings: 1.5.0 node-addon-api: 7.1.0 @@ -11231,7 +11317,7 @@ packages: name: eth-object version: 1.0.3 dependencies: - eth-util-lite: github.com/near/eth-util-lite/ae0210cbe127b4d43ba01fd7cd4898d1a3f6c96a + eth-util-lite: github.com/near/eth-util-lite/427b7634a123d171432f3b38c6542913a3897ac7 ethereumjs-util: 7.1.5 web3: 1.10.4 transitivePeerDependencies: @@ -11241,8 +11327,8 @@ packages: - utf-8-validate dev: false - github.com/near/eth-util-lite/ae0210cbe127b4d43ba01fd7cd4898d1a3f6c96a: - resolution: {tarball: https://codeload.github.com/near/eth-util-lite/tar.gz/ae0210cbe127b4d43ba01fd7cd4898d1a3f6c96a} + github.com/near/eth-util-lite/427b7634a123d171432f3b38c6542913a3897ac7: + resolution: {tarball: https://codeload.github.com/near/eth-util-lite/tar.gz/427b7634a123d171432f3b38c6542913a3897ac7} name: eth-util-lite version: 1.0.1 dependencies: diff --git a/test/suites/dev/moonbase/test-contract/test-eip1153.ts b/test/suites/dev/moonbase/test-contract/test-eip1153.ts new file mode 100644 index 0000000000..d3167efb95 --- /dev/null +++ b/test/suites/dev/moonbase/test-contract/test-eip1153.ts @@ -0,0 +1,37 @@ +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import exp from "constants"; + +describeSuite({ + id: "D010611", + title: "EIP-1153 - Transient storage", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + let contract: `0x${string}`; + + beforeAll(async function () { + const { contractAddress } = await context.deployContract!("ReentrancyProtected", { + gas: 1000000n, + }); + contract = contractAddress; + }); + + it({ + id: "T01", + title: "should detect reentrant call and revert", + test: async function () { + try { + await context.writeContract!({ + contractName: "ReentrancyProtected", + contractAddress: contract, + functionName: "test", + }) + } catch (error) { + return expect(error.details).to.be.eq( + "VM Exception while processing transaction: revert Reentrant call detected." + ); + } + expect.fail("Expected the contract call to fail"); + }, + }); + } +});