Open lnist opened 1 year ago
One thing that can happen in our tests are 1) there can be pending transactions when we call revert - I would expect these to be dropped, but maybe the behavior is undefined? 2) we may have pending RPC calls to read from the chain - could this mess up the revert?
Experiencing a similar issue when trying to send a transaction via metamask to a local anvil node:
MetaMask - RPC Error: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"data":{"code":-32602,"message":"BlockOutOfRangeError: block height is 8 but requested was 18"}}}'
It doesn't happen when sending the tx straight via cast
.
I get his error when running cast run on a tx to an anvil node
hmm, could you provide an example of how to reproduce this? that would help me debugging this
hmm, could you provide an example of how to reproduce this? that would help me debugging this
I unfortunately cannot send the full code but generally the flow is
cast run <tx_hash>
Executing previous transactions from the block.
2023-12-31T08:38:33.147839Z ERROR sharedbackend: Failed to send/recv `basic` err=failed to get account for 0xbeFe7DabDF096d389eF332fd2874268b81dd8ADF: (code: -32602, message: BlockOutOfRangeError: block height is 10299038 but requested was 10298993, data: None) address=0xbeFe7DabDF096d389eF332fd2874268b81dd8ADF
Error:
backend: failed while inspecting: Database error: failed to get account for 0xbeFe7DabDF096d389eF332fd2874268b81dd8ADF: (code: -32602, message: BlockOutOfRangeError: block height is 10299038 but requested was 10298993, data: None)
running it with -q does not change the result.
I know the account does exist and has made transactions that have succeeded ...
Hi there,
Getting a similar issue while running an anvil
process as a "private test blockchain", and deploying blockscout to visualize what's happening up there.
One specificity is that we configured it to be auto-mining a new block every 10s.
Any idea if we can do something to help, reproduce, debug?
Thanks a lot for the help
EDIT: Managed to fix this by deploying the tag v1.0.0
instead of using the latest docker image
Component
Anvil
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (8f246e0 2023-04-28T00:03:59.802167368Z)
What command(s) is the bug in?
anvil
Operating System
Linux
Describe the bug
As the title says, we occasionally get errors similar to
BlockOutOfRangeError: block height is 23 but requested was 21
and it seems like a race-condition happening when using emv_revert+evm_snapshot.Since the requested is lower than the height, I assume the error is raised by https://github.com/foundry-rs/foundry/blob/8f246e07c89129b6effa89f0d71c4ac67758a155/anvil/src/eth/backend/mem/mod.rs#L1493
We cannot reproduce locally, and it only happens occasionally when running our typescript test suite in GitHub actions with the default runners (which is very resource constrained, but, e.g. cpulimit of anvil does not seem to reproduce).
We use (evm_snapshot+)evm_revert+evm_snapshot to reset state between each test. So I definitely expect that to be the culprit.
We are not using --prune-history (so https://github.com/foundry-rs/foundry/issues/4252 seems irrelevant) We are not using forks in these tests (so https://github.com/foundry-rs/foundry/issues/4082 , https://github.com/foundry-rs/foundry/issues/3700 and https://github.com/foundry-rs/foundry/issues/3718 seems irrelevant)
I am not sure whether we are doing something we should not be doing or whether this is an actual bug.