Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
TypeError: Cannot read property 'legacyAST' of undefined #1679
Solidity compilers version 0.4.8 and older do not deliver a legacyAST as it is expected by truffle. This means that older sources cannot be tested anymore with the appropriate compiler version.
Steps to Reproduce
A truffle test run that does not throw exceptions.
Thanks for raising this issue.
Would it be possible for you to upgrade Solidity versions?
It's a challenge to continue supporting these old versions of solc, and I am hesitant to suggest doing so because of outstanding bugs present in these older versions.
We will continue to try to find a balance between supporting older versions while maintaining forward momentum. Let us know if you are blocked from being able to upgrade and we can consider next steps. Thank you!
Thank you for your suggestion to avoid the problem by upgrading solc. However, that won't work for me because I am trying to as it were to "recreate history". For my research I re-compile smart contracts with the same compiler version that was used to generate the binary deployed on the mainnet. I gather this information from etherscan. See for example the contract Vitaluck at [https://etherscan.io/address/0xef7c7254c290df3d167182356255cdfd8d3b400b#code]. This was compiled with v0.4.19, so I want to re-compile with the same version and deploy it in my testnet for further analysis.
Could you please fix "truffle-compile" so that it does not throw an exception, but instead sets legacyAST to a value that at least allows the truffle test to finish?
@pieterhartel Ah, my apologies, I forgot about that use case.
It's a bit trickier than you propose because truffle-compile's profiler needs that AST. We would have to skip the profiling in this situation.
There are likely to be other incompatibilities, though, e.g. with Solidity tests. We are notionally working towards supporting multiple compiler versions at the same time, so this compatibility work would naturally fall into that effort.
In the meantime, if you feel like pursuing a fix yourself, please feel free to open a PR! The Truffle team's time is going to be limited this week and next, so we won't likely be able to get to these kinds of compatibility fixes until after that.
This will mean that we won't have the artifact's