mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-08-24 22:29:22 +00:00
feat: protect from public pda griefing attacks
This commit is contained in:
@@ -38,7 +38,7 @@ fn main() {
|
||||
program_id: auth_transfer_id,
|
||||
instruction_data: instruction_data.clone(),
|
||||
pre_states: vec![running_sender_pre.clone(), running_recipient_pre.clone()], /* <- Account order permutation here */
|
||||
pda_seeds: pda_seed.iter().cloned().collect(),
|
||||
pda_seeds: pda_seed.iter().copied().collect(),
|
||||
};
|
||||
chained_calls.push(new_chained_call);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs};
|
||||
use nssa_core::program::{AccountPostState, Claim, ProgramInput, ProgramOutput, read_nssa_inputs};
|
||||
|
||||
type Instruction = (Option<Vec<u8>>, bool);
|
||||
|
||||
@@ -28,7 +28,7 @@ fn main() {
|
||||
|
||||
// Claim or not based on the boolean flag
|
||||
let post_state = if should_claim {
|
||||
AccountPostState::new_claimed(account_post)
|
||||
AccountPostState::new_claimed(account_post, Claim::Authorized)
|
||||
} else {
|
||||
AccountPostState::new(account_post)
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs};
|
||||
use nssa_core::program::{AccountPostState, Claim, ProgramInput, ProgramOutput, read_nssa_inputs};
|
||||
|
||||
type Instruction = ();
|
||||
|
||||
@@ -15,7 +15,7 @@ fn main() {
|
||||
return;
|
||||
};
|
||||
|
||||
let account_post = AccountPostState::new_claimed(pre.account.clone());
|
||||
let account_post = AccountPostState::new_claimed(pre.account.clone(), Claim::Authorized);
|
||||
|
||||
ProgramOutput::new(instruction_words, vec![pre], vec![account_post]).write();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs};
|
||||
use nssa_core::program::{AccountPostState, Claim, ProgramInput, ProgramOutput, read_nssa_inputs};
|
||||
|
||||
type Instruction = Vec<u8>;
|
||||
|
||||
@@ -25,7 +25,10 @@ fn main() {
|
||||
ProgramOutput::new(
|
||||
instruction_words,
|
||||
vec![pre],
|
||||
vec![AccountPostState::new_claimed(account_post)],
|
||||
vec![AccountPostState::new_claimed(
|
||||
account_post,
|
||||
Claim::Authorized,
|
||||
)],
|
||||
)
|
||||
.write();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user