From abc30c0ce0cbf0b601696b674d5a411b591d5535 Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Wed, 25 Mar 2026 16:56:04 -0300 Subject: [PATCH] remove old program output constructors --- .../methods/guest/src/bin/hello_world.rs | 6 ++++-- .../src/bin/hello_world_with_authorization.rs | 6 ++++-- .../src/bin/hello_world_with_move_function.rs | 6 ++++-- .../methods/guest/src/bin/simple_tail_call.rs | 16 +++++++--------- .../guest/src/bin/tail_call_with_pda.rs | 17 ++++++++--------- nssa/core/src/program.rs | 19 ------------------- program_methods/guest/src/bin/amm.rs | 11 ++++------- .../guest/src/bin/authenticated_transfer.rs | 4 ++-- program_methods/guest/src/bin/pinata.rs | 7 ++++--- program_methods/guest/src/bin/pinata_token.rs | 10 +++++----- program_methods/guest/src/bin/token.rs | 4 ++-- test_program_methods/guest/src/bin/burner.rs | 9 +++------ .../guest/src/bin/chain_caller.rs | 11 ++++++----- .../guest/src/bin/changer_claimer.rs | 4 ++-- test_program_methods/guest/src/bin/claimer.rs | 4 ++-- .../guest/src/bin/data_changer.rs | 7 ++++--- .../guest/src/bin/extra_output.rs | 7 ++++--- .../bin/malicious_authorization_changer.rs | 10 +++++----- test_program_methods/guest/src/bin/minter.rs | 9 +++------ .../guest/src/bin/missing_output.rs | 7 ++++--- .../guest/src/bin/modified_transfer.rs | 4 ++-- .../guest/src/bin/nonce_changer.rs | 9 +++------ test_program_methods/guest/src/bin/noop.rs | 4 ++-- .../guest/src/bin/program_owner_changer.rs | 9 +++------ .../guest/src/bin/simple_balance_transfer.rs | 7 ++++--- 25 files changed, 91 insertions(+), 116 deletions(-) diff --git a/examples/program_deployment/methods/guest/src/bin/hello_world.rs b/examples/program_deployment/methods/guest/src/bin/hello_world.rs index 3391eb5d..381b71c3 100644 --- a/examples/program_deployment/methods/guest/src/bin/hello_world.rs +++ b/examples/program_deployment/methods/guest/src/bin/hello_world.rs @@ -1,5 +1,5 @@ use nssa_core::program::{ - AccountPostState, DEFAULT_PROGRAM_ID, ProgramInput, read_nssa_inputs, write_nssa_outputs, + AccountPostState, DEFAULT_PROGRAM_ID, ProgramInput, ProgramOutput, read_nssa_inputs, }; // Hello-world example program. @@ -56,5 +56,7 @@ fn main() { // The output is a proposed state difference. It will only succeed if the pre states coincide // with the previous values of the accounts, and the transition to the post states conforms // with the NSSA program rules. - write_nssa_outputs(instruction_data, vec![pre_state], vec![post_state]); + // WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be + // called to commit the output. + ProgramOutput::new(instruction_data, vec![pre_state], vec![post_state]).write(); } diff --git a/examples/program_deployment/methods/guest/src/bin/hello_world_with_authorization.rs b/examples/program_deployment/methods/guest/src/bin/hello_world_with_authorization.rs index e327ca47..d90c072b 100644 --- a/examples/program_deployment/methods/guest/src/bin/hello_world_with_authorization.rs +++ b/examples/program_deployment/methods/guest/src/bin/hello_world_with_authorization.rs @@ -1,5 +1,5 @@ use nssa_core::program::{ - AccountPostState, DEFAULT_PROGRAM_ID, ProgramInput, read_nssa_inputs, write_nssa_outputs, + AccountPostState, DEFAULT_PROGRAM_ID, ProgramInput, ProgramOutput, read_nssa_inputs, }; // Hello-world with authorization example program. @@ -63,5 +63,7 @@ fn main() { // The output is a proposed state difference. It will only succeed if the pre states coincide // with the previous values of the accounts, and the transition to the post states conforms // with the NSSA program rules. - write_nssa_outputs(instruction_data, vec![pre_state], vec![post_state]); + // WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be + // called to commit the output. + ProgramOutput::new(instruction_data, vec![pre_state], vec![post_state]).write(); } diff --git a/examples/program_deployment/methods/guest/src/bin/hello_world_with_move_function.rs b/examples/program_deployment/methods/guest/src/bin/hello_world_with_move_function.rs index 65f0f9cd..0b2885a8 100644 --- a/examples/program_deployment/methods/guest/src/bin/hello_world_with_move_function.rs +++ b/examples/program_deployment/methods/guest/src/bin/hello_world_with_move_function.rs @@ -1,7 +1,7 @@ use nssa_core::{ account::{Account, AccountWithMetadata, Data}, program::{ - AccountPostState, DEFAULT_PROGRAM_ID, ProgramInput, read_nssa_inputs, write_nssa_outputs, + AccountPostState, DEFAULT_PROGRAM_ID, ProgramInput, ProgramOutput, read_nssa_inputs, }, }; @@ -95,5 +95,7 @@ fn main() { _ => panic!("invalid params"), }; - write_nssa_outputs(instruction_words, pre_states, post_states); + // WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be + // called to commit the output. + ProgramOutput::new(instruction_words, pre_states, post_states).write(); } diff --git a/examples/program_deployment/methods/guest/src/bin/simple_tail_call.rs b/examples/program_deployment/methods/guest/src/bin/simple_tail_call.rs index 01389085..d2c04083 100644 --- a/examples/program_deployment/methods/guest/src/bin/simple_tail_call.rs +++ b/examples/program_deployment/methods/guest/src/bin/simple_tail_call.rs @@ -1,6 +1,5 @@ use nssa_core::program::{ - AccountPostState, ChainedCall, ProgramId, ProgramInput, read_nssa_inputs, - write_nssa_outputs_with_chained_call, + AccountPostState, ChainedCall, ProgramId, ProgramInput, ProgramOutput, read_nssa_inputs, }; // Tail Call example program. @@ -53,11 +52,10 @@ fn main() { pda_seeds: vec![], }; - // Write the outputs - write_nssa_outputs_with_chained_call( - instruction_data, - vec![pre_state], - vec![post_state], - vec![chained_call], - ); + // Write the outputs. + // WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be + // called to commit the output. + ProgramOutput::new(instruction_data, vec![pre_state], vec![post_state]) + .with_chained_calls(vec![chained_call]) + .write(); } diff --git a/examples/program_deployment/methods/guest/src/bin/tail_call_with_pda.rs b/examples/program_deployment/methods/guest/src/bin/tail_call_with_pda.rs index 3ebcabd2..564efc2b 100644 --- a/examples/program_deployment/methods/guest/src/bin/tail_call_with_pda.rs +++ b/examples/program_deployment/methods/guest/src/bin/tail_call_with_pda.rs @@ -1,6 +1,6 @@ use nssa_core::program::{ - AccountPostState, ChainedCall, PdaSeed, ProgramId, ProgramInput, read_nssa_inputs, - write_nssa_outputs_with_chained_call, + AccountPostState, ChainedCall, PdaSeed, ProgramId, ProgramInput, ProgramOutput, + read_nssa_inputs, }; // Tail Call with PDA example program. @@ -65,11 +65,10 @@ fn main() { pda_seeds: vec![PDA_SEED], }; - // Write the outputs - write_nssa_outputs_with_chained_call( - instruction_data, - vec![pre_state], - vec![post_state], - vec![chained_call], - ); + // Write the outputs. + // WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be + // called to commit the output. + ProgramOutput::new(instruction_data, vec![pre_state], vec![post_state]) + .with_chained_calls(vec![chained_call]) + .write(); } diff --git a/nssa/core/src/program.rs b/nssa/core/src/program.rs index 74bfe515..182d8960 100644 --- a/nssa/core/src/program.rs +++ b/nssa/core/src/program.rs @@ -380,25 +380,6 @@ pub fn read_nssa_inputs() -> (ProgramInput, InstructionD ) } -pub fn write_nssa_outputs( - instruction_data: InstructionData, - pre_states: Vec, - post_states: Vec, -) { - ProgramOutput::new(instruction_data, pre_states, post_states).write(); -} - -pub fn write_nssa_outputs_with_chained_call( - instruction_data: InstructionData, - pre_states: Vec, - post_states: Vec, - chained_calls: Vec, -) { - ProgramOutput::new(instruction_data, pre_states, post_states) - .with_chained_calls(chained_calls) - .write(); -} - /// Validates well-behaved program execution. /// /// # Parameters diff --git a/program_methods/guest/src/bin/amm.rs b/program_methods/guest/src/bin/amm.rs index 00fd39d3..748630d9 100644 --- a/program_methods/guest/src/bin/amm.rs +++ b/program_methods/guest/src/bin/amm.rs @@ -9,7 +9,7 @@ use std::num::NonZero; use amm_core::Instruction; -use nssa_core::program::{ProgramInput, read_nssa_inputs, write_nssa_outputs_with_chained_call}; +use nssa_core::program::{ProgramInput, ProgramOutput, read_nssa_inputs}; fn main() { let ( @@ -133,10 +133,7 @@ fn main() { } }; - write_nssa_outputs_with_chained_call( - instruction_words, - pre_states_clone, - post_states, - chained_calls, - ); + ProgramOutput::new(instruction_words, pre_states_clone, post_states) + .with_chained_calls(chained_calls) + .write(); } diff --git a/program_methods/guest/src/bin/authenticated_transfer.rs b/program_methods/guest/src/bin/authenticated_transfer.rs index 7835f733..20f4dd68 100644 --- a/program_methods/guest/src/bin/authenticated_transfer.rs +++ b/program_methods/guest/src/bin/authenticated_transfer.rs @@ -1,7 +1,7 @@ use nssa_core::{ account::{Account, AccountWithMetadata}, program::{ - AccountPostState, DEFAULT_PROGRAM_ID, ProgramInput, read_nssa_inputs, write_nssa_outputs, + AccountPostState, DEFAULT_PROGRAM_ID, ProgramInput, ProgramOutput, read_nssa_inputs, }, }; @@ -84,5 +84,5 @@ fn main() { _ => panic!("invalid params"), }; - write_nssa_outputs(instruction_words, pre_states, post_states); + ProgramOutput::new(instruction_words, pre_states, post_states).write(); } diff --git a/program_methods/guest/src/bin/pinata.rs b/program_methods/guest/src/bin/pinata.rs index c9fc0735..cfe0a7e4 100644 --- a/program_methods/guest/src/bin/pinata.rs +++ b/program_methods/guest/src/bin/pinata.rs @@ -1,4 +1,4 @@ -use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}; use risc0_zkvm::sha::{Impl, Sha256 as _}; const PRIZE: u128 = 150; @@ -78,12 +78,13 @@ fn main() { .checked_add(PRIZE) .expect("Overflow when adding prize to winner"); - write_nssa_outputs( + ProgramOutput::new( instruction_words, vec![pinata, winner], vec![ AccountPostState::new_claimed_if_default(pinata_post), AccountPostState::new(winner_post), ], - ); + ) + .write(); } diff --git a/program_methods/guest/src/bin/pinata_token.rs b/program_methods/guest/src/bin/pinata_token.rs index f1bbdc87..3dee05b7 100644 --- a/program_methods/guest/src/bin/pinata_token.rs +++ b/program_methods/guest/src/bin/pinata_token.rs @@ -1,8 +1,7 @@ use nssa_core::{ account::Data, program::{ - AccountPostState, ChainedCall, PdaSeed, ProgramInput, read_nssa_inputs, - write_nssa_outputs_with_chained_call, + AccountPostState, ChainedCall, PdaSeed, ProgramInput, ProgramOutput, read_nssa_inputs, }, }; use risc0_zkvm::sha::{Impl, Sha256 as _}; @@ -97,7 +96,7 @@ fn main() { ) .with_pda_seeds(vec![PdaSeed::new([0; 32])]); - write_nssa_outputs_with_chained_call( + ProgramOutput::new( instruction_words, vec![ pinata_definition, @@ -109,6 +108,7 @@ fn main() { AccountPostState::new(pinata_token_holding_post), AccountPostState::new(winner_token_holding_post), ], - vec![chained_call], - ); + ) + .with_chained_calls(vec![chained_call]) + .write(); } diff --git a/program_methods/guest/src/bin/token.rs b/program_methods/guest/src/bin/token.rs index 0bc3d245..421d43ef 100644 --- a/program_methods/guest/src/bin/token.rs +++ b/program_methods/guest/src/bin/token.rs @@ -6,7 +6,7 @@ //! Token program accepts [`Instruction`] as input, refer to the corresponding documentation //! for more details. -use nssa_core::program::{ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{ProgramInput, ProgramOutput, read_nssa_inputs}; use token_program::core::Instruction; fn main() { @@ -81,5 +81,5 @@ fn main() { } }; - write_nssa_outputs(instruction_words, pre_states_clone, post_states); + ProgramOutput::new(instruction_words, pre_states_clone, post_states).write(); } diff --git a/test_program_methods/guest/src/bin/burner.rs b/test_program_methods/guest/src/bin/burner.rs index a2256aa3..a6a514c8 100644 --- a/test_program_methods/guest/src/bin/burner.rs +++ b/test_program_methods/guest/src/bin/burner.rs @@ -1,4 +1,4 @@ -use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}; type Instruction = u128; @@ -19,9 +19,6 @@ fn main() { let mut account_post = account_pre.clone(); account_post.balance = account_post.balance.saturating_sub(balance_to_burn); - write_nssa_outputs( - instruction_words, - vec![pre], - vec![AccountPostState::new(account_post)], - ); + ProgramOutput::new(instruction_words, vec![pre], vec![AccountPostState::new(account_post)]) + .write(); } diff --git a/test_program_methods/guest/src/bin/chain_caller.rs b/test_program_methods/guest/src/bin/chain_caller.rs index 7e67fa9b..98154258 100644 --- a/test_program_methods/guest/src/bin/chain_caller.rs +++ b/test_program_methods/guest/src/bin/chain_caller.rs @@ -1,6 +1,6 @@ use nssa_core::program::{ - AccountPostState, ChainedCall, PdaSeed, ProgramId, ProgramInput, read_nssa_inputs, - write_nssa_outputs_with_chained_call, + AccountPostState, ChainedCall, PdaSeed, ProgramId, ProgramInput, ProgramOutput, + read_nssa_inputs, }; use risc0_zkvm::serde::to_vec; @@ -54,13 +54,14 @@ fn main() { }; } - write_nssa_outputs_with_chained_call( + ProgramOutput::new( instruction_words, vec![sender_pre.clone(), recipient_pre.clone()], vec![ AccountPostState::new(sender_pre.account), AccountPostState::new(recipient_pre.account), ], - chained_calls, - ); + ) + .with_chained_calls(chained_calls) + .write(); } diff --git a/test_program_methods/guest/src/bin/changer_claimer.rs b/test_program_methods/guest/src/bin/changer_claimer.rs index 37079737..fb5505f7 100644 --- a/test_program_methods/guest/src/bin/changer_claimer.rs +++ b/test_program_methods/guest/src/bin/changer_claimer.rs @@ -1,4 +1,4 @@ -use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}; type Instruction = (Option>, bool); @@ -33,5 +33,5 @@ fn main() { AccountPostState::new(account_post) }; - write_nssa_outputs(instruction_words, vec![pre], vec![post_state]); + ProgramOutput::new(instruction_words, vec![pre], vec![post_state]).write(); } diff --git a/test_program_methods/guest/src/bin/claimer.rs b/test_program_methods/guest/src/bin/claimer.rs index 897ca6a6..57e7e4e5 100644 --- a/test_program_methods/guest/src/bin/claimer.rs +++ b/test_program_methods/guest/src/bin/claimer.rs @@ -1,4 +1,4 @@ -use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}; type Instruction = (); @@ -17,5 +17,5 @@ fn main() { let account_post = AccountPostState::new_claimed(pre.account.clone()); - write_nssa_outputs(instruction_words, vec![pre], vec![account_post]); + ProgramOutput::new(instruction_words, vec![pre], vec![account_post]).write(); } diff --git a/test_program_methods/guest/src/bin/data_changer.rs b/test_program_methods/guest/src/bin/data_changer.rs index c689dce5..55f4e2a0 100644 --- a/test_program_methods/guest/src/bin/data_changer.rs +++ b/test_program_methods/guest/src/bin/data_changer.rs @@ -1,4 +1,4 @@ -use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}; type Instruction = Vec; @@ -22,9 +22,10 @@ fn main() { .try_into() .expect("provided data should fit into data limit"); - write_nssa_outputs( + ProgramOutput::new( instruction_words, vec![pre], vec![AccountPostState::new_claimed(account_post)], - ); + ) + .write(); } diff --git a/test_program_methods/guest/src/bin/extra_output.rs b/test_program_methods/guest/src/bin/extra_output.rs index 4d67df6e..3adc591c 100644 --- a/test_program_methods/guest/src/bin/extra_output.rs +++ b/test_program_methods/guest/src/bin/extra_output.rs @@ -1,6 +1,6 @@ use nssa_core::{ account::Account, - program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}, + program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}, }; type Instruction = (); @@ -14,12 +14,13 @@ fn main() { let account_pre = pre.account.clone(); - write_nssa_outputs( + ProgramOutput::new( instruction_words, vec![pre], vec![ AccountPostState::new(account_pre), AccountPostState::new(Account::default()), ], - ); + ) + .write(); } diff --git a/test_program_methods/guest/src/bin/malicious_authorization_changer.rs b/test_program_methods/guest/src/bin/malicious_authorization_changer.rs index 56ba7e72..7452d337 100644 --- a/test_program_methods/guest/src/bin/malicious_authorization_changer.rs +++ b/test_program_methods/guest/src/bin/malicious_authorization_changer.rs @@ -1,8 +1,7 @@ use nssa_core::{ account::AccountWithMetadata, program::{ - AccountPostState, ChainedCall, ProgramId, ProgramInput, read_nssa_inputs, - write_nssa_outputs_with_chained_call, + AccountPostState, ChainedCall, ProgramId, ProgramInput, ProgramOutput, read_nssa_inputs, }, }; use risc0_zkvm::serde::to_vec; @@ -40,13 +39,14 @@ fn main() { pda_seeds: vec![], }; - write_nssa_outputs_with_chained_call( + ProgramOutput::new( instruction_words, vec![sender.clone(), receiver.clone()], vec![ AccountPostState::new(sender.account), AccountPostState::new(receiver.account), ], - vec![chained_call], - ); + ) + .with_chained_calls(vec![chained_call]) + .write(); } diff --git a/test_program_methods/guest/src/bin/minter.rs b/test_program_methods/guest/src/bin/minter.rs index a602df56..914e55e0 100644 --- a/test_program_methods/guest/src/bin/minter.rs +++ b/test_program_methods/guest/src/bin/minter.rs @@ -1,4 +1,4 @@ -use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}; type Instruction = (); @@ -16,9 +16,6 @@ fn main() { .checked_add(1) .expect("Balance overflow"); - write_nssa_outputs( - instruction_words, - vec![pre], - vec![AccountPostState::new(account_post)], - ); + ProgramOutput::new(instruction_words, vec![pre], vec![AccountPostState::new(account_post)]) + .write(); } diff --git a/test_program_methods/guest/src/bin/missing_output.rs b/test_program_methods/guest/src/bin/missing_output.rs index 52ca6e2f..b485e87a 100644 --- a/test_program_methods/guest/src/bin/missing_output.rs +++ b/test_program_methods/guest/src/bin/missing_output.rs @@ -1,4 +1,4 @@ -use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}; type Instruction = (); @@ -11,9 +11,10 @@ fn main() { let account_pre1 = pre1.account.clone(); - write_nssa_outputs( + ProgramOutput::new( instruction_words, vec![pre1, pre2], vec![AccountPostState::new(account_pre1)], - ); + ) + .write(); } diff --git a/test_program_methods/guest/src/bin/modified_transfer.rs b/test_program_methods/guest/src/bin/modified_transfer.rs index 3aee3816..a89c72fb 100644 --- a/test_program_methods/guest/src/bin/modified_transfer.rs +++ b/test_program_methods/guest/src/bin/modified_transfer.rs @@ -5,7 +5,7 @@ use nssa_core::{ account::{Account, AccountWithMetadata}, - program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}, + program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}, }; /// Initializes a default account under the ownership of this program. @@ -80,5 +80,5 @@ fn main() { } _ => panic!("invalid params"), }; - write_nssa_outputs(instruction_data, pre_states, post_states); + ProgramOutput::new(instruction_data, pre_states, post_states).write(); } diff --git a/test_program_methods/guest/src/bin/nonce_changer.rs b/test_program_methods/guest/src/bin/nonce_changer.rs index 52d2e392..295c244a 100644 --- a/test_program_methods/guest/src/bin/nonce_changer.rs +++ b/test_program_methods/guest/src/bin/nonce_changer.rs @@ -1,4 +1,4 @@ -use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}; type Instruction = (); @@ -13,9 +13,6 @@ fn main() { let mut account_post = account_pre.clone(); account_post.nonce.public_account_nonce_increment(); - write_nssa_outputs( - instruction_words, - vec![pre], - vec![AccountPostState::new(account_post)], - ); + ProgramOutput::new(instruction_words, vec![pre], vec![AccountPostState::new(account_post)]) + .write(); } diff --git a/test_program_methods/guest/src/bin/noop.rs b/test_program_methods/guest/src/bin/noop.rs index 79dd1dec..35a07765 100644 --- a/test_program_methods/guest/src/bin/noop.rs +++ b/test_program_methods/guest/src/bin/noop.rs @@ -1,4 +1,4 @@ -use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}; type Instruction = (); @@ -9,5 +9,5 @@ fn main() { .iter() .map(|account| AccountPostState::new(account.account.clone())) .collect(); - write_nssa_outputs(instruction_words, pre_states, post_states); + ProgramOutput::new(instruction_words, pre_states, post_states).write(); } diff --git a/test_program_methods/guest/src/bin/program_owner_changer.rs b/test_program_methods/guest/src/bin/program_owner_changer.rs index 4b7de0f7..a435524e 100644 --- a/test_program_methods/guest/src/bin/program_owner_changer.rs +++ b/test_program_methods/guest/src/bin/program_owner_changer.rs @@ -1,4 +1,4 @@ -use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}; type Instruction = (); @@ -13,9 +13,6 @@ fn main() { let mut account_post = account_pre.clone(); account_post.program_owner = [0, 1, 2, 3, 4, 5, 6, 7]; - write_nssa_outputs( - instruction_words, - vec![pre], - vec![AccountPostState::new(account_post)], - ); + ProgramOutput::new(instruction_words, vec![pre], vec![AccountPostState::new(account_post)]) + .write(); } diff --git a/test_program_methods/guest/src/bin/simple_balance_transfer.rs b/test_program_methods/guest/src/bin/simple_balance_transfer.rs index 55bbfcef..9ee715e8 100644 --- a/test_program_methods/guest/src/bin/simple_balance_transfer.rs +++ b/test_program_methods/guest/src/bin/simple_balance_transfer.rs @@ -1,4 +1,4 @@ -use nssa_core::program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs}; +use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs}; type Instruction = u128; @@ -26,12 +26,13 @@ fn main() { .checked_add(balance) .expect("Overflow when adding balance"); - write_nssa_outputs( + ProgramOutput::new( instruction_words, vec![sender_pre, receiver_pre], vec![ AccountPostState::new(sender_post), AccountPostState::new(receiver_post), ], - ); + ) + .write(); }