Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update compiler version #621

Merged
merged 6 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/rulesets/solhint-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
{
Expand Down
2 changes: 1 addition & 1 deletion conf/rulesets/solhint-recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
{
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/security/compiler-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
}
```
Expand Down
3 changes: 2 additions & 1 deletion e2e/03-no-empty-blocks/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"no-empty-blocks": "error"
"no-empty-blocks": "error",
"compiler-version": "off"
}
}
3 changes: 2 additions & 1 deletion e2e/04-dotSol-on-path/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"no-empty-blocks": "off"
"no-empty-blocks": "off",
"compiler-version": "off"
}
}
2 changes: 1 addition & 1 deletion e2e/05-max-warnings/contracts/Foo.sol
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion e2e/06-formatters/contracts/Foo2.sol
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion e2e/06-formatters/contracts/Foo3.sol
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion e2e/06-formatters/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion e2e/08-autofix/_commands/Foo1.sol
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion e2e/08-autofix/_commands/Foo1AfterFix.sol
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion e2e/08-autofix/_commands/Foo1BeforeFix.sol
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
3 changes: 2 additions & 1 deletion e2e/08-autofix/avoid-suicide/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"avoid-suicide": "error"
"avoid-suicide": "error",
"compiler-version": "off"
}
}
3 changes: 2 additions & 1 deletion e2e/08-autofix/contract-name-capwords/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"contract-name-capwords": "error"
"contract-name-capwords": "error",
"compiler-version": "off"
}
}
3 changes: 2 additions & 1 deletion e2e/08-autofix/event-name-capwords/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"event-name-capwords": "error"
"event-name-capwords": "error",
"compiler-version": "off"
}
}
3 changes: 2 additions & 1 deletion e2e/08-autofix/explicit-types/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"explicit-types": ["error", "explicit"]
"explicit-types": ["error", "explicit"],
"compiler-version": "off"
}
}
3 changes: 2 additions & 1 deletion e2e/08-autofix/imports-order/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"imports-order": "error"
"imports-order": "error",
"compiler-version": "off"
}
}
3 changes: 2 additions & 1 deletion e2e/08-autofix/no-console/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"no-console": "error"
"no-console": "error",
"compiler-version": "off"
}
}
3 changes: 2 additions & 1 deletion e2e/08-autofix/payable-fallback/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"payable-fallback": "error"
"payable-fallback": "error",
"compiler-version": "off"
}
}
3 changes: 2 additions & 1 deletion e2e/08-autofix/private-vars-underscore/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"private-vars-leading-underscore": ["error",{"strict":false}]
"private-vars-leading-underscore": ["error",{"strict":false}],
"compiler-version": "off"
}
}
3 changes: 2 additions & 1 deletion e2e/08-autofix/quotes/.doubleQuotes.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"quotes": ["error", "double"]
"quotes": ["error", "double"],
"compiler-version": "off"
}
}
3 changes: 2 additions & 1 deletion e2e/08-autofix/quotes/.singleQuotes.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"quotes": ["error", "single"]
"quotes": ["error", "single"],
"compiler-version": "off"
}
}
2 changes: 1 addition & 1 deletion e2e/formatters-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/security/compiler-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/rules/best-practices/no-global-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion test/rules/best-practices/no-unused-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
16 changes: 8 additions & 8 deletions test/rules/security/compiler-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -123,31 +123,31 @@ 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] },
})

assert.equal(report.errorCount, 0)
})

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] },
})

assert.equal(report.errorCount, 0)
})

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] },
})

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
}`,
Expand Down
Loading