Skip to content

Commit

Permalink
Merge branch 'V2.1' into maintainer_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Shi-eld authored Apr 2, 2024
2 parents e430532 + 7afcb98 commit 5a0b9d9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ panic = "abort"

# patch Anchor 0.13 to be able to use Solana 1.9.28
[patch.crates-io]
anchor-lang = { git = "https://github.com/lidofinance/anchor-lang" }
anchor-lang = { git = "https://github.com/kkonevets/anchor-solana1.9.28.git" , branch = "solana-1.9.28"}

# https://github.com/tiny-http/tiny-http/pull/225
tiny_http = { git = "https://github.com/tiny-http/tiny-http", rev = "f0fce7ed0bdf7439b5bd0b2d15fa82944aac30f6" }
23 changes: 20 additions & 3 deletions cli/maintainer/src/commands_solido.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::convert::TryFrom;
use std::{fmt, path::PathBuf};

use serde::Serialize;
use solana_program::rent::Rent;
use solana_program::{pubkey::Pubkey, system_instruction};
use solana_sdk::{
account::ReadableAccount,
Expand All @@ -22,6 +23,7 @@ use lido::{
vote_state::get_vote_account_commission,
MINT_AUTHORITY, RESERVE_ACCOUNT, STAKE_AUTHORITY,
};
use solana_stake_program::stake_state::StakeState;
use solido_cli_common::{
error::{CliError, Error},
snapshot::{SnapshotClientConfig, SnapshotConfig},
Expand Down Expand Up @@ -963,7 +965,19 @@ pub fn command_withdraw(
.position(heaviest_validator.pubkey())
.ok_or_else(|| CliError::new("Pubkey not found in validator list"))?;

let instr = lido::instruction::withdraw(
let mut instructions = Vec::new();

// We need to fund a new stake account so it is rent-exempt https://github.com/solana-labs/solana/issues/33300.
let rent = Rent::default();
let minimum_rent_exempt_balance =
Lamports(rent.minimum_balance(std::mem::size_of::<StakeState>()));
instructions.push(system_instruction::transfer(
&config.signer.pubkey(),
&destination_stake_account.pubkey(),
minimum_rent_exempt_balance.0,
));

instructions.push(lido::instruction::withdraw(
opts.solido_program_id(),
&lido::instruction::WithdrawAccountsMetaV2 {
lido: *opts.solido_address(),
Expand All @@ -978,8 +992,11 @@ pub fn command_withdraw(
},
*opts.amount_st_sol(),
validator_index,
);
config.sign_and_send_transaction(&[instr], &[config.signer, &destination_stake_account])?;
));
config.sign_and_send_transaction(
&instructions,
&[config.signer, &destination_stake_account],
)?;

Ok((st_sol_address, destination_stake_account))
})?;
Expand Down

0 comments on commit 5a0b9d9

Please sign in to comment.