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

Solgraph return blank .dot file on large contract #3

Closed
Bunjin opened this issue Jul 7, 2016 · 4 comments
Closed

Solgraph return blank .dot file on large contract #3

Bunjin opened this issue Jul 7, 2016 · 4 comments

Comments

@Bunjin
Copy link

Bunjin commented Jul 7, 2016

Hey there Raine,

A real issue this time.
I have been able (after some trouble with npm install) to install solgraph.

Also for some reason the link has not been made and I have to start it with
sudo node /usr/local/lib/node_modules/solgraph/dist/solgraph.js mycontract.sol > graph.dot

Anyways, no big deal, I have been able to generate the graph from the example contract and it works fine.

But my real issue is that when I turn to a more complex contract, it returns (silently) a blank .dot file.
Any idea as to why and how to proceed ?

(I'm on gitter solidity we can speak there if you prefer)

Thanks again !!

@raineorshine
Copy link
Owner

Thanks for reporting! I'm just as excited as you to be able run this on full contracts (like the DAO). It is failing silently because the parser is just missing certain constructs that are being used in complex, real-world constructs that are not used in my simple test contracts. The next step would be to test this on slightly larger contracts, one-step-at-a-time, to identify which specific Solidity constructs are being missed by the parser.

My idea is to run it on a sampling of contracts from dapp-bin. That should give us a good representation of different Solidity contracts.

If you'd like to help, it would be awesome if you could find a small-ish contract that breaks solgraph and isolate what construct is different that it does not support. Then we can add the necessary unit test and implementation to get it to work.

@elenadimitrova
Copy link

First of all: good work! :)
But I am having similar problems as @Bunjin with large contracts. I get the following parse error

Parse error
{ [SyntaxError: Expected "!=", "!==", "%", "%=", "&", "&&", "&=", "*", "*=", "+", "++", "+=", ",", "-", "--", "-=", "/", "/*", "//", "/=", ";", "<", "<<", "<<=", "<=", "=", "==", "===", ">", ">=", ">>", ">>=", ">>>", ">>>=", "?", "^", "^=", "in", "instanceof", "|", "|=", "||", comment, end of line or whitespace but "f" found. Line: 26, Column: 21]
  message: 'Expected "!=", "!==", "%", "%=", "&", "&&", "&=", "*", "*=", "+", "++", "+=", ",", "-", "--", "-=", "/", "/*", "//", "/=", ";", "<", "<<", "<<=", "<=", "=", "==", "===", ">", ">=", ">>", ">>=", ">>>", ">>>=", "?", "^", "^=", "in", "instanceof", "|", "|=", "||", comment, end of line or whitespace but "f" found. Line: 26, Column: 21',
  expected: 
   [ { type: 'literal', value: '!=', description: '"!="' },
     { type: 'literal', value: '!==', description: '"!=="' },
     { type: 'literal', value: '%', description: '"%"' },
     { type: 'literal', value: '%=', description: '"%="' },
     { type: 'literal', value: '&', description: '"&"' },
     { type: 'literal', value: '&&', description: '"&&"' },
     { type: 'literal', value: '&=', description: '"&="' },
     { type: 'literal', value: '*', description: '"*"' },
     { type: 'literal', value: '*=', description: '"*="' },
     { type: 'literal', value: '+', description: '"+"' },
     { type: 'literal', value: '++', description: '"++"' },
     { type: 'literal', value: '+=', description: '"+="' },
     { type: 'literal', value: ',', description: '","' },
     { type: 'literal', value: '-', description: '"-"' },
     { type: 'literal', value: '--', description: '"--"' },
     { type: 'literal', value: '-=', description: '"-="' },
     { type: 'literal', value: '/', description: '"/"' },
     { type: 'literal', value: '/*', description: '"/*"' },
     { type: 'literal', value: '//', description: '"//"' },
     { type: 'literal', value: '/=', description: '"/="' },
     { type: 'literal', value: ';', description: '";"' },
     { type: 'literal', value: '<', description: '"<"' },
     { type: 'literal', value: '<<', description: '"<<"' },
     { type: 'literal', value: '<<=', description: '"<<="' },
     { type: 'literal', value: '<=', description: '"<="' },
     { type: 'literal', value: '=', description: '"="' },
     { type: 'literal', value: '==', description: '"=="' },
     { type: 'literal', value: '===', description: '"==="' },
     { type: 'literal', value: '>', description: '">"' },
     { type: 'literal', value: '>=', description: '">="' },
     { type: 'literal', value: '>>', description: '">>"' },
     { type: 'literal', value: '>>=', description: '">>="' },
     { type: 'literal', value: '>>>', description: '">>>"' },
     { type: 'literal', value: '>>>=', description: '">>>="' },
     { type: 'literal', value: '?', description: '"?"' },
     { type: 'literal', value: '^', description: '"^"' },
     { type: 'literal', value: '^=', description: '"^="' },
     { type: 'literal', value: 'in', description: '"in"' },
     { type: 'literal',
       value: 'instanceof',
       description: '"instanceof"' },
     { type: 'literal', value: '|', description: '"|"' },
     { type: 'literal', value: '|=', description: '"|="' },
     { type: 'literal', value: '||', description: '"||"' },
     { type: 'other', description: 'comment' },
     { type: 'other', description: 'end of line' },
     { type: 'other', description: 'whitespace' } ],
  found: 'f',
  location: 
   { start: { offset: 611, line: 26, column: 21 },
     end: { offset: 612, line: 26, column: 22 } },
  name: 'SyntaxError' }

@raineorshine
Copy link
Owner

Thanks for reporting! Can you paste here line 26 of your contract where the error is occurring (with a few lines above and below for context)?

@raineorshine
Copy link
Owner

A lot of the parsing errors got fixed with solidity-parser v0.1.0. If the problem persists, feel free to reopen. If there is a rendering issue, please create a new issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants