Consensys / surya

A set of utilities for exploring Solidity contracts
Apache License 2.0
1.08k stars 119 forks source link

Surya doesn't seem to support some 0.6.x Solidity features #145

Closed cleanunicorn closed 4 years ago

cleanunicorn commented 4 years ago

Consider this contract:

pragma solidity >=0.6.0;

abstract contract Abstract {}

Running surya generates this error

$ surya describe ./contract.sol

/home/daniel/.npm-packages/lib/node_modules/surya/node_modules/yargs/yargs.js:1133
      else throw err
           ^
ParserError: extraneous input 'abstract' expecting {<EOF>, 'pragma', 'import', 'contract', 'interface', 'library'} (4:0)
    at Object.parse (/home/daniel/.npm-packages/lib/node_modules/surya/node_modules/solidity-parser-antlr/dist/index.js:79:11)
    at describe (/home/daniel/.npm-packages/lib/node_modules/surya/lib/describe.js:21:24)
    at Object.require.usage.command [as handler] (/home/daniel/.npm-packages/lib/node_modules/surya/bin/surya:14:5)
    at Object.runCommand (/home/daniel/.npm-packages/lib/node_modules/surya/node_modules/yargs/lib/command.js:235:44)
    at Object.parseArgs [as _parseArgs] (/home/daniel/.npm-packages/lib/node_modules/surya/node_modules/yargs/yargs.js:1046:30)
    at Object.get [as argv] (/home/daniel/.npm-packages/lib/node_modules/surya/node_modules/yargs/yargs.js:989:21)
    at Object.<anonymous> (/home/daniel/.npm-packages/lib/node_modules/surya/bin/surya:101:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

Similarly with this contract

pragma solidity >=0.6.0;

contract Immutable {
    uint public immutable ImmutableUint;
}

We get another error

$ surya describe ./contract.sol

/home/daniel/.npm-packages/lib/node_modules/surya/node_modules/yargs/yargs.js:1133
      else throw err
           ^
ParserError: extraneous input 'ImmutableUint' expecting {';', '='} (5:26)
    at Object.parse (/home/daniel/.npm-packages/lib/node_modules/surya/node_modules/solidity-parser-antlr/dist/index.js:79:11)
    at describe (/home/daniel/.npm-packages/lib/node_modules/surya/lib/describe.js:21:24)
    at Object.require.usage.command [as handler] (/home/daniel/.npm-packages/lib/node_modules/surya/bin/surya:14:5)
    at Object.runCommand (/home/daniel/.npm-packages/lib/node_modules/surya/node_modules/yargs/lib/command.js:235:44)
    at Object.parseArgs [as _parseArgs] (/home/daniel/.npm-packages/lib/node_modules/surya/node_modules/yargs/yargs.js:1046:30)
    at Object.get [as argv] (/home/daniel/.npm-packages/lib/node_modules/surya/node_modules/yargs/yargs.js:989:21)
    at Object.<anonymous> (/home/daniel/.npm-packages/lib/node_modules/surya/bin/surya:101:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

It seems that support for 0.6.x is not included.

GNSPS commented 4 years ago

Whooops, Sorry @cleanunicorn! Only saw this now!

I think this was solved a while ago, right? Gonna close it for now. Feel free to reopen. 😊