Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

[Profiler] Truffle sometimes fails to compile #1713

Closed
1 task done
maxsam4 opened this issue Feb 13, 2019 · 11 comments
Closed
1 task done

[Profiler] Truffle sometimes fails to compile #1713

maxsam4 opened this issue Feb 13, 2019 · 11 comments

Comments

@maxsam4
Copy link
Contributor

maxsam4 commented Feb 13, 2019


Issue

When solidity code has changed a lot since the last compile, truffle compile fails most of the time. The exact error thrown is

Using network 'development'.

ReferenceError: e is not defined
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:267:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:255:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:255:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:255:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:255:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:255:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
ReferenceError: e is not defined
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:267:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:255:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:255:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:255:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:255:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:255:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)
    at async.whilst.fileFinished (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:278:1)
    at next (/home/max/Desktop/Ethereum/truffle 5/polymath-core/node_modules/truffle/build/webpack:/~/async/dist/async.js:5223:1)

:23
(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var __GLOBAL__I_000101=Module["__GLOBAL__I_000101"]=asm["__GLOBAL__I_000101"];var __GLOBAL__sub_I_ABIFunctions_cpp=Module["__GLOBAL__sub_I_ABIFunctions_cpp"]=asm["__GLOBAL__sub_I_ABIFunctions_cpp"];var __GLOBAL__sub_I_ABI_cpp=Module["__GLOBAL__sub_I_ABI_cpp"]=asm["__GLOBAL__sub_I_ABI_cpp"];var __GLOBAL__sub_I_ASTJsonConverter_cpp=Module["__GLOBAL__sub_I_ASTJsonConverter_cpp"]=asm["__GLOBAL__sub_I_ASTJsonConverter_cpp"];var __GLOBAL__sub_I_AST_cpp=Module["__GLOBAL__sub_I_AST_cpp"]=asm["__GLOBAL__sub_I_AST_cpp"];var __GLOBAL__sub_I_ArrayUtils_cpp=Module["__GLOBAL__sub_I_ArrayUtils_cpp"]=asm["__GLOBAL__sub_I_ArrayUtils_cpp"];var __GLOBAL__sub_I_AsmAnalysis_cpp=Module["__GLOBAL__sub_I_AsmAnalysis_cpp"]=asm["__GLOBAL__sub_I_AsmAnalysis_cpp"];var __GLOBAL__sub_I_CompilerContext_cpp=Module["__GLOBAL__sub_I_CompilerContext_cpp"]=asm["__GLOBAL__sub_I_CompilerContext_cpp"];var __GLOBAL__sub_I_CompilerStack_cpp=Module["__GLOBAL__sub_I_CompilerStack_cpp"]=asm["__GLO
abort({}). Build with -s ASSERTIONS=1 for more info.

I suspect that the reason behind this is that solcjs is used by the parser in profiler (thanks to @gnidan for pointing that out in gitter) while I am using native solc for actual compilation. The native solc being used and solcjs being used are of different version which I suspect might be causing some issues. I am not sure though. The issue can very well be something completely different.

The issue goes away on clearing the build folder.

Steps to Reproduce

I don't have reliable steps to reproduce it. I reckon trying to compile something with solc 0.5.0 and then changing the hell outa it and recompiling. Make sure that a different version of solcjs is cached to be used by the profiler.

Environment

  • Operating System: Ubuntu bionic
  • Ethereum client: ganache
  • Truffle v5.0.4 (core: 5.0.4)
  • Solidity - native (solc-js)
  • Node v8.12.0
@mattcrooks
Copy link

Seeing something similar in our environment (same as above) when using Gulp watch task. Deleting build folder resolves it.

@AC0DEM0NK3Y
Copy link

This looks very similar to #1659

@gnidan
Copy link
Contributor

gnidan commented Apr 3, 2019

This might be fixed by the outstanding PR #1720, which needs to be revisited. Will add that to the to-dos for this week or next. Thanks all!

@eggplantzzz
Copy link
Contributor

Is this still an issue on the latest version of Truffle (v5.0.21)?

@maxsam4
Copy link
Contributor Author

maxsam4 commented Jun 11, 2019

@eggplantzzz I tried it a bit with v5.0.21 and I did not get this error. However, instead of throwing this error, truffle compiled invalid code which caused invalid opcode error when running truffle migrate. I think that the fix you included for this (or something else) broke some other component.

Maybe this error is still present. I did not try much as truffle v5.0.21 was unusable for me.

@eggplantzzz
Copy link
Contributor

To be honest I'm not sure if this was ever directly addressed or reproduced on my part but some of the code related to compilation/parsing has been worked on since 5.0.4. If you are able to provide specific reproduction steps then I would be happy to try and troubleshoot this. Let me know!

@wbt
Copy link
Contributor

wbt commented Jul 9, 2019

instead of throwing this error, truffle compiled invalid code which caused invalid opcode error when running truffle migrate. I think that the fix you included for this (or something else) broke some other component.

I wonder if this is related to Solidity issue 6977, which @chriseth thinks is actually a problem in Truffle?

@eggplantzzz
Copy link
Contributor

@wbt Just to confirm, you said you are unable to reproduce this? If you ever figure out a way to do this reliably then I would appreciate it! In the meantime, however, I will keep a look out for this issue.

@wbt
Copy link
Contributor

wbt commented Jul 11, 2019

I have not reproduced the specific issue ReferenceError: e is not defined as described in OP above. I have seen the issue in Solidity issue 6977 several times but lately I have been avoiding recompilation, largely to avoid that issue and the associated delays in real development progress on the parts of the dapp that are not the smart contracts. If I do get reliable reproduction steps I will post them or at least a link to them in that Solidity issue.

I put the cross-link in here because there may be a relationship between the two, as suggested by OP on June 11, like a fix for the original problem causing the other one...or maybe they are two intermittent independent bugs.

@eggplantzzz
Copy link
Contributor

Is this still a problem that exists on current Truffle (5.1.16)? I feel like this may have been solved. If someone can produce this error, let us know!

@gnidan
Copy link
Contributor

gnidan commented Apr 15, 2020

So this issue is still a mystery, then.

The original issue is almost certainly out of date (we recently removed async/whilst in that code, e.g., and even before that commit, a misnamed e variable would've been caught ~1y ago when we set up a linter).

Unless there's evidence that there's still a real issue here, or something actionable for us, going to mark this one as closed for issue maintenance.

Happy to re-open if there's further work here; let us know! Thanks!

@gnidan gnidan closed this as completed Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants