Merge branch 'main' into schouhy/add-block-context-system-accounts

This commit is contained in:
Sergio Chouhy
2026-04-02 19:48:55 -03:00
78 changed files with 1262 additions and 253 deletions
@@ -5,6 +5,7 @@ type Instruction = u128;
fn main() {
let (
ProgramInput {
self_program_id,
pre_states,
instruction: balance_to_burn,
},
@@ -20,6 +21,7 @@ fn main() {
account_post.balance = account_post.balance.saturating_sub(balance_to_burn);
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pre],
vec![AccountPostState::new(account_post)],
@@ -13,6 +13,7 @@ type Instruction = (u128, ProgramId, u32, Option<PdaSeed>);
fn main() {
let (
ProgramInput {
self_program_id,
pre_states,
instruction: (balance, auth_transfer_id, num_chain_calls, pda_seed),
},
@@ -55,6 +56,7 @@ fn main() {
}
ProgramOutput::new(
self_program_id,
instruction_words,
vec![sender_pre.clone(), recipient_pre.clone()],
vec![
@@ -6,6 +6,7 @@ type Instruction = (Option<Vec<u8>>, bool);
fn main() {
let (
ProgramInput {
self_program_id,
pre_states,
instruction: (data_opt, should_claim),
},
@@ -33,5 +34,11 @@ fn main() {
AccountPostState::new(account_post)
};
ProgramOutput::new(instruction_words, vec![pre], vec![post_state]).write();
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pre],
vec![post_state],
)
.write();
}
@@ -5,6 +5,7 @@ type Instruction = ();
fn main() {
let (
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(instruction_words, vec![pre], vec![account_post]).write();
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pre],
vec![account_post],
)
.write();
}
@@ -11,6 +11,7 @@ type Instruction = (ProgramId, u64); // (clock_program_id, timestamp)
fn main() {
let (
ProgramInput {
self_program_id,
pre_states,
instruction: (clock_program_id, timestamp),
},
@@ -29,7 +30,7 @@ fn main() {
pda_seeds: vec![],
};
ProgramOutput::new(instruction_words, pre_states, post_states)
ProgramOutput::new(self_program_id, instruction_words, pre_states, post_states)
.with_chained_calls(vec![chained_call])
.write();
}
@@ -6,6 +6,7 @@ type Instruction = Vec<u8>;
fn main() {
let (
ProgramInput {
self_program_id,
pre_states,
instruction: data,
},
@@ -23,6 +24,7 @@ fn main() {
.expect("provided data should fit into data limit");
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pre],
vec![AccountPostState::new_claimed(
@@ -6,7 +6,14 @@ use nssa_core::{
type Instruction = ();
fn main() {
let (ProgramInput { pre_states, .. }, instruction_words) = read_nssa_inputs::<Instruction>();
let (
ProgramInput {
self_program_id,
pre_states,
..
},
instruction_words,
) = read_nssa_inputs::<Instruction>();
let Ok([pre]) = <[_; 1]>::try_from(pre_states) else {
return;
@@ -15,6 +22,7 @@ fn main() {
let account_pre = pre.account.clone();
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pre],
vec![
@@ -14,6 +14,7 @@ type Instruction = (u128, ProgramId);
fn main() {
let (
ProgramInput {
self_program_id,
pre_states,
instruction: (balance, transfer_program_id),
},
@@ -40,6 +41,7 @@ fn main() {
};
ProgramOutput::new(
self_program_id,
instruction_words,
vec![sender.clone(), receiver.clone()],
vec![
+9 -1
View File
@@ -3,7 +3,14 @@ use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nss
type Instruction = ();
fn main() {
let (ProgramInput { pre_states, .. }, instruction_words) = read_nssa_inputs::<Instruction>();
let (
ProgramInput {
self_program_id,
pre_states,
..
},
instruction_words,
) = read_nssa_inputs::<Instruction>();
let Ok([pre]) = <[_; 1]>::try_from(pre_states) else {
return;
@@ -17,6 +24,7 @@ fn main() {
.expect("Balance overflow");
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pre],
vec![AccountPostState::new(account_post)],
@@ -3,7 +3,14 @@ use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nss
type Instruction = ();
fn main() {
let (ProgramInput { pre_states, .. }, instruction_words) = read_nssa_inputs::<Instruction>();
let (
ProgramInput {
self_program_id,
pre_states,
..
},
instruction_words,
) = read_nssa_inputs::<Instruction>();
let Ok([pre1, pre2]) = <[_; 2]>::try_from(pre_states) else {
return;
@@ -12,6 +19,7 @@ fn main() {
let account_pre1 = pre1.account.clone();
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pre1, pre2],
vec![AccountPostState::new(account_pre1)],
@@ -64,6 +64,7 @@ fn main() {
// Read input accounts.
let (
ProgramInput {
self_program_id,
pre_states,
instruction: balance_to_move,
},
@@ -80,5 +81,5 @@ fn main() {
}
_ => panic!("invalid params"),
};
ProgramOutput::new(instruction_data, pre_states, post_states).write();
ProgramOutput::new(self_program_id, instruction_data, pre_states, post_states).write();
}
@@ -3,7 +3,14 @@ use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nss
type Instruction = ();
fn main() {
let (ProgramInput { pre_states, .. }, instruction_words) = read_nssa_inputs::<Instruction>();
let (
ProgramInput {
self_program_id,
pre_states,
..
},
instruction_words,
) = read_nssa_inputs::<Instruction>();
let Ok([pre]) = <[_; 1]>::try_from(pre_states) else {
return;
@@ -14,6 +21,7 @@ fn main() {
account_post.nonce.public_account_nonce_increment();
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pre],
vec![AccountPostState::new(account_post)],
+9 -2
View File
@@ -3,11 +3,18 @@ use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nss
type Instruction = ();
fn main() {
let (ProgramInput { pre_states, .. }, instruction_words) = read_nssa_inputs::<Instruction>();
let (
ProgramInput {
self_program_id,
pre_states,
..
},
instruction_words,
) = read_nssa_inputs::<Instruction>();
let post_states = pre_states
.iter()
.map(|account| AccountPostState::new(account.account.clone()))
.collect();
ProgramOutput::new(instruction_words, pre_states, post_states).write();
ProgramOutput::new(self_program_id, instruction_words, pre_states, post_states).write();
}
@@ -3,7 +3,14 @@ use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nss
type Instruction = ();
fn main() {
let (ProgramInput { pre_states, .. }, instruction_words) = read_nssa_inputs::<Instruction>();
let (
ProgramInput {
self_program_id,
pre_states,
..
},
instruction_words,
) = read_nssa_inputs::<Instruction>();
let Ok([pre]) = <[_; 1]>::try_from(pre_states) else {
return;
@@ -14,6 +21,7 @@ fn main() {
account_post.program_owner = [0, 1, 2, 3, 4, 5, 6, 7];
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pre],
vec![AccountPostState::new(account_post)],
@@ -5,6 +5,7 @@ type Instruction = u128;
fn main() {
let (
ProgramInput {
self_program_id,
pre_states,
instruction: balance,
},
@@ -27,6 +28,7 @@ fn main() {
.expect("Overflow when adding balance");
ProgramOutput::new(
self_program_id,
instruction_words,
vec![sender_pre, receiver_pre],
vec![
@@ -8,6 +8,7 @@ type Instruction = (BlockValidityWindow, TimestampValidityWindow);
fn main() {
let (
ProgramInput {
self_program_id,
pre_states,
instruction: (block_validity_window, timestamp_validity_window),
},
@@ -21,6 +22,7 @@ fn main() {
let post = pre.account.clone();
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pre],
vec![AccountPostState::new(post)],
@@ -16,6 +16,7 @@ type Instruction = (BlockValidityWindow, ProgramId, BlockValidityWindow);
fn main() {
let (
ProgramInput {
self_program_id,
pre_states,
instruction: (block_validity_window, chained_program_id, chained_block_validity_window),
},
@@ -38,6 +39,7 @@ fn main() {
};
ProgramOutput::new(
self_program_id,
instruction_words,
vec![pre],
vec![AccountPostState::new(post)],