solana
solana copied to clipboard
Runtime: Module to migrate builtin programs to Core BPF
I'm introducing this PR as a draft to hopefully gather some feedback on the approach and some of the various things this migration path touches.
I've carefully structured the commits to ensure maximum readability, including saving the Bank modifications required for testing the migrations for last (coming soon).
Problem
Now that SIMD 0088 has been merged, the runtime requires a code path for migrating built-in programs to Core BPF.
Solution
The static BUILTINS
list, which houses the source-of-truth for all runtime
built-in programs, contains a feature_id
field for activating new built-in
programs.
Building on this architecture, I've included a new field for
core_bpf_migration
configurations, which the runtime can use on epoch rollover
to migrate a built-in to Core BPF and ensure it's handled properly by both the
Bank and the program cache.
The config defines two main fields:
- Source BPF Program: The upgradeable BPF program that will be moved in place of the built-in.
- Feature ID: The feature ID whose activation will trigger the migration.
To ensure maximum safety when enabling migrations, I've abstracted all of the
checks and account manipulation required to perform the migration away into the
builtin
module's sub-module core_bpf_migration
.
To migrate a built-in program to Core BPF, contributors need only add the source program ID and the feature ID to the built-in's config.
Note: Once #35267 lands I can add a commit with feature activation tests.
Codecov Report
Attention: Patch coverage is 74.93917%
with 103 lines
in your changes are missing coverage. Please review.
Project coverage is 81.6%. Comparing base (
e8c87e8
) to head (5221627
). Report is 5 commits behind head on master.
:exclamation: Current head 5221627 differs from pull request most recent head a518972. Consider uploading reports for the commit a518972 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## master #35260 +/- ##
=========================================
- Coverage 81.8% 81.6% -0.2%
=========================================
Files 834 837 +3
Lines 224815 225158 +343
=========================================
- Hits 183919 183787 -132
- Misses 40896 41371 +475
This repository is no longer in use. Please re-open this pull request in the agave repo: https://github.com/anza-xyz/agave