diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0358ba4e..b819c916 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,8 +3,8 @@ repos: - repo: https://github.com/Yelp/detect-secrets rev: v1.5.0 hooks: - - id: detect-secrets - args: ['--baseline', '.secrets.baseline'] + - id: detect-secrets + args: ["--baseline", ".secrets.baseline"] exclude: "(pnpm-lock.yaml|testdata|static|config.json|genesis.json)" # Then run code formatters @@ -27,16 +27,16 @@ repos: - id: go-mod-tidy # Run go mod tidy when go.mod changes files: go.mod - id: go-fmt - args: [ -w, -s ] # simplify code and write result to (source) file instead of stdout + args: [-w, -s] # simplify code and write result to (source) file instead of stdout - repo: local hooks: - - id: run-solidity-lint - name: run-solidity-lint - language: script - entry: .pre-commit/run_solidity_lint.sh - types: [ file, solidity ] - require_serial: true + - id: run-solidity-lint + name: run-solidity-lint + language: script + entry: .pre-commit/run_solidity_lint.sh + types: [file, solidity] + require_serial: true # Then run code validators (on the formatted code) @@ -54,7 +54,7 @@ repos: name: run-buf language: script entry: .pre-commit/run_buf.sh - types: [ file, proto ] + types: [file, proto] pass_filenames: false - id: run-go-tests @@ -62,20 +62,20 @@ repos: language: script require_serial: true # Don't run this in parallel entry: .pre-commit/run_go_tests.sh - types: [ file, go ] + types: [file, go] - id: run-forge-tests name: run-forge-tests language: script entry: .pre-commit/run_forge_tests.sh - types: [ file, solidity ] + types: [file, solidity] require_serial: true - id: run-regexp name: run-regexp language: script entry: .pre-commit/run_regexp.sh - types: [ file, go ] + types: [file, go] exclude: "(_test.go|contracts/bindings/.*|scripts/)" - id: run-goversion @@ -83,11 +83,4 @@ repos: language: script entry: .pre-commit/run_goversion.sh pass_filenames: false - types: [ file, go ] - - - id: run-solhint - name: run-solhint - language: script - entry: .pre-commit/run_solhint.sh - types: [ file, solidity ] - require_serial: true + types: [file, go] diff --git a/.pre-commit/run_solhint.sh b/.pre-commit/run_solhint.sh deleted file mode 100755 index b1039d39..00000000 --- a/.pre-commit/run_solhint.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# Solhint's repo doesn't support pre-commit out-of-the-box, so this script is the workaround. - -# TODO: Unify and fix solhint versions in repo -# VERSION="5.0.3" - -# if ! which solhint 1>/dev/null || [[ $(solhint --version) != "$VERSION" ]]; then -# echo "Installing solhint@$VERSION" -# npm install -g solhint@$VERSION -# fi - -# solhint $@ diff --git a/.pre-commit/run_solidity_lint.sh b/.pre-commit/run_solidity_lint.sh index 0eb5d573..d1b232a2 100755 --- a/.pre-commit/run_solidity_lint.sh +++ b/.pre-commit/run_solidity_lint.sh @@ -3,13 +3,11 @@ # Runs `pnpm lint-check` for every unique foundry project derived from the list # of files provided as arguments by pre-commit. -# TODO: Unify and fix solhint versions in repo -# source scripts/install_foundry.sh +source scripts/install_foundry.sh -# import foundryroots -# source .pre-commit/foundry_utils.sh +source .pre-commit/foundry_utils.sh -# for dir in $(foundryroots $@); do -# echo "Running 'lint-check' in ./$dir" -# (cd $dir && pnpm lint-check) -# done +for dir in $(foundryroots $@); do + echo "Running 'lint-fix and lint-full' in ./$dir" + (cd $dir && pnpm lint-fix && pnpm lint-full) +done diff --git a/.solhint.json b/.solhint.json deleted file mode 100644 index 05844850..00000000 --- a/.solhint.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "solhint:recommended", - "rules": { - "const-name-snakecase": "off", - "custom-errors": "off", - "func-visibility": ["error", { "ignoreConstructors": true }], - "func-name-mixedcase": "off", - "immutable-vars-naming": "off", - "no-unused-import": "error", - "no-unused-vars": "error" - } -} diff --git a/.solhintignore b/.solhintignore deleted file mode 100644 index e9e1f54e..00000000 --- a/.solhintignore +++ /dev/null @@ -1 +0,0 @@ -**/test/**/*.sol diff --git a/contracts/.solhint.json b/contracts/.solhint.json index 80790b05..cf88b264 100644 --- a/contracts/.solhint.json +++ b/contracts/.solhint.json @@ -20,7 +20,6 @@ "private-vars-leading-underscore": "off", "func-name-mixedcase": "off", "var-name-mixedcase": "off", - "modifier-name-mixedcase": "off", - "custom-errors": "off" + "modifier-name-mixedcase": "off" } } diff --git a/contracts/package.json b/contracts/package.json index 9411ca17..021f812c 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -12,9 +12,9 @@ ], "scripts": { "test": "pnpm test:gen && forge test", - "lint-full": "prettier --log-level warn --ignore-path .gitignore '{contracts,test}/**/*.sol' --check && solhint '{contracts,test}/**/*.sol'", - "lint-fix": "prettier --log-level warn --ignore-path .gitignore '{contracts,test}/**/*.sol' --write", - "lint-check": "solhint '{contracts,script,test}/**/*.sol'" + "lint-full": "prettier --log-level warn --ignore-path .gitignore '{src,test,script}/**/*.sol' --check && solhint '{src,test,script}/**/*.sol'", + "lint-fix": "prettier --log-level warn --ignore-path .gitignore '{src,test,script}/**/*.sol' --write", + "lint-check": "solhint '{src,test,script}/**/*.sol'" }, "devDependencies": { "@openzeppelin/merkle-tree": "^1.0.5", @@ -23,9 +23,8 @@ "ethereum-cryptography": "^2.1.3", "forge-std": "https://github.com/foundry-rs/forge-std", "prettier": "^3.3.3", - "prettier-plugin-solidity": "^1.3.1", - "solhint": "^5.0.1", - "solhint-community": "^4.0.0", + "prettier-plugin-solidity": "^1.4.1", + "solhint": "^5.0.3", "solhint-plugin-prettier": "^0.1.0", "ts-node": "^10.9.2", "typescript": "^5.3.3", diff --git a/contracts/pnpm-lock.yaml b/contracts/pnpm-lock.yaml index 08901052..45560a5f 100644 --- a/contracts/pnpm-lock.yaml +++ b/contracts/pnpm-lock.yaml @@ -23,7 +23,7 @@ importers: version: 1.0.7 '@types/node': specifier: ^20.11.7 - version: 20.14.10 + version: 20.16.11 ds-test: specifier: https://github.com/dapphub/ds-test version: https://codeload.github.com/dapphub/ds-test/tar.gz/e282159d5170298eb2455a6c05280ab5a73a4ef0 @@ -32,36 +32,33 @@ importers: version: 2.2.1 forge-std: specifier: https://github.com/foundry-rs/forge-std - version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/07263d193d621c4b2b0ce8b4d54af58f6957d97d + version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/4f57c59f066a03d13de8c65bb34fca8247f5fcb2 prettier: specifier: ^3.3.3 version: 3.3.3 prettier-plugin-solidity: - specifier: ^1.3.1 - version: 1.3.1(prettier@3.3.3) + specifier: ^1.4.1 + version: 1.4.1(prettier@3.3.3) solhint: - specifier: ^5.0.1 - version: 5.0.1(typescript@5.5.3) - solhint-community: - specifier: ^4.0.0 - version: 4.0.0(typescript@5.5.3) + specifier: ^5.0.3 + version: 5.0.3(typescript@5.6.3) solhint-plugin-prettier: specifier: ^0.1.0 - version: 0.1.0(prettier-plugin-solidity@1.3.1(prettier@3.3.3))(prettier@3.3.3) + version: 0.1.0(prettier-plugin-solidity@1.4.1(prettier@3.3.3))(prettier@3.3.3) ts-node: specifier: ^10.9.2 - version: 10.9.2(@types/node@20.14.10)(typescript@5.5.3) + version: 10.9.2(@types/node@20.16.11)(typescript@5.6.3) typescript: specifier: ^5.3.3 - version: 5.5.3 + version: 5.6.3 viem: specifier: ^2.5.0 - version: 2.17.4(typescript@5.5.3) + version: 2.21.22(typescript@5.6.3) packages: - '@adraffy/ens-normalize@1.10.0': - resolution: {integrity: sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==} + '@adraffy/ens-normalize@1.11.0': + resolution: {integrity: sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==} '@babel/code-frame@7.24.7': resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} @@ -143,16 +140,21 @@ packages: '@jridgewell/trace-mapping@0.3.9': resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - '@noble/curves@1.4.0': - resolution: {integrity: sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==} - '@noble/curves@1.4.2': resolution: {integrity: sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==} + '@noble/curves@1.6.0': + resolution: {integrity: sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==} + engines: {node: ^14.21.3 || >=16} + '@noble/hashes@1.4.0': resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} engines: {node: '>= 16'} + '@noble/hashes@1.5.0': + resolution: {integrity: sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==} + engines: {node: ^14.21.3 || >=16} + '@openzeppelin/contracts-upgradeable@5.0.2': resolution: {integrity: sha512-0MmkHSHiW2NRFiT9/r5Lu4eJq5UJ4/tzlOgYXNAIj/ONkQTVnz22pLxDvp4C4uZ9he7ZFvGn3Driptn1/iU7tQ==} peerDependencies: @@ -181,25 +183,25 @@ packages: peerDependencies: prettier: ^3.0.0 - '@scure/base@1.1.7': - resolution: {integrity: sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==} + '@scure/base@1.1.9': + resolution: {integrity: sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==} '@scure/bip32@1.4.0': resolution: {integrity: sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==} + '@scure/bip32@1.5.0': + resolution: {integrity: sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw==} + '@scure/bip39@1.3.0': resolution: {integrity: sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==} + '@scure/bip39@1.4.0': + resolution: {integrity: sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==} + '@sindresorhus/is@5.6.0': resolution: {integrity: sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==} engines: {node: '>=14.16'} - '@solidity-parser/parser@0.16.2': - resolution: {integrity: sha512-PI9NfoA3P8XK2VBkK5oIfRgKDsicwDZfkVq9ZTBCQYGOP1N2owgY2dyLGyU5/J/hQs8KRk55kdmvTLjy3Mu3vg==} - - '@solidity-parser/parser@0.17.0': - resolution: {integrity: sha512-Nko8R0/kUo391jsEHHxrGM07QFdnPGvlmox4rmH0kNiNAashItAilhy4Mv4pK5gQmW5f4sXAF58fwJbmlkGcVw==} - '@solidity-parser/parser@0.18.0': resolution: {integrity: sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA==} @@ -222,11 +224,11 @@ packages: '@types/http-cache-semantics@4.0.4': resolution: {integrity: sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==} - '@types/node@20.14.10': - resolution: {integrity: sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ==} + '@types/node@20.16.11': + resolution: {integrity: sha512-y+cTCACu92FyA5fgQSAI8A1H429g7aSK2HsO7K4XYUWc4dY5IUz55JSDIYT6/VsOLfGy8vmvQYC2hfb0iF16Uw==} - abitype@1.0.5: - resolution: {integrity: sha512-YzDhti7cjlfaBhHutMaboYB21Ha3rXR9QTkNJFzYC4kC8YclaiwPBBBJY8ejFdu2wnJeZCVZSMlQJ7fi8S6hsw==} + abitype@1.0.6: + resolution: {integrity: sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A==} peerDependencies: typescript: '>=5.0.4' zod: ^3 >=3.22.0 @@ -267,13 +269,6 @@ packages: resolution: {integrity: sha512-kiXTspaRYvnIArgE97z5YVVf/cDVQABr3abFRR6mE7yesLMkgu4ujuyV/sgxafQ8wgve0DJQUJ38Z8tkgA2izA==} engines: {node: '>=16'} - antlr4@4.13.1-patch-1: - resolution: {integrity: sha512-OjFLWWLzDMV9rdFhpvroCWR4ooktNg9/nvVYSA5z28wuVpU36QUNuioR1XLnQtcjVlf8npjyz593PxnU/f/Cow==} - engines: {node: '>=16'} - - antlr4ts@0.5.0-alpha.4: - resolution: {integrity: sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ==} - arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} @@ -339,10 +334,6 @@ packages: resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} engines: {node: '>=14'} - commander@11.1.0: - resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==} - engines: {node: '>=16'} - config-chain@1.1.13: resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==} @@ -406,9 +397,9 @@ packages: fast-uri@3.0.1: resolution: {integrity: sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==} - forge-std@https://codeload.github.com/foundry-rs/forge-std/tar.gz/07263d193d621c4b2b0ce8b4d54af58f6957d97d: - resolution: {tarball: https://codeload.github.com/foundry-rs/forge-std/tar.gz/07263d193d621c4b2b0ce8b4d54af58f6957d97d} - version: 1.9.1 + forge-std@https://codeload.github.com/foundry-rs/forge-std/tar.gz/4f57c59f066a03d13de8c65bb34fca8247f5fcb2: + resolution: {tarball: https://codeload.github.com/foundry-rs/forge-std/tar.gz/4f57c59f066a03d13de8c65bb34fca8247f5fcb2} + version: 1.9.3 form-data-encoder@2.1.4: resolution: {integrity: sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw==} @@ -479,8 +470,8 @@ packages: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} engines: {node: '>=8'} - isows@1.0.4: - resolution: {integrity: sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ==} + isows@1.0.6: + resolution: {integrity: sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw==} peerDependencies: ws: '*' @@ -588,8 +579,8 @@ packages: resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} engines: {node: '>=6.0.0'} - prettier-plugin-solidity@1.3.1: - resolution: {integrity: sha512-MN4OP5I2gHAzHZG1wcuJl0FsLS3c4Cc5494bbg+6oQWBPuEamjwDvmGfFMZ6NFzsh3Efd9UUxeT7ImgjNH4ozA==} + prettier-plugin-solidity@1.4.1: + resolution: {integrity: sha512-Mq8EtfacVZ/0+uDKTtHZGW3Aa7vEbX/BNx63hmVg6YTiTXSiuKP0amj0G6pGwjmLaOfymWh3QgXEZkjQbU8QRg==} engines: {node: '>=16'} peerDependencies: prettier: '>=2.3.0' @@ -642,10 +633,6 @@ packages: resolution: {integrity: sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==} engines: {node: '>=14.16'} - semver@6.3.1: - resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} - hasBin: true - semver@7.6.3: resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} engines: {node: '>=10'} @@ -655,23 +642,16 @@ packages: resolution: {integrity: sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==} engines: {node: '>=10'} - solhint-community@4.0.0: - resolution: {integrity: sha512-BERw3qYzkJE64EwvYrp2+iiTN8yAZOJ74FCiL4bTBp7v0JFUvRYCEGZKAqfHcfi/koKkzM6qThsJUceKm9vvfg==} - hasBin: true - solhint-plugin-prettier@0.1.0: resolution: {integrity: sha512-SDOTSM6tZxZ6hamrzl3GUgzF77FM6jZplgL2plFBclj/OjKP8Z3eIPojKU73gRr0MvOS8ACZILn8a5g0VTz/Gw==} peerDependencies: prettier: ^3.0.0 prettier-plugin-solidity: ^1.0.0 - solhint@5.0.1: - resolution: {integrity: sha512-QeQLS9HGCnIiibt+xiOa/+MuP7BWz9N7C5+Mj9pLHshdkNhuo3AzCpWmjfWVZBUuwIUO3YyCRVIcYLR3YOKGfg==} + solhint@5.0.3: + resolution: {integrity: sha512-OLCH6qm/mZTCpplTXzXTJGId1zrtNuDYP5c2e6snIv/hdRVxPfBBz/bAlL91bY/Accavkayp2Zp2BaDSrLVXTQ==} hasBin: true - solidity-comments-extractor@0.0.8: - resolution: {integrity: sha512-htM7Vn6LhHreR+EglVMd2s+sZhcXAirB1Zlyrv5zBuTxieCvjfnRpd7iZk75m/u6NOlEyQ94C6TWbBn2cY7w8g==} - solmate@6.2.0: resolution: {integrity: sha512-AM38ioQ2P8zRsA42zenb9or6OybRjOLXIu3lhIT8rhddUuduCt76pUEuLxOIg9GByGojGz+EbpFdCB6B+QZVVA==} @@ -716,13 +696,13 @@ packages: '@swc/wasm': optional: true - typescript@5.5.3: - resolution: {integrity: sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==} + typescript@5.6.3: + resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} engines: {node: '>=14.17'} hasBin: true - undici-types@5.26.5: - resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + undici-types@6.19.8: + resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} @@ -730,19 +710,22 @@ packages: v8-compile-cache-lib@3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - viem@2.17.4: - resolution: {integrity: sha512-6gmBB85I7z1qt/+yPPS+i4L2jNPJqCs+SEb+26WnKVYez13svSzjYMsU9OYYlPFpQmpGSy9dV2bKW6VX68FTgg==} + viem@2.21.22: + resolution: {integrity: sha512-jU+WniqIhwDXfgWWkNX7YqlGqenzTa5roLDNs2cbcUGQXxG8aQt1vlTqeezM8W1kepkaU/jvR2QSq/lGirpzrQ==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: typescript: optional: true + webauthn-p256@0.0.10: + resolution: {integrity: sha512-EeYD+gmIT80YkSIDb2iWq0lq2zbHo1CxHlQTeJ+KkCILWpVy3zASH3ByD4bopzfk0uCwXxLqKGLqp2W4O28VFA==} + wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - ws@8.17.1: - resolution: {integrity: sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==} + ws@8.18.0: + resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} engines: {node: '>=10.0.0'} peerDependencies: bufferutil: ^4.0.1 @@ -759,7 +742,7 @@ packages: snapshots: - '@adraffy/ens-normalize@1.10.0': {} + '@adraffy/ens-normalize@1.11.0': {} '@babel/code-frame@7.24.7': dependencies: @@ -911,16 +894,18 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@noble/curves@1.4.0': + '@noble/curves@1.4.2': dependencies: '@noble/hashes': 1.4.0 - '@noble/curves@1.4.2': + '@noble/curves@1.6.0': dependencies: - '@noble/hashes': 1.4.0 + '@noble/hashes': 1.5.0 '@noble/hashes@1.4.0': {} + '@noble/hashes@1.5.0': {} + '@openzeppelin/contracts-upgradeable@5.0.2(@openzeppelin/contracts@5.0.2)': dependencies: '@openzeppelin/contracts': 5.0.2 @@ -950,26 +935,31 @@ snapshots: dependencies: prettier: 3.3.3 - '@scure/base@1.1.7': {} + '@scure/base@1.1.9': {} '@scure/bip32@1.4.0': dependencies: '@noble/curves': 1.4.2 '@noble/hashes': 1.4.0 - '@scure/base': 1.1.7 + '@scure/base': 1.1.9 + + '@scure/bip32@1.5.0': + dependencies: + '@noble/curves': 1.6.0 + '@noble/hashes': 1.5.0 + '@scure/base': 1.1.9 '@scure/bip39@1.3.0': dependencies: '@noble/hashes': 1.4.0 - '@scure/base': 1.1.7 - - '@sindresorhus/is@5.6.0': {} + '@scure/base': 1.1.9 - '@solidity-parser/parser@0.16.2': + '@scure/bip39@1.4.0': dependencies: - antlr4ts: 0.5.0-alpha.4 + '@noble/hashes': 1.5.0 + '@scure/base': 1.1.9 - '@solidity-parser/parser@0.17.0': {} + '@sindresorhus/is@5.6.0': {} '@solidity-parser/parser@0.18.0': {} @@ -987,13 +977,13 @@ snapshots: '@types/http-cache-semantics@4.0.4': {} - '@types/node@20.14.10': + '@types/node@20.16.11': dependencies: - undici-types: 5.26.5 + undici-types: 6.19.8 - abitype@1.0.5(typescript@5.5.3): + abitype@1.0.6(typescript@5.6.3): optionalDependencies: - typescript: 5.5.3 + typescript: 5.6.3 acorn-walk@8.3.3: dependencies: @@ -1027,10 +1017,6 @@ snapshots: antlr4@4.13.1: {} - antlr4@4.13.1-patch-1: {} - - antlr4ts@0.5.0-alpha.4: {} - arg@4.1.3: {} argparse@2.0.1: {} @@ -1090,21 +1076,19 @@ snapshots: commander@10.0.1: {} - commander@11.1.0: {} - config-chain@1.1.13: dependencies: ini: 1.3.8 proto-list: 1.2.4 - cosmiconfig@8.3.6(typescript@5.5.3): + cosmiconfig@8.3.6(typescript@5.6.3): dependencies: import-fresh: 3.3.0 js-yaml: 4.1.0 parse-json: 5.2.0 path-type: 4.0.0 optionalDependencies: - typescript: 5.5.3 + typescript: 5.6.3 create-require@1.1.1: {} @@ -1153,7 +1137,7 @@ snapshots: fast-uri@3.0.1: {} - forge-std@https://codeload.github.com/foundry-rs/forge-std/tar.gz/07263d193d621c4b2b0ce8b4d54af58f6957d97d: {} + forge-std@https://codeload.github.com/foundry-rs/forge-std/tar.gz/4f57c59f066a03d13de8c65bb34fca8247f5fcb2: {} form-data-encoder@2.1.4: {} @@ -1227,9 +1211,9 @@ snapshots: is-fullwidth-code-point@3.0.0: {} - isows@1.0.4(ws@8.17.1): + isows@1.0.6(ws@8.18.0): dependencies: - ws: 8.17.1 + ws: 8.18.0 js-sha3@0.8.0: {} @@ -1315,12 +1299,11 @@ snapshots: dependencies: fast-diff: 1.3.0 - prettier-plugin-solidity@1.3.1(prettier@3.3.3): + prettier-plugin-solidity@1.4.1(prettier@3.3.3): dependencies: - '@solidity-parser/parser': 0.17.0 + '@solidity-parser/parser': 0.18.0 prettier: 3.3.3 semver: 7.6.3 - solidity-comments-extractor: 0.0.8 prettier@2.8.8: optional: true @@ -1358,8 +1341,6 @@ snapshots: dependencies: lowercase-keys: 3.0.0 - semver@6.3.1: {} - semver@7.6.3: {} slice-ansi@4.0.0: @@ -1368,46 +1349,22 @@ snapshots: astral-regex: 2.0.0 is-fullwidth-code-point: 3.0.0 - solhint-community@4.0.0(typescript@5.5.3): - dependencies: - '@solidity-parser/parser': 0.16.2 - ajv: 6.12.6 - antlr4: 4.13.1 - ast-parents: 0.0.1 - chalk: 4.1.2 - commander: 11.1.0 - cosmiconfig: 8.3.6(typescript@5.5.3) - fast-diff: 1.3.0 - glob: 8.1.0 - ignore: 5.3.1 - js-yaml: 4.1.0 - lodash: 4.17.21 - pluralize: 8.0.0 - semver: 6.3.1 - strip-ansi: 6.0.1 - table: 6.8.2 - text-table: 0.2.0 - optionalDependencies: - prettier: 2.8.8 - transitivePeerDependencies: - - typescript - - solhint-plugin-prettier@0.1.0(prettier-plugin-solidity@1.3.1(prettier@3.3.3))(prettier@3.3.3): + solhint-plugin-prettier@0.1.0(prettier-plugin-solidity@1.4.1(prettier@3.3.3))(prettier@3.3.3): dependencies: '@prettier/sync': 0.3.0(prettier@3.3.3) prettier: 3.3.3 prettier-linter-helpers: 1.0.0 - prettier-plugin-solidity: 1.3.1(prettier@3.3.3) + prettier-plugin-solidity: 1.4.1(prettier@3.3.3) - solhint@5.0.1(typescript@5.5.3): + solhint@5.0.3(typescript@5.6.3): dependencies: '@solidity-parser/parser': 0.18.0 ajv: 6.12.6 - antlr4: 4.13.1-patch-1 + antlr4: 4.13.1 ast-parents: 0.0.1 chalk: 4.1.2 commander: 10.0.1 - cosmiconfig: 8.3.6(typescript@5.5.3) + cosmiconfig: 8.3.6(typescript@5.6.3) fast-diff: 1.3.0 glob: 8.1.0 ignore: 5.3.1 @@ -1424,8 +1381,6 @@ snapshots: transitivePeerDependencies: - typescript - solidity-comments-extractor@0.0.8: {} - solmate@6.2.0: {} string-width@4.2.3: @@ -1458,27 +1413,27 @@ snapshots: text-table@0.2.0: {} - ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3): + ts-node@10.9.2(@types/node@20.16.11)(typescript@5.6.3): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.11 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.14.10 + '@types/node': 20.16.11 acorn: 8.12.1 acorn-walk: 8.3.3 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.5.3 + typescript: 5.6.3 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 - typescript@5.5.3: {} + typescript@5.6.3: {} - undici-types@5.26.5: {} + undici-types@6.19.8: {} uri-js@4.4.1: dependencies: @@ -1486,25 +1441,31 @@ snapshots: v8-compile-cache-lib@3.0.1: {} - viem@2.17.4(typescript@5.5.3): - dependencies: - '@adraffy/ens-normalize': 1.10.0 - '@noble/curves': 1.4.0 - '@noble/hashes': 1.4.0 - '@scure/bip32': 1.4.0 - '@scure/bip39': 1.3.0 - abitype: 1.0.5(typescript@5.5.3) - isows: 1.0.4(ws@8.17.1) - ws: 8.17.1 + viem@2.21.22(typescript@5.6.3): + 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(typescript@5.6.3) + isows: 1.0.6(ws@8.18.0) + webauthn-p256: 0.0.10 + ws: 8.18.0 optionalDependencies: - typescript: 5.5.3 + typescript: 5.6.3 transitivePeerDependencies: - bufferutil - utf-8-validate - zod + webauthn-p256@0.0.10: + dependencies: + '@noble/curves': 1.6.0 + '@noble/hashes': 1.5.0 + wrappy@1.0.2: {} - ws@8.17.1: {} + ws@8.18.0: {} yn@3.1.1: {} diff --git a/contracts/script/GenerateAlloc.s.sol b/contracts/script/GenerateAlloc.s.sol index 95a1ebf1..855ae54a 100644 --- a/contracts/script/GenerateAlloc.s.sol +++ b/contracts/script/GenerateAlloc.s.sol @@ -144,12 +144,15 @@ contract GenerateAlloc is Script { function setStaking() internal { address impl = Predeploys.getImplAddress(Predeploys.Staking); - address tmp = address(new IPTokenStaking( - 1 gwei, // stakingRounding - 1000, // defaultCommissionRate, 10% - 5000, // defaultMaxCommissionRate, 50% - 500 // defaultMaxCommissionChangeRate, 5% - )); + address tmp = address( + new IPTokenStaking( + 1 gwei, // stakingRounding + 1000, // defaultCommissionRate, 10% + 5000, // defaultMaxCommissionRate, 50% + 500 // defaultMaxCommissionChangeRate, 5% + ) + ); + console2.log("tpm", tmp); vm.etch(impl, tmp.code); diff --git a/contracts/script/TestPrecompileUpgrades.s.sol b/contracts/script/TestPrecompileUpgrades.s.sol index 76228602..18021355 100644 --- a/contracts/script/TestPrecompileUpgrades.s.sol +++ b/contracts/script/TestPrecompileUpgrades.s.sol @@ -16,7 +16,7 @@ import { EIP1967Helper } from "./utils/EIP1967Helper.sol"; import { Predeploys } from "../src/libraries/Predeploys.sol"; abstract contract MockNewFeatures { - function foo() external pure returns(string memory) { + function foo() external pure returns (string memory) { return "bar"; } } @@ -27,17 +27,16 @@ contract IPTokenStakingV2 is IPTokenStaking, MockNewFeatures { uint32 defaultCommissionRate, uint32 defaultMaxCommissionRate, uint32 defaultMaxCommissionChangeRate - ) IPTokenStaking(stakingRounding, defaultCommissionRate, defaultMaxCommissionRate, defaultMaxCommissionChangeRate) { - - } + ) + IPTokenStaking(stakingRounding, defaultCommissionRate, defaultMaxCommissionRate, defaultMaxCommissionChangeRate) + {} } contract IPTokenSlashingV2 is IPTokenSlashing, MockNewFeatures { constructor(address ipTokenStaking) IPTokenSlashing(ipTokenStaking) {} } -contract UpgradeEntrypointV2 is UpgradeEntrypoint, MockNewFeatures { -} +contract UpgradeEntrypointV2 is UpgradeEntrypoint, MockNewFeatures {} /** * @title TestPrecompileUpgrades @@ -60,22 +59,18 @@ contract TestPrecompileUpgrades is Script { vm.startBroadcast(upgradeKey); // ---- Staking - address newImpl = address(new IPTokenStakingV2( - 1 gwei, // stakingRounding - 1000, // defaultCommissionRate, 10% - 5000, // defaultMaxCommissionRate, 50% - 500 // defaultMaxCommissionChangeRate, 5% - )); - ProxyAdmin proxyAdmin = ProxyAdmin( - EIP1967Helper.getAdmin(Predeploys.Staking) + address newImpl = address( + new IPTokenStakingV2( + 1 gwei, // stakingRounding + 1000, // defaultCommissionRate, 10% + 5000, // defaultMaxCommissionRate, 50% + 500 // defaultMaxCommissionChangeRate, 5% + ) ); + ProxyAdmin proxyAdmin = ProxyAdmin(EIP1967Helper.getAdmin(Predeploys.Staking)); console2.log("staking proxy admin", address(proxyAdmin)); console2.log("staking proxy admin owner", proxyAdmin.owner()); - proxyAdmin.upgradeAndCall( - ITransparentUpgradeableProxy(Predeploys.Staking), - newImpl, - "" - ); + proxyAdmin.upgradeAndCall(ITransparentUpgradeableProxy(Predeploys.Staking), newImpl, ""); if (EIP1967Helper.getImplementation(Predeploys.Staking) != newImpl) { revert("Staking not upgraded"); } @@ -84,19 +79,11 @@ contract TestPrecompileUpgrades is Script { } // ---- Slashing - newImpl = address(new IPTokenSlashingV2( - Predeploys.Staking - )); - proxyAdmin = ProxyAdmin( - EIP1967Helper.getAdmin(Predeploys.Slashing) - ); + newImpl = address(new IPTokenSlashingV2(Predeploys.Staking)); + proxyAdmin = ProxyAdmin(EIP1967Helper.getAdmin(Predeploys.Slashing)); console2.log("slashing proxy admin", address(proxyAdmin)); console2.log("slashing proxy admin owner", proxyAdmin.owner()); - proxyAdmin.upgradeAndCall( - ITransparentUpgradeableProxy(Predeploys.Slashing), - newImpl, - "" - ); + proxyAdmin.upgradeAndCall(ITransparentUpgradeableProxy(Predeploys.Slashing), newImpl, ""); if (EIP1967Helper.getImplementation(Predeploys.Slashing) != newImpl) { revert("Slashing not upgraded"); } @@ -106,17 +93,11 @@ contract TestPrecompileUpgrades is Script { // ---- Upgrades newImpl = address(new UpgradeEntrypointV2()); - proxyAdmin = ProxyAdmin( - EIP1967Helper.getAdmin(Predeploys.Upgrades) - ); + proxyAdmin = ProxyAdmin(EIP1967Helper.getAdmin(Predeploys.Upgrades)); console2.log("upgrades proxy admin", address(proxyAdmin)); console2.log("upgrades proxy admin owner", proxyAdmin.owner()); - proxyAdmin.upgradeAndCall( - ITransparentUpgradeableProxy(Predeploys.Upgrades), - newImpl, - "" - ); + proxyAdmin.upgradeAndCall(ITransparentUpgradeableProxy(Predeploys.Upgrades), newImpl, ""); if (keccak256(abi.encode(UpgradeEntrypointV2(Predeploys.Upgrades).foo())) != keccak256(abi.encode("bar"))) { revert("Upgraded to wrong iface"); } diff --git a/contracts/test/script/DeployCore.t.sol b/contracts/test/script/DeployCore.t.sol index 285fa7c3..86597b98 100644 --- a/contracts/test/script/DeployCore.t.sol +++ b/contracts/test/script/DeployCore.t.sol @@ -1,30 +1,27 @@ -// // SPDX-License-Identifier: BUSL-1.1 -// pragma solidity ^0.8.23; +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.23; // /* solhint-disable no-console */ // /* solhint-disable max-line-length */ -// /// NOTE: pragma allowlist-secret must be inline (same line as the pubkey hex string) to avoid false positive -// /// flag "Hex High Entropy String" in CI run detect-secrets +/// NOTE: pragma allowlist-secret must be inline (same line as the pubkey hex string) to avoid false positive +/// flag "Hex High Entropy String" in CI run detect-secrets -// import { Test } from "forge-std/Test.sol"; +import { Test } from "forge-std/Test.sol"; // import { DeployCore } from "../../script/DeployCore.s.sol"; -// contract DeployCoreTest is Test { -// DeployCore private deployCore; - -// function setUp() public { -// deployCore = new DeployCore(); -// } - -// function testDeployDeployCore_run() public { -// // Network shall not deploy the IPTokenStaking contract if IPTOKENSTAKING_DEPLOYER_KEY not set. -// vm.chainId(1513); -// // solhint-disable -// vm.expectRevert('vm.envUint: environment variable "IPTOKENSTAKING_DEPLOYER_KEY" not found'); -// deployCore.run(); - -// // Network shall deploy the IPTokenStaking contract. -// vm.setEnv("IPTOKENSTAKING_DEPLOYER_KEY", "0x123456789abcdef"); -// deployCore.run(); -// } -// } +contract DeployCoreTest is Test { + // DeployCore private deployCore; + // function setUp() public { + // deployCore = new DeployCore(); + // } + // function testDeployDeployCore_run() public { + // // Network shall not deploy the IPTokenStaking contract if IPTOKENSTAKING_DEPLOYER_KEY not set. + // vm.chainId(1513); + // // solhint-disable + // vm.expectRevert('vm.envUint: environment variable "IPTOKENSTAKING_DEPLOYER_KEY" not found'); + // deployCore.run(); + // // Network shall deploy the IPTokenStaking contract. + // vm.setEnv("IPTOKENSTAKING_DEPLOYER_KEY", "0x123456789abcdef"); + // deployCore.run(); + // } +} diff --git a/contracts/test/upgrade/UpgradeEntryPoint.t.sol b/contracts/test/upgrade/UpgradeEntryPoint.t.sol index 1cd2a7f6..8e6081f8 100644 --- a/contracts/test/upgrade/UpgradeEntryPoint.t.sol +++ b/contracts/test/upgrade/UpgradeEntryPoint.t.sol @@ -5,13 +5,11 @@ pragma solidity ^0.8.23; /// NOTE: pragma allowlist-secret must be inline (same line as the pubkey hex string) to avoid false positive /// flag "Hex High Entropy String" in CI run detect-secrets -import { UpgradeEntrypoint, IUpgradeEntrypoint } from "../../src/protocol/UpgradeEntrypoint.sol"; -import { TransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import { IUpgradeEntrypoint } from "../../src/protocol/UpgradeEntrypoint.sol"; import { Test } from "../utils/Test.sol"; contract UpgradeEntrypointTest is Test { - function testUpgradeEntrypoint_planUpgrade() public { // Network shall allow the protocol owner to submit an upgrade plan. string memory name = "upgrade"; diff --git a/contracts/test/utils/Test.sol b/contracts/test/utils/Test.sol index 28446b72..fd3639e5 100644 --- a/contracts/test/utils/Test.sol +++ b/contracts/test/utils/Test.sol @@ -3,9 +3,7 @@ pragma solidity ^0.8.23; /* solhint-disable no-console */ /* solhint-disable max-line-length */ -import { console2 } from "forge-std/console2.sol"; import { Test as ForgeTest } from "forge-std/Test.sol"; -import { TransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import { IPTokenStaking } from "../../src/protocol/IPTokenStaking.sol"; import { IPTokenSlashing } from "../../src/protocol/IPTokenSlashing.sol"; @@ -22,7 +20,7 @@ contract Test is ForgeTest { IPTokenSlashing internal ipTokenSlashing; UpgradeEntrypoint internal upgradeEntrypoint; - function setUp() virtual public { + function setUp() public virtual { GenerateAlloc initializer = new GenerateAlloc(); initializer.disableStateDump(); // Faster tests. Don't call to verify JSON output initializer.setAdminAddresses(upgradeAdmin, admin);