Skip to content

Conversation

@2501babe
Copy link
Member

@2501babe 2501babe commented Nov 1, 2025

Problem

#7203 removed all usage of the native stake program itself in the agave codebase, switching the builtin to bpf stake, pulling the core bpf repo for genesis, and using a bpf stake binary for tests. #7645 deleted the native stake program implementation, in other words virtually all stake program code

to keep the enormous diff of #7645 trivial, we left behind a few utility functions that were used in other parts of the codebase. this pr removes solana-stake-program entirely

Summary of Changes

  • everything in points.rs was already copied to runtime by someone other than myself. this is deleted with no additions
  • config.rs and epoch_rewards.rs only exist to set up these accounts for genesis. this functionality is moved to runtime::genesis_utils since it is lowest on the dependency tree compared to genesis and genesis-utils
  • stake_state.rs deserialization wrappers are mostly deleted and replaced with standard deserialize calls. a few are moved where they are used frequently and locally
  • stake_state::create_account() is moved to a new runtime::stake_utils module. this is used in many places, the logic is very annoying, and it is only required for tests and cli so it shouldnt be added to stake interface. it is also copy-pasted to accounts-db behind dcou, the one place that cannot import runtime
  • get_minimum_delegation() is also added to runtime::stake_utils. this is a trivial function that accepts a bool and returns 1 or 1*10^9. the main reason to keep it is that when we implement minimum delegation (under a new feature flag), this marks the places in agave that care about it
  • switch anything that was getting structs, program id, etc from solana-stake-program to solana-stake-interface
  • delete solana-stake-program in its entirety

Upgrade Path

after this lands, we will be free to reuse the solana-stake-program name on crates io for the bpf stake program

our timing here is actually impeccable. native stake reexports stake interface, so removing it is a major breaking change for downstream. but the entire package was marked unstable in agave 3.x, and master is now on 4.0 alpha. this means we can land this pr now with no issues

bpf stake is presently on 1.0, with a version bump (to 2.0 or 1.1 im not sure) planned. after this pr lands, we must skip bpf stake at least to 4.0 and then we can push to crates io. if any 4.x agave release hits crates io before this pr is merged, we should skip bpf stake to 5.0

@mergify
Copy link

mergify bot commented Nov 1, 2025

The Firedancer team maintains a line-for-line reimplementation of the
native programs, and until native programs are moved to BPF, those
implementations must exactly match their Agave counterparts.
If this PR represents a change to a native program implementation (not
tests), please include a reviewer from the Firedancer team. And please
keep refactors to a minimum.

@2501babe 2501babe force-pushed the 20251101_stake_annihilation branch from 71abb0a to c1732d2 Compare November 1, 2025 16:48
@2501babe 2501babe self-assigned this Nov 1, 2025
@mergify
Copy link

mergify bot commented Nov 2, 2025

If this PR represents a change to the public RPC API:

  1. Make sure it includes a complementary update to rpc-client/ (example)
  2. Open a follow-up PR to update the JavaScript client @solana/kit (example)

Thank you for keeping the RPC clients in sync with the server API @2501babe.

@2501babe 2501babe force-pushed the 20251101_stake_annihilation branch 2 times, most recently from 00fe45a to 1225ef4 Compare November 2, 2025 11:01
@2501babe 2501babe changed the title remove remaining stake program functions remove solana-stake-program Nov 2, 2025
@2501babe 2501babe force-pushed the 20251101_stake_annihilation branch from 625b89d to b50c9cf Compare November 2, 2025 12:50
@codecov-commenter
Copy link

codecov-commenter commented Nov 2, 2025

Codecov Report

❌ Patch coverage is 98.35165% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.2%. Comparing base (6fb754f) to head (bebd047).
⚠️ Report is 12 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8834   +/-   ##
=======================================
  Coverage    83.2%    83.2%           
=======================================
  Files         864      860    -4     
  Lines      375287   375284    -3     
=======================================
+ Hits       312389   312390    +1     
+ Misses      62898    62894    -4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@2501babe 2501babe marked this pull request as ready for review November 2, 2025 15:30
@2501babe 2501babe requested review from grod220 and joncinque November 2, 2025 15:30
@2501babe
Copy link
Member Author

2501babe commented Nov 2, 2025

added both of you but this only needs one full review, i was thinking @grod220 could go over the detail since this relates to his de-floating (sinking?) work on stake-interface, while @joncinque might want to glance over and confirm there are no bigger-picture concerns eg with genesis or downstream projects

Copy link

@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 great on my side! Thanks for doing all the cleanup

Comment on lines +133 to +134
#[cfg(feature = "dev-context-only-utils")]
fn create_stake_account(

Choose a reason for hiding this comment

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

We've had to duplicate a function across accounts-db and runtime in the past, so I'm fine with it here

EpochSchedule, DEFAULT_LEADER_SCHEDULE_SLOT_OFFSET, MINIMUM_SLOTS_PER_EPOCH,
},
solana_keypair::Keypair,
solana_runtime::bank::Bank,

Choose a reason for hiding this comment

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

Weird, this wasn't caught by clippy before?

Copy link
Member Author

Choose a reason for hiding this comment

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

it looks like clippy doesnt detect useless test imports like it does code imports only used in tests. i went to add a useless test import in svm/ to double check it wasnt a weird build thing and turns out it already has at least one 😅

Copy link

@grod220 grod220 left a comment

Choose a reason for hiding this comment

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

LGTM, great job!

@2501babe 2501babe force-pushed the 20251101_stake_annihilation branch from b50c9cf to bebd047 Compare November 3, 2025 19:23
@2501babe
Copy link
Member Author

2501babe commented Nov 3, 2025

oh i remember why we hated the merge queue last time we tried it, it doesnt let you rewrite the final commit message. happily it looks like re-reviews arent needed for a rebase with the same base

@2501babe 2501babe enabled auto-merge November 3, 2025 19:26
@2501babe 2501babe added this pull request to the merge queue Nov 3, 2025
Merged via the queue into anza-xyz:master with commit 58eb815 Nov 3, 2025
55 checks passed
@2501babe 2501babe deleted the 20251101_stake_annihilation branch November 3, 2025 20:12
2501babe added a commit that referenced this pull request Nov 14, 2025
this backports the stake program excision from #8834 but leaves the crate intact with a warning
procdump added a commit to LimeChain/litesvm that referenced this pull request Nov 19, 2025
monorepo so that stake tests can pass.
Aursen pushed a commit to LiteSVM/litesvm that referenced this pull request Nov 19, 2025
monorepo so that stake tests can pass.
rustopian pushed a commit to rustopian/agave that referenced this pull request Nov 20, 2025
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.

4 participants