Skip to content

fix: eviction race#21534

Open
alexghr wants to merge 1 commit intomerge-train/spartanfrom
ag/eviction-race
Open

fix: eviction race#21534
alexghr wants to merge 1 commit intomerge-train/spartanfrom
ag/eviction-race

Conversation

@alexghr
Copy link
Contributor

@alexghr alexghr commented Mar 13, 2026

Fix A-661

if (context.event === EvictionEvent.BLOCK_MINED) {
const blockNumber = context.block.getBlockNumber();
await this.worldState.syncImmediate(blockNumber);
const syncedTo = await this.worldState.syncImmediate(blockNumber, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the right approach. I suspect what happened here is

  1. Block 4425 was pruned and immediately replaced.
  2. We called await this.worldState.syncImmediate(blockNumber) and at the time, I suspect the world state was synced to the old block 4425 so happily returned.
  3. Then it processed the prune, so by the time we went to query it, the block was gone and it hadn't processed the new block.

I think if we simply call await this.worldState.syncImmediate(), with no args, this will forc the world state to do a full sync against the latest archiver state. Processing both the pruned block and the newly added replacement.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed #21556 after seeing this, what do you guys think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants