From b86aa73b282f207a2d535ca91fc498ff2f768090 Mon Sep 17 00:00:00 2001 From: didi Date: Tue, 13 Jan 2026 12:27:27 +0100 Subject: [PATCH 1/3] updated solhint to v6 --- .gitignore | 3 ++ README.md | 2 +- flake.nix | 2 +- package.json | 2 +- .../autowrap/.solhint.json | 12 +++++- .../scheduler/.solhint.json | 12 +++++- packages/ethereum-contracts/.gitignore | 2 + packages/ethereum-contracts/.solhint.json | 12 +++++- .../test/test-solc-compatibility.sh | 2 +- packages/hot-fuzz/.solhint.json | 13 +++++- .../solidity-semantic-money/.solhint.json | 12 +++++- yarn.lock | 43 +++++++++++++++---- 12 files changed, 99 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 1a6a88ce3b..7624fc61f5 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ package-lock.json # echidna litters crytic-export corpus + +/broadcast +/.direnv diff --git a/README.md b/README.md index 7373672bea..ec3b0ab29e 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ For technical document, references and tutorials, etc, refer to the Version - + diff --git a/flake.nix b/flake.nix index 4e6f328d99..bc7fd21e11 100644 --- a/flake.nix +++ b/flake.nix @@ -92,7 +92,7 @@ gnupg ]; - # minimem development shell + # minimum development shell minimumDevInputs = commonDevInputs ++ ethDevInputs ++ defaultNodeDevInputs; # additional tooling for whitehat hackers diff --git a/package.json b/package.json index 9cdea83ffc..7967a812d9 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "nyc": "^17.0.0", "prettier": "^3.3.3", "prettier-eslint": "^16.3.0", - "solhint": "^5.0.3", + "solhint": "^6.0.2", "syncpack": "^13.0.0", "truffle": "^5.11.5", "ts-node": "^10.9.2", diff --git a/packages/automation-contracts/autowrap/.solhint.json b/packages/automation-contracts/autowrap/.solhint.json index 80a876d2e9..1e31b8ca30 100644 --- a/packages/automation-contracts/autowrap/.solhint.json +++ b/packages/automation-contracts/autowrap/.solhint.json @@ -14,6 +14,16 @@ "constructor-syntax": "error", "func-visibility": ["error", { "ignoreConstructors": true }], "quotes": ["error", "double"], - "max-line-length": ["error", 120] + "max-line-length": ["error", 120], + "use-natspec": "off", + "import-path-check": "off", + "gas-indexed-events": "off", + "gas-struct-packing": "off", + "gas-small-strings": "off", + "gas-increment-by-one": "off", + "gas-strict-inequalities": "off", + "gas-calldata-parameters": "off", + "function-max-lines": "off", + "contract-name-capwords": "off" } } diff --git a/packages/automation-contracts/scheduler/.solhint.json b/packages/automation-contracts/scheduler/.solhint.json index 80a876d2e9..1e31b8ca30 100644 --- a/packages/automation-contracts/scheduler/.solhint.json +++ b/packages/automation-contracts/scheduler/.solhint.json @@ -14,6 +14,16 @@ "constructor-syntax": "error", "func-visibility": ["error", { "ignoreConstructors": true }], "quotes": ["error", "double"], - "max-line-length": ["error", 120] + "max-line-length": ["error", 120], + "use-natspec": "off", + "import-path-check": "off", + "gas-indexed-events": "off", + "gas-struct-packing": "off", + "gas-small-strings": "off", + "gas-increment-by-one": "off", + "gas-strict-inequalities": "off", + "gas-calldata-parameters": "off", + "function-max-lines": "off", + "contract-name-capwords": "off" } } diff --git a/packages/ethereum-contracts/.gitignore b/packages/ethereum-contracts/.gitignore index d5791612ca..1a08887d6c 100644 --- a/packages/ethereum-contracts/.gitignore +++ b/packages/ethereum-contracts/.gitignore @@ -13,3 +13,5 @@ /packages /testing-benchmark.json /broadcast + +/addrs diff --git a/packages/ethereum-contracts/.solhint.json b/packages/ethereum-contracts/.solhint.json index 86c3f4d7b6..e24930910b 100644 --- a/packages/ethereum-contracts/.solhint.json +++ b/packages/ethereum-contracts/.solhint.json @@ -16,6 +16,16 @@ "constructor-syntax": "error", "func-visibility": ["error", { "ignoreConstructors": true }], "quotes": ["error", "double"], - "max-line-length": ["error", 120] + "max-line-length": ["error", 120], + "use-natspec": "off", + "import-path-check": "off", + "gas-indexed-events": "off", + "gas-struct-packing": "off", + "gas-small-strings": "off", + "gas-increment-by-one": "off", + "gas-strict-inequalities": "off", + "gas-calldata-parameters": "off", + "function-max-lines": "off", + "contract-name-capwords": "off" } } diff --git a/packages/ethereum-contracts/test/test-solc-compatibility.sh b/packages/ethereum-contracts/test/test-solc-compatibility.sh index c4a397d019..11917a6766 100755 --- a/packages/ethereum-contracts/test/test-solc-compatibility.sh +++ b/packages/ethereum-contracts/test/test-solc-compatibility.sh @@ -31,7 +31,7 @@ fi # from here - don't forget to add 0x to our generated sha256 # workaround to make solc to find OZ library -ln -s ../../lib/openzeppelin-contracts @openzeppelin-v5 +ln -sf ../../lib/openzeppelin-contracts @openzeppelin-v5 # verify they are compatible with the minimum version of the SOLC we support find contracts/{interfaces/,apps/} -name '*.sol' | while read i;do diff --git a/packages/hot-fuzz/.solhint.json b/packages/hot-fuzz/.solhint.json index f127ecd0bb..2887187566 100644 --- a/packages/hot-fuzz/.solhint.json +++ b/packages/hot-fuzz/.solhint.json @@ -8,7 +8,6 @@ "no-unused-import": "off", "max-states-count": "off", "no-inline-assembly": "off", - "mark-callable-contracts": "off", "gas-custom-errors": "off", "one-contract-per-file": "off", "max-line-length": ["error", 120], @@ -17,6 +16,16 @@ "private-vars-leading-underscore": "off", "reason-string": ["error", { "maxLength": 64 } ], "compiler-version": ["off"], - "func-visibility" : ["error", { "ignoreConstructors": true }] + "func-visibility" : ["error", { "ignoreConstructors": true }], + "use-natspec": "off", + "import-path-check": "off", + "gas-indexed-events": "off", + "gas-struct-packing": "off", + "gas-small-strings": "off", + "gas-increment-by-one": "off", + "gas-strict-inequalities": "off", + "gas-calldata-parameters": "off", + "function-max-lines": "off", + "contract-name-capwords": "off" } } diff --git a/packages/solidity-semantic-money/.solhint.json b/packages/solidity-semantic-money/.solhint.json index f4923a5b6f..3c6c582d2a 100644 --- a/packages/solidity-semantic-money/.solhint.json +++ b/packages/solidity-semantic-money/.solhint.json @@ -16,6 +16,16 @@ "constructor-syntax": "error", "func-visibility": ["error", { "ignoreConstructors": true }], "quotes": ["error", "double"], - "max-line-length": ["error", 120] + "max-line-length": ["error", 120], + "use-natspec": "off", + "import-path-check": "off", + "gas-indexed-events": "off", + "gas-struct-packing": "off", + "gas-small-strings": "off", + "gas-increment-by-one": "off", + "gas-strict-inequalities": "off", + "gas-calldata-parameters": "off", + "function-max-lines": "off", + "contract-name-capwords": "off" } } diff --git a/yarn.lock b/yarn.lock index 009d9d1715..293ddb8ca6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1879,6 +1879,11 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== +"@humanwhocodes/momoa@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@humanwhocodes/momoa/-/momoa-2.0.4.tgz#8b9e7a629651d15009c3587d07a222deeb829385" + integrity sha512-RE815I4arJFtt+FVeU1Tgp9/Xvecacji8w/V6XtXsWWH/wz/eNkNbhb+ny/+PlVZjV0rxQpRSQKNKE3lcktHEA== + "@humanwhocodes/object-schema@^2.0.2": version "2.0.3" resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" @@ -3672,6 +3677,11 @@ resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.18.0.tgz#8e77a02a09ecce957255a2f48c9a7178ec191908" integrity sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA== +"@solidity-parser/parser@^0.20.2": + version "0.20.2" + resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.20.2.tgz#e07053488ed60dae1b54f6fe37bb6d2c5fe146a7" + integrity sha512-rbu0bzwNvMcwAjH86hiEAcOeRI2EeK8zCkHDrFykh/Al8mvJeFmjy3UrE7GYQjNwOgbGUUtCn5/k8CB8zIu7QA== + "@standard-schema/spec@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@standard-schema/spec/-/spec-1.0.0.tgz#f193b73dc316c4170f2e82a881da0f550d551b9c" @@ -5086,6 +5096,11 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" +ajv-errors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" + integrity sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ== + ajv-formats@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520" @@ -5828,6 +5843,17 @@ better-ajv-errors@^0.8.2: jsonpointer "^5.0.0" leven "^3.1.0" +better-ajv-errors@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/better-ajv-errors/-/better-ajv-errors-2.0.3.tgz#effc8d80b5b9777447159bfec7492daedeb75ecb" + integrity sha512-t1vxUP+vYKsaYi/BbKo2K98nEAZmfi4sjwvmRT8aOPDzPJeAtLurfoIDazVkLILxO4K+Sw4YrLYnBQ46l6pePg== + dependencies: + "@babel/code-frame" "^7.27.1" + "@humanwhocodes/momoa" "^2.0.4" + chalk "^4.1.2" + jsonpointer "^5.0.1" + leven "^3.1.0 < 4" + big-integer@1.6.36: version "1.6.36" resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.36.tgz#78631076265d4ae3555c04f85e7d9d2f3a071a36" @@ -11913,7 +11939,7 @@ jsonparse@^1.2.0, jsonparse@^1.3.1: resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== -jsonpointer@^5.0.0: +jsonpointer@^5.0.0, jsonpointer@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-5.0.1.tgz#2110e0af0900fd37467b5907ecd13a7884a1b559" integrity sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ== @@ -12314,7 +12340,7 @@ levelup@^1.2.1: semver "~5.4.1" xtend "~4.0.0" -leven@^3.1.0: +leven@^3.1.0, "leven@^3.1.0 < 4": version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== @@ -16518,15 +16544,17 @@ solc@^0.4.20: semver "^5.3.0" yargs "^4.7.1" -solhint@^5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/solhint/-/solhint-5.0.3.tgz#b57f6d2534fe09a60f9db1b92e834363edd1cbde" - integrity sha512-OLCH6qm/mZTCpplTXzXTJGId1zrtNuDYP5c2e6snIv/hdRVxPfBBz/bAlL91bY/Accavkayp2Zp2BaDSrLVXTQ== +solhint@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/solhint/-/solhint-6.0.2.tgz#9c78abf3a9d3be10d9886ee058845956dea83915" + integrity sha512-RInN0tz9FVR4eYlyLS0Pk8iJP3WdfVmmMJR9FIUxe9bKHgAPE8OYUXcMd5PGi5fO5BnZw32e0qMYcJZgH9MiBg== dependencies: - "@solidity-parser/parser" "^0.18.0" + "@solidity-parser/parser" "^0.20.2" ajv "^6.12.6" + ajv-errors "^1.0.1" antlr4 "^4.13.1-patch-1" ast-parents "^0.0.1" + better-ajv-errors "^2.0.2" chalk "^4.1.2" commander "^10.0.0" cosmiconfig "^8.0.0" @@ -16538,7 +16566,6 @@ solhint@^5.0.3: lodash "^4.17.21" pluralize "^8.0.0" semver "^7.5.2" - strip-ansi "^6.0.1" table "^6.8.1" text-table "^0.2.0" optionalDependencies: From 73f6c1fadf656dcf18cb761365e42a602e514f9f Mon Sep 17 00:00:00 2001 From: Didi Date: Tue, 13 Jan 2026 12:57:27 +0100 Subject: [PATCH 2/3] Remove duplicate import of ISuperfluidToken --- .../ethereum-contracts/contracts/agreements/AgreementLibrary.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/ethereum-contracts/contracts/agreements/AgreementLibrary.sol b/packages/ethereum-contracts/contracts/agreements/AgreementLibrary.sol index 22d4e66ddb..90c257e615 100644 --- a/packages/ethereum-contracts/contracts/agreements/AgreementLibrary.sol +++ b/packages/ethereum-contracts/contracts/agreements/AgreementLibrary.sol @@ -7,7 +7,6 @@ import { ISuperApp, SuperAppDefinitions } from "../interfaces/superfluid/ISuperfluid.sol"; -import { ISuperfluidToken } from "../interfaces/superfluid/ISuperfluidToken.sol"; import { SafeCast } from "@openzeppelin-v5/contracts/utils/math/SafeCast.sol"; From 7b6003d8deb843d9dbc72ea433c41d17115a9999 Mon Sep 17 00:00:00 2001 From: didi Date: Tue, 13 Jan 2026 13:07:08 +0100 Subject: [PATCH 3/3] switched evm target to cancun, removed ganache dependency --- .github/workflows/call.deploy-dry-run.yml | 10 ++++---- .../autowrap/foundry.toml | 2 +- .../scheduler/foundry.toml | 2 +- packages/ethereum-contracts/CHANGELOG.md | 6 +++++ packages/ethereum-contracts/README.md | 2 +- packages/ethereum-contracts/foundry.toml | 2 +- packages/ethereum-contracts/hardhat.config.ts | 6 ++++- .../ops-scripts/libs/getConfig.js | 9 ++------ packages/ethereum-contracts/package.json | 3 +-- .../test/TestEnvironment.ts | 23 ++++++++++++++----- .../ethereum-contracts/test/testenv-ctl.sh | 16 ++++++------- packages/ethereum-contracts/truffle-config.js | 8 +++---- packages/hot-fuzz/foundry.toml | 2 +- yarn.lock | 22 +++++------------- 14 files changed, 58 insertions(+), 55 deletions(-) diff --git a/.github/workflows/call.deploy-dry-run.yml b/.github/workflows/call.deploy-dry-run.yml index f09cf98d1f..b0c4f33f41 100644 --- a/.github/workflows/call.deploy-dry-run.yml +++ b/.github/workflows/call.deploy-dry-run.yml @@ -6,9 +6,6 @@ on: network: required: true type: string - network-id: - required: true - type: string provider-url: required: true type: string @@ -28,8 +25,11 @@ jobs: yarn install --frozen-lockfile yarn build-for-contracts-dev - - name: Start ganache - run: npx ganache --port 47545 --mnemonic --fork.url ${{ github.event.inputs.provider-url }} --network-id ${{ github.event.inputs.network-id }} --chain.chainId ${{ github.event.inputs.network-id }} + - name: Start hardhat node + run: | + cd ${{ env.ethereum-contracts-working-directory }} + npx hardhat node --port 47545 --fork ${{ github.event.inputs.provider-url }} & + sleep 5 - name: Deploy framework run: | diff --git a/packages/automation-contracts/autowrap/foundry.toml b/packages/automation-contracts/autowrap/foundry.toml index a724979827..61775d11b7 100644 --- a/packages/automation-contracts/autowrap/foundry.toml +++ b/packages/automation-contracts/autowrap/foundry.toml @@ -3,7 +3,7 @@ root = '../../../' libs = ['lib'] src = 'packages/automation-contracts/autowrap' solc_version = "0.8.30" -evm_version = 'shanghai' +evm_version = 'cancun' optimizer = true optimizer_runs = 200 remappings = [ diff --git a/packages/automation-contracts/scheduler/foundry.toml b/packages/automation-contracts/scheduler/foundry.toml index d430bfbe9f..aa61497fdf 100644 --- a/packages/automation-contracts/scheduler/foundry.toml +++ b/packages/automation-contracts/scheduler/foundry.toml @@ -3,7 +3,7 @@ root = '../../../' libs = ['lib'] src = 'packages/automation-contracts/scheduler' solc_version = "0.8.30" -evm_version = 'shanghai' +evm_version = 'cancun' optimizer = true optimizer_runs = 200 remappings = [ diff --git a/packages/ethereum-contracts/CHANGELOG.md b/packages/ethereum-contracts/CHANGELOG.md index 71058b745b..1dc378ce48 100644 --- a/packages/ethereum-contracts/CHANGELOG.md +++ b/packages/ethereum-contracts/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to the ethereum-contracts will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [UNRELEASED] + +### Changed + +- EVM target changed from _shanghai_ to _cancun_. + ## [v1.14.1] ### Added diff --git a/packages/ethereum-contracts/README.md b/packages/ethereum-contracts/README.md index 9330f7d6b1..5d1d27d658 100644 --- a/packages/ethereum-contracts/README.md +++ b/packages/ethereum-contracts/README.md @@ -355,7 +355,7 @@ Run the test suite for core contracts: yarn run-hardhat test testsuites/superfluid-core.js ``` -The `pretest` script starts a ganache instance with deterministic accounts in the background, the `posttest` script stops it. +The `pretest` script starts a local dev chain with deterministic accounts in the background, the `posttest` script stops it. When running tests with `yarn test`, those get executed automatically (see [npm docs](https://docs.npmjs.com/cli/v7/using-npm/scripts#pre--post-scripts)). > NOTE: You don't need to run the `pretest` and `posttest` scripts when running hardhat tests, but you do when running tests with truffle. diff --git a/packages/ethereum-contracts/foundry.toml b/packages/ethereum-contracts/foundry.toml index d0e6a3f967..350cd10e1c 100644 --- a/packages/ethereum-contracts/foundry.toml +++ b/packages/ethereum-contracts/foundry.toml @@ -8,7 +8,7 @@ ignored_error_codes = [ 1699 # assembly { selfdestruct } in contracts/mocks/SuperfluidDestructorMock.sol ] # keep in sync with truffle-config.js -evm_version = 'shanghai' +evm_version = 'cancun' optimizer = true optimizer_runs = 200 remappings = [ diff --git a/packages/ethereum-contracts/hardhat.config.ts b/packages/ethereum-contracts/hardhat.config.ts index e8ecc1933f..46d41394b0 100644 --- a/packages/ethereum-contracts/hardhat.config.ts +++ b/packages/ethereum-contracts/hardhat.config.ts @@ -105,7 +105,7 @@ const config: HardhatUserConfig = { enabled: true, runs: 200, }, - evmVersion: "shanghai", + evmVersion: "cancun", }, }, paths: { @@ -159,6 +159,10 @@ const config: HardhatUserConfig = { hardhat: { // We defer the contract size limit test to foundry. allowUnlimitedContractSize: true, + // Expected by testenv-ctl.sh + accounts: { + mnemonic: "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat", + }, }, }, mocha: { diff --git a/packages/ethereum-contracts/ops-scripts/libs/getConfig.js b/packages/ethereum-contracts/ops-scripts/libs/getConfig.js index d1985387a2..099a574865 100644 --- a/packages/ethereum-contracts/ops-scripts/libs/getConfig.js +++ b/packages/ethereum-contracts/ops-scripts/libs/getConfig.js @@ -6,13 +6,8 @@ module.exports = function getConfig(chainId) { // here go the trusted forwarders which aren't part of the framework contracts // Local Testing - 4447: { - // for local testing (truffle internal ganache and TestEnvironment) - // this is a fake forwarder address, it is to test the deployment script - trustedForwarders: ["0x3075b4dc7085C48A14A5A39BBa68F58B19545971"], - }, - 5777: { - // for local testing (external ganache) + 31337: { + // for local testing (hardhat node default chainId) // this is a fake forwarder address, it is to test the deployment script trustedForwarders: ["0x3075b4dc7085C48A14A5A39BBa68F58B19545971"], }, diff --git a/packages/ethereum-contracts/package.json b/packages/ethereum-contracts/package.json index e0c0581858..cca0215676 100644 --- a/packages/ethereum-contracts/package.json +++ b/packages/ethereum-contracts/package.json @@ -22,10 +22,9 @@ "async": "^3.2.6", "csv-writer": "^1.6.0", "ethers": "^5.7.2", - "ganache-time-traveler": "^1.0.16", "mochawesome": "^7.1.3", "readline": "^1.3.0", - "solidity-coverage": "^0.8.12", + "solidity-coverage": "^0.8.17", "solidity-docgen": "^0.6.0-beta.36", "stack-trace": "0.0.10", "truffle-flattener": "^1.6.0" diff --git a/packages/ethereum-contracts/test/TestEnvironment.ts b/packages/ethereum-contracts/test/TestEnvironment.ts index 560e63ffb8..b43a2558be 100644 --- a/packages/ethereum-contracts/test/TestEnvironment.ts +++ b/packages/ethereum-contracts/test/TestEnvironment.ts @@ -32,7 +32,6 @@ import { const {web3tx, wad4human} = require("@decentral.ee/web3-helpers"); const SuperfluidSDK = require("@superfluid-finance/js-sdk"); -const traveler = require("ganache-time-traveler"); const deployFramework = require("../ops-scripts/deploy-framework"); const deploySuperToken = require("../ops-scripts/deploy-super-token"); @@ -161,6 +160,22 @@ export default class TestEnvironment { console.debug("popEvmSnapshot", JSON.stringify(this._evmSnapshots)); } + /** + * Advance time by specified seconds and mine a block (replaces ganache-time-traveler.advanceTimeAndBlock) + */ + async _advanceTimeAndBlock(seconds: number) { + await network.provider.send("evm_increaseTime", [seconds]); + await network.provider.send("evm_mine", []); + } + + /** + * Set the next block's timestamp and mine a block (replaces ganache-time-traveler.advanceBlockAndSetTime) + * Uses evm_mine with timestamp parameter, matching ganache-time-traveler behavior + */ + async _advanceBlockAndSetTime(timestamp: number) { + await network.provider.send("evm_mine", [timestamp]); + } + async useLastEvmSnapshot() { let oldEvmSnapshotId = ""; const popped = this._evmSnapshots.pop(); @@ -171,10 +186,6 @@ export default class TestEnvironment { } = popped); } await this._revertToEvmSnapShot(oldEvmSnapshotId); - // move the time to now - await traveler.advanceBlockAndSetTime( - parseInt((Date.now() / 1000).toString()) - ); const newEvmSnapshotId = await this._takeEvmSnapshot(); this._evmSnapshots.push({ id: newEvmSnapshotId, @@ -192,7 +203,7 @@ export default class TestEnvironment { const block1 = await ethers.provider.getBlock("latest"); console.log("current block time", block1.timestamp); console.log(`time traveler going to the future +${jsNumTime}...`); - await traveler.advanceTimeAndBlock(jsNumTime); + await this._advanceTimeAndBlock(jsNumTime); const block2 = await ethers.provider.getBlock("latest"); console.log("new block time", block2.timestamp); } diff --git a/packages/ethereum-contracts/test/testenv-ctl.sh b/packages/ethereum-contracts/test/testenv-ctl.sh index cd81f6a2cf..147acf6422 100755 --- a/packages/ethereum-contracts/test/testenv-ctl.sh +++ b/packages/ethereum-contracts/test/testenv-ctl.sh @@ -3,21 +3,19 @@ # make sure that if any step fails, the script fails set -xe -TESTENV_MNEMONIC="candy maple cake sugar pudding cream honey rich smooth crumble sweet treat" - CMD=$1 -start_ganache() { - ganache-cli --networkId 4447 --port 47545 --mnemonic "$TESTENV_MNEMONIC" +start_hardhat_node() { + npx hardhat node --port 47545 } -kill_ganache() { - pkill -f "ganache-cli --networkId 4447" || true +kill_hardhat_node() { + pkill -f "hardhat node --port 47545" || true } if [ "$CMD" == "start" ];then - kill_ganache - start_ganache + kill_hardhat_node + start_hardhat_node elif [ "$CMD" == "stop" ];then - kill_ganache + kill_hardhat_node fi diff --git a/packages/ethereum-contracts/truffle-config.js b/packages/ethereum-contracts/truffle-config.js index cc53fc2335..9dd7ba3ad2 100644 --- a/packages/ethereum-contracts/truffle-config.js +++ b/packages/ethereum-contracts/truffle-config.js @@ -171,8 +171,8 @@ const E = (module.exports = { networks: { // Useful for testing. The `development` name is special - truffle uses it by default // if it's defined here and no other network is specified at the command line. - // You should run a client (like ganache-cli, geth or parity) in a separate terminal - // tab if you use this network and you must also set the `host`, `port` and `network_id` + // You should run a client in a separate terminal tab + // if you use this network and you must also set the `host`, `port` and `network_id` // options below to some value. // @@ -312,7 +312,7 @@ const E = (module.exports = { development: { host: "127.0.0.1", port: 47545, - network_id: "4447", + network_id: "31337", // hardhat default chainId // workaround to improve testing speed // see https://github.com/trufflesuite/truffle/issues/3522 @@ -389,7 +389,7 @@ const E = (module.exports = { runs: 200, }, // see https://docs.soliditylang.org/en/latest/using-the-compiler.html#target-options - evmVersion: "shanghai", + evmVersion: "cancun", }, }, }, diff --git a/packages/hot-fuzz/foundry.toml b/packages/hot-fuzz/foundry.toml index 2d630772b8..c2769d9c2b 100644 --- a/packages/hot-fuzz/foundry.toml +++ b/packages/hot-fuzz/foundry.toml @@ -2,7 +2,7 @@ root = '../..' src = 'packages/hot-fuzz/contracts' solc_version = "0.8.30" -evm_version = 'shanghai' +evm_version = 'cancun' optimizer = true optimizer_runs = 200 remappings = [ diff --git a/yarn.lock b/yarn.lock index 293ddb8ca6..686458b871 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3672,12 +3672,7 @@ dependencies: antlr4ts "^0.5.0-alpha.4" -"@solidity-parser/parser@^0.18.0": - version "0.18.0" - resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.18.0.tgz#8e77a02a09ecce957255a2f48c9a7178ec191908" - integrity sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA== - -"@solidity-parser/parser@^0.20.2": +"@solidity-parser/parser@^0.20.1", "@solidity-parser/parser@^0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.20.2.tgz#e07053488ed60dae1b54f6fe37bb6d2c5fe146a7" integrity sha512-rbu0bzwNvMcwAjH86hiEAcOeRI2EeK8zCkHDrFykh/Al8mvJeFmjy3UrE7GYQjNwOgbGUUtCn5/k8CB8zIu7QA== @@ -9675,11 +9670,6 @@ functions-have-names@^1.2.3: resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== -ganache-time-traveler@^1.0.16: - version "1.0.16" - resolved "https://registry.yarnpkg.com/ganache-time-traveler/-/ganache-time-traveler-1.0.16.tgz#9ddeafd72c909ecd3501e4ec628a3af707334b3a" - integrity sha512-oUaQge9tiT/zzcGqehqJcoH10claKi9QFhq7zI1Wa3KtdPobjgLVMYvqXCJuHCAZoS7sHvLB/N/rSnhmivxaKw== - ganache@7.9.1: version "7.9.1" resolved "https://registry.yarnpkg.com/ganache/-/ganache-7.9.1.tgz#94f8518215c7989ff5fd542db80bd47d7c7da786" @@ -16581,13 +16571,13 @@ solidity-comments-extractor@^0.0.7: resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.7.tgz#99d8f1361438f84019795d928b931f4e5c39ca19" integrity sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw== -solidity-coverage@^0.8.12: - version "0.8.13" - resolved "https://registry.yarnpkg.com/solidity-coverage/-/solidity-coverage-0.8.13.tgz#8eeada2e82ae19d25568368aa782a2baad0e0ce7" - integrity sha512-RiBoI+kF94V3Rv0+iwOj3HQVSqNzA9qm/qDP1ZDXK5IX0Cvho1qiz8hAXTsAo6KOIUeP73jfscq0KlLqVxzGWA== +solidity-coverage@^0.8.17: + version "0.8.17" + resolved "https://registry.yarnpkg.com/solidity-coverage/-/solidity-coverage-0.8.17.tgz#e71df844ccf46a49b03c5ce92333a3b27597c4ae" + integrity sha512-5P8vnB6qVX9tt1MfuONtCTEaEGO/O4WuEidPHIAJjx4sktHHKhO3rFvnE0q8L30nWJPTrcqGQMT7jpE29B2qow== dependencies: "@ethersproject/abi" "^5.0.9" - "@solidity-parser/parser" "^0.18.0" + "@solidity-parser/parser" "^0.20.1" chalk "^2.4.2" death "^1.1.0" difflib "^0.2.4"