Created
November 23, 2018 23:07
-
-
Save rocky/c36a4387061230d429d159a6d3ea91c2 to your computer and use it in GitHub Desktop.
tx.origin antlr vs solc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Return true if node is the tx.origin which refers to an | |
// address. | |
function txOriginViolation(node: any, issues: Issue[]): boolean { | |
const attrib = node.attributes; | |
if (attrib.type !== "address") { | |
return false; | |
} | |
if (attrib.member_name !== "origin") { | |
return false | |
} | |
if (node.childen[0].type === "tx") { | |
const mess = "Don't use `tx.origin`; Use `msg.sender` instead."; | |
const issue = new Issue(node.src, "SWC-115", Severity.Warning, mess); | |
issues.push(issue); | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Testing reveals that line 11 should be: