Refactor: Make program_id always last in program chain (#20598)
* Replaces program_id field in InvokeContextStackFrame by index. * Swaps order of program account and programdata account. * Removes program_id parameter from InvokeContext::push().
This commit is contained in:
committed by
GitHub
parent
c231cfe235
commit
1d813ea078
@ -485,7 +485,7 @@ impl InstructionProcessor {
|
||||
);
|
||||
return Err(InstructionError::AccountNotExecutable);
|
||||
}
|
||||
let mut program_indices = vec![program_account_index];
|
||||
let mut program_indices = vec![];
|
||||
if program_account.borrow().owner() == &bpf_loader_upgradeable::id() {
|
||||
if let UpgradeableLoaderState::Program {
|
||||
programdata_address,
|
||||
@ -512,6 +512,7 @@ impl InstructionProcessor {
|
||||
return Err(InstructionError::MissingAccount);
|
||||
}
|
||||
}
|
||||
program_indices.push(program_account_index);
|
||||
|
||||
Ok((message, caller_write_privileges, program_indices))
|
||||
}
|
||||
@ -593,8 +594,6 @@ impl InstructionProcessor {
|
||||
.get(0)
|
||||
.ok_or(InstructionError::GenericError)?;
|
||||
|
||||
let program_id = instruction.program_id(&message.account_keys);
|
||||
|
||||
// Verify the calling program hasn't misbehaved
|
||||
invoke_context.verify_and_update(instruction, account_indices, caller_write_privileges)?;
|
||||
|
||||
@ -602,13 +601,7 @@ impl InstructionProcessor {
|
||||
invoke_context.set_return_data(Vec::new())?;
|
||||
|
||||
// Invoke callee
|
||||
invoke_context.push(
|
||||
program_id,
|
||||
message,
|
||||
instruction,
|
||||
program_indices,
|
||||
Some(account_indices),
|
||||
)?;
|
||||
invoke_context.push(message, instruction, program_indices, Some(account_indices))?;
|
||||
|
||||
let mut instruction_processor = InstructionProcessor::default();
|
||||
for (program_id, process_instruction) in invoke_context.get_programs().iter() {
|
||||
|
Reference in New Issue
Block a user