refactor(lee): migrate program self/caller identity from ProgramId to AccountId

ProgramInput/ProgramOutput.self_program_id/caller_program_id, and the
dispatcher's CallerData.program_id, now carry AccountId (renamed to
self_account_id/caller_account_id) instead of ProgramId. These fields
are self-reported/cross-checked dispatch bookkeeping, not RISC0 image
identity, and AccountId already crosses the guest/host boundary this
way via every pre_state.account_id.

ProgramId is now confined to what's actually image-id-keyed:
env::verify, Program.id (from compute_image_id()), and the
for_public_pda/for_private_pda derivation formulas, each recovering
the real ProgramId from AccountId via the existing bijection exactly
where needed.

Rebuilds artifacts and the prebuilt sequencer db fixture to match.
This commit is contained in:
Marvin Jones
2026-08-14 16:43:59 -04:00
parent 7ce202c64e
commit 0ef2d61fee
86 changed files with 457 additions and 427 deletions
@@ -19,8 +19,8 @@ fn main() {
// Read inputs
let (
ProgramInput {
self_program_id,
caller_program_id,
self_account_id,
caller_account_id,
pre_states,
instruction: greeting,
},
@@ -53,8 +53,8 @@ fn main() {
// WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be
// called to commit the output.
ProgramOutput::new(
self_program_id,
caller_program_id,
self_account_id,
caller_account_id,
instruction_data,
vec![pre_state],
vec![post_state],
@@ -19,8 +19,8 @@ fn main() {
// Read inputs
let (
ProgramInput {
self_program_id,
caller_program_id,
self_account_id,
caller_account_id,
pre_states,
instruction: greeting,
},
@@ -60,8 +60,8 @@ fn main() {
// WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be
// called to commit the output.
ProgramOutput::new(
self_program_id,
caller_program_id,
self_account_id,
caller_account_id,
instruction_data,
vec![pre_state],
vec![post_state],
@@ -66,8 +66,8 @@ fn main() {
// Read input accounts.
let (
ProgramInput {
self_program_id,
caller_program_id,
self_account_id,
caller_account_id,
pre_states,
instruction: (function_id, data),
},
@@ -88,8 +88,8 @@ fn main() {
// WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be
// called to commit the output.
ProgramOutput::new(
self_program_id,
caller_program_id,
self_account_id,
caller_account_id,
instruction_words,
pre_states,
post_states,
@@ -27,8 +27,8 @@ fn main() {
// Read inputs
let (
ProgramInput {
self_program_id,
caller_program_id,
self_account_id,
caller_account_id,
pre_states,
instruction: (),
},
@@ -58,8 +58,8 @@ fn main() {
// WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be
// called to commit the output.
ProgramOutput::new(
self_program_id,
caller_program_id,
self_account_id,
caller_account_id,
instruction_data,
vec![pre_state],
vec![post_state],
@@ -32,8 +32,8 @@ fn main() {
// Read inputs
let (
ProgramInput {
self_program_id,
caller_program_id,
self_account_id,
caller_account_id,
pre_states,
instruction: (),
},
@@ -70,8 +70,8 @@ fn main() {
// WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be
// called to commit the output.
ProgramOutput::new(
self_program_id,
caller_program_id,
self_account_id,
caller_account_id,
instruction_data,
vec![pre_state],
vec![post_state],