From 85cc3236497414e0b07b42787dde01959b9a8f2d Mon Sep 17 00:00:00 2001 From: moudyellaz Date: Thu, 2 Apr 2026 00:39:36 +0200 Subject: [PATCH] feat: verify self_program_id in privacy circuit --- .../guest/src/bin/privacy_preserving_circuit.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/program_methods/guest/src/bin/privacy_preserving_circuit.rs b/program_methods/guest/src/bin/privacy_preserving_circuit.rs index e53334f9..fddeeb4a 100644 --- a/program_methods/guest/src/bin/privacy_preserving_circuit.rs +++ b/program_methods/guest/src/bin/privacy_preserving_circuit.rs @@ -107,6 +107,13 @@ impl ExecutionState { |_: Infallible| unreachable!("Infallible error is never constructed"), ); + // Verify that the program output's self_program_id matches the expected program ID. + // This ensures the proof commits to which program produced the output. + assert_eq!( + program_output.self_program_id, chained_call.program_id, + "program output self_program_id does not match chained call program_id" + ); + // Check that the program is well behaved. // See the # Programs section for the definition of the `validate_execution` method. let execution_valid = validate_execution(