feat: add logs for program pre_states and output

This commit is contained in:
Daniil Polyakov 2025-12-17 19:34:06 +03:00
parent 9b729d6c3e
commit 172b13d03a
2 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,7 @@ borsh.workspace = true
hex.workspace = true
secp256k1 = "0.31.1"
risc0-binfmt = "3.0.2"
log.workspace = true
[build-dependencies]
risc0-build = "3.0.3"

View File

@ -1,6 +1,7 @@
use std::collections::{HashMap, HashSet, VecDeque};
use borsh::{BorshDeserialize, BorshSerialize};
use log::debug;
use nssa_core::{
account::{Account, AccountId, AccountWithMetadata},
program::{ChainedCall, DEFAULT_PROGRAM_ID, PdaSeed, ProgramId, validate_execution},
@ -123,8 +124,16 @@ impl PublicTransaction {
return Err(NssaError::InvalidInput("Unknown program".into()));
};
debug!(
"Program {:?} pre_states: {:?}, instruction_data: {:?}",
chained_call.program_id, chained_call.pre_states, chained_call.instruction_data
);
let mut program_output =
program.execute(&chained_call.pre_states, &chained_call.instruction_data)?;
debug!(
"Program {:?} output: {:?}",
chained_call.program_id, program_output
);
let authorized_pdas =
self.compute_authorized_pdas(&caller_program_id, &chained_call.pda_seeds);