Consensys / vscode-solidity-auditor

Solidity language support and visual security auditor for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor
GNU General Public License v3.0
569 stars 60 forks source link

Function selector is incorrect if there's a comment in the function signature definition #68

Closed mds1 closed 3 years ago

mds1 commented 3 years ago

Steps to reproduce:

  1. See this function has an inline comment
  2. Run "List function signatures" for this file
  3. Notice how it outputs 1137c1f8 => sendToken(address,address,uint256,bytes32,//) when it should output b9bfabe1 => sendToken(address,address,uint256,bytes32,bytes32)

Function linked above:

function sendToken(
    address _receiver,
    address _tokenAddr,
    uint256 _amount,
    bytes32 _pkx, // ephemeral public key x coordinate
    bytes32 _ciphertext
) external payable {
   ...
}
tintinweb commented 3 years ago

@mds1,

fixed it for the upcoming v0.1.1. let me know if you need it earlier and I can probably provide you an alpha.

the function signature extraction is super hacky and I do not expect that a lot of people are using it. if it turns out it is actually being used I might refactor the lexical extraction and actually use the AST.

cheers

PS: v0.1.1 will take a couple more weeks for testing.