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

@ -26,9 +26,10 @@ use solana_sdk::{
pubkey::Pubkey,
rent::Rent,
signature::{Keypair, Signer},
stake::state::StakeState,
system_program, timing,
};
use solana_stake_program::stake_state::{self, StakeState};
use solana_stake_program::stake_state;
use solana_vote_program::vote_state::{self, VoteState};
use std::{
collections::HashMap,

View File

@ -1,15 +1,22 @@
//! stakes generator
use crate::{
address_generator::AddressGenerator,
unlocks::{UnlockInfo, Unlocks},
};
use solana_sdk::{
account::Account, clock::Slot, genesis_config::GenesisConfig, pubkey::Pubkey, system_program,
timing::years_as_slots,
};
use solana_stake_program::{
self,
stake_state::{create_lockup_stake_account, Authorized, Lockup, StakeState},
use {
crate::{
address_generator::AddressGenerator,
unlocks::{UnlockInfo, Unlocks},
},
solana_sdk::{
account::Account,
clock::Slot,
genesis_config::GenesisConfig,
pubkey::Pubkey,
stake::{
self,
state::{Authorized, Lockup, StakeState},
},
system_program,
timing::years_as_slots,
},
solana_stake_program::stake_state::create_lockup_stake_account,
};
#[derive(Debug)]
@ -98,8 +105,7 @@ pub fn create_and_add_stakes(
genesis_config.ticks_per_slot,
);
let mut address_generator =
AddressGenerator::new(&authorized.staker, &solana_stake_program::id());
let mut address_generator = AddressGenerator::new(&authorized.staker, &stake::program::id());
let stake_rent_reserve = StakeState::get_rent_exempt_reserve(&genesis_config.rent);