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 { }`,