question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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.

  1. Create Solidity contract.
  2. Run truffle develop to open console.
  3. Use compile command from the console.
  4. 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:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bijeebusscommented, Dec 18, 2017

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

0reactions
wbtcommented, Jul 2, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compile contracts - Truffle Suite
This will make all contracts within AnotherContract.sol available. Here, AnotherContract.sol is relative to the path of the current contract being written. Note ...
Read more >
How to interact with a contract from Truffle console without ...
Launch truffle console : truffle console --network live --verbose-rpc with live the main network configured in the truffle-config.js file.
Read more >
Truffle Suite tutorial: How to develop Ethereum smart contracts
This tutorial focuses on smart contracts written in Solidity and using the Truffle ... Truffle provides the compiler for smart contracts.
Read more >
5 minute guide to deploying smart contracts with Truffle and ...
By default, Truffle only deploys to the local developer network. truffle deploy --network ropsten. You should see a console log as follows: Running...
Read more >
Truffle Console Error When Trying To Access The "totalSupply ...
truffle (development)> Token.deployed().then(function(instance) {token ... also see this error if you are not using the correct ABI for the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found