Skip to content

SIMD-0266: Efficient Token program#7125

Merged
febo merged 27 commits into
anza-xyz:masterfrom
febo:p-token-migration
Oct 31, 2025
Merged

SIMD-0266: Efficient Token program#7125
febo merged 27 commits into
anza-xyz:masterfrom
febo:p-token-migration

Conversation

@febo
Copy link
Copy Markdown

@febo febo commented Jul 23, 2025

Problem

SIMD-0266 proposes to replace the current verion of SPL Token with p-token.

Summary of Changes

This PR includes the following changes:

  • Add a migration path for a Loader v2 program to Loader v3 using a similar setup as builtin to Core BPF.
  • Add a feature to agave-feature-set and its activation on bank.rs, which uses the migrate_bpf_loader_v2_to_v3 to replace the SPL Token program data.

The feature activation and migration of the account have been tested using a Core BPF migration CLI fork:

image

Logs from the test validator:

[2025-07-23T17:31:26.974514281Z INFO  solana_runtime::bank] Feature ptokSWRqZz5u2xdqMdstkMKpFurauUpVen7TZXgDpkQ activated at slot 40
[2025-07-23T17:31:26.974570665Z INFO  solana_metrics::metrics] datapoint: replace_spl_token_with_p_token slot=40i

Additionally, it was also tested using a "p-token migration simulator" tool.

Before the upgrade of SPL Token program:

image

After the feature is activated and the program upgraded:

image

Note

When the feature is activated and the program is swapped, it stays in DelayVisibility for 1 slot – the first slot of the epoch after the feature activation – which means that any transaction executing SPL Token instructions will fail during that slot.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 24, 2025

Codecov Report

❌ Patch coverage is 98.78472% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.2%. Comparing base (28b8616) to head (45770bc).
⚠️ Report is 1700 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #7125    +/-   ##
========================================
  Coverage    83.2%    83.2%            
========================================
  Files         863      864     +1     
  Lines      374519   375041   +522     
========================================
+ Hits       311611   312144   +533     
+ Misses      62908    62897    -11     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

The v2 target implementation is looking great! I reviewed the migration path, but haven't checked the tests yet since it's still a draft.

Comment thread runtime/src/bank/builtins/core_bpf_migration/mod.rs Outdated
Comment thread runtime/src/bank/builtins/core_bpf_migration/mod.rs Outdated
@febo febo force-pushed the p-token-migration branch from 294db55 to a4def68 Compare July 24, 2025 07:50
@febo febo marked this pull request as ready for review July 24, 2025 07:56
@febo
Copy link
Copy Markdown
Author

febo commented Jul 24, 2025

The v2 target implementation is looking great! I reviewed the migration path, but haven't checked the tests yet since it's still a draft.

I was waiting for CI to pass – all good now! 😊

Copy link
Copy Markdown

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks good to me, once Joe's last comment is addressed!

Comment thread svm-feature-set/src/lib.rs Outdated
Comment thread runtime/src/bank/builtins/core_bpf_migration/mod.rs
@febo febo force-pushed the p-token-migration branch from f48b1df to 456c009 Compare July 28, 2025 15:08
Copy link
Copy Markdown

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Looks good to me, just need a feature-set rebase & CI to pass!

I think maybe, just to be insanely careful, we should also add a test with live transactions and a valid "stub" ELF. I did a few of these over here:

mod tests_core_bpf_migration {

Comment thread runtime/src/bank/builtins/core_bpf_migration/mod.rs Outdated
Comment thread runtime/src/bank/builtins/core_bpf_migration/mod.rs
Comment thread feature-set/src/lib.rs Outdated
Comment thread runtime/src/bank.rs Outdated
Comment thread runtime/src/bank.rs
Comment thread runtime/src/bank/builtins/core_bpf_migration/mod.rs
Comment thread feature-set/src/lib.rs Outdated
@febo febo force-pushed the p-token-migration branch 5 times, most recently from e6476a2 to 63c8eea Compare August 5, 2025 20:41
Copy link
Copy Markdown

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Changes look good on my side, but I'd still love to see a stub test as I mentioned up here.

@febo febo force-pushed the p-token-migration branch from 63c8eea to 8544810 Compare August 18, 2025 00:18
Copy link
Copy Markdown

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Looking good, but let's reduce some redundancy.

Comment thread runtime/src/bank/bpf_program_upgrade_tests.rs Outdated
Comment thread runtime/src/bank/bpf_program_upgrade_tests.rs Outdated
Comment thread runtime/src/bank/bpf_program_upgrade_tests.rs Outdated
Comment thread runtime/src/bank/bpf_program_upgrade_tests.rs Outdated
@febo febo marked this pull request as draft August 18, 2025 09:39
@febo febo force-pushed the p-token-migration branch 2 times, most recently from 70f5922 to e9ebc2b Compare August 30, 2025 18:03
@febo febo marked this pull request as ready for review August 30, 2025 18:04
@febo febo force-pushed the p-token-migration branch 2 times, most recently from ca097c2 to a3c6d39 Compare September 4, 2025 08:53
buffalojoec
buffalojoec previously approved these changes Sep 5, 2025
Copy link
Copy Markdown

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

I think this looks great! Just get @Lichtso's sign off on the cache step. Otherwise g2g from my side.

Comment thread runtime/src/bank/builtins/core_bpf_migration/mod.rs Outdated
Comment thread runtime/src/bank/builtins/core_bpf_migration/mod.rs Outdated
Comment thread runtime/src/bank/builtins/core_bpf_migration/mod.rs Outdated
@febo febo dismissed stale reviews from joncinque and buffalojoec via 45770bc October 30, 2025 23:42
@febo febo force-pushed the p-token-migration branch from 50e195d to 45770bc Compare October 30, 2025 23:42
Copy link
Copy Markdown

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Still looks great to me!

@febo febo added this pull request to the merge queue Oct 31, 2025
Merged via the queue into anza-xyz:master with commit 0da9819 Oct 31, 2025
44 checks passed
@febo febo deleted the p-token-migration branch October 31, 2025 00:40
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.

6 participants