mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-08-25 03:11:21 +00:00
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<ProgramId> for AccountId / From<AccountId> 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.
This commit is contained in:
@@ -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<AccountId, Account>` key.
|
||||
impl From<ProgramId> for AccountId {
|
||||
fn from(program_id: ProgramId) -> Self {
|
||||
let bytes: Vec<u8> = program_id
|
||||
|
||||
Reference in New Issue
Block a user