-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Outputting of ast and bytecode is inconsistent #5758
Comments
You need an output selector of |
Also, the |
When I use `--bin` the file I get is different than the output in bytecode. I can share the diff if that would be helpful.
When I deployed the --bin output, I got an error about being out of gas. Although now that I think about it, I might have forgotten to prefix with "0x"
|
Oh. I think the output is different because the optimizer runs are different! |
Prefixing the output of --bin with "0x" made truffle happy. I'll open an issue with them. Can you explain why an empty looking selector enables the ast? Is that intentional? It should probably be documented since the docs make it look like "ast" will work. |
We recently clarified that in the documentation: https://solidity.readthedocs.io/en/develop/using-the-compiler.html#input-description The reason is that the AST is associated with a source file and not a contract within the source file, so you use Please tell me if the explanation in the documentation is still insufficient. |
Aha. That explains my confusion. I was reading the docs for 0.4.25 to match the compiler I was using and so the docs still had the old information about the AST.
… On Jan 8, 2019, at 2:51 AM, chriseth ***@***.***> wrote:
We recently clarified that in the documentation: https://solidity.readthedocs.io/en/develop/using-the-compiler.html#input-description
The reason is that the AST is associated with a source file and not a contract within the source file, so you use "fileName": { "": ["ast"]}.
Please tell me if the explanation in the documentation is still insufficient.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I am using solc to compile some external contracts and then pass these files to truffle for my repo in an external compile step.
I have it working, but it requires some workarounds that I don't think should be necessary. Truffle requires both the abi and the bytecode.
There is no
--bytecode
flag, so I had to switch to using--standard-json
which allows outputing "evm.bytecode.object": (More detail on how I did this at trufflesuite/truffle#1607)But I just ran into another problem; the json output doesn't have an
ast
section at all. I've tried setting outputSelection to["*"]
,["abi", "ast", "evm"]
,["abi", "legacyAST", "evm"]
and a few other combinations, but none of them included the ast.For now I'm compiling twice. Once with
--ast-json
to get the ast, and once with--standard-json
to get the bytecode (which I have to prepend with "0x"). Let me know if I should open this as a seperate issue.This whole process seems more complicated than it should be. What am I missing?
Specification
--bytecode
flag to solc that outputs the evm.bytecode.object. I'm not sure if it should be prefixed with 0x or not. Truffle expects the prefix and expects no new-lines.ast
missing from JSON outputThe text was updated successfully, but these errors were encountered: