Skip to content

Commit

Permalink
fix: update compiler version
Browse files Browse the repository at this point in the history
  • Loading branch information
dbale-altoros committed Jan 1, 2025
1 parent 2bf186f commit 50b355d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
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
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.

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

0 comments on commit 50b355d

Please sign in to comment.