fix: verify caller_program_id in program output

This commit is contained in:
Moudy
2026-04-07 19:03:06 +02:00
parent 495680e2ea
commit 7d465dded7
17 changed files with 109 additions and 17 deletions
@@ -20,7 +20,7 @@ fn main() {
let (
ProgramInput {
self_program_id,
caller_program_id: _,
caller_program_id,
pre_states,
instruction: greeting,
},
@@ -54,6 +54,7 @@ fn main() {
// called to commit the output.
ProgramOutput::new(
self_program_id,
caller_program_id,
instruction_data,
vec![pre_state],
vec![post_state],
@@ -20,7 +20,7 @@ fn main() {
let (
ProgramInput {
self_program_id,
caller_program_id: _,
caller_program_id,
pre_states,
instruction: greeting,
},
@@ -61,6 +61,7 @@ fn main() {
// called to commit the output.
ProgramOutput::new(
self_program_id,
caller_program_id,
instruction_data,
vec![pre_state],
vec![post_state],
@@ -67,7 +67,7 @@ fn main() {
let (
ProgramInput {
self_program_id,
caller_program_id: _,
caller_program_id,
pre_states,
instruction: (function_id, data),
},
@@ -87,5 +87,5 @@ 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, instruction_words, pre_states, post_states).write();
ProgramOutput::new(self_program_id, caller_program_id, instruction_words, pre_states, post_states).write();
}
@@ -28,7 +28,7 @@ fn main() {
let (
ProgramInput {
self_program_id,
caller_program_id: _,
caller_program_id,
pre_states,
instruction: (),
},
@@ -59,6 +59,7 @@ fn main() {
// called to commit the output.
ProgramOutput::new(
self_program_id,
caller_program_id,
instruction_data,
vec![pre_state],
vec![post_state],
@@ -34,7 +34,7 @@ fn main() {
let (
ProgramInput {
self_program_id,
caller_program_id: _,
caller_program_id,
pre_states,
instruction: (),
},
@@ -72,6 +72,7 @@ fn main() {
// called to commit the output.
ProgramOutput::new(
self_program_id,
caller_program_id,
instruction_data,
vec![pre_state],
vec![post_state],