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

system-program: Remove zero lamport check on transfers #17726

Merged
merged 9 commits into from
Jun 5, 2021
Prev Previous commit
Next Next commit
Remove unnecessary assign_with_seed from split_with_seed
  • Loading branch information
joncinque committed Jun 4, 2021
commit 3980e3fb03eb9e0a1e17ef8a31a1f0063cf6b5df
5 changes: 2 additions & 3 deletions programs/stake/src/stake_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ pub fn split_with_seed(
std::mem::size_of::<StakeState>() as u64,
&id(),
),
system_instruction::assign_with_seed(split_stake_pubkey, base, seed, &id()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Landmines everywhere!

SystemInstruction::AllocateWithSeed {
base,
seed,
space,
owner,
} => {
let keyed_account = keyed_account_at_index(keyed_accounts, 0)?;
let mut account = keyed_account.try_account_ref_mut()?;
let address = Address::create(
keyed_account.unsigned_key(),
Some((&base, &seed, &owner)),
invoke_context,
)?;
allocate_and_assign(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seriously. You should see my most recent commit 😅

_split(
stake_pubkey,
authorized_pubkey,
Expand Down Expand Up @@ -783,7 +782,7 @@ mod tests {
&invalid_stake_state_pubkey(),
&Pubkey::default(),
"seed"
)[2]
)[1]
),
Err(InstructionError::InvalidAccountData),
);
Expand Down Expand Up @@ -890,7 +889,7 @@ mod tests {
&Pubkey::default(),
&Pubkey::default(),
"seed"
)[2]
)[1]
),
Err(InstructionError::InvalidAccountOwner),
);
Expand Down