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:
@ -38,7 +38,6 @@ solana-perf = { path = "../perf", version = "=1.8.0" }
|
||||
solana-poh = { path = "../poh", version = "=1.8.0" }
|
||||
solana-runtime = { path = "../runtime", version = "=1.8.0" }
|
||||
solana-sdk = { path = "../sdk", version = "=1.8.0" }
|
||||
solana-stake-program = { path = "../programs/stake", version = "=1.8.0" }
|
||||
solana-storage-bigtable = { path = "../storage-bigtable", version = "=1.8.0" }
|
||||
solana-transaction-status = { path = "../transaction-status", version = "=1.8.0" }
|
||||
solana-version = { path = "../version", version = "=1.8.0" }
|
||||
@ -52,6 +51,7 @@ tokio-util = { version = "0.3", features = ["codec"] } # This crate needs to sta
|
||||
serial_test = "0.4.0"
|
||||
solana-logger = { path = "../logger", version = "=1.8.0" }
|
||||
solana-net-utils = { path = "../net-utils", version = "=1.8.0" }
|
||||
solana-stake-program = { path = "../programs/stake", version = "=1.8.0" }
|
||||
symlink = "0.1.0"
|
||||
|
||||
[lib]
|
||||
|
@ -62,12 +62,12 @@ use {
|
||||
pubkey::Pubkey,
|
||||
sanitize::Sanitize,
|
||||
signature::{Keypair, Signature, Signer},
|
||||
stake::state::StakeState,
|
||||
stake_history::StakeHistory,
|
||||
system_instruction,
|
||||
sysvar::stake_history,
|
||||
transaction::{self, Transaction},
|
||||
},
|
||||
solana_stake_program::stake_state::StakeState,
|
||||
solana_transaction_status::{
|
||||
EncodedConfirmedTransaction, Reward, RewardType, TransactionConfirmationStatus,
|
||||
TransactionStatus, UiConfirmedBlock, UiTransactionEncoding,
|
||||
|
@ -569,13 +569,14 @@ mod tests {
|
||||
message::Message,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
stake::{
|
||||
self, instruction as stake_instruction,
|
||||
state::{Authorized, Lockup, StakeAuthorize},
|
||||
},
|
||||
system_instruction, system_program, system_transaction,
|
||||
transaction::{self, Transaction},
|
||||
},
|
||||
solana_stake_program::{
|
||||
self, stake_instruction,
|
||||
stake_state::{Authorized, Lockup, StakeAuthorize, StakeState},
|
||||
},
|
||||
solana_stake_program::stake_state,
|
||||
solana_vote_program::vote_state::Vote,
|
||||
std::{
|
||||
sync::{atomic::AtomicBool, RwLock},
|
||||
@ -791,7 +792,7 @@ mod tests {
|
||||
let stake_authority = Keypair::new();
|
||||
let from = Keypair::new();
|
||||
let stake_account = Keypair::new();
|
||||
let stake_program_id = solana_stake_program::id();
|
||||
let stake_program_id = stake::program::id();
|
||||
let bank = Bank::new(&genesis_config);
|
||||
let blockhash = bank.last_blockhash();
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
|
||||
@ -887,7 +888,7 @@ mod tests {
|
||||
let bank = bank_forks.read().unwrap()[1].clone();
|
||||
let account = bank.get_account(&stake_account.pubkey()).unwrap();
|
||||
assert_eq!(
|
||||
StakeState::authorized_from(&account).unwrap().staker,
|
||||
stake_state::authorized_from(&account).unwrap().staker,
|
||||
new_stake_authority
|
||||
);
|
||||
}
|
||||
|
@ -1343,7 +1343,7 @@ pub(crate) mod tests {
|
||||
solana_sdk::{
|
||||
message::Message,
|
||||
signature::{Keypair, Signer},
|
||||
system_instruction, system_program, system_transaction,
|
||||
stake, system_instruction, system_program, system_transaction,
|
||||
transaction::Transaction,
|
||||
},
|
||||
std::{fmt::Debug, sync::mpsc::channel},
|
||||
@ -1544,7 +1544,7 @@ pub(crate) mod tests {
|
||||
blockhash,
|
||||
1,
|
||||
16,
|
||||
&solana_stake_program::id(),
|
||||
&stake::program::id(),
|
||||
);
|
||||
bank_forks
|
||||
.write()
|
||||
@ -1567,7 +1567,7 @@ pub(crate) mod tests {
|
||||
optimistically_confirmed_bank,
|
||||
);
|
||||
subscriptions.add_program_subscription(
|
||||
solana_stake_program::id(),
|
||||
stake::program::id(),
|
||||
Some(RpcProgramAccountsConfig {
|
||||
account_config: RpcAccountInfoConfig {
|
||||
commitment: Some(CommitmentConfig::processed()),
|
||||
@ -1584,7 +1584,7 @@ pub(crate) mod tests {
|
||||
.program_subscriptions
|
||||
.read()
|
||||
.unwrap()
|
||||
.contains_key(&solana_stake_program::id()));
|
||||
.contains_key(&stake::program::id()));
|
||||
|
||||
subscriptions.notify_subscribers(CommitmentSlots::default());
|
||||
let (response, _) = robust_poll_or_panic(transport_receiver);
|
||||
@ -1616,7 +1616,7 @@ pub(crate) mod tests {
|
||||
.program_subscriptions
|
||||
.read()
|
||||
.unwrap()
|
||||
.contains_key(&solana_stake_program::id()));
|
||||
.contains_key(&stake::program::id()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -2044,7 +2044,7 @@ pub(crate) mod tests {
|
||||
blockhash,
|
||||
1,
|
||||
16,
|
||||
&solana_stake_program::id(),
|
||||
&stake::program::id(),
|
||||
);
|
||||
|
||||
// Add the transaction to the 1st bank and then freeze the bank
|
||||
|
Reference in New Issue
Block a user