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

String decoding breaks #65

Open
montyanderson opened this issue May 25, 2018 · 3 comments
Open

String decoding breaks #65

montyanderson opened this issue May 25, 2018 · 3 comments

Comments

@montyanderson
Copy link

Decoding a name() returns (string) breaks.

  Error: Number can only safely store up to 53 bits
      at assert (node_modules/bn.js/lib/bn.js:6:21)
      at BN.toNumber (node_modules/bn.js/lib/bn.js:506:7)
      at decodeSingle (node_modules/ethereumjs-abi/lib/index.js:234:52)
      at decodeSingle (node_modules/ethereumjs-abi/lib/index.js:214:17)
      at Function.ABI.rawDecode (node_modules/ethereumjs-abi/lib/index.js:367:19)
      at app.use (index.js:42:21)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)

@montyanderson
Copy link
Author

This was actually due to passing in a string to abi.rawDecode and it failing silently.

Possible we should check that the data argument is definitely a buffer?

@k06a
Copy link

k06a commented Jun 28, 2019

Same problem actual for me:

const inTypes = [
    'address',
    'address',
    'address',
    'address',
    'uint256',
    'uint256',
    'uint256',
    'uint256',
    'uint256',
    'uint256',
    'bytes',
    'bytes',
    '[]',
    'uint256',
    'bytes[]'
];

const input = '0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000006924a03bb710eaf199ab6ac9f2bb148215ae9b5d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a258b39954cef5cb142fd567a46cddb31a67012400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ce954ae8b5d1cf0000000000000000000000000000000000000000000000036c090d0ca6888000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005d15e7c50000000000000000000000000000000000000000000000000000016b9d8e9ab2000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000024f47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024f47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000421b01fda954331f6f5430d93ab7a884458b4b5259e6ce2127e3c41a6090d10481375023f3c61afb372349ec0ecbd0e476593cce90cc8dbb46cf569875910753705403000000000000000000000000000000000000000000000000000000000000';

abi.rawDecode(inTypes, Buffer.from(input, 'hex'))

@k06a
Copy link

k06a commented Jun 28, 2019

It seems I wrongly parsed argument types:

marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])

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

No branches or pull requests

3 participants