Skip to content

Commit 10ba90c

Browse files
committed
dammit we have to skip this one too
1 parent 8acfefd commit 10ba90c

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

program/src/processor.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -325,26 +325,27 @@ fn move_stake_or_lamports_shared_checks(
325325
}
326326

327327
// NOTE our usage of the accounts iter is idiosyncratic, in imitation of the native stake program
328-
// native stake typically accumulates all signers from the accounts array indiscriminately
329-
// each instruction processor also asserts a required number of instruction accounts
330-
// but this is extremely ad hoc, essentially allowing any account to act as a signing authority
331-
// when lengths are asserted in setup, accounts are retrieved via hardcoded index from InstructionContext
332-
// but after control is passed to main processing functions, they are pulled from the TransactionContext
328+
// native stake typically, but not always, accumulated signers from the accounts array indiscriminately
329+
// this was done extremely ad hoc, essentially allowing any account to act as a signing authority
330+
// instruction processors also asserted a required number of instruction accounts, often fewer than the actual number
331+
// when lengths were asserted in setup, accounts were retrieved via hardcoded index from InstructionContext
332+
// but after control was passed to main processing functions, they were pulled from the TransactionContext
333333
//
334334
// when porting to bpf, we reimplemented this behavior exactly, such that both programs would be consensus compatible:
335335
// * all transactions that would fail on one program also fail on the other
336336
// * all transactions that would succeed on one program also succeed on the other
337337
// * for successful transactions, all account state transitions are identical
338-
// error codes and log output may differ
339-
//
340-
// the new interface is designed to be more restrictive, asserting the presence of accounts which were technically optional
341-
// when we remove the old interface, `consume_next_account()` calls can become `next_account_to_use()`
342-
// this differs from `.ok()` account retrievals (lockup custodians) which are optional by design
338+
// error codes and log output sometimes differed
343339
//
344340
// the native stake program also accepted some sysvars as input accounts, but pulled others from `InvokeContext`
345341
// this was done for backwards compatibility but the end result was highly inconsistent
346342
// now, we skip all sysvar accounts previously required (clock, rent, stake history) and retrieve them via syscall
347343
// we also skip the stake config account, which was removed from native stake but is still included in instruction builders
344+
//
345+
// the sysvar-free interface is more restrictive, requiring positional authorities which were previously optional
346+
// if or when we remove the old interface, `consume_next_account()` calls can become `next_account_to_use()`
347+
// these differ from `.ok()` account retrievals (lockup custodians) which will always be optional by design
348+
// eventually we may be able to move away from signer globbing to a standard fully positional interface
348349
pub struct Processor {}
349350
impl Processor {
350351
fn process_initialize(
@@ -466,7 +467,7 @@ impl Processor {
466467

467468
// other accounts
468469
// NOTE we cannot consume this account without a breaking change
469-
// its presence was never enforced and Split never accepted sysvars as args
470+
// its presence was never enforced and `Split` never accepted sysvars as args
470471
// we may decide to enforce this as a breaking change if the pattern is not used on mainnet
471472
// let _stake_authority_info = next_account_to_use(account_info_iter)?;
472473

@@ -766,7 +767,10 @@ impl Processor {
766767
let stake_account_info = next_account_to_use(account_info_iter)?;
767768

768769
// other accounts
769-
let _old_withdraw_or_lockup_authority_info = consume_next_account(account_info_iter)?;
770+
// NOTE we cannot consume this account without a breaking change
771+
// its presence was never enforced and `SetLockup` never accepted sysvars as args
772+
// we may decide to enforce this as a breaking change if the pattern is not used on mainnet
773+
// let _old_withdraw_or_lockup_authority_info = next_account_to_use(account_info_iter)?;
770774

771775
let clock = Clock::get()?;
772776

@@ -978,9 +982,9 @@ impl Processor {
978982
let stake_account_info = next_account_to_use(account_info_iter)?;
979983

980984
// other accounts
981-
// NOTE we cannot unconditionally consume the old authority without a breaking change
982-
// it was technically not required by native stake if removing a lockup
983-
// but if this interaction pattern is not used on mainnet, we can add `?`
985+
// NOTE we cannot consume this account without a breaking change
986+
// its presence was never enforced and `SetLockupChecked` never accepted sysvars as args
987+
// we may decide to enforce this as a breaking change if the pattern is not used on mainnet
984988
let _old_withdraw_or_lockup_authority_info = next_account_to_use(account_info_iter);
985989
let option_new_lockup_authority_info = next_account_to_use(account_info_iter).ok();
986990

@@ -1310,8 +1314,6 @@ impl Processor {
13101314
}
13111315
#[allow(deprecated)]
13121316
StakeInstruction::Redelegate => Err(ProgramError::InvalidInstructionData),
1313-
// NOTE we assume the program is going live after `move_stake_and_move_lamports_ixs` is
1314-
// activated
13151317
StakeInstruction::MoveStake(lamports) => {
13161318
msg!("Instruction: MoveStake");
13171319
Self::process_move_stake(accounts, lamports)

0 commit comments

Comments
 (0)