Fix InvokeContext::push() account_deps (#17350)
* Reverts aliasing of account_deps with the previous invocation stack frame in InvokeContext::push(). * Adds explicit assert of programdata account content in test_program_bpf_upgrade_via_cpi.
This commit is contained in:
committed by
GitHub
parent
9471ba61c5
commit
855ae79598
@ -354,27 +354,19 @@ impl<'a> InvokeContext for ThisInvokeContext<'a> {
|
||||
.chain(self.message.account_keys.iter())
|
||||
.position(|key| key == *search_key)
|
||||
.map(|mut index| {
|
||||
if index < self.account_deps.len() {
|
||||
(
|
||||
*is_signer,
|
||||
*is_writable,
|
||||
&self.account_deps[index].0,
|
||||
&self.account_deps[index].1 as &RefCell<AccountSharedData>,
|
||||
)
|
||||
// TODO
|
||||
// Currently we are constructing new accounts on the stack
|
||||
// before calling MessageProcessor::process_cross_program_instruction
|
||||
// Ideally we would recycle the existing accounts here.
|
||||
let key = if index < self.account_deps.len() {
|
||||
&self.account_deps[index].0
|
||||
// &self.account_deps[index].1 as &RefCell<AccountSharedData>,
|
||||
} else {
|
||||
index = index.saturating_sub(self.account_deps.len());
|
||||
(
|
||||
*is_signer,
|
||||
*is_writable,
|
||||
&self.message.account_keys[index],
|
||||
// TODO
|
||||
// Currently we are constructing new accounts on the stack
|
||||
// before calling MessageProcessor::process_cross_program_instruction
|
||||
// Ideally we would recycle the existing accounts here like this:
|
||||
// &self.accounts[index] as &RefCell<AccountSharedData>,
|
||||
transmute_lifetime(*account),
|
||||
)
|
||||
}
|
||||
&self.message.account_keys[index]
|
||||
// &self.accounts[index] as &RefCell<AccountSharedData>,
|
||||
};
|
||||
(*is_signer, *is_writable, key, transmute_lifetime(*account))
|
||||
})
|
||||
})
|
||||
.collect::<Option<Vec<_>>>()
|
||||
|
Reference in New Issue
Block a user