Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Unifies code paths of both unsafe transmute_lifetime into one.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed May 18, 2021
1 parent 94c297e commit a74f97a
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions runtime/src/message_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,24 +357,15 @@ impl<'a> InvokeContext for ThisInvokeContext<'a> {
// Currently we are constructing new accounts on the stack
// before calling MessageProcessor::process_cross_program_instruction
// Ideally we would recycle the existing accounts here.
if index < self.account_deps.len() {
(
*is_signer,
*is_writable,
&self.account_deps[index].0,
// &self.account_deps[index].1 as &RefCell<AccountSharedData>,
transmute_lifetime(*account),
)
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],
// &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<_>>>()
Expand Down

0 comments on commit a74f97a

Please sign in to comment.