Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getPastEvents fails when called with 'allEvents' #2467

Closed
marcscherer opened this issue Mar 6, 2019 · 4 comments
Closed

getPastEvents fails when called with 'allEvents' #2467

marcscherer opened this issue Mar 6, 2019 · 4 comments
Labels
Bug Addressing a bug

Comments

@marcscherer
Copy link

when using the following code in beta.48 returns the error below. It worked fine in beta.47. Changing "allEvents" to a certain event will also work.

```web3Contract.getPastEvents('allEvents', {
        fromBlock: startBlock,
        toBlock: endBlock,
    });
```
Error: Empty outputs array given!
    at AbiCoder.decodeParameters (C:\Projects\myproj\node_modules\web3-eth-abi\dist\web3-eth-abi.cjs.js:61:15)
    at AbiCoder.decodeLog (C:\Projects\myproj\node_modules\web3-eth-abi\dist\web3-eth-abi.cjs.js:123:27)
    at AllEventsLogDecoder.decode (C:\Projects\myproj\node_modules\web3-eth-contract\dist\web3-eth-contract.cjs.js:246:45)
    at AllEventsLogDecoder.decode (C:\Projects\myproj\node_modules\web3-eth-contract\dist\web3-eth-contract.cjs.js:276:85)
    at C:\Projects\myproj\node_modules\web3-eth-contract\dist\web3-eth-contract.cjs.js:831:43
    at Array.map (<anonymous>)
    at AllPastEventLogsMethod.afterExecution (C:\Projects\myproj\node_modules\web3-eth-contract\dist\web3-eth-contract.cjs.js:830:28)
    at AllPastEventLogsMethod._callee$ (C:\Projects\myproj\node_modules\web3-core-method\dist\web3-core-method.cjs.js:354:35)
    at tryCatch (C:\Projects\myproj\node_modules\regenerator-runtime\runtime.js:62:40)
    at Generator.invoke [as _invoke] (C:\Projects\myproj\node_modules\regenerator-runtime\runtime.js:288:22)
    at Generator.prototype.(anonymous function) [as next] (C:\Projects\myproj\node_modules\regenerator-runtime\runtime.js:114:21)
    at asyncGeneratorStep (C:\Projects\myproj\node_modules\@babel\runtime\helpers\asyncToGenerator.js:3:24)
    at _next (C:\Projects\myproj\node_modules\@babel\runtime\helpers\asyncToGenerator.js:25:9)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

Versions

  • web3.js: beta.48
@nivida nivida added the Needs Clarification Requires additional input label Mar 7, 2019
@nivida
Copy link
Contributor

nivida commented Mar 7, 2019

There was a similar issue regarding the getPastEvents method. I will check if this already got solved but not released.

@davekaj
Copy link

davekaj commented Mar 7, 2019

I'm getting a similar failure. My error is:

(node:97348) UnhandledPromiseRejectionWarning: Error: Empty outputs array given!
    at AbiCoder.decodeParameters (/Users/davidkajpust/coding-no-icloud-backup/thegraph/research/soho-token-contracts/contracts/subgraph/node_modules/web3-eth-abi/dist/web3-eth-abi.cjs.js:61:15)
    at AbiCoder.decodeLog (/Users/davidkajpust/coding-no-icloud-backup/thegraph/research/soho-token-contracts/contracts/subgraph/node_modules/web3-eth-abi/dist/web3-eth-abi.cjs.js:123:27)
.....

For me, I am making a pretty typical web3 transaction:

let test = gns.methods.registerDomain('Compound', governor).send({ from: governor })

And it actually works, and the tx is successful as seen in ganache logs. The solidity function is:

    function registerDomain (string calldata _domainName, address _owner) external onlyGovernance {
        gnsDomains[keccak256(abi.encodePacked(_domainName))] = Domain({owner: _owner});
        emit domainAdded(_domainName, keccak256(abi.encodePacked(_domainName)), _owner);
    }

The abi of the function is:

    {
      "constant": false,
      "inputs": [
        {
          "name": "_domainName",
          "type": "string"
        },
        {
          "name": "_owner",
          "type": "address"
        }
      ],
      "name": "registerDomain",
      "outputs": [],
      "payable": false,
      "stateMutability": "nonpayable",
      "type": "function"
    },

I think it has to do with outputs of the abi function being an empty array. Is it possible there was an upgrade to the solc compiler, that changed outputs, and now this is causing an error in web3js?

@nivida
Copy link
Contributor

nivida commented Mar 14, 2019

@davekaj Thanks for the additional information! I will check and fix this asap.

@nivida nivida added Bug Addressing a bug and removed Needs Clarification Requires additional input labels Mar 18, 2019
@nivida
Copy link
Contributor

nivida commented Mar 18, 2019

This got fixed with PR #2458.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

3 participants