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

Graphviz interpreter fails on syntax error? #76

Closed
chronaeon opened this issue Dec 12, 2018 · 7 comments
Closed

Graphviz interpreter fails on syntax error? #76

chronaeon opened this issue Dec 12, 2018 · 7 comments

Comments

@chronaeon
Copy link

chronaeon commented Dec 12, 2018

this line is typical of other lines in graphviz generated files that begin with subgraph,

subgraph "cluster[{"type":"MemberAccess","expression":{"type":"Identifier","name":"pending"},"memberName":"to"}]"

except that the naming convention isn't maintained.

instead of:

subgraph "clusterArrays" {
graph [...]
}

subgraph "clusterAddress" {
graph [...]
}

subgraph "clusterReentrancyGuard" {
graph [...]
}

we have

subgraph "cluster[{"type":"MemberAccess","expression":{"type":"Identifier","name":"pending"},"memberName":"to"}]" {
graph [...]
}

so it violates the observed naming convention in this autogenerated file, which returns a syntax error when run through dot -Tpng

@GNSPS GNSPS closed this as completed Apr 28, 2019
@guylando
Copy link

why is this closed if it still does not work?

@GNSPS
Copy link
Collaborator

GNSPS commented May 27, 2019

Has this happened to you in the latest version, @guylando?

Could you please point me to a code example where I could reproduce this crash?

@GNSPS GNSPS reopened this May 27, 2019
@guylando
Copy link

@GNSPS
just running
npm install -g surya
surya inheritance MyContract.sol
produces exactly the problem described here

@GNSPS
Copy link
Collaborator

GNSPS commented May 27, 2019

But do you happen to have the source for "MyContract.sol"? 😊

If you call it with an inexistent file as a parameter it should error out automatically and not output any Graphviz DAG.

@guylando
Copy link

https://github.com/guylando/EthereumSmartContracts/blob/master/SafeUpgradeableTokenERC20/contracts/SafeUpgradeableTokenERC20.sol

"If you call it with an inexistent file as a parameter it should error out automatically and not output any Graphviz DAG.", oh really?! surprising!

@GNSPS
Copy link
Collaborator

GNSPS commented May 28, 2019

So the "MyContract.sol" is actually a placeholder for the name of the contract whose inheritance you want to graph!

Surya is actually working with your example contract. What I did:
$ git clone git@github.com:guylando/EthereumSmartContracts.git
$ cd SafeUpgradeableTokenERC20/contracts
$ surya inheritance SafeUpgradeableTokenERC20.sol

And it outputs a Graphviz valid file.

There are other options to run Surya on your codebase, though. Some examples are:

$ surya inheritance contracts/**/*.sol <- calling it with a glob pattern will pass along a list of files to be fed to Surya that will all be processed together
$ surya inheritance -i SafeUpgradeableTokenERC20.sol <- using the -i (or --importer) flag actually fetches all the files that are imported in the files passed along automatically

@GNSPS
Copy link
Collaborator

GNSPS commented May 28, 2019

This being said I don't think there actually is a bug here! 😄 But let me know if you still have troubles and I'll reopen the issue.

@GNSPS GNSPS closed this as completed Jan 13, 2020
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