{"action":"opened","issue":{"url":"https://api.github.com/repos/trufflesuite/truffle/issues/569","repository_url":"https://api.github.com/repos/trufflesuite/truffle","labels_url":"https://api.github.com/repos/trufflesuite/truffle/issues/569/labels{/name}","comments_url":"https://api.github.com/repos/trufflesuite/truffle/issues/569/comments","events_url":"https://api.github.com/repos/trufflesuite/truffle/issues/569/events","html_url":"https://github.com/trufflesuite/truffle/issues/569","id":257671454,"number":569,"title":"Validating the arguments of an overloaded function fails due to having a different number of parameters than the base function","user":{"login":"rzv01","id":6143342,"avatar_url":"https://avatars2.githubusercontent.com/u/6143342?v=4","gravatar_id":"","url":"https://api.github.com/users/rzv01","html_url":"https://github.com/rzv01","followers_url":"https://api.github.com/users/rzv01/followers","following_url":"https://api.github.com/users/rzv01/following{/other_user}","gists_url":"https://api.github.com/users/rzv01/gists{/gist_id}","starred_url":"https://api.github.com/users/rzv01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rzv01/subscriptions","organizations_url":"https://api.github.com/users/rzv01/orgs","repos_url":"https://api.github.com/users/rzv01/repos","events_url":"https://api.github.com/users/rzv01/events{/privacy}","received_events_url":"https://api.github.com/users/rzv01/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-14T10:32:45Z","updated_at":"2017-09-14T10:32:45Z","closed_at":null,"author_association":"NONE","body":"- [X] I've asked for help in the [Truffle Gitter](http://gitter.im/Consensys/truffle) before filing this issue.\r\n\r\n---------------------------\r\n\r\n## Issue\r\n\r\nAs the title says, attempting to call an overloaded function from e.g. a JS test fails, since the validation for the number of function parameters fails, not taking into account that there might be 2 functions with the same name.\r\n\r\n## Steps to Reproduce\r\nIn a contract:\r\n\r\n```\r\nfunction theFn(string p1) {}\r\n\r\nfunction theFn(string p1, string p2) {}\r\n```\r\n\r\nIn a test:\r\n`\r\ninstance.theFn.call('first param', 'second param')\r\n`\r\n\r\nwill fail, since the validator in `cli.bundled.js` (see full stacktrace below) doesn't take into account that there could be multiple functions with the same name, but different number of parameters.\r\n\r\nIt's important to call the function that is defined last, that's the one ignored by the validator (calling the first version of the function, with only 1 param, works fine).\r\n\r\n## Expected Behavior\r\n\r\nI would expect to be able to call an overloaded function from js tests, since it's valid Solidity. \r\n\r\n## Actual Results\r\n\r\n```\r\n Error: Invalid number of arguments to Solidity function\r\n      at Object.InvalidNumberOfSolidityArgs (/usr/lib/node_modules/truffle/build/cli.bundled.js:37282:16)\r\n      at SolidityFunction.validateArgs (/usr/lib/node_modules/truffle/build/cli.bundled.js:223127:22)\r\n      at SolidityFunction.toPayload (/usr/lib/node_modules/truffle/build/cli.bundled.js:223143:10)\r\n      at SolidityFunction.call (/usr/lib/node_modules/truffle/build/cli.bundled.js:223184:24)\r\n      at /usr/lib/node_modules/truffle/build/cli.bundled.js:212184:16\r\n      at Promise (<anonymous>)\r\n      at /usr/lib/node_modules/truffle/build/cli.bundled.js:212175:18\r\n      at <anonymous>\r\n      at process._tickCallback (internal/process/next_tick.js:188:7)\r\n```\r\n\r\n## Environment\r\n\r\n* Operating System: CentOS 7\r\n* Truffle version: v3.4.9\r\n* Ethereum client: EthereumJS TestRPC v4.1.1 (ganache-core: 1.1.2)\r\n* node version: v8.4.0\r\n* npm version: 5.3.0\r\n"}}
{"actor":{"display_login":"rzv01"}}