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

eth_call via Graph Node returns "Required data unavailable" #7023

Closed
2 tasks done
akshatmittal opened this issue Feb 6, 2024 · 14 comments · Fixed by #7229
Closed
2 tasks done

eth_call via Graph Node returns "Required data unavailable" #7023

akshatmittal opened this issue Feb 6, 2024 · 14 comments · Fixed by #7229
Assignees
Labels
T-bug Type: bug

Comments

@akshatmittal
Copy link

akshatmittal commented Feb 6, 2024

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

anvil 0.2.0 (0688b5a 2024-02-06T00:22:52.883641000Z)

What command(s) is the bug in?

anvil --fork-url $rpc --chain-id 1 --no-rate-limit --prune-history

Operating System

Linux

Describe the bug

An eth_call from Graph Node returns with "Required data unavailable", screenshot attached.

image

The anvil node is forking mainnet using Infura as the provider (also tried Alchemy and LlamaRPC), graph-node is connected to this node via RPC and indexing a subgraph. This subgraph indexes fine against mainnet and used to index fine in this setup until a few weeks ago.

Zero idea on what could be causing this, any suggestions are appreciated and I'm willing to try any number of debug ops.

@akshatmittal akshatmittal added the T-bug Type: bug label Feb 6, 2024
@gakonst gakonst added this to Foundry Feb 6, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Feb 6, 2024
@onbjerg
Copy link
Collaborator

onbjerg commented Feb 6, 2024

Not all RPC providers provide access to the full history, meaning only the last n blocks of historical data is available. This is most likely the case with the underlying RPC you are using, which causes this error.

@Evalir
Copy link
Member

Evalir commented Feb 6, 2024

Indeed, as @onbjerg said make sure you're using an archive endpoint—else you won't have the required data.

@akshatmittal
Copy link
Author

I tried it with Infura (Growth plan) and Alchemy (Scale plan) both with archive node capabilities (I can't seem to find any documentation saying that they limit archive data access). I also attempted to query a block from 2019, trace call on the tx mentioned and querying balance on genesis block on both providers and they both succeed.

Anything I should try with the RPCs or something else to verify if that's indeed the issue?

@onbjerg
Copy link
Collaborator

onbjerg commented Feb 6, 2024

Interesting - what call is the indexer trying to perform, and at what block? I see some reference to PROPOSER_ROLE but I'm not really sure what this is referring to. Also, it would be preferred if you could post the logs as text in a codeblock so we can see it more clearly :)

@akshatmittal
Copy link
Author

Sure, here's the log in plaintext: https://gist.github.com/akshatmittal/0f97e4fb4b5665df69438570f97b86ee (added some additional later errors, but I think they are all because of this one call failing)

Failing at block 16681681 and tx 0xf1bad (oh the irony), subgraph hash QmaYzfSaPsXEyueSVYqTXp4nYWTC8MxGazuZLqYVJnNhVD.

I'm not entirely sure what call exactly the indexer is making, to be honest. My understanding is that the indexer detects triggers using logs and then replays/traces the transaction to get more information to process it. The weirdest thing to me is certainly that the exact setup was working fine until just last week.

(I've also tried with --steps-tracing to see if that helps but same error)

@akshatmittal
Copy link
Author

Quick update, just ran the exact same setup replacing anvil with hardhat and it works fine! This is certainly an issue with anvil based on everything I've tried at this point.

I've included additional logs from hardhat and infura RPCs to document what should happen here. https://gist.github.com/akshatmittal/0f97e4fb4b5665df69438570f97b86ee

I would really really like to get this running with anvil.

@akshatmittal
Copy link
Author

akshatmittal commented Feb 7, 2024

Hey @onbjerg, @Evalir, I did some more debugging. Seems like this bug was introduced recently, I rolled back anvil version to nightly-8343e7d8ac08724238db1c014c325bba479ba587 and it works again!

My current best guess is that it was introduced in this commit d46bcb3 but I'm not certain.

Edit: Also, sidenote, the old version is much faster too when making calls.

@onbjerg
Copy link
Collaborator

onbjerg commented Feb 7, 2024

@Evalir this is most likely because we are returning some optimism specific stuff in receipts even if we're not supposed to, wdyt?

@Evalir
Copy link
Member

Evalir commented Feb 7, 2024

yep @onbjerg could be this. Will look into it

@Evalir Evalir self-assigned this Feb 7, 2024
@akshatmittal
Copy link
Author

I've nailed it down to the exact function call. Here's the code to reproduce: https://gist.github.com/akshatmittal/9fab55c38c75090fba173f4db058c394

Running against anvil node with command anvil --fork-url $rpc --chain-id 1 --no-rate-limit.

It should revert without reason but rather fails with "Required data unavailable".

@Evalir
Copy link
Member

Evalir commented Feb 7, 2024

seems the repro is missing the ./setup.ts file

@akshatmittal
Copy link
Author

seems the repro is missing the ./setup.ts file

It's just a viem setup with publicClient, updated the gist to simplify.

@mattsse
Copy link
Member

mattsse commented Feb 24, 2024

unclear how to run this, please provide instructions

@mattsse
Copy link
Member

mattsse commented Feb 24, 2024

nvm figured it out

@jenpaff jenpaff moved this from Todo to Completed in Foundry Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants