Invalid number of arguments in Solidity function when using Geth and Parity clients
See original GitHub issue- I’ve asked for help in the Truffle Gitter before filing this issue.
Issue
Encountering Error: Invalid number of arguments to Solidity function
when running unit tests with Geth and Parity clients both using private instant-seal networks. The error is not encountered when using ganache-cli.
I have tried deleting the build folder and running truffle migrate --compile-all --reset
as suggested in other issues. But I am still running into this issue with geth and parity as the client.
Steps to Reproduce
Run truffle test
using ganache-cli as the client. All tests pass.
Kill ganache-cli client instance and set up dockerized geth or parity client
Run truffle test
using either geth or parity client
Some tests fail with Error: Invalid number of arguments to Solidity function
Expected Behavior
Seems like the tests should behave the same when testing with ganache or with geth or parity.
Actual Results
Example contract function that complains about invalid number of arguments between clients:
// MiniMeToken Contract
function generateTokens(address _owner, uint _amount) onlyController public returns (bool) {
...
return true;
}
Testing that function:
contract('MiniMeToken', accounts => {
let token = {}
it('should deploy contracts', async () => {
factory = await MiniMeTokenFactory.new()
token = await MiniMeToken.new(
factory.address,
0,
0,
'MiniMe Test Token',
18,
'MMT',
true)
assert.ok(token)
})
it('should generate tokens', async () => {
await token.generateTokens(accounts[1], 100)
}
})
The argument types are correct and we are passing the correct number of arguments to that function. But when testing with both geth and parity the following error appears:
Contract: MiniMeToken create, destroy, and claim tokens should generate tokens:
Error: Invalid number of arguments to Solidity function
at Object.InvalidNumberOfSolidityArgs (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:41470:16)
at SolidityFunction.validateArgs (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:328709:22)
at SolidityFunction.toPayload (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:328725:10)
at SolidityFunction.sendTransaction (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:328798:24)
at SolidityFunction.execute (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:328891:37)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:317657:16
at new Promise (<anonymous>)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:317617:18
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Environment
- Operating System: macOS High Sierra, testing with docker images
- Truffle version: v4.0.5
- Ethereum client: ganache-cli, geth v1.7.3, parity
- node version: v8.7.0
- npm version: 5.6.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Sure thing. I have my own repo for setting up the image that has the accounts setup, funded and unlocked here: https://github.com/cpurta/geth-devnet. Should also be able to pull the image from docker hub
docker pull purta/geth-devnet:latest
if you want to skip building the images.I was using augur’s image for parity (https://github.com/AugurProject/ethereum-nodes) but it looks like they only unlock the first account. I will probably end up forking and unlocking all accounts then build and push those images.
Ahh. That makes sense. I agree that is pretty misleading. I will run some tests using images with multiple accounts with funds to confirm that is the case.