From 50b355deb0474b3dbaf0ce71e506150beb0075c3 Mon Sep 17 00:00:00 2001 From: dbale-altoros Date: Wed, 1 Jan 2025 11:18:47 -0300 Subject: [PATCH 1/5] fix: update compiler version --- conf/rulesets/solhint-all.js | 2 +- conf/rulesets/solhint-recommended.js | 2 +- docs/rules/security/compiler-version.md | 4 ++-- lib/rules/security/compiler-version.js | 2 +- package-lock.json | 2 +- test/rules/security/compiler-version.js | 16 ++++++++-------- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/conf/rulesets/solhint-all.js b/conf/rulesets/solhint-all.js index 5c0629e6..0c51314d 100644 --- a/conf/rulesets/solhint-all.js +++ b/conf/rulesets/solhint-all.js @@ -71,7 +71,7 @@ module.exports = Object.freeze({ 'avoid-throw': 'warn', 'avoid-tx-origin': 'warn', 'check-send-result': 'warn', - 'compiler-version': ['error', '^0.8.0'], + 'compiler-version': ['error', '^0.8.24'], 'func-visibility': [ 'warn', { diff --git a/conf/rulesets/solhint-recommended.js b/conf/rulesets/solhint-recommended.js index da7f6095..9e689089 100644 --- a/conf/rulesets/solhint-recommended.js +++ b/conf/rulesets/solhint-recommended.js @@ -43,7 +43,7 @@ module.exports = Object.freeze({ 'avoid-throw': 'warn', 'avoid-tx-origin': 'warn', 'check-send-result': 'warn', - 'compiler-version': ['error', '^0.8.0'], + 'compiler-version': ['error', '^0.8.24'], 'func-visibility': [ 'warn', { diff --git a/docs/rules/security/compiler-version.md b/docs/rules/security/compiler-version.md index 5bb37df6..6082b579 100644 --- a/docs/rules/security/compiler-version.md +++ b/docs/rules/security/compiler-version.md @@ -20,14 +20,14 @@ This rule accepts an array of options: | Index | Description | Default Value | | ----- | ----------------------------------------------------- | ------------- | | 0 | Rule severity. Must be one of "error", "warn", "off". | error | -| 1 | Semver requirement | ^0.8.0 | +| 1 | Semver requirement | ^0.8.24 | ### Example Config ```json { "rules": { - "compiler-version": ["error","^0.8.0"] + "compiler-version": ["error","^0.8.24"] } } ``` diff --git a/lib/rules/security/compiler-version.js b/lib/rules/security/compiler-version.js index 955a53bd..c7e4ef36 100644 --- a/lib/rules/security/compiler-version.js +++ b/lib/rules/security/compiler-version.js @@ -4,7 +4,7 @@ const { severityDescription } = require('../../doc/utils') const ruleId = 'compiler-version' const DEFAULT_SEVERITY = 'error' -const DEFAULT_SEMVER = '^0.8.0' +const DEFAULT_SEMVER = '^0.8.24' const meta = { type: 'security', diff --git a/package-lock.json b/package-lock.json index fef8f0d7..678f151b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "solhint", - "version": "5.0.3", + "version": "5.0.4", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/test/rules/security/compiler-version.js b/test/rules/security/compiler-version.js index b3c51feb..62578565 100644 --- a/test/rules/security/compiler-version.js +++ b/test/rules/security/compiler-version.js @@ -2,7 +2,7 @@ const assert = require('assert') const { assertNoErrors, assertErrorCount, assertErrorMessage } = require('../../common/asserts') const linter = require('../../../lib/index') -const DEFAULT_SEMVER = '^0.8.0' +const DEFAULT_SEMVER = '^0.8.24' describe('Linter - compiler-version', () => { it('should disable only one compiler error on next line', () => { @@ -123,15 +123,15 @@ describe('Linter - compiler-version', () => { }) it('should not report compiler version error on exact match', () => { - const report = linter.processStr('pragma solidity 0.8.0;', { - rules: { 'compiler-version': ['error', '0.8.0'] }, + const report = linter.processStr('pragma solidity 0.8.24;', { + rules: { 'compiler-version': ['error', '0.8.24'] }, }) assert.equal(report.errorCount, 0) }) it('should not report compiler version error on range match', () => { - const report = linter.processStr('pragma solidity ^0.8.0;', { + const report = linter.processStr('pragma solidity ^0.8.24;', { rules: { 'compiler-version': ['error', DEFAULT_SEMVER] }, }) @@ -139,7 +139,7 @@ describe('Linter - compiler-version', () => { }) it('should not report compiler version error on patch bump', () => { - const report = linter.processStr('pragma solidity 0.8.1;', { + const report = linter.processStr('pragma solidity 0.8.25;', { rules: { 'compiler-version': ['error', DEFAULT_SEMVER] }, }) @@ -147,7 +147,7 @@ describe('Linter - compiler-version', () => { }) it('should not report compiler version error on range match', () => { - const report = linter.processStr('pragma solidity ^0.8.2;', { + const report = linter.processStr('pragma solidity ^0.8.25;', { rules: { 'compiler-version': ['error', DEFAULT_SEMVER] }, }) @@ -207,7 +207,7 @@ describe('Linter - compiler-version', () => { it(`should not report compiler version error using default and correct pragma`, () => { const report = linter.processStr( - `pragma solidity ^0.8.1; + `pragma solidity ^0.8.25; pragma experimental ABIEncoderV2; contract Main { @@ -237,7 +237,7 @@ describe('Linter - compiler-version', () => { it(`should not report compiler version error using >= and default and correct pragma`, () => { const report = linter.processStr( - `pragma solidity >=0.8.0; + `pragma solidity >=0.8.24; contract Main { }`, From 7e2e6c0faf94e12316577b6ee87cd8989c4ddda6 Mon Sep 17 00:00:00 2001 From: dbale-altoros Date: Wed, 1 Jan 2025 12:27:43 -0300 Subject: [PATCH 2/5] fix: update compiler version --- e2e/03-no-empty-blocks/.solhint.json | 3 ++- e2e/04-dotSol-on-path/.solhint.json | 3 ++- e2e/05-max-warnings/.solhint.json | 5 ++++- e2e/06-formatters/.solhint.json | 5 ++++- e2e/08-autofix/_commands/Foo1.sol | 2 +- e2e/08-autofix/_commands/Foo1AfterFix.sol | 2 +- e2e/08-autofix/_commands/Foo1BeforeFix.sol | 2 +- e2e/08-autofix/avoid-suicide/.solhint.json | 3 ++- e2e/08-autofix/contract-name-capwords/.solhint.json | 3 ++- e2e/08-autofix/event-name-capwords/.solhint.json | 3 ++- e2e/08-autofix/explicit-types/.solhint.json | 3 ++- e2e/08-autofix/imports-order/.solhint.json | 3 ++- e2e/08-autofix/no-console/.solhint.json | 3 ++- e2e/08-autofix/payable-fallback/.solhint.json | 3 ++- e2e/08-autofix/private-vars-underscore/.solhint.json | 3 ++- e2e/08-autofix/quotes/.doubleQuotes.json | 3 ++- e2e/08-autofix/quotes/.singleQuotes.json | 3 ++- test/rules/best-practices/no-global-import.js | 2 +- test/rules/best-practices/no-unused-import.js | 2 +- 19 files changed, 37 insertions(+), 19 deletions(-) diff --git a/e2e/03-no-empty-blocks/.solhint.json b/e2e/03-no-empty-blocks/.solhint.json index a64b9a28..6a0c26c9 100644 --- a/e2e/03-no-empty-blocks/.solhint.json +++ b/e2e/03-no-empty-blocks/.solhint.json @@ -1,5 +1,6 @@ { "rules": { - "no-empty-blocks": "error" + "no-empty-blocks": "error", + "compiler-version": "off" } } diff --git a/e2e/04-dotSol-on-path/.solhint.json b/e2e/04-dotSol-on-path/.solhint.json index 1ee2c693..97d9efed 100644 --- a/e2e/04-dotSol-on-path/.solhint.json +++ b/e2e/04-dotSol-on-path/.solhint.json @@ -1,5 +1,6 @@ { "rules": { - "no-empty-blocks": "off" + "no-empty-blocks": "off", + "compiler-version": "off" } } diff --git a/e2e/05-max-warnings/.solhint.json b/e2e/05-max-warnings/.solhint.json index 3b8ee84a..b35e781a 100644 --- a/e2e/05-max-warnings/.solhint.json +++ b/e2e/05-max-warnings/.solhint.json @@ -1,3 +1,6 @@ { - "extends": "solhint:all" + "extends": "solhint:all", + "rules": { + "compiler-version": "off" + } } diff --git a/e2e/06-formatters/.solhint.json b/e2e/06-formatters/.solhint.json index 3b8ee84a..b35e781a 100644 --- a/e2e/06-formatters/.solhint.json +++ b/e2e/06-formatters/.solhint.json @@ -1,3 +1,6 @@ { - "extends": "solhint:all" + "extends": "solhint:all", + "rules": { + "compiler-version": "off" + } } diff --git a/e2e/08-autofix/_commands/Foo1.sol b/e2e/08-autofix/_commands/Foo1.sol index 78bcaec7..f5b6b3c6 100644 --- a/e2e/08-autofix/_commands/Foo1.sol +++ b/e2e/08-autofix/_commands/Foo1.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.4; +pragma solidity ^0.8.24; import {ERC20Burnable} from '@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol'; diff --git a/e2e/08-autofix/_commands/Foo1AfterFix.sol b/e2e/08-autofix/_commands/Foo1AfterFix.sol index ca900d69..b45f2bef 100644 --- a/e2e/08-autofix/_commands/Foo1AfterFix.sol +++ b/e2e/08-autofix/_commands/Foo1AfterFix.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.4; +pragma solidity ^0.8.24; import {ERC20Burnable} from '@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol'; diff --git a/e2e/08-autofix/_commands/Foo1BeforeFix.sol b/e2e/08-autofix/_commands/Foo1BeforeFix.sol index 78bcaec7..f5b6b3c6 100644 --- a/e2e/08-autofix/_commands/Foo1BeforeFix.sol +++ b/e2e/08-autofix/_commands/Foo1BeforeFix.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity ^0.8.4; +pragma solidity ^0.8.24; import {ERC20Burnable} from '@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol'; diff --git a/e2e/08-autofix/avoid-suicide/.solhint.json b/e2e/08-autofix/avoid-suicide/.solhint.json index 7f54d632..99c16ecb 100644 --- a/e2e/08-autofix/avoid-suicide/.solhint.json +++ b/e2e/08-autofix/avoid-suicide/.solhint.json @@ -1,5 +1,6 @@ { "rules": { - "avoid-suicide": "error" + "avoid-suicide": "error", + "compiler-version": "off" } } diff --git a/e2e/08-autofix/contract-name-capwords/.solhint.json b/e2e/08-autofix/contract-name-capwords/.solhint.json index e1789abb..d80e50fc 100644 --- a/e2e/08-autofix/contract-name-capwords/.solhint.json +++ b/e2e/08-autofix/contract-name-capwords/.solhint.json @@ -1,5 +1,6 @@ { "rules": { - "contract-name-capwords": "error" + "contract-name-capwords": "error", + "compiler-version": "off" } } diff --git a/e2e/08-autofix/event-name-capwords/.solhint.json b/e2e/08-autofix/event-name-capwords/.solhint.json index 22cb73d9..9fc6a6b8 100644 --- a/e2e/08-autofix/event-name-capwords/.solhint.json +++ b/e2e/08-autofix/event-name-capwords/.solhint.json @@ -1,5 +1,6 @@ { "rules": { - "event-name-capwords": "error" + "event-name-capwords": "error", + "compiler-version": "off" } } diff --git a/e2e/08-autofix/explicit-types/.solhint.json b/e2e/08-autofix/explicit-types/.solhint.json index 7bd7c6a2..f46aa779 100644 --- a/e2e/08-autofix/explicit-types/.solhint.json +++ b/e2e/08-autofix/explicit-types/.solhint.json @@ -1,5 +1,6 @@ { "rules": { - "explicit-types": ["error", "explicit"] + "explicit-types": ["error", "explicit"], + "compiler-version": "off" } } diff --git a/e2e/08-autofix/imports-order/.solhint.json b/e2e/08-autofix/imports-order/.solhint.json index b17afc51..13709f75 100644 --- a/e2e/08-autofix/imports-order/.solhint.json +++ b/e2e/08-autofix/imports-order/.solhint.json @@ -1,5 +1,6 @@ { "rules": { - "imports-order": "error" + "imports-order": "error", + "compiler-version": "off" } } diff --git a/e2e/08-autofix/no-console/.solhint.json b/e2e/08-autofix/no-console/.solhint.json index 2ff50f91..f5e0eb1e 100644 --- a/e2e/08-autofix/no-console/.solhint.json +++ b/e2e/08-autofix/no-console/.solhint.json @@ -1,5 +1,6 @@ { "rules": { - "no-console": "error" + "no-console": "error", + "compiler-version": "off" } } diff --git a/e2e/08-autofix/payable-fallback/.solhint.json b/e2e/08-autofix/payable-fallback/.solhint.json index aa02d3b1..c6939a02 100644 --- a/e2e/08-autofix/payable-fallback/.solhint.json +++ b/e2e/08-autofix/payable-fallback/.solhint.json @@ -1,5 +1,6 @@ { "rules": { - "payable-fallback": "error" + "payable-fallback": "error", + "compiler-version": "off" } } diff --git a/e2e/08-autofix/private-vars-underscore/.solhint.json b/e2e/08-autofix/private-vars-underscore/.solhint.json index 47ff676f..a4b8eeff 100644 --- a/e2e/08-autofix/private-vars-underscore/.solhint.json +++ b/e2e/08-autofix/private-vars-underscore/.solhint.json @@ -1,5 +1,6 @@ { "rules": { - "private-vars-leading-underscore": ["error",{"strict":false}] + "private-vars-leading-underscore": ["error",{"strict":false}], + "compiler-version": "off" } } diff --git a/e2e/08-autofix/quotes/.doubleQuotes.json b/e2e/08-autofix/quotes/.doubleQuotes.json index bd5e47be..21faf61b 100644 --- a/e2e/08-autofix/quotes/.doubleQuotes.json +++ b/e2e/08-autofix/quotes/.doubleQuotes.json @@ -1,5 +1,6 @@ { "rules": { - "quotes": ["error", "double"] + "quotes": ["error", "double"], + "compiler-version": "off" } } diff --git a/e2e/08-autofix/quotes/.singleQuotes.json b/e2e/08-autofix/quotes/.singleQuotes.json index 1cd619b8..cde73263 100644 --- a/e2e/08-autofix/quotes/.singleQuotes.json +++ b/e2e/08-autofix/quotes/.singleQuotes.json @@ -1,5 +1,6 @@ { "rules": { - "quotes": ["error", "single"] + "quotes": ["error", "single"], + "compiler-version": "off" } } diff --git a/test/rules/best-practices/no-global-import.js b/test/rules/best-practices/no-global-import.js index 7a357e18..c163085d 100644 --- a/test/rules/best-practices/no-global-import.js +++ b/test/rules/best-practices/no-global-import.js @@ -28,7 +28,7 @@ describe('Linter - no-global-import', () => { assertErrorMessage(report, 'Specify names to import individually') }) it('should raise warning when using solhint:recommended', () => { - const code = `pragma solidity ^0.8.0; import "./A.sol";` + const code = `pragma solidity ^0.8.24; import "./A.sol";` const report = linter.processStr(code, { extends: 'solhint:recommended', diff --git a/test/rules/best-practices/no-unused-import.js b/test/rules/best-practices/no-unused-import.js index f3666891..32c18cef 100644 --- a/test/rules/best-practices/no-unused-import.js +++ b/test/rules/best-practices/no-unused-import.js @@ -48,7 +48,7 @@ describe('Linter - no-unused-import', () => { }) it('should raise error when using solhint:recommended', () => { - const code = `pragma solidity ^0.8.0; import {A} from "./A.sol";` + const code = `pragma solidity ^0.8.24; import {A} from "./A.sol";` const report = linter.processStr(code, { extends: 'solhint:recommended', From bdb6ed37817d5bb4a89fdabaab5039f830510dd4 Mon Sep 17 00:00:00 2001 From: dbale-altoros Date: Wed, 1 Jan 2025 12:36:11 -0300 Subject: [PATCH 3/5] fix: update compiler version --- e2e/05-max-warnings/.solhint.json | 5 +---- e2e/06-formatters/.solhint.json | 5 +---- e2e/06-formatters/contracts/Foo2.sol | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/e2e/05-max-warnings/.solhint.json b/e2e/05-max-warnings/.solhint.json index b35e781a..3b8ee84a 100644 --- a/e2e/05-max-warnings/.solhint.json +++ b/e2e/05-max-warnings/.solhint.json @@ -1,6 +1,3 @@ { - "extends": "solhint:all", - "rules": { - "compiler-version": "off" - } + "extends": "solhint:all" } diff --git a/e2e/06-formatters/.solhint.json b/e2e/06-formatters/.solhint.json index b35e781a..3b8ee84a 100644 --- a/e2e/06-formatters/.solhint.json +++ b/e2e/06-formatters/.solhint.json @@ -1,6 +1,3 @@ { - "extends": "solhint:all", - "rules": { - "compiler-version": "off" - } + "extends": "solhint:all" } diff --git a/e2e/06-formatters/contracts/Foo2.sol b/e2e/06-formatters/contracts/Foo2.sol index 4a5c2af2..9e0b71cf 100644 --- a/e2e/06-formatters/contracts/Foo2.sol +++ b/e2e/06-formatters/contracts/Foo2.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; +pragma solidity >=0.8.24; contract Foo { uint256 public constant test1 = 1; From 01d37205d9f8b528e356a999ad6acebd6ef88283 Mon Sep 17 00:00:00 2001 From: dbale-altoros Date: Wed, 1 Jan 2025 12:42:14 -0300 Subject: [PATCH 4/5] fix: update compiler version --- e2e/05-max-warnings/contracts/Foo.sol | 2 +- e2e/06-formatters/contracts/Foo3.sol | 2 +- e2e/06-formatters/helpers/helpers.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/05-max-warnings/contracts/Foo.sol b/e2e/05-max-warnings/contracts/Foo.sol index 1c045747..e97cea3c 100644 --- a/e2e/05-max-warnings/contracts/Foo.sol +++ b/e2e/05-max-warnings/contracts/Foo.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; +pragma solidity >=0.8.24; contract Foo { uint256 public constant test1 = 1; diff --git a/e2e/06-formatters/contracts/Foo3.sol b/e2e/06-formatters/contracts/Foo3.sol index 8c1c1e0a..e9ea7297 100644 --- a/e2e/06-formatters/contracts/Foo3.sol +++ b/e2e/06-formatters/contracts/Foo3.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; +pragma solidity >=0.8.24; contract Foo { uint256 public constant TEST1 = 1; diff --git a/e2e/06-formatters/helpers/helpers.js b/e2e/06-formatters/helpers/helpers.js index 8376310f..e23b5682 100644 --- a/e2e/06-formatters/helpers/helpers.js +++ b/e2e/06-formatters/helpers/helpers.js @@ -3,7 +3,7 @@ const foo1Output = [ line: 2, column: 1, severity: 'Error', - message: 'Compiler version >=0.6.0 does not satisfy the ^0.8.0 semver requirement', + message: 'Compiler version >=0.6.0 does not satisfy the ^0.8.24 semver requirement', ruleId: 'compiler-version', fix: null, filePath: 'contracts/Foo.sol', From b96095c3d51c88280b031d96987a69ecf17c2906 Mon Sep 17 00:00:00 2001 From: dbale-altoros Date: Wed, 1 Jan 2025 12:46:36 -0300 Subject: [PATCH 5/5] fix: update compiler version --- e2e/formatters-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/formatters-test.js b/e2e/formatters-test.js index 0b955587..f903f240 100644 --- a/e2e/formatters-test.js +++ b/e2e/formatters-test.js @@ -507,7 +507,7 @@ describe('e2e', function () { { level: 'error', message: { - text: 'Compiler version >=0.6.0 does not satisfy the ^0.8.0 semver requirement', + text: 'Compiler version >=0.6.0 does not satisfy the ^0.8.24 semver requirement', }, locations: [ {