From 76587f65fc0027ea710e12a31e08d9bbe45c4675 Mon Sep 17 00:00:00 2001 From: Marvin Jones Date: Thu, 13 Aug 2026 16:10:00 -0400 Subject: [PATCH] feat(lee): migrate Account.program_owner from ProgramId to AccountId Account.program_owner is now AccountId-typed instead of ProgramId, via a new bijective From for AccountId / From for ProgramId conversion pair (pure byte reinterpretation, not a hash - both types are exactly 32 bytes). Adds DEFAULT_PROGRAM_OWNER as the AccountId-typed counterpart to DEFAULT_PROGRAM_ID, used at every program_owner comparison/claim site instead of an inline AccountId::default(). Touches every call site across lee_core, lee (including the guest-side privacy-preserving circuit), all 16 deployed guest programs, wallet/wallet-ffi, indexer_ffi/indexer_service/ indexer_service_protocol, sequencer_core, testnet_initial_state, system_accounts, cross_zone, storage, cycle_bench, and integration_tests - mostly mechanical .into() conversions, plus two simplifications: wallet's manual base58 encode/decode of program_owner was dead code once it's AccountId (which already has Display/FromStr), and the FFI crates' program_owner field now reuses the existing generic FfiBytes32 wrapper instead of the now-unused FfiProgramId one. Rebuilds every guest ELF artifact and the prebuilt sequencer test fixture via just build-artifacts, since execute_and_prove runs against the checked-in precompiled privacy_preserving_circuit.bin, which isn't rebuilt automatically by cargo test/check. --- lee/state_machine/core/src/program/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lee/state_machine/core/src/program/mod.rs b/lee/state_machine/core/src/program/mod.rs index 59be7ef50..e8c6c6796 100644 --- a/lee/state_machine/core/src/program/mod.rs +++ b/lee/state_machine/core/src/program/mod.rs @@ -23,8 +23,12 @@ pub const MAX_NUMBER_CHAINED_CALLS: usize = 10; pub type ProgramId = [u32; 8]; -/// TODO: This is a temporary conversion; will be removed once `Program` to `Account` -/// migration is complete. +/// Derives the `AccountId` under which a program's data is stored, directly from its +/// `ProgramId`, by reinterpreting the 8 little-endian `u32` words as 32 raw bytes. +/// +/// A 1:1, information-preserving mapping (both types are exactly 32 bytes) rather than a +/// hash — `ProgramId` is already content-derived (RISC0's `image_id`), so no extra domain +/// separation is needed just to use it as a `HashMap` key. impl From for AccountId { fn from(program_id: ProgramId) -> Self { let bytes: Vec = program_id