This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
Race condition between assignment of "latest" tag and persistence of the latest raw block data causing intermittent test failures #3060
Labels
If you wrap the "should set storage slot and delete after" evm API test in a for loop such that it executes 100 times, you'll observe that it fails intermittently, due to the RPC method handler for
eth_getStorageAt
throwing because it can't find a block.This occurs even though the test isn't specifying the block number in its call to
eth_getStorageAt
, meaning it's implicitly using the "latest" tag. This implies thatblockchain.blocks.getEffectiveBlockNumber
is occasionally returning the number for a block that hasn't yet been persisted to the database.If you refactor the API handler for
eth_getStorageAt
to avoid the use ofblockchain.blocks.getRawByBlockNumber
and instead preferblockchain.blocks.get
, the test in question succeeds 100% of the time. While this adequately works around the problem, I don't think that this is a proper fix for the issue, as it seems that the real problem is a lack of consistency between the in-memory and on-disk representations of the block's current head state.Note that several other RPC method handlers appear to use the same pattern for reading the raw block data, and are therefore likely also affected by this issue.
The text was updated successfully, but these errors were encountered: