feat: add restriction clippy lints

This commit is contained in:
Daniil Polyakov
2026-03-17 21:25:30 +03:00
parent efe8393ba0
commit e3b93b6e9a
137 changed files with 4171 additions and 3765 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ fn main() {
let account_pre = &pre.account;
let mut account_post = account_pre.clone();
account_post.balance -= balance_to_burn;
account_post.balance = account_post.balance.saturating_sub(balance_to_burn);
write_nssa_outputs(
instruction_words,
@@ -42,8 +42,16 @@ fn main() {
};
chained_calls.push(new_chained_call);
running_sender_pre.account.balance -= balance;
running_recipient_pre.account.balance += balance;
running_sender_pre.account.balance =
match running_sender_pre.account.balance.checked_sub(balance) {
Some(new_balance) => new_balance,
None => return,
};
running_recipient_pre.account.balance =
match running_recipient_pre.account.balance.checked_add(balance) {
Some(new_balance) => new_balance,
None => return,
};
}
write_nssa_outputs_with_chained_call(
+4 -1
View File
@@ -11,7 +11,10 @@ fn main() {
let account_pre = &pre.account;
let mut account_post = account_pre.clone();
account_post.balance += 1;
account_post.balance = account_post
.balance
.checked_add(1)
.expect("Balance overflow");
write_nssa_outputs(
instruction_words,
@@ -1,3 +1,8 @@
#![expect(
clippy::arithmetic_side_effects,
reason = "This program is intentionally malicious and is expected to have side effects."
)]
use nssa_core::{
account::{Account, AccountWithMetadata},
program::{AccountPostState, ProgramInput, read_nssa_inputs, write_nssa_outputs},
@@ -11,7 +11,7 @@ fn main() {
let account_pre = &pre.account;
let mut account_post = account_pre.clone();
account_post.nonce += 1;
account_post.nonce = account_post.nonce.overflowing_add(1).0;
write_nssa_outputs(
instruction_words,
@@ -17,8 +17,14 @@ fn main() {
let mut sender_post = sender_pre.account.clone();
let mut receiver_post = receiver_pre.account.clone();
sender_post.balance -= balance;
receiver_post.balance += balance;
sender_post.balance = sender_post
.balance
.checked_sub(balance)
.expect("Not enough balance to transfer");
receiver_post.balance = receiver_post
.balance
.checked_add(balance)
.expect("Overflow when adding balance");
write_nssa_outputs(
instruction_words,