Skip to content

svm: load: use rooted access slot - #15967

Merged
buffalojoec merged 3 commits into
anza-xyz:masterfrom
latent-9:clamp-load-access-slot
Oct 13, 2026
Merged

buffalojoec merged 3 commits into
anza-xyz:masterfrom
latent-9:clamp-load-access-slot

Conversation

@latent-9

Copy link
Copy Markdown

Problem

#15811 clamped the access slot recorded by extract() to latest_root_slot, on the grounds that a rooted slot "represents a slot for a fork that can't be pruned off" so "usage stats are effectively 'rooted'". The load path still records the raw bank slot: load_program_with_pubkey stamps current_slot on every freshly loaded entry before it reaches the global cache. A program first loaded on an unrooted bank keeps an inflated latest_access_slot by (bank_slot - latest_root_slot) until the root advances past it, which delays prune()'s stale-tombstone cleanup and inflates retention_score() for entries whose fork may never root. This is the one remaining production writer of latest_access_slot without the clamp.

Summary of Changes

  • Record the access slot at the two call sites whose entries enter the global cache, clamped with min(latest_root_slot), mirroring extract().
  • load_program_with_pubkey no longer stamps the access slot itself. Its only other caller is Bank::load_program, whose entries go to a local batch cache for ledger-tool and never enter the global cache, so the stamp was unused there.

Note: #10770 restructures this call site for threaded compilation. This change is independent of it, but whichever lands second will need a small rebase; happy to coordinate.

Testing

  • New test_replenish_program_cache_records_rooted_access_slot: a program first loaded on a bank at slot 200 with latest_root_slot = 100 records access slot 100. Fails on master (records 200), passes with this change.
  • cargo test -p solana-svm passes (140 lib + 44 integration tests).

@buffalojoec buffalojoec added the CI Pull Request is ready to enter CI label Oct 13, 2026
@github-actions github-actions Bot removed the CI Pull Request is ready to enter CI label Oct 13, 2026

@buffalojoec buffalojoec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, just one nit.

Comment thread svm/src/transaction_processor.rs Resolved
@codecov-commenter

codecov-commenter commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.2%. Comparing base (74ab941) to head (1909327).
⚠️ Report is 14 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #15967    +/-   ##
========================================
  Coverage    82.2%    82.2%            
========================================
  Files         938      938            
  Lines      372938   373002    +64     
========================================
+ Hits       306616   306769   +153     
+ Misses      66322    66233    -89     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread svm/src/transaction_processor.rs Resolved

@buffalojoec buffalojoec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for handling this!

@buffalojoec buffalojoec added the CI Pull Request is ready to enter CI label Oct 13, 2026
@buffalojoec
buffalojoec enabled auto-merge October 13, 2026 07:31
@github-actions github-actions Bot removed the CI Pull Request is ready to enter CI label Oct 13, 2026
@buffalojoec
buffalojoec added this pull request to the merge queue Oct 13, 2026
Merged via the queue into anza-xyz:master with commit 80b20cd Oct 13, 2026
53 of 54 checks passed
@latent-9

Copy link
Copy Markdown
Author

@buffalojoec thanks legend!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants