Skip to content

fix(anvil): refetch full fork blocks with missing tx cache#14384

Merged
mattsse merged 2 commits intofoundry-rs:masterfrom
solanaXpeter:fix-anvil-refetch-full-fork-blocks
Apr 21, 2026
Merged

fix(anvil): refetch full fork blocks with missing tx cache#14384
mattsse merged 2 commits intofoundry-rs:masterfrom
solanaXpeter:fix-anvil-refetch-full-fork-blocks

Conversation

@solanaXpeter
Copy link
Copy Markdown
Contributor

Motivation

Cached fork blocks can lose one or more stored transaction payloads while still keeping the block shell. When block_by_hash_full or block_by_number_full reconstructs that stale cache entry, RPC consumers receive an incomplete full block instead of a refetched upstream response.

Solution

Return None from full-block reconstruction when any cached transaction is missing, then fall back to fetch_full_block(...) so the fork cache is repaired from upstream data. Add an integration test that removes one cached transaction and asserts the next full-block read refetches and restores it.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

figtracer
figtracer previously approved these changes Apr 21, 2026
Copy link
Copy Markdown
Collaborator

@figtracer figtracer left a comment

Choose a reason for hiding this comment

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

this is defensive but not sure how important it is here, pending another review

mattsse
mattsse previously approved these changes Apr 21, 2026
Copy link
Copy Markdown
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

doesnt hurt

@mattsse mattsse enabled auto-merge (squash) April 21, 2026 08:00
@mattsse mattsse closed this Apr 21, 2026
auto-merge was automatically disabled April 21, 2026 08:10

Pull request was closed

@github-project-automation github-project-automation Bot moved this to Done in Foundry Apr 21, 2026
@solanaXpeter
Copy link
Copy Markdown
Contributor Author

Hi @mattsse, thanks for your review. I noticed this was approved and later closed while I was working on the CI issue, so I wanted to check whether there was some other concern with the change.

@mablr mablr reopened this Apr 21, 2026
@mablr
Copy link
Copy Markdown
Collaborator

mablr commented Apr 21, 2026

re-opened 👍

@solanaXpeter solanaXpeter dismissed stale reviews from mattsse and figtracer via adcdc2c April 21, 2026 08:45
@solanaXpeter
Copy link
Copy Markdown
Contributor Author

@mablr @mattsse @figtracer I fixed the CI issue. Could you please re-run the CI? Thanks very much for your time!

@mattsse mattsse enabled auto-merge (squash) April 21, 2026 09:25
@mattsse mattsse disabled auto-merge April 21, 2026 10:16
@mattsse mattsse merged commit 3052015 into foundry-rs:master Apr 21, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants