From 1b2962fa03a9c9a28df1341bf79ec34272f2b17c Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Wed, 10 Dec 2025 23:06:35 -0300 Subject: [PATCH] add missing check on pre_states for privacy tail calls --- nssa/core/src/account.rs | 4 ++-- .../guest/src/bin/privacy_preserving_circuit.rs | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/nssa/core/src/account.rs b/nssa/core/src/account.rs index 89bec37..c152581 100644 --- a/nssa/core/src/account.rs +++ b/nssa/core/src/account.rs @@ -25,8 +25,8 @@ pub struct Account { pub nonce: Nonce, } -#[derive(Serialize, Deserialize, Clone)] -#[cfg_attr(any(feature = "host", test), derive(Debug, PartialEq, Eq))] +#[derive(Serialize, Deserialize, Clone, PartialEq, Eq)] +#[cfg_attr(any(feature = "host", test), derive(Debug))] pub struct AccountWithMetadata { pub account: Account, pub is_authorized: bool, diff --git a/nssa/program_methods/guest/src/bin/privacy_preserving_circuit.rs b/nssa/program_methods/guest/src/bin/privacy_preserving_circuit.rs index e8f184b..4cbc42c 100644 --- a/nssa/program_methods/guest/src/bin/privacy_preserving_circuit.rs +++ b/nssa/program_methods/guest/src/bin/privacy_preserving_circuit.rs @@ -45,14 +45,19 @@ fn main() { } // TODO: Modify when multi-chain calls are supported in the circuit - let Some(chained_call) = &caller.chained_calls.first() else { + let Some(caller_chained_call) = &caller.chained_calls.first() else { panic!("Expected chained call"); }; // Check that instruction data in caller is the instruction data in callee - if chained_call.instruction_data != callee.instruction_data { + if caller_chained_call.instruction_data != callee.instruction_data { panic!("Invalid instruction data"); } + + // Check that account pre_states in caller are the ones in calle + if caller_chained_call.pre_states != callee.pre_states { + panic!("Invalid pre states"); + } } for (i, program_output) in program_outputs.iter().enumerate() {