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

Decoding function inputs for an Ethereum call failed #932

Closed
ziegfried opened this issue May 12, 2019 · 6 comments
Closed

Decoding function inputs for an Ethereum call failed #932

ziegfried opened this issue May 12, 2019 · 6 comments
Assignees
Milestone

Comments

@ziegfried
Copy link

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Subgraph fails with error when attempting to decode some invalid inputs for an Ethereum function call.

Subgraph instance failed to run: Failed to process trigger: Generating function inputs for an Ethereum call failed = Cannot decode bytes16, code: SubgraphSyncingFailure, id: QmcVgWVzeugoZjAdJHbKxD9Gt1FCB4cq2JzknoNKPdw9zN, updates: 0

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

  1. Clone https://github.com/ziegfried/peepeth-subgraph
  2. Edit subgraph.yaml: Remove line-comment from changeName(bytes16) handler
        # - function: changeName(bytes16)
        #   handler: handleChangeName
  1. Deploy

What is the expected behavior?

Graph node should ignore the invalid function call and keep processing the subgraph.

@Jannis Jannis self-assigned this May 15, 2019
@Jannis Jannis added chains/ethereum bug Something isn't working labels May 15, 2019
@Jannis Jannis added this to the Q2 2019 milestone May 15, 2019
@Jannis
Copy link
Contributor

Jannis commented May 15, 2019

I've managed to reproduce this locally:

   block_number: 6774386
    block_hash: 0x7fe3891b67aea2e048d02d764b83019b21df764a391617d73fcaf88a43db06be
     May 15 16:51:55.304 INFO 1 trigger found in this block for this subgraph
     May 15 16:51:55.305 DEBG Start processing Ethereum call, to: 0xfa28…ce1d, data_source: Contract, handler: handleChangeName, function: changeName(bytes16)
     May 15 16:51:55.589 INFO Done processing Ethereum call, ms: 284, handler: handleChangeName, function: changeName(bytes16)
   component: BlockStream
    May 15 16:51:55.753 DEBG Requesting traces for block 6774518
    May 15 16:51:56.024 DEBG Received 261 traces for block 6774518
    May 15 16:51:56.025 DEBG Skipping 131 irrelevant block(s)
   block_number: 6774518
    block_hash: 0x58dd82c8082b627440289b1cbeb9fbe7c97269ddcffdcf3836487da0f18f9328
     May 15 16:51:56.033 INFO 1 trigger found in this block for this subgraph
   component: BlockStream
    May 15 16:51:56.035 DEBG Terminating chain head updates; channel closed
   May 15 16:51:56.036 ERRO Subgraph instance failed to run: Failed to process trigger: Generating function inputs for an Ethereum call failed = Cannot decode bytes16, code: SubgraphSyncingFailure, id: QmcBMXknjNmo2bZ3G3bqMYFkpZEcjUjV96CocMDnHxdKby

@Jannis
Copy link
Contributor

Jannis commented May 15, 2019

Transaction: https://etherscan.io/tx/0x837a8753e9b9d1a57a055b49b95ddbff85bdb1f099951e4289848bd490ddb171

Input data:

Etherscan:  0x5047b3376c65616465727300000000000000000000000000000000000000000000000000
Graph Node: 0x5047b337737475617274

So somehow our input data is different and invalid. The first four bytes of the input data are for the function signature itself. These are identical in both cases.

If we strip those off, we get:

Etherscan:  6c65616465727300000000000000000000000000000000000000000000000000
Graph Node: 737475617274

@Jannis Jannis assigned ghost May 16, 2019
@ghost
Copy link

ghost commented May 28, 2019

The problem here is that the tx has an input of 0x5047b337737475617274. The function signature expects a bytes16, but after stripping off the first 4 bytes for the method id the function parameters data is only of length 6.

The serialization library we use, ethabi, does not successfully deserialize the input because it is expecting 16 bytes. Solidity could be accepting the 6 byte input (and maybe padding it in the runtime) to populate a bytes16 for processing.

I'm modifying ethabi to handle this.

@Jannis
Copy link
Contributor

Jannis commented Jun 26, 2019

This is worked on in graphprotocol/ethabi#8.

@azf20
Copy link
Contributor

azf20 commented Aug 19, 2021

@Jannis & @fordN do you know if this is still a live issue? The Linked ethabi PR was closed

@leoyvens
Copy link
Collaborator

Closing because this is old and seems fixed

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

5 participants