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 a28b90f4..ea2edd95 100644 --- a/examples/program_deployment/methods/guest/src/bin/hello_world.rs +++ b/examples/program_deployment/methods/guest/src/bin/hello_world.rs @@ -18,7 +18,8 @@ type Instruction = Vec; fn main() { // Read inputs let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: greeting, }, @@ -50,5 +51,11 @@ fn main() { // with the NSSA program rules. // WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be // called to commit the output. - ProgramOutput::new(self_program_id, instruction_data, vec![pre_state], vec![post_state]).write(); + ProgramOutput::new( + self_program_id, + 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 57e90195..3f369fa7 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 @@ -18,7 +18,8 @@ type Instruction = Vec; fn main() { // Read inputs let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: greeting, }, @@ -57,5 +58,11 @@ fn main() { // with the NSSA program rules. // WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be // called to commit the output. - ProgramOutput::new(self_program_id, instruction_data, vec![pre_state], vec![post_state]).write(); + ProgramOutput::new( + self_program_id, + 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 bbeb1ce0..57a2190c 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 @@ -65,7 +65,8 @@ fn move_data(from_pre: AccountWithMetadata, to_pre: AccountWithMetadata) -> Vec< fn main() { // Read input accounts. let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: (function_id, data), }, 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 8107cc34..22098b7a 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 @@ -26,7 +26,8 @@ fn hello_world_program_id() -> ProgramId { fn main() { // Read inputs let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: (), }, @@ -55,7 +56,12 @@ fn main() { // Write the outputs. // WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be // called to commit the output. - ProgramOutput::new(self_program_id, instruction_data, vec![pre_state], vec![post_state]) - .with_chained_calls(vec![chained_call]) - .write(); + ProgramOutput::new( + self_program_id, + 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 682dc210..2ae65ec7 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 @@ -32,7 +32,8 @@ fn hello_world_program_id() -> ProgramId { fn main() { // Read inputs let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: (), }, @@ -68,7 +69,12 @@ fn main() { // Write the outputs. // WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be // called to commit the output. - ProgramOutput::new(self_program_id, instruction_data, vec![pre_state], vec![post_state]) - .with_chained_calls(vec![chained_call]) - .write(); + ProgramOutput::new( + self_program_id, + 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 82e9a2a4..057c8238 100644 --- a/nssa/core/src/program.rs +++ b/nssa/core/src/program.rs @@ -636,24 +636,24 @@ mod tests { #[test] fn program_output_with_block_validity_window_range_from() { - let output = - ProgramOutput::new(DEFAULT_PROGRAM_ID, vec![], vec![], vec![]).with_block_validity_window(10_u64..); + let output = ProgramOutput::new(DEFAULT_PROGRAM_ID, vec![], vec![], vec![]) + .with_block_validity_window(10_u64..); assert_eq!(output.block_validity_window.start(), Some(10)); assert_eq!(output.block_validity_window.end(), None); } #[test] fn program_output_with_block_validity_window_range_to() { - let output = - ProgramOutput::new(DEFAULT_PROGRAM_ID, vec![], vec![], vec![]).with_block_validity_window(..100_u64); + let output = ProgramOutput::new(DEFAULT_PROGRAM_ID, vec![], vec![], vec![]) + .with_block_validity_window(..100_u64); assert_eq!(output.block_validity_window.start(), None); assert_eq!(output.block_validity_window.end(), Some(100)); } #[test] fn program_output_try_with_block_validity_window_empty_range_fails() { - let result = - ProgramOutput::new(DEFAULT_PROGRAM_ID, vec![], vec![], vec![]).try_with_block_validity_window(5_u64..5); + let result = ProgramOutput::new(DEFAULT_PROGRAM_ID, vec![], vec![], vec![]) + .try_with_block_validity_window(5_u64..5); assert!(result.is_err()); } diff --git a/program_methods/guest/src/bin/amm.rs b/program_methods/guest/src/bin/amm.rs index fc73a4e7..59c89742 100644 --- a/program_methods/guest/src/bin/amm.rs +++ b/program_methods/guest/src/bin/amm.rs @@ -13,7 +13,8 @@ use nssa_core::program::{ProgramInput, ProgramOutput, read_nssa_inputs}; fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction, }, @@ -152,7 +153,12 @@ fn main() { } }; - ProgramOutput::new(self_program_id, instruction_words, pre_states_clone, post_states) - .with_chained_calls(chained_calls) - .write(); + ProgramOutput::new( + self_program_id, + instruction_words, + pre_states_clone, + post_states, + ) + .with_chained_calls(chained_calls) + .write(); } diff --git a/program_methods/guest/src/bin/associated_token_account.rs b/program_methods/guest/src/bin/associated_token_account.rs index b2e7902e..42162ba2 100644 --- a/program_methods/guest/src/bin/associated_token_account.rs +++ b/program_methods/guest/src/bin/associated_token_account.rs @@ -3,7 +3,8 @@ use nssa_core::program::{ProgramInput, ProgramOutput, read_nssa_inputs}; fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction, }, @@ -56,7 +57,12 @@ fn main() { } }; - ProgramOutput::new(self_program_id, instruction_words, pre_states_clone, post_states) - .with_chained_calls(chained_calls) - .write(); + ProgramOutput::new( + self_program_id, + 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 fb930150..d7c68e62 100644 --- a/program_methods/guest/src/bin/authenticated_transfer.rs +++ b/program_methods/guest/src/bin/authenticated_transfer.rs @@ -66,7 +66,8 @@ fn transfer( fn main() { // Read input accounts. let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: balance_to_move, }, diff --git a/program_methods/guest/src/bin/pinata.rs b/program_methods/guest/src/bin/pinata.rs index 41b2a6bb..d6f35ae8 100644 --- a/program_methods/guest/src/bin/pinata.rs +++ b/program_methods/guest/src/bin/pinata.rs @@ -45,7 +45,8 @@ fn main() { // Read input accounts. // It is expected to receive only two accounts: [pinata_account, winner_account] let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: solution, }, diff --git a/program_methods/guest/src/bin/pinata_token.rs b/program_methods/guest/src/bin/pinata_token.rs index fa62a67a..5c31af45 100644 --- a/program_methods/guest/src/bin/pinata_token.rs +++ b/program_methods/guest/src/bin/pinata_token.rs @@ -51,7 +51,8 @@ fn main() { // It is expected to receive three accounts: [pinata_definition, pinata_token_holding, // winner_token_holding] let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: solution, }, diff --git a/program_methods/guest/src/bin/token.rs b/program_methods/guest/src/bin/token.rs index 3ad533a6..2414a289 100644 --- a/program_methods/guest/src/bin/token.rs +++ b/program_methods/guest/src/bin/token.rs @@ -11,7 +11,8 @@ use token_program::core::Instruction; fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction, }, @@ -81,5 +82,11 @@ fn main() { } }; - ProgramOutput::new(self_program_id, instruction_words, pre_states_clone, post_states).write(); + ProgramOutput::new( + self_program_id, + 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 20bc3cb6..06ac9b6b 100644 --- a/test_program_methods/guest/src/bin/burner.rs +++ b/test_program_methods/guest/src/bin/burner.rs @@ -4,7 +4,8 @@ type Instruction = u128; fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: balance_to_burn, }, diff --git a/test_program_methods/guest/src/bin/chain_caller.rs b/test_program_methods/guest/src/bin/chain_caller.rs index 3f7794d8..e8bf9d6f 100644 --- a/test_program_methods/guest/src/bin/chain_caller.rs +++ b/test_program_methods/guest/src/bin/chain_caller.rs @@ -12,7 +12,8 @@ type Instruction = (u128, ProgramId, u32, Option); /// program. fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: (balance, auth_transfer_id, num_chain_calls, pda_seed), }, diff --git a/test_program_methods/guest/src/bin/changer_claimer.rs b/test_program_methods/guest/src/bin/changer_claimer.rs index bc0f054a..c1bd886c 100644 --- a/test_program_methods/guest/src/bin/changer_claimer.rs +++ b/test_program_methods/guest/src/bin/changer_claimer.rs @@ -5,7 +5,8 @@ type Instruction = (Option>, bool); /// A program that optionally modifies the account data and optionally claims it. fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: (data_opt, should_claim), }, @@ -33,5 +34,11 @@ fn main() { AccountPostState::new(account_post) }; - ProgramOutput::new(self_program_id, instruction_words, vec![pre], vec![post_state]).write(); + ProgramOutput::new( + self_program_id, + 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 c3794a23..27b1ae73 100644 --- a/test_program_methods/guest/src/bin/claimer.rs +++ b/test_program_methods/guest/src/bin/claimer.rs @@ -4,7 +4,8 @@ type Instruction = (); fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: (), }, @@ -17,5 +18,11 @@ fn main() { let account_post = AccountPostState::new_claimed(pre.account.clone(), Claim::Authorized); - ProgramOutput::new(self_program_id, instruction_words, vec![pre], vec![account_post]).write(); + ProgramOutput::new( + self_program_id, + 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 6ff68dab..ee7cb235 100644 --- a/test_program_methods/guest/src/bin/data_changer.rs +++ b/test_program_methods/guest/src/bin/data_changer.rs @@ -5,7 +5,8 @@ type Instruction = Vec; /// A program that modifies the account data by setting bytes sent in instruction. fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: data, }, diff --git a/test_program_methods/guest/src/bin/extra_output.rs b/test_program_methods/guest/src/bin/extra_output.rs index f6e1f970..924f4d8f 100644 --- a/test_program_methods/guest/src/bin/extra_output.rs +++ b/test_program_methods/guest/src/bin/extra_output.rs @@ -6,7 +6,14 @@ use nssa_core::{ type Instruction = (); fn main() { - let (ProgramInput { self_program_id, pre_states, .. }, instruction_words) = read_nssa_inputs::(); + let ( + ProgramInput { + self_program_id, + pre_states, + .. + }, + instruction_words, + ) = read_nssa_inputs::(); let Ok([pre]) = <[_; 1]>::try_from(pre_states) else { return; 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 768dc990..1db09a73 100644 --- a/test_program_methods/guest/src/bin/malicious_authorization_changer.rs +++ b/test_program_methods/guest/src/bin/malicious_authorization_changer.rs @@ -13,7 +13,8 @@ type Instruction = (u128, ProgramId); /// but sets the `is_authorized` field of the first account to true. fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: (balance, transfer_program_id), }, diff --git a/test_program_methods/guest/src/bin/minter.rs b/test_program_methods/guest/src/bin/minter.rs index 3bebbb1f..445df32f 100644 --- a/test_program_methods/guest/src/bin/minter.rs +++ b/test_program_methods/guest/src/bin/minter.rs @@ -3,7 +3,14 @@ use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nss type Instruction = (); fn main() { - let (ProgramInput { self_program_id, pre_states, .. }, instruction_words) = read_nssa_inputs::(); + let ( + ProgramInput { + self_program_id, + pre_states, + .. + }, + instruction_words, + ) = read_nssa_inputs::(); let Ok([pre]) = <[_; 1]>::try_from(pre_states) else { return; diff --git a/test_program_methods/guest/src/bin/missing_output.rs b/test_program_methods/guest/src/bin/missing_output.rs index 36f72bf8..6b33d95e 100644 --- a/test_program_methods/guest/src/bin/missing_output.rs +++ b/test_program_methods/guest/src/bin/missing_output.rs @@ -3,7 +3,14 @@ use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nss type Instruction = (); fn main() { - let (ProgramInput { self_program_id, pre_states, .. }, instruction_words) = read_nssa_inputs::(); + let ( + ProgramInput { + self_program_id, + pre_states, + .. + }, + instruction_words, + ) = read_nssa_inputs::(); let Ok([pre1, pre2]) = <[_; 2]>::try_from(pre_states) else { return; diff --git a/test_program_methods/guest/src/bin/modified_transfer.rs b/test_program_methods/guest/src/bin/modified_transfer.rs index 97578512..859f5cc0 100644 --- a/test_program_methods/guest/src/bin/modified_transfer.rs +++ b/test_program_methods/guest/src/bin/modified_transfer.rs @@ -63,7 +63,8 @@ fn transfer( fn main() { // Read input accounts. let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: balance_to_move, }, diff --git a/test_program_methods/guest/src/bin/nonce_changer.rs b/test_program_methods/guest/src/bin/nonce_changer.rs index 30e2f4e8..5e1cdbb2 100644 --- a/test_program_methods/guest/src/bin/nonce_changer.rs +++ b/test_program_methods/guest/src/bin/nonce_changer.rs @@ -3,7 +3,14 @@ use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nss type Instruction = (); fn main() { - let (ProgramInput { self_program_id, pre_states, .. }, instruction_words) = read_nssa_inputs::(); + let ( + ProgramInput { + self_program_id, + pre_states, + .. + }, + instruction_words, + ) = read_nssa_inputs::(); let Ok([pre]) = <[_; 1]>::try_from(pre_states) else { return; diff --git a/test_program_methods/guest/src/bin/noop.rs b/test_program_methods/guest/src/bin/noop.rs index eba068c8..71787776 100644 --- a/test_program_methods/guest/src/bin/noop.rs +++ b/test_program_methods/guest/src/bin/noop.rs @@ -3,7 +3,14 @@ use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nss type Instruction = (); fn main() { - let (ProgramInput { self_program_id, pre_states, .. }, instruction_words) = read_nssa_inputs::(); + let ( + ProgramInput { + self_program_id, + pre_states, + .. + }, + instruction_words, + ) = read_nssa_inputs::(); let post_states = pre_states .iter() 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 1a6fadbb..f1b2cfce 100644 --- a/test_program_methods/guest/src/bin/program_owner_changer.rs +++ b/test_program_methods/guest/src/bin/program_owner_changer.rs @@ -3,7 +3,14 @@ use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nss type Instruction = (); fn main() { - let (ProgramInput { self_program_id, pre_states, .. }, instruction_words) = read_nssa_inputs::(); + let ( + ProgramInput { + self_program_id, + pre_states, + .. + }, + instruction_words, + ) = read_nssa_inputs::(); let Ok([pre]) = <[_; 1]>::try_from(pre_states) else { return; 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 3c71310f..4edd6198 100644 --- a/test_program_methods/guest/src/bin/simple_balance_transfer.rs +++ b/test_program_methods/guest/src/bin/simple_balance_transfer.rs @@ -4,7 +4,8 @@ type Instruction = u128; fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: balance, }, diff --git a/test_program_methods/guest/src/bin/validity_window.rs b/test_program_methods/guest/src/bin/validity_window.rs index 3bcd9daf..67908836 100644 --- a/test_program_methods/guest/src/bin/validity_window.rs +++ b/test_program_methods/guest/src/bin/validity_window.rs @@ -7,7 +7,8 @@ type Instruction = (BlockValidityWindow, TimestampValidityWindow); fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: (block_validity_window, timestamp_validity_window), }, diff --git a/test_program_methods/guest/src/bin/validity_window_chain_caller.rs b/test_program_methods/guest/src/bin/validity_window_chain_caller.rs index 4ea4abcf..cbe3c7c1 100644 --- a/test_program_methods/guest/src/bin/validity_window_chain_caller.rs +++ b/test_program_methods/guest/src/bin/validity_window_chain_caller.rs @@ -15,7 +15,8 @@ type Instruction = (BlockValidityWindow, ProgramId, BlockValidityWindow); fn main() { let ( - ProgramInput { self_program_id, + ProgramInput { + self_program_id, pre_states, instruction: (block_validity_window, chained_program_id, chained_block_validity_window), },