mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-11 10:39:28 +00:00
feat: add self_program_id to ProgramInput and read_nssa_inputs
This commit is contained in:
parent
fbdfd8f7ef
commit
27299e75cc
@ -16,6 +16,7 @@ pub const MAX_NUMBER_CHAINED_CALLS: usize = 10;
|
|||||||
pub type ProgramId = [u32; 8];
|
pub type ProgramId = [u32; 8];
|
||||||
pub type InstructionData = Vec<u32>;
|
pub type InstructionData = Vec<u32>;
|
||||||
pub struct ProgramInput<T> {
|
pub struct ProgramInput<T> {
|
||||||
|
pub self_program_id: ProgramId,
|
||||||
pub pre_states: Vec<AccountWithMetadata>,
|
pub pre_states: Vec<AccountWithMetadata>,
|
||||||
pub instruction: T,
|
pub instruction: T,
|
||||||
}
|
}
|
||||||
@ -415,11 +416,13 @@ pub fn compute_authorized_pdas(
|
|||||||
/// Reads the NSSA inputs from the guest environment.
|
/// Reads the NSSA inputs from the guest environment.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn read_nssa_inputs<T: DeserializeOwned>() -> (ProgramInput<T>, InstructionData) {
|
pub fn read_nssa_inputs<T: DeserializeOwned>() -> (ProgramInput<T>, InstructionData) {
|
||||||
|
let self_program_id: ProgramId = env::read();
|
||||||
let pre_states: Vec<AccountWithMetadata> = env::read();
|
let pre_states: Vec<AccountWithMetadata> = env::read();
|
||||||
let instruction_words: InstructionData = env::read();
|
let instruction_words: InstructionData = env::read();
|
||||||
let instruction = T::deserialize(&mut Deserializer::new(instruction_words.as_ref())).unwrap();
|
let instruction = T::deserialize(&mut Deserializer::new(instruction_words.as_ref())).unwrap();
|
||||||
(
|
(
|
||||||
ProgramInput {
|
ProgramInput {
|
||||||
|
self_program_id,
|
||||||
pre_states,
|
pre_states,
|
||||||
instruction,
|
instruction,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user