foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.18k stars 1.7k forks source link

bug(anvil): `missing trie node path state is not available` - occuring unpredictably and with no replication #7625

Closed RonTuretzky closed 2 months ago

RonTuretzky commented 5 months ago

Component

Anvil

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

What version of Foundry are you on?

nightly-460319558e455611be1de64be8364c65c6896d15

What command(s) is the bug in?

anvil --fork-url

Operating System

macOS (Apple Silicon)

Describe the bug

Also occcurs on ubuntu, when sending transaction for accounts and contracts, the "missing trie node path state is not available" occurs , a restart will sometime fix it , sometimes multiple restarts will be required, sometimes it will not occur at all. I have noticed that the longer the anvil instance is up, the higher the chance this error will occur.

mattsse commented 5 months ago

this happens when your provider does not have the requested data (not archive node)

RonTuretzky commented 5 months ago

this happens when your provider does not have the requested data (not archive node)

This happens with different providers, including archive ones like alchemy.

This is also happening when I'm running transactions on an anvil fork which references no other contracts other than the ones I'm deploying on that instance... So I don't think it's an archival issue ...

zerosnacks commented 2 months ago

Hi @RonTuretzky, any additional details or traces to help narrow this down further would be greatly appreciated

RonTuretzky commented 2 months ago

Hi @RonTuretzky, any additional details or traces to help narrow this down further would be greatly appreciated

The chance for this to happen is observed to be higher over time, replicated across Ethereum , goerli (pre-deprecation) and holesky

Present across multiple foundry version

mattsse commented 2 months ago

this is a server error response, so nothing we can do here really

RonTuretzky commented 2 months ago

this is a server error response, so nothing we can do here really

Are you saying anvil is just forwarding a response from the rpc it is forking in this case?

mattsse commented 2 months ago

yes, it has to to fetch the state

RonTuretzky commented 2 months ago

yes, it has to to fetch the state

If I make a new ecdsa address that has never been used on the fork origin, but only on the fork itself ( the anvil state)

It would make sense that the rpc would return no trie node for that account because that account has no activity there

But why is anvil forwarding that request to the rpc? Shouldn't it be aware that the trie will only exist internally within the anvil state?

mattsse commented 2 months ago

Shouldn't it be aware that the trie will only exist internally within the anvil state?

how would it?

this is a server error

https://github.com/ledgerwatch/erigon/blob/aefb97b07d1c4fd32a66097a24eddd8f6ccacae0/turbo/trie/errors.go#L25-L35