Upgradeable programs called same as non-upgradeable (#14239)

* Upgradeable programs called same as non-upgradeable

* nudge
This commit is contained in:
Jack May
2020-12-22 09:26:55 -08:00
committed by GitHub
parent 1b30155dc3
commit ab205b682a
8 changed files with 212 additions and 76 deletions

View File

@@ -993,6 +993,7 @@ mod tests {
Rent::default(),
vec![],
&[],
&[],
None,
BpfComputeBudget {
max_units: 1,

View File

@@ -1389,18 +1389,19 @@ fn call<'a>(
.ok_or(SyscallError::InstructionError(
InstructionError::MissingAccount,
))?;
if !program_account.executable {
if !program_account.borrow().executable {
return Err(SyscallError::InstructionError(InstructionError::AccountNotExecutable).into());
}
let programdata_executable = if program_account.owner == bpf_loader_upgradeable::id() {
let programdata_executable = if program_account.borrow().owner == bpf_loader_upgradeable::id() {
if let UpgradeableLoaderState::Program {
programdata_address,
} = program_account
.borrow()
.state()
.map_err(SyscallError::InstructionError)?
{
if let Some(account) = invoke_context.get_account(&programdata_address) {
Some((programdata_address, RefCell::new(account)))
Some((programdata_address, account))
} else {
return Err(
SyscallError::InstructionError(InstructionError::MissingAccount).into(),
@@ -1412,7 +1413,7 @@ fn call<'a>(
} else {
None
};
let mut executable_accounts = vec![(callee_program_id, RefCell::new(program_account))];
let mut executable_accounts = vec![(callee_program_id, program_account)];
if let Some(programdata) = programdata_executable {
executable_accounts.push(programdata);
}