Skip to content

Commit

Permalink
fix Solana error MergeTransientStake
Browse files Browse the repository at this point in the history
When there is a big amount in a reserve account Solana can't activate
it in a single shot. It activates it in several epochs. When reserve
SOLs are sent to stake accounts those stake accounts are still not
fully activated after current epoch. But if Solido creates a new stake
account in next epoch (e.g. I make a new deposit) then at the end of
epoch it tries to merger these two account and gets Solana error
"stake account with transient stake cannot be merged". We can't merge
non fully activated stake account from different activation epochs.

Same error is reproduced in Solido v2. If there is lots of SOL in a
reserve account (currently we have ~4_000_000 SOL on mainnet) then
after migrate to v2 instruction it stakes from reserve and stake is
activated partially. And if I try to deposit e.g. 10 SOL, then another
stake account is created and merging those two account fails at epoch
end.

Guess the same error will happen on v1 if I remove all validators and then add a new one. There should be at least 600_000 SOL in the reserve for the error to happen. On local validator Solana activates max 250_000 SOL per epoch.
  • Loading branch information
kkonevets committed Sep 4, 2022
1 parent 0ea7140 commit 45aec53
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion program/src/stake_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@ impl StakeAccount {
return true;
}
// Two activating accounts that share an activation epoch, during the activation epoch.
if self.is_activating() && merge_from.is_activating() {
if self.is_activating()
&& merge_from.is_activating()
&& self.activation_epoch == merge_from.activation_epoch
{
return true;
}
}
Expand Down

0 comments on commit 45aec53

Please sign in to comment.