Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Error decoding event with indexed bytes param #507

Closed
dukei opened this issue Jul 22, 2017 · 3 comments
Closed

Error decoding event with indexed bytes param #507

dukei opened this issue Jul 22, 2017 · 3 comments

Comments

@dukei
Copy link

dukei commented Jul 22, 2017

  • [no] I've asked for help in the Truffle Gitter before filing this issue.

Issue

When contract transaction fires event with indexed bytes param truffle fails with an exception

  1. Contract: MetaCoin should send coin correctly:
    Uncaught Error: Number can only safely store up to 53 bits

Steps to Reproduce

  1. Make empty dir
  2. Make truffle init in it
  3. Change MetaCoin.sol line 13 to
    event Transfer(address indexed _from, address indexed _to, uint256 _value, bytes indexed data);
  4. Change MetaCoin.sol line 23 to
    bytes memory empty; Transfer(msg.sender, receiver, amount, empty);
  5. Execute truffle test

Expected Behavior

Tests should pass

Actual Results

Test fails with error

4 passing (485ms)
1 failing

  1. Contract: MetaCoin should send coin correctly:
    Uncaught Error: Number can only safely store up to 53 bits
    at assert (C:\Users\User\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:126109:21)
    at BN.toNumber (C:\Users\User\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:126609:7)
    at C:\Users\User\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:62400:59
    at Array.forEach (native)
    at decodeParams (C:\Users\User\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:62395:9)
    at Object.decodeEvent (C:\Users\User\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:62441:10)
    at C:\Users\User\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:205589:38
    at Array.map (native)
    at Object.decodeLogs (C:\Users\User\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:205559:19)
    at Object.callback (C:\Users\User\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:205688:35)

Environment

  • Operating System: Windows 10
  • Truffle version: Truffle v3.4.5 (core: 3.4.5) Solidity v0.4.11 (solc-js)
  • Ethereum client: TestRPC
  • node version: 7.10.0
  • npm version: 4.3.0
@se3000
Copy link

se3000 commented Aug 3, 2017

@k06a
Copy link
Contributor

k06a commented Nov 9, 2017

Same for me, raising this event:

event MyEvent(address[] indexed wallets);

gives error:

Uncaught Error: Number can only safely store up to 53 bits
      at assert (node_modules/truffle/build/cli.bundled.js:123137:21)
      at BN.toNumber (node_modules/truffle/build/cli.bundled.js:123637:7)
      at node_modules/truffle/build/cli.bundled.js:80331:59
      at Array.forEach (<anonymous>)
      at decodeParams (node_modules/truffle/build/cli.bundled.js:80327:9)
      at Object.decodeEvent (node_modules/truffle/build/cli.bundled.js:80372:10)
      at node_modules/truffle/build/cli.bundled.js:207924:38
      at Array.map (<anonymous>)
      at Object.decodeLogs (node_modules/truffle/build/cli.bundled.js:207895:19)
      at Object.callback (node_modules/truffle/build/cli.bundled.js:208023:35)

Temporary fixed by removing indexed attribute:

event MyEvent(address[] wallets);

@cgewecke
Copy link
Contributor

cgewecke commented Feb 8, 2018

Hello all, thanks for reporting. This is an issue at the web3 dependency and relates to decoding dynamically sized solidity data types. At the moment, they're not indexable. More discussion on this topic at issue #728.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants