Compile within truffle development console provides wrong ABI
See original GitHub issue- I’ve asked for help in the Truffle Gitter before filing this issue.
Issue
What the issue is, in broad strokes.
I am using the truffle develop
console to run contract tests. When I change my contract code and re-run the test, it recompiles before the test, which sometimes generates an incorrect ABI. I get errors saying Error: Invalid number of arguments to Solidity function
, and then when I check the ABI (in the build/contracts
directory), I can see that it is messed up (wrong function inputs). If I exit the develop console and then run truffle test
from the same directory, the proper ABI is generated in the build directory. Strange!
Steps to Reproduce
Please provide the shortest amount of steps to reproduce your issue.
- Create Solidity contract.
- Run
truffle develop
to open console. - Use
compile
command from the console. - Sometimes, the wrong ABI will be generated.
Expected Behavior
What you expected to happen.
Proper ABI is generated.
Actual Results
What actually happened. Please give examples and support it with screenshots, copied output or error messages.
Wrong ABI is generated.
Environment
- Operating System: macOS High Sierra Version 10.13.1
- Truffle version: v4.0.1
- Ethereum client: truffle develop
- node version: v8.6.0
- npm version: 5.5.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:20 (2 by maintainers)
For me I can fix it by going into my artifact json file and deleting the abi section then running “truffle compile --all” . That way I don’t lose other information by nuking the build folder
I suspect this issue may be the same as the one reported here, with Truffle v5.0.14, especially the original report about wrong function inputs. In that case, additional inputs were observed being copied up from three functions below, despite having not been there even in any previously compiled version of the contract.