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
This commit is contained in:
Jon Cinque
2021-06-15 18:04:00 +02:00
committed by GitHub
parent 36b09db2d1
commit 1b1d34da59
59 changed files with 1765 additions and 1711 deletions

View File

@ -29,13 +29,14 @@ use solana_sdk::{
poh_config::PohConfig,
pubkey::Pubkey,
signature::{Keypair, Signer},
stake::{
config as stake_config, instruction as stake_instruction,
state::{Authorized, Lockup},
},
system_transaction,
transaction::Transaction,
};
use solana_stake_program::{
config as stake_config, stake_instruction,
stake_state::{Authorized, Lockup, StakeState},
};
use solana_stake_program::{config::create_account as create_stake_config_account, stake_state};
use solana_vote_program::{
vote_instruction,
vote_state::{VoteInit, VoteState},
@ -190,7 +191,7 @@ impl LocalCluster {
// Replace staking config
genesis_config.add_account(
stake_config::id(),
stake_config::create_account(
create_stake_config_account(
1,
&stake_config::Config {
warmup_cooldown_rate: 1_000_000_000.0f64,
@ -568,7 +569,7 @@ impl LocalCluster {
) {
(Ok(Some(stake_account)), Ok(Some(vote_account))) => {
match (
StakeState::stake_from(&stake_account),
stake_state::stake_from(&stake_account),
VoteState::from(&vote_account),
) {
(Some(stake_state), Some(vote_state)) => {