mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-27 07:01:14 +00:00
chore(lint): add staged lint baseline
This commit is contained in:
committed by
r4bbit
parent
035f593f5e
commit
49d7f91ee5
@@ -3,6 +3,9 @@ name = "token_program"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
token_core = { path = "core" }
|
||||
|
||||
@@ -3,6 +3,9 @@ name = "token_core"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", package = "spel-framework-macros" }
|
||||
|
||||
@@ -3,6 +3,9 @@ name = "token-methods"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
risc0-build = "=3.0.5"
|
||||
|
||||
|
||||
@@ -5,6 +5,32 @@ edition = "2021"
|
||||
|
||||
[workspace]
|
||||
|
||||
[lints.rust]
|
||||
rust_2018_idioms = { level = "deny", priority = -1 }
|
||||
unsafe_code = "forbid"
|
||||
|
||||
[lints.clippy]
|
||||
all = { level = "deny", priority = -1 }
|
||||
allow_attributes = "warn"
|
||||
allow_attributes_without_reason = "deny"
|
||||
arithmetic_side_effects = "deny"
|
||||
as_conversions = "deny"
|
||||
cast_possible_truncation = "deny"
|
||||
cast_possible_wrap = "deny"
|
||||
cast_precision_loss = "warn"
|
||||
cast_sign_loss = "deny"
|
||||
dbg_macro = "deny"
|
||||
indexing_slicing = "deny"
|
||||
integer_division = "warn"
|
||||
large_enum_variant = "deny"
|
||||
match_wildcard_for_single_variants = "warn"
|
||||
module_name_repetitions = "allow"
|
||||
similar_names = "allow"
|
||||
todo = "deny"
|
||||
unimplemented = "deny"
|
||||
unwrap_used = "deny"
|
||||
wildcard_enum_match_arm = "deny"
|
||||
|
||||
[[bin]]
|
||||
name = "token"
|
||||
path = "src/bin/token.rs"
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
#![no_main]
|
||||
#![cfg_attr(not(test), no_main)]
|
||||
|
||||
use spel_framework::prelude::*;
|
||||
use spel_framework::context::ProgramContext;
|
||||
use nssa_core::account::AccountWithMetadata;
|
||||
|
||||
#[cfg(not(test))]
|
||||
risc0_zkvm::guest::entry!(main);
|
||||
|
||||
#[lez_program(instruction = "token_core::Instruction")]
|
||||
mod token {
|
||||
#[allow(unused_imports)]
|
||||
#[expect(
|
||||
unused_imports,
|
||||
reason = "SPEL instruction macro requires importing parent-scope handler types"
|
||||
)]
|
||||
use super::*;
|
||||
|
||||
/// Transfer tokens from sender to recipient.
|
||||
@@ -48,6 +52,10 @@ mod token {
|
||||
|
||||
/// Create a new fungible or non-fungible token definition with metadata.
|
||||
/// Definition, holding, and metadata targets must be uninitialized and authorized.
|
||||
#[expect(
|
||||
clippy::boxed_local,
|
||||
reason = "boxed metadata keeps the instruction argument size bounded on the stack"
|
||||
)]
|
||||
#[instruction]
|
||||
pub fn new_definition_with_metadata(
|
||||
definition_target_account: AccountWithMetadata,
|
||||
|
||||
@@ -40,7 +40,9 @@ pub fn print_nft(
|
||||
*print_balance > 1,
|
||||
"Insufficient balance to print another NFT copy"
|
||||
);
|
||||
*print_balance -= 1;
|
||||
*print_balance = print_balance
|
||||
.checked_sub(1)
|
||||
.expect("print balance must be greater than one after validation");
|
||||
|
||||
let mut master_account_post = master_account.account;
|
||||
master_account_post.data = Data::from(&master_account_data);
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
#![cfg(test)]
|
||||
#![expect(
|
||||
clippy::arithmetic_side_effects,
|
||||
reason = "test fixtures use fixed values to lock boundary behavior"
|
||||
)]
|
||||
|
||||
use nssa_core::{
|
||||
account::{Account, AccountId, AccountWithMetadata, Data, Nonce},
|
||||
|
||||
Reference in New Issue
Block a user