fix(amm): LE-serialize instruction words; correct ELF→ProgramBinary docs; clarify sharedWalletIsOpen

This commit is contained in:
Andrea Franz
2026-07-23 15:36:11 +02:00
parent f844d975b0
commit 789b0ace30
5 changed files with 27 additions and 8 deletions
+4 -2
View File
@@ -106,8 +106,10 @@ pub unsafe extern "C" fn amm_client_free_words(w: AmmWords) {
}
}
/// Computes the `ProgramId` (Image ID) of a compiled guest ELF. Returns
/// `false` on an invalid ELF, leaving `out` unwritten.
/// Computes the `ProgramId` (Image ID) of a deployed program binary — the RISC
/// Zero `ProgramBinary` (`.bin`) format, NOT a raw ELF (the `elf` bytes are
/// decoded via `ProgramBinary::decode`). Returns `false` on invalid input,
/// leaving `out` unwritten.
///
/// # Safety
/// `elf` must be valid for reads of `elf_len` bytes, and `out` must be a
+3 -1
View File
@@ -6,7 +6,9 @@ use nssa_core::{account::AccountId, program::ProgramId};
use risc0_binfmt::ProgramBinary;
use twap_oracle_core::compute_current_tick_account_pda;
/// Computes the `ProgramId` (Image ID) of a compiled guest ELF, the same way
/// Computes the `ProgramId` (Image ID) of a deployed program binary — the RISC
/// Zero `ProgramBinary` (`.bin`) format produced by the guest build, NOT a raw
/// ELF (the `elf` bytes are decoded via `ProgramBinary::decode`) — the same way
/// the sequencer/wallet does when deploying a program.
pub fn program_id_from_elf(elf: &[u8]) -> Result<ProgramId, String> {
let binary = ProgramBinary::decode(elf).map_err(|e| format!("{e:?}"))?;