mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-07-14 01:39:58 +00:00
Integrates origin/main (per-program-crate refactor) and re-homes the cross-zone messaging feature onto it. BREAKING CHANGE: Genesis state root changes. This registers six builtin programs (cross_zone_outbox, cross_zone_inbox, ping_sender, ping_receiver, bridge_lock, wrapped_token) and seeds their genesis accounts (the wrapped_token authorized minter config, the per-zone inbox config, and optional bridge-lock holdings). Building the new cores alongside the existing builtins also enables serde/alloc for the shared programs build, regenerating every builtin program image id. All nodes must upgrade together.
39 lines
1.2 KiB
Rust
39 lines
1.2 KiB
Rust
use lee_core::{
|
|
account::AccountId,
|
|
program::{PdaSeed, ProgramId},
|
|
};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
const PING_RECORD_SEED: [u8; 32] = *b"/LEZ/v0.3/PingRecord/0000000000/";
|
|
|
|
/// Instruction delivered to `ping_receiver` by the inbox: record the payload.
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum ReceiverInstruction {
|
|
Record { payload: Vec<u8> },
|
|
}
|
|
|
|
/// Instruction to `ping_sender`: forwarded verbatim into `cross_zone_outbox::Instruction::Emit`.
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum SenderInstruction {
|
|
Send {
|
|
outbox_program_id: ProgramId,
|
|
target_zone: [u8; 32],
|
|
target_program_id: ProgramId,
|
|
target_accounts: Vec<[u8; 32]>,
|
|
payload: Vec<u8>,
|
|
ordinal: u32,
|
|
},
|
|
}
|
|
|
|
/// The account a `ping_receiver` records the latest delivered payload into.
|
|
#[must_use]
|
|
pub fn ping_record_pda(receiver_id: ProgramId) -> AccountId {
|
|
AccountId::for_public_pda(&receiver_id, &ping_record_seed())
|
|
}
|
|
|
|
/// Seed of the record PDA, exposed so the guest can claim the account.
|
|
#[must_use]
|
|
pub const fn ping_record_seed() -> PdaSeed {
|
|
PdaSeed::new(PING_RECORD_SEED)
|
|
}
|