mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 22:21:16 +00:00
fix(amm): LE-serialize instruction words; correct ELF→ProgramBinary docs; clarify sharedWalletIsOpen
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:?}"))?;
|
||||
|
||||
Reference in New Issue
Block a user