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.

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:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cpurtacommented, Feb 15, 2018

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.

1reaction
cpurtacommented, Feb 14, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Invalid number of arguments to Solidity function
So in the end, the issue was that my .sol file was not able to take in an integer parameter from my App.js...
Read more >
Solidity Web3js Invalid number of arguments to ... - Edureka
I'm currently using web3.js to use a function on form submit, which is transfer(address _to, uint256 _value).
Read more >
JSON-RPC API - ethereum.org
Returns number of peers currently connected to the client. Parameters. None. Returns. QUANTITY - integer of the number of connected peers. Example. 1 ......
Read more >
Solidity Best Practices for Smart Contract Security - ConsenSys
From monitoring to timestamp considerations, here are some pro tips to ensure your Ethereum smart contracts are fortified.
Read more >
Documentation - Ethers.js
It was originally designed for use with ethers.io and has since expanded ... in your client, safe and sound; Import and export JSON...
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