From 116a3af7dbcf7c699b6598cf7bb93716d87edf1b Mon Sep 17 00:00:00 2001 From: Karl Bartel Date: Wed, 20 Aug 2025 11:48:51 +0200 Subject: [PATCH 1/2] Use Celo Sepolia for e2e test instead of alfajores The changed error message is more precise and more stable across geth versions. Right now, the test "zero tip fee currency tx rejected" still fails for Sepolia, but the same is true for Alfajores. It will work once the node is updated. Closes https://github.com/celo-org/celo-blockchain-planning/issues/1158 --- .github/workflows/e2e-test-deployed-network.yaml | 2 +- e2e_test/js-tests/test_viem_tx.mjs | 2 +- e2e_test/js-tests/viem_setup.mjs | 5 ++++- e2e_test/shared.sh | 8 ++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e-test-deployed-network.yaml b/.github/workflows/e2e-test-deployed-network.yaml index bae8fb2c5d..6effef75b4 100644 --- a/.github/workflows/e2e-test-deployed-network.yaml +++ b/.github/workflows/e2e-test-deployed-network.yaml @@ -23,4 +23,4 @@ jobs: - uses: ./.github/workflows/composite/setup - name: Run e2e tests alfajores shell: bash - run: NETWORK=alfajores e2e_test/run_all_tests.sh + run: NETWORK=celo-sepolia e2e_test/run_all_tests.sh diff --git a/e2e_test/js-tests/test_viem_tx.mjs b/e2e_test/js-tests/test_viem_tx.mjs index 43d151bffd..fc1154c70a 100644 --- a/e2e_test/js-tests/test_viem_tx.mjs +++ b/e2e_test/js-tests/test_viem_tx.mjs @@ -327,7 +327,7 @@ describe("viem send tx", () => { maxFeePerGas: gasPrice, maxPriorityFeePerGas: 0n, }); - await expectTxFail(request, "transaction gas price below minimum"); + await expectTxFail(request, "gas tip cap 0"); }).timeout(10_000); }); diff --git a/e2e_test/js-tests/viem_setup.mjs b/e2e_test/js-tests/viem_setup.mjs index 7868806ec3..54470f5106 100644 --- a/e2e_test/js-tests/viem_setup.mjs +++ b/e2e_test/js-tests/viem_setup.mjs @@ -7,7 +7,7 @@ import { webSocket, defineChain, } from "viem"; -import { celo, celoAlfajores } from "viem/chains"; +import { celo, celoAlfajores, celoSepolia } from "viem/chains"; import { privateKeyToAccount } from "viem/accounts"; // Setup up chain @@ -51,6 +51,8 @@ const chain = (() => { return celoAlfajores case 'baklava': return celoBaklava + case 'celo-sepolia': + return celoSepolia case 'mainnet': return celoMainnet default: @@ -62,6 +64,7 @@ const transportForNetwork = (() => { switch (process.env.NETWORK) { case 'alfajores': case 'baklava': + case 'celo-sepolia': case 'mainnet': return webSocket(process.env.ETH_RPC_URL); default: diff --git a/e2e_test/shared.sh b/e2e_test/shared.sh index bf17770e52..8e82517095 100644 --- a/e2e_test/shared.sh +++ b/e2e_test/shared.sh @@ -34,6 +34,14 @@ baklava) export FEE_CURRENCY_DIRECTORY_ADDR=0xD59E1599F45e42Eb356202B2C714D6C7b734C034 echo "Using Baklava network" ;; +celo-sepolia) + export ETH_RPC_URL=wss://forno.celo-sepolia.celo-testnet.org/ws + export TOKEN_ADDR=0x471EcE3750Da237f93B8E339c536989b8978a438 + export FEE_HANDLER=0xcD437749E43A154C07F3553504c68fBfD56B8778 + export FEE_CURRENCY=0x6B172e333e2978484261D7eCC3DE491E79764BbC + export FEE_CURRENCY_DIRECTORY_ADDR=0x9212Fb72ae65367A7c887eC4Ad9bE310BAC611BF + echo "Using Celo Sepolia network" + ;; '') export ETH_RPC_URL=http://127.0.0.1:8545 export TOKEN_ADDR=0x471ece3750da237f93b8e339c536989b8978a438 From 32ffa2e91a11b1c9398f256506c8e504930a3ccb Mon Sep 17 00:00:00 2001 From: Karl Bartel Date: Tue, 26 Aug 2025 12:01:11 +0200 Subject: [PATCH 2/2] e2e: Update viem This brings a celoSepolia definition and staying up to date is generally a good idea. Due to https://github.com/wevm/viem/pull/3117 being merged in view, we can (and have to) remove a changed assert in the "test gas price difference for fee currency" test. --- e2e_test/js-tests/package-lock.json | 180 ++++++++++------------------ e2e_test/js-tests/package.json | 2 +- e2e_test/js-tests/test_viem_tx.mjs | 4 +- 3 files changed, 67 insertions(+), 119 deletions(-) diff --git a/e2e_test/js-tests/package-lock.json b/e2e_test/js-tests/package-lock.json index ce8bbff326..04ea3031c5 100644 --- a/e2e_test/js-tests/package-lock.json +++ b/e2e_test/js-tests/package-lock.json @@ -12,7 +12,7 @@ "chai": "^5.1.2", "ethers": "^6.10.0", "mocha": "^10.2.0", - "viem": "^2.21.18" + "viem": "^2.35.1" }, "engines": { "node": ">=18.0.0" @@ -59,35 +59,35 @@ } }, "node_modules/@scure/base": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", - "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", "license": "MIT", "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@scure/bip32": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.5.0.tgz", - "integrity": "sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.7.0.tgz", + "integrity": "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==", "license": "MIT", "dependencies": { - "@noble/curves": "~1.6.0", - "@noble/hashes": "~1.5.0", - "@scure/base": "~1.1.7" + "@noble/curves": "~1.9.0", + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" }, "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@scure/bip32/node_modules/@noble/curves": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", - "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "version": "1.9.7", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz", + "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==", "license": "MIT", "dependencies": { - "@noble/hashes": "1.5.0" + "@noble/hashes": "1.8.0" }, "engines": { "node": "^14.21.3 || >=16" @@ -97,9 +97,9 @@ } }, "node_modules/@scure/bip32/node_modules/@noble/hashes": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", - "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", "license": "MIT", "engines": { "node": "^14.21.3 || >=16" @@ -109,22 +109,22 @@ } }, "node_modules/@scure/bip39": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.4.0.tgz", - "integrity": "sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz", + "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==", "license": "MIT", "dependencies": { - "@noble/hashes": "~1.5.0", - "@scure/base": "~1.1.8" + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" }, "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@scure/bip39/node_modules/@noble/hashes": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", - "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", "license": "MIT", "engines": { "node": "^14.21.3 || >=16" @@ -143,9 +143,9 @@ } }, "node_modules/abitype": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.6.tgz", - "integrity": "sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.8.tgz", + "integrity": "sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/wevm" @@ -681,9 +681,9 @@ } }, "node_modules/isows": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.6.tgz", - "integrity": "sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.7.tgz", + "integrity": "sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==", "funding": [ { "type": "github", @@ -813,9 +813,9 @@ } }, "node_modules/ox": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ox/-/ox-0.7.1.tgz", - "integrity": "sha512-+k9fY9PRNuAMHRFIUbiK9Nt5seYHHzSQs9Bj+iMETcGtlpS7SmBzcGSVUQO3+nqGLEiNK4598pHNFlVRaZbRsg==", + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/ox/-/ox-0.8.7.tgz", + "integrity": "sha512-W1f0FiMf9NZqtHPEDEAEkyzZDwbIKfmH2qmQx8NNiQ/9JhxrSblmtLJsSfTtQG5YKowLOnBlLVguCyxm/7ztxw==", "funding": [ { "type": "github", @@ -824,13 +824,13 @@ ], "license": "MIT", "dependencies": { - "@adraffy/ens-normalize": "^1.10.1", + "@adraffy/ens-normalize": "^1.11.0", "@noble/ciphers": "^1.3.0", - "@noble/curves": "^1.6.0", - "@noble/hashes": "^1.5.0", - "@scure/bip32": "^1.5.0", - "@scure/bip39": "^1.4.0", - "abitype": "^1.0.6", + "@noble/curves": "^1.9.1", + "@noble/hashes": "^1.8.0", + "@scure/bip32": "^1.7.0", + "@scure/bip39": "^1.6.0", + "abitype": "^1.0.8", "eventemitter3": "5.0.1" }, "peerDependencies": { @@ -849,9 +849,9 @@ "license": "MIT" }, "node_modules/ox/node_modules/@noble/curves": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.1.tgz", - "integrity": "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA==", + "version": "1.9.7", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz", + "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==", "license": "MIT", "dependencies": { "@noble/hashes": "1.8.0" @@ -1061,9 +1061,9 @@ "license": "MIT" }, "node_modules/viem": { - "version": "2.21.27", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.21.27.tgz", - "integrity": "sha512-lBpldSmwmKZ8jIiVLqoplPnuMs2Cza8tK0/G9m+ZjqfbgEp4+BPviFBJWCDNFxSp8H3gPzAuqj8o1WKQyq3wlg==", + "version": "2.35.1", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.35.1.tgz", + "integrity": "sha512-BVGrI2xzMa+cWaUhhMuq+RV6t/8aHN08QAPG07OMFb3PBWc0AYubRMyIuxMKncFe8lJdxfRWNRYv1agoM/xSlQ==", "funding": [ { "type": "github", @@ -1072,15 +1072,14 @@ ], "license": "MIT", "dependencies": { - "@adraffy/ens-normalize": "1.11.0", - "@noble/curves": "1.6.0", - "@noble/hashes": "1.5.0", - "@scure/bip32": "1.5.0", - "@scure/bip39": "1.4.0", - "abitype": "1.0.6", - "isows": "1.0.6", - "webauthn-p256": "0.0.10", - "ws": "8.18.0" + "@noble/curves": "1.9.6", + "@noble/hashes": "1.8.0", + "@scure/bip32": "1.7.0", + "@scure/bip39": "1.6.0", + "abitype": "1.0.8", + "isows": "1.0.7", + "ox": "0.8.7", + "ws": "8.18.3" }, "peerDependencies": { "typescript": ">=5.0.4" @@ -1092,12 +1091,12 @@ } }, "node_modules/viem/node_modules/@noble/curves": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", - "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "version": "1.9.6", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.6.tgz", + "integrity": "sha512-GIKz/j99FRthB8icyJQA51E8Uk5hXmdyThjgQXRKiv9h0zeRlzSCLIzFw6K1LotZ3XuB7yzlf76qk7uBmTdFqA==", "license": "MIT", "dependencies": { - "@noble/hashes": "1.5.0" + "@noble/hashes": "1.8.0" }, "engines": { "node": "^14.21.3 || >=16" @@ -1107,9 +1106,9 @@ } }, "node_modules/viem/node_modules/@noble/hashes": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", - "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", "license": "MIT", "engines": { "node": "^14.21.3 || >=16" @@ -1118,16 +1117,10 @@ "url": "https://paulmillr.com/funding/" } }, - "node_modules/viem/node_modules/@adraffy/ens-normalize": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz", - "integrity": "sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==", - "license": "MIT" - }, "node_modules/viem/node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", "license": "MIT", "engines": { "node": ">=10.0.0" @@ -1145,49 +1138,6 @@ } } }, - "node_modules/webauthn-p256": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/webauthn-p256/-/webauthn-p256-0.0.10.tgz", - "integrity": "sha512-EeYD+gmIT80YkSIDb2iWq0lq2zbHo1CxHlQTeJ+KkCILWpVy3zASH3ByD4bopzfk0uCwXxLqKGLqp2W4O28VFA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/wevm" - } - ], - "license": "MIT", - "dependencies": { - "@noble/curves": "^1.4.0", - "@noble/hashes": "^1.4.0" - } - }, - "node_modules/webauthn-p256/node_modules/@noble/curves": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", - "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", - "license": "MIT", - "dependencies": { - "@noble/hashes": "1.5.0" - }, - "engines": { - "node": "^14.21.3 || >=16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/webauthn-p256/node_modules/@noble/hashes": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", - "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", - "license": "MIT", - "engines": { - "node": "^14.21.3 || >=16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "node_modules/workerpool": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", @@ -1297,4 +1247,4 @@ } } } -} \ No newline at end of file +} diff --git a/e2e_test/js-tests/package.json b/e2e_test/js-tests/package.json index 30c16346d6..7cac5fcc1d 100644 --- a/e2e_test/js-tests/package.json +++ b/e2e_test/js-tests/package.json @@ -12,7 +12,7 @@ "chai": "^5.1.2", "ethers": "^6.10.0", "mocha": "^10.2.0", - "viem": "^2.21.18" + "viem": "^2.35.1" }, "engines": { "node": ">=18.0.0" diff --git a/e2e_test/js-tests/test_viem_tx.mjs b/e2e_test/js-tests/test_viem_tx.mjs index fc1154c70a..81b4b0bdc7 100644 --- a/e2e_test/js-tests/test_viem_tx.mjs +++ b/e2e_test/js-tests/test_viem_tx.mjs @@ -182,11 +182,9 @@ describe("viem send tx", () => { args: [process.env.FEE_CURRENCY], }); - // TODO fix this when viem is fixed - https://github.com/celo-org/viem/pull/20 // The expected value for the max fee should be the (baseFeePerGas * multiplier) + maxPriorityFeePerGas - // Instead what is currently returned is (maxFeePerGas * multiplier) + maxPriorityFeePerGas const maxPriorityFeeInFeeCurrency = (maxPriorityFeePerGasNative * numerator) / denominator; - const maxFeeInFeeCurrency = ((block.baseFeePerGas + maxPriorityFeePerGasNative) * numerator) / denominator; + const maxFeeInFeeCurrency = ((block.baseFeePerGas) * numerator) / denominator; assert.equal(fees.maxFeePerGas, ((maxFeeInFeeCurrency * 12n) / 10n) + maxPriorityFeeInFeeCurrency); assert.equal(fees.maxPriorityFeePerGas, maxPriorityFeeInFeeCurrency);