Skip to content

Commit

Permalink
Added last_host in GetHolderResponse struct
Browse files Browse the repository at this point in the history
  • Loading branch information
AnastasiyaTarasova committed Oct 11, 2024
1 parent 0419f12 commit 3874068
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion evm_loader/lib/src/commands/get_holder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub struct GetHolderResponse {
pub accounts: Option<Vec<Pubkey>>,

pub steps_executed: u64,
pub last_slot: u64,
}

impl GetHolderResponse {
Expand Down Expand Up @@ -139,7 +140,7 @@ pub fn read_holder(program_id: &Pubkey, info: AccountInfo) -> NeonResult<GetHold
// StateAccount::from_account doesn't work here because state contains heap
// and transaction inside state account has been allocated via this heap.
// Data should be read by pointers with offsets.
let (transaction, owner, origin, accounts, steps) =
let (transaction, owner, origin, accounts, steps, last_used_slot) =
StateAccount::get_state_account_view(program_id, &info)?;

let tx_params = TxParams::from_transaction(origin, &transaction);
Expand All @@ -157,6 +158,7 @@ pub fn read_holder(program_id: &Pubkey, info: AccountInfo) -> NeonResult<GetHold
origin: Some(origin),
accounts: Some(accounts),
steps_executed: steps,
last_slot: last_used_slot,
})
}
_ => Err(ProgramError::InvalidAccountData.into()),
Expand Down
5 changes: 3 additions & 2 deletions evm_loader/program/src/account/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub struct StateAccount<'a> {
data: ManuallyDrop<Boxx<Data>>,
}

type StateAccountCoreApiView = (Transaction, Pubkey, Address, Vec<Pubkey>, u64);
type StateAccountCoreApiView = (Transaction, Pubkey, Address, Vec<Pubkey>, u64, u64);

const BUFFER_OFFSET: usize = ACCOUNT_PREFIX_LEN + size_of::<Header>();

Expand Down Expand Up @@ -622,8 +622,9 @@ impl<'a> StateAccount<'a> {
.collect();

let steps = read_unaligned(addr_of!((*data_ptr).steps_executed));
let last_slot = read_unaligned(addr_of!((*data_ptr).timeout));

Ok((tx, owner, origin, accounts, steps))
Ok((tx, owner, origin, accounts, steps, last_slot))
}
}
}

0 comments on commit 3874068

Please sign in to comment.