increaseAdditionalValidatorStake static method
TransactionInstruction
increaseAdditionalValidatorStake({
- required Pubkey stakePoolAddress,
- required Pubkey staker,
- required Pubkey withdrawAuthority,
- required Pubkey validatorList,
- required Pubkey reserveStake,
- required Pubkey uninitializedStakeAccount,
- required Pubkey transientStakeAccount,
- required Pubkey validatorStakeAccount,
- required Pubkey voteAccount,
- required bu64 lamports,
- required bu64 transientStakeSeed,
- required bu64 ephemeralStakeSeed,
(Staker only) Increase stake on a validator again in an epoch.
Works regardless if the transient stake account exists.
Internally, this instruction splits reserve stake into an ephemeral stake account, activates
it, then merges or splits it into the transient stake account delegated to the appropriate
validator. UpdateValidatorListBalance
will do the work of merging once it's ready.
The minimum amount to move is rent-exemption plus
max(crate::MINIMUM_ACTIVE_STAKE, solana_program::stake::tools::get_minimum_delegation())
.
The rent-exemption of the stake account is withdrawn back to the reserve after it is merged.
Keys:
[]
stakePoolAddress
- Stake pool.[s]
staker
- Stake pool staker.[]
withdrawAuthority
- Stake pool withdraw authority.[w]
validatorList
- Validator list.[w]
reserveStake
- Stake pool reserve stake.[w]
uninitializedStakeAccount
- Uninitialized ephemeral stake account to receive stake.[w]
transientStakeAccount
- Transient stake account.[]
validatorStakeAccount
- Validator stake account.[]
voteAccount
- Validator vote account to delegate to.
Data:
lamports
- Amount of lamports to increase on the given validator. The actual amount split into the transient stake account is:lamports + stake_rent_exemption
.transientStakeSeed
- Seed used to create transient stake account.ephemeralStakeSeed
- Seed used to create ephemeral account. userdata:
Implementation
static TransactionInstruction increaseAdditionalValidatorStake({
// Keys
required final Pubkey stakePoolAddress,
required final Pubkey staker,
required final Pubkey withdrawAuthority,
required final Pubkey validatorList,
required final Pubkey reserveStake,
required final Pubkey uninitializedStakeAccount,
required final Pubkey transientStakeAccount,
required final Pubkey validatorStakeAccount,
required final Pubkey voteAccount,
// Data
required final bu64 lamports,
required final bu64 transientStakeSeed,
required final bu64 ephemeralStakeSeed,
}) {
// 0. `[]` Stake pool
// 1. `[s]` Stake pool staker
// 2. `[]` Stake pool withdraw authority
// 3. `[w]` Validator list
// 4. `[w]` Stake pool reserve stake
// 5. `[w]` Uninitialized ephemeral stake account to receive stake
// 6. `[w]` Transient stake account
// 7. `[]` Validator stake account
// 8. `[]` Validator vote account to delegate to
// 9. '[]' Clock sysvar
// 10. `[]` Stake History sysvar
// 11. `[]` Stake Config sysvar
// 12. `[]` System program
// 13. `[]` Stake program
final List<AccountMeta> keys = [
AccountMeta(stakePoolAddress),
AccountMeta.signer(staker),
AccountMeta(withdrawAuthority),
AccountMeta.writable(validatorList),
AccountMeta.writable(reserveStake),
AccountMeta.writable(uninitializedStakeAccount),
AccountMeta.writable(transientStakeAccount),
AccountMeta(validatorStakeAccount),
AccountMeta(voteAccount),
AccountMeta(sysvarClockPubkey),
AccountMeta(sysvarStakeHistoryPubkey),
AccountMeta(StakeProgram.configId),
AccountMeta(SystemProgram.programId),
AccountMeta(StakeProgram.programId),
];
final List<Iterable<int>> data = [
borsh.u64.encode(lamports),
borsh.u64.encode(transientStakeSeed),
borsh.u64.encode(ephemeralStakeSeed),
];
return _instance.createTransactionIntruction(
StakePoolInstruction.increaseAdditionalValidatorStake,
keys: keys,
data: data,
);
}