-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Refactor stake program into solana_program #17906
Conversation
Codecov Report
@@ Coverage Diff @@
## master #17906 +/- ##
=======================================
Coverage 82.6% 82.6%
=======================================
Files 431 435 +4
Lines 121614 121584 -30
=======================================
+ Hits 100460 100497 +37
+ Misses 21154 21087 -67 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wdyt about calling the new module sdk/program/src/stake_program/..
? I know that's a change from how we're handling things in the programs
directory, but I find all the stake::id()
declarations pretty terse, esp in contrast with system_program::id()
An alternative could be to wrap the |
Oh totally, something like this could be better than renaming the directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should maintain pub use
of the public API features from the solana-stake-program
crate to avoid breaking any external consumers? stake-o-matic comes to mind. They can probably be marked with the deprecated attribute.
I hesitated a lot with the name of |
Good idea, I'll do that |
This is ready for another review on my side |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! Couple nits
Pull request has been modified.
* Move stake state / instructions into solana_program * Update account-decoder * Update cli and runtime * Update all other parts * Commit Cargo.lock changes in programs/bpf * Update cli stake instruction import * Allow integer arithmetic * Update ABI digest * Bump rust mem instruction count * Remove useless structs * Move stake::id() -> stake::program::id() * Re-export from solana_sdk and mark deprecated * Address feedback * Run cargo fmt
* Refactor stake program into solana_program (#17906) * Move stake state / instructions into solana_program * Update account-decoder * Update cli and runtime * Update all other parts * Commit Cargo.lock changes in programs/bpf * Update cli stake instruction import * Allow integer arithmetic * Update ABI digest * Bump rust mem instruction count * Remove useless structs * Move stake::id() -> stake::program::id() * Re-export from solana_sdk and mark deprecated * Address feedback * Run cargo fmt * Run cargo fmt post cherry-pick
Problem
The
solana_stake_program
crate is not available on-chain, causing programs to copy all of its code where needed. This was flagged by the stake pool audit at solana-labs/solana-program-library#1865Summary of Changes
Move the essential instruction and state types into
solana_program
. In order to move as little as possible, new types were introduced (renamed from the stake program core types) insolana_stake_program
which require sdk-level types. There's a few little goofy parts, mainly having theStakeConfig
struct implementConfigState
in the config program directly, and a few functions in theStakeConverter
type which should really belong directly on theStake
type insolana_program
, but that will require the vote program to be moved over as well.Note that no logic was changed, this is entirely a refactor. CI will probably catch any lingering issues, so I'll fix them all as they're flagged up.
Fixes #