Files
logos-execution-zone/test_programs/guest/src/bin/chained_call_forwarder.rs
T
Marvin JonesandClaude Sonnet 5 ed61107f1c refactor(lee): unify program dispatch/bijection addresses, fix downstream bugs
Programs dispatch at the address seeded via with_programs/a live Deploy
(loader_core::immutable_deploy_account_id), not the bijection
AccountId::from(program_id) used by the legacy ProgramDeploymentTransaction
storage shape. This sweep threads the correct address through
lee/lez/integration_tests/wallet-ffi call sites and fixes 7 dispatch-address
bugs the mismatch was masking: bijection-vs-real-PDA mismatches in
lez/wallet's native_token_transfer facade, integration_tests'
auth_transfer/private and private_pda suites, wallet-ffi's
generic_transaction FFI boundary, a stale assertion in program_deployment.rs,
and a stale expected-error string in cross_zone_state_machine.rs.

Also includes a full clippy/fmt pass: doc-comment reflow, #[expect(...)]
attribute additions, redundant type-annotation/unused-import removal, and
two assert!s added purely for bounds-check elision on already-guarded
slices — no logic changes. Both CI clippy invocations and cargo fmt --check
are clean.

Verified: RISC0_DEV_MODE=1 cargo test -p lee --lib (214 passed) and the
broader sanity set across lee/wallet/bridge_lock_core/ping_core/
cross_zone_outbox_core/sequencer_core (mock features) both green.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 21:14:21 -04:00

49 lines
1.4 KiB
Rust

//! Forwards a single chained call to `target_program_id`'s dispatch address with
//! `instruction_data`, passing through whatever `pre_states` this program itself was invoked
//! with unchanged.
//!
//! Exists purely as test infrastructure: lets a test exercise "program X invokes program Y via
//! a chained call" for an arbitrary Y and instruction, without needing a purpose-built guest for
//! every target program under test.
use lee_core::{
account::AccountId,
program::{AccountPostState, ChainedCall, ProgramInput, ProgramOutput, read_lee_inputs},
};
type Instruction = (AccountId, Vec<u32>);
fn main() {
let (
ProgramInput {
self_account_id,
caller_account_id,
pre_states,
instruction: (target_program_id, instruction_data),
},
instruction_words,
) = read_lee_inputs::<Instruction>();
let post_states = pre_states
.iter()
.map(|pre| AccountPostState::new(pre.account.clone()))
.collect();
let chained_call = ChainedCall {
program_account_id: target_program_id,
instruction_data,
pre_states: pre_states.clone(),
pda_seeds: vec![],
};
ProgramOutput::new(
self_account_id,
caller_account_id,
instruction_words,
pre_states,
post_states,
)
.with_chained_calls(vec![chained_call])
.write();
}