Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Revert "Update Stake with the additional deactivation flag (#4504)" (#…
Browse files Browse the repository at this point in the history
…4841)

This reverts commit 19645b6.
  • Loading branch information
joncinque authored Jul 24, 2023
1 parent 098edc4 commit 9e4e89c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions stake-pool/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ fn command_deposit_stake(
println!("Depositing stake account {:?}", stake_state);
}
let vote_account = match stake_state {
stake::state::StakeState::Stake(_, stake, _) => Ok(stake.delegation.voter_pubkey),
stake::state::StakeState::Stake(_, stake) => Ok(stake.delegation.voter_pubkey),
_ => Err("Wrong stake account state, must be delegated to validator"),
}?;

Expand Down Expand Up @@ -865,7 +865,7 @@ fn command_deposit_all_stake(
let stake_state = get_stake_state(&config.rpc_client, &stake_address)?;

let vote_account = match stake_state {
stake::state::StakeState::Stake(_, stake, _) => Ok(stake.delegation.voter_pubkey),
stake::state::StakeState::Stake(_, stake) => Ok(stake.delegation.voter_pubkey),
_ => Err("Wrong stake account state, must be delegated to validator"),
}?;

Expand Down
10 changes: 5 additions & 5 deletions stake-pool/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn get_stake_state(
let stake_state =
try_from_slice_unchecked::<stake::state::StakeState>(&stake_account_info.data.borrow())?;
match stake_state {
stake::state::StakeState::Stake(meta, stake, _) => Ok((meta, stake)),
stake::state::StakeState::Stake(meta, stake) => Ok((meta, stake)),
_ => Err(StakePoolError::WrongStakeState.into()),
}
}
Expand Down Expand Up @@ -1738,7 +1738,7 @@ impl Processor {
)?;
match stake_state {
// if it was delegated on or before this epoch, we're good
stake::state::StakeState::Stake(_, stake, _)
stake::state::StakeState::Stake(_, stake)
if stake.delegation.activation_epoch <= clock.epoch => {}
// all other situations, delegate!
_ => {
Expand Down Expand Up @@ -2275,7 +2275,7 @@ impl Processor {
}
}
}
Some(stake::state::StakeState::Stake(meta, stake, _)) => {
Some(stake::state::StakeState::Stake(meta, stake)) => {
if stake_is_usable_by_pool(
&meta,
withdraw_authority_info.key,
Expand All @@ -2297,7 +2297,7 @@ impl Processor {
)?;
validator_stake_record.status.remove_transient_stake();
} else if stake.delegation.activation_epoch < clock.epoch {
if let Some(stake::state::StakeState::Stake(_, validator_stake, _)) =
if let Some(stake::state::StakeState::Stake(_, validator_stake)) =
validator_stake_state
{
if validator_stake.delegation.activation_epoch < clock.epoch {
Expand Down Expand Up @@ -2338,7 +2338,7 @@ impl Processor {
)
.ok();
match validator_stake_state {
Some(stake::state::StakeState::Stake(meta, stake, _)) => {
Some(stake::state::StakeState::Stake(meta, stake)) => {
let additional_lamports = validator_stake_info
.lamports()
.saturating_sub(stake.delegation.stake)
Expand Down
4 changes: 1 addition & 3 deletions stake-pool/program/tests/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2382,9 +2382,7 @@ pub fn add_validator_stake_account(
let stake_account = SolanaAccount::create(
stake_amount + STAKE_ACCOUNT_RENT_EXEMPTION,
bincode::serialize::<stake::state::StakeState>(&stake::state::StakeState::Stake(
meta,
stake,
stake::stake_flags::StakeFlags::empty(),
meta, stake,
))
.unwrap(),
stake::program::id(),
Expand Down
4 changes: 2 additions & 2 deletions stake-pool/program/tests/vsa_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ async fn success() {
let stake = get_account(&mut banks_client, &validator_stake.stake_account).await;
let stake_state = deserialize::<stake::state::StakeState>(&stake.data).unwrap();
match stake_state {
stake::state::StakeState::Stake(meta, _, _) => {
stake::state::StakeState::Stake(meta, _) => {
assert_eq!(
&meta.authorized.staker,
&stake_pool_accounts.withdraw_authority
Expand Down Expand Up @@ -595,7 +595,7 @@ async fn success_with_lamports_in_account() {
let stake = get_account(&mut banks_client, &validator_stake.stake_account).await;
let stake_state = deserialize::<stake::state::StakeState>(&stake.data).unwrap();
match stake_state {
stake::state::StakeState::Stake(meta, _, _) => {
stake::state::StakeState::Stake(meta, _) => {
assert_eq!(
&meta.authorized.staker,
&stake_pool_accounts.withdraw_authority
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/single-pool-cli/src/quarantine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub async fn get_stake_info(
.await?
{
match bincode::deserialize::<StakeState>(&stake_account.data)? {
StakeState::Stake(meta, stake, _) => Ok(Some((meta, stake))),
StakeState::Stake(meta, stake) => Ok(Some((meta, stake))),
StakeState::Initialized(_) => {
Err(format!("Stake account {} is undelegated", stake_account_address).into())
}
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/single-pool/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn get_stake_state(stake_account_info: &AccountInfo) -> Result<(Meta, Stake), Pr
let stake_state = try_from_slice_unchecked::<StakeState>(&stake_account_info.data.borrow())?;

match stake_state {
StakeState::Stake(meta, stake, _) => Ok((meta, stake)),
StakeState::Stake(meta, stake) => Ok((meta, stake)),
_ => Err(SinglePoolError::WrongStakeState.into()),
}
}
Expand Down
2 changes: 1 addition & 1 deletion stake-pool/single-pool/tests/helpers/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub async fn get_stake_account(
let lamports = stake_account.lamports;
match deserialize::<StakeState>(&stake_account.data).unwrap() {
StakeState::Initialized(meta) => (meta, None, lamports),
StakeState::Stake(meta, stake, _) => (meta, Some(stake), lamports),
StakeState::Stake(meta, stake) => (meta, Some(stake), lamports),
_ => unimplemented!(),
}
}
Expand Down

0 comments on commit 9e4e89c

Please sign in to comment.