Direct entrypoint for execution (#7746)

This commit is contained in:
Jack May
2020-01-10 13:20:15 -08:00
committed by GitHub
parent 27d2c0aaf3
commit 08ba27627d
9 changed files with 230 additions and 276 deletions

View File

@ -113,6 +113,12 @@ pub fn next_keyed_account<I: Iterator>(iter: &mut I) -> Result<I::Item, Instruct
iter.next().ok_or(InstructionError::NotEnoughAccountKeys)
}
/// Return true if the first keyed_account is executable, used to determine if
/// the loader should call a program's 'main'
pub fn is_executable(keyed_accounts: &[KeyedAccount]) -> bool {
!keyed_accounts.is_empty() && keyed_accounts[0].account.executable
}
pub fn limited_deserialize<T>(data: &[u8]) -> Result<T, InstructionError>
where
T: serde::de::DeserializeOwned,

View File

@ -24,14 +24,6 @@ pub enum LoaderInstruction {
///
/// The transaction must be signed by key[0]
Finalize,
/// Invoke the "main" entrypoint with the given data.
///
/// * key[0] - an executable account
InvokeMain {
#[serde(with = "serde_bytes")]
data: Vec<u8>,
},
}
pub fn write(