From 40bcc1d3ceaa82714812e4c329afd0cb09d4ec05 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Mon, 11 Jul 2022 08:24:47 -0500 Subject: [PATCH 01/24] setup boilerplate and tests for 6-dup --- .../.cargo/config.toml | 11 ++++ lints/duplicate-mutable-accounts/.gitignore | 2 + lints/duplicate-mutable-accounts/Cargo.toml | 21 +++++++ .../duplicate-mutable-accounts/rust-toolchain | 3 + lints/duplicate-mutable-accounts/src/lib.rs | 56 +++++++++++++++++++ .../ui/insecure/Cargo.toml | 19 +++++++ .../ui/insecure/Xargo.toml | 2 + .../ui/insecure/src/lib.rs | 28 ++++++++++ .../ui/secure/Cargo.toml | 19 +++++++ .../ui/secure/Xargo.toml | 2 + .../ui/secure/src/lib.rs | 29 ++++++++++ 11 files changed, 192 insertions(+) create mode 100644 lints/duplicate-mutable-accounts/.cargo/config.toml create mode 100644 lints/duplicate-mutable-accounts/.gitignore create mode 100644 lints/duplicate-mutable-accounts/Cargo.toml create mode 100644 lints/duplicate-mutable-accounts/rust-toolchain create mode 100644 lints/duplicate-mutable-accounts/src/lib.rs create mode 100644 lints/duplicate-mutable-accounts/ui/insecure/Cargo.toml create mode 100644 lints/duplicate-mutable-accounts/ui/insecure/Xargo.toml create mode 100644 lints/duplicate-mutable-accounts/ui/insecure/src/lib.rs create mode 100644 lints/duplicate-mutable-accounts/ui/secure/Cargo.toml create mode 100644 lints/duplicate-mutable-accounts/ui/secure/Xargo.toml create mode 100644 lints/duplicate-mutable-accounts/ui/secure/src/lib.rs diff --git a/lints/duplicate-mutable-accounts/.cargo/config.toml b/lints/duplicate-mutable-accounts/.cargo/config.toml new file mode 100644 index 0000000..46d1571 --- /dev/null +++ b/lints/duplicate-mutable-accounts/.cargo/config.toml @@ -0,0 +1,11 @@ +[target.aarch64-apple-darwin] +linker = "dylint-link" + +[target.x86_64-apple-darwin] +linker = "dylint-link" + +[target.x86_64-unknown-linux-gnu] +linker = "dylint-link" + +[target.x86_64-pc-windows-msvc] +linker = "dylint-link" diff --git a/lints/duplicate-mutable-accounts/.gitignore b/lints/duplicate-mutable-accounts/.gitignore new file mode 100644 index 0000000..4fffb2f --- /dev/null +++ b/lints/duplicate-mutable-accounts/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/lints/duplicate-mutable-accounts/Cargo.toml b/lints/duplicate-mutable-accounts/Cargo.toml new file mode 100644 index 0000000..7f446b5 --- /dev/null +++ b/lints/duplicate-mutable-accounts/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "duplicate_mutable_accounts" +version = "0.1.0" +authors = ["authors go here"] +description = "decription goes here" +edition = "2018" +publish = false + +[lib] +crate-type = ["cdylib"] + +[dependencies] +clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "7b2896a8fc9f0b275692677ee6d2d66a7cbde16a" } +dylint_linting = "2.0.1" +if_chain = "1.0.2" + +[dev-dependencies] +dylint_testing = "2.0.1" + +[package.metadata.rust-analyzer] +rustc_private = true diff --git a/lints/duplicate-mutable-accounts/rust-toolchain b/lints/duplicate-mutable-accounts/rust-toolchain new file mode 100644 index 0000000..e348c78 --- /dev/null +++ b/lints/duplicate-mutable-accounts/rust-toolchain @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly-2022-02-24" +components = ["llvm-tools-preview", "rustc-dev"] diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs new file mode 100644 index 0000000..bc2e695 --- /dev/null +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -0,0 +1,56 @@ +#![feature(rustc_private)] +#![warn(unused_extern_crates)] + +extern crate rustc_ast; +extern crate rustc_ast_pretty; +extern crate rustc_data_structures; +extern crate rustc_errors; +extern crate rustc_hir; +extern crate rustc_hir_pretty; +extern crate rustc_index; +extern crate rustc_infer; +extern crate rustc_lexer; +extern crate rustc_middle; +extern crate rustc_mir_dataflow; +extern crate rustc_parse; +extern crate rustc_parse_format; +extern crate rustc_span; +extern crate rustc_target; +extern crate rustc_trait_selection; +extern crate rustc_typeck; + +use rustc_lint::LateLintPass; + +dylint_linting::declare_late_lint! { + /// **What it does:** + /// + /// **Why is this bad?** + /// + /// **Known problems:** None. + /// + /// **Example:** + /// + /// ```rust + /// // example code where a warning is issued + /// ``` + /// Use instead: + /// ```rust + /// // example code that does not raise a warning + /// ``` + pub DUPLICATE_MUTABLE_ACCOUNTS, + Warn, + "description goes here" +} + +impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { + // A list of things you might check can be found here: + // https://doc.rust-lang.org/stable/nightly-rustc/rustc_lint/trait.LateLintPass.html +} + +#[test] +fn ui() { + dylint_testing::ui_test( + env!("CARGO_PKG_NAME"), + &std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("ui"), + ); +} diff --git a/lints/duplicate-mutable-accounts/ui/insecure/Cargo.toml b/lints/duplicate-mutable-accounts/ui/insecure/Cargo.toml new file mode 100644 index 0000000..adcf234 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/insecure/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "duplicate-mutable-accounts-insecure" +version = "0.1.0" +description = "Created with Anchor" +edition = "2018" + +[lib] +crate-type = ["cdylib", "lib"] +name = "duplicate_mutable_accounts_insecure" + +[features] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +cpi = ["no-entrypoint"] +default = [] + +[dependencies] +anchor-lang = "0.20.1" diff --git a/lints/duplicate-mutable-accounts/ui/insecure/Xargo.toml b/lints/duplicate-mutable-accounts/ui/insecure/Xargo.toml new file mode 100644 index 0000000..475fb71 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/insecure/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.rs b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.rs new file mode 100644 index 0000000..0427589 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.rs @@ -0,0 +1,28 @@ +use anchor_lang::prelude::*; + +declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); + +#[program] +pub mod duplicate_mutable_accounts_insecure { + use super::*; + + pub fn update(ctx: Context, a: u64, b: u64) -> ProgramResult { + let user_a = &mut ctx.accounts.user_a; + let user_b = &mut ctx.accounts.user_b; + + user_a.data = a; + user_b.data = b; + Ok(()) + } +} + +#[derive(Accounts)] +pub struct Update<'info> { + user_a: Account<'info, User>, + user_b: Account<'info, User>, +} + +#[account] +pub struct User { + data: u64, +} diff --git a/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml b/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml new file mode 100644 index 0000000..43d63ca --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "duplicate-mutable-accounts-secure" +version = "0.1.0" +description = "Created with Anchor" +edition = "2018" + +[lib] +crate-type = ["cdylib", "lib"] +name = "duplicate_mutable_accounts_secure" + +[features] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +cpi = ["no-entrypoint"] +default = [] + +[dependencies] +anchor-lang = "0.20.1" diff --git a/lints/duplicate-mutable-accounts/ui/secure/Xargo.toml b/lints/duplicate-mutable-accounts/ui/secure/Xargo.toml new file mode 100644 index 0000000..475fb71 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/secure/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs b/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs new file mode 100644 index 0000000..d98454f --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs @@ -0,0 +1,29 @@ +use anchor_lang::prelude::*; + +declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); + +#[program] +pub mod duplicate_mutable_accounts_secure { + use super::*; + + pub fn update_secure(ctx: Context, a: u64, b: u64) -> ProgramResult { + let user_a = &mut ctx.accounts.user_a; + let user_b = &mut ctx.accounts.user_b; + + user_a.data = a; + user_b.data = b; + Ok(()) + } +} + +#[derive(Accounts)] +pub struct Update<'info> { + #[account(constraint = user_a.key() != user_b.key())] + user_a: Account<'info, User>, + user_b: Account<'info, User>, +} + +#[account] +pub struct User { + data: u64, +} From dc1242feb3b0750df149733dd167524ad884ec0c Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Mon, 11 Jul 2022 11:26:38 -0500 Subject: [PATCH 02/24] implement 6-duplicate-mutable-accounts lint --- lints/duplicate-mutable-accounts/Cargo.toml | 12 + lints/duplicate-mutable-accounts/src/lib.rs | 164 +- .../ui/insecure/Cargo.lock | 1315 +++++++++++++++++ .../ui/insecure/Cargo.toml | 4 +- .../ui/insecure/src/lib.rs | 8 +- .../ui/insecure/src/lib.stderr | 15 + .../ui/secure/Cargo.lock | 1315 +++++++++++++++++ .../ui/secure/Cargo.toml | 4 +- .../ui/secure/src/lib.rs | 8 +- .../ui/secure/src/lib.stderr | 0 10 files changed, 2817 insertions(+), 28 deletions(-) create mode 100644 lints/duplicate-mutable-accounts/ui/insecure/Cargo.lock create mode 100644 lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr create mode 100644 lints/duplicate-mutable-accounts/ui/secure/Cargo.lock create mode 100644 lints/duplicate-mutable-accounts/ui/secure/src/lib.stderr diff --git a/lints/duplicate-mutable-accounts/Cargo.toml b/lints/duplicate-mutable-accounts/Cargo.toml index 7f446b5..64ad973 100644 --- a/lints/duplicate-mutable-accounts/Cargo.toml +++ b/lints/duplicate-mutable-accounts/Cargo.toml @@ -9,13 +9,25 @@ publish = false [lib] crate-type = ["cdylib"] +[[example]] +name = "insecure" +path = "ui/insecure/src/lib.rs" + +[[example]] +name = "secure" +path = "ui/secure/src/lib.rs" + [dependencies] clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "7b2896a8fc9f0b275692677ee6d2d66a7cbde16a" } dylint_linting = "2.0.1" if_chain = "1.0.2" +solana-lints = { path = "../../crate" } [dev-dependencies] dylint_testing = "2.0.1" +anchor-lang = "0.24.2" + +[workspace] [package.metadata.rust-analyzer] rustc_private = true diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index bc2e695..1613aea 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -2,26 +2,26 @@ #![warn(unused_extern_crates)] extern crate rustc_ast; -extern crate rustc_ast_pretty; -extern crate rustc_data_structures; -extern crate rustc_errors; extern crate rustc_hir; -extern crate rustc_hir_pretty; -extern crate rustc_index; -extern crate rustc_infer; -extern crate rustc_lexer; -extern crate rustc_middle; -extern crate rustc_mir_dataflow; -extern crate rustc_parse; -extern crate rustc_parse_format; extern crate rustc_span; -extern crate rustc_target; -extern crate rustc_trait_selection; -extern crate rustc_typeck; -use rustc_lint::LateLintPass; +use rustc_ast::{ + token::TokenKind, + tokenstream::{TokenStream, TokenTree}, + AttrKind, Attribute, MacArgs, +}; +use rustc_hir::def::Res; +use rustc_hir::*; +use rustc_lint::{LateContext, LateLintPass}; +use rustc_span::{def_id::DefId, symbol::Symbol, Span}; +use std::collections::HashMap; +use std::default::Default; -dylint_linting::declare_late_lint! { +use clippy_utils::{diagnostics::span_lint_and_help, ty::match_type}; +use if_chain::if_chain; +use solana_lints::paths; + +dylint_linting::impl_late_lint! { /// **What it does:** /// /// **Why is this bad?** @@ -39,18 +39,134 @@ dylint_linting::declare_late_lint! { /// ``` pub DUPLICATE_MUTABLE_ACCOUNTS, Warn, - "description goes here" + "description goes here", + DuplicateMutableAccounts::default() +} + +#[derive(Default, Debug)] +struct DuplicateMutableAccounts { + accounts: HashMap>, + streams: Vec, } impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { - // A list of things you might check can be found here: - // https://doc.rust-lang.org/stable/nightly-rustc/rustc_lint/trait.LateLintPass.html + fn check_struct_def(&mut self, cx: &LateContext<'tcx>, variant_data: &'tcx VariantData<'tcx>) { + if let VariantData::Struct(fields, _) = variant_data { + fields.iter().for_each(|field| { + if_chain! { + // grab the def_id of the field type + let ty = field.ty; + if let TyKind::Path(qpath) = &ty.kind; + if let QPath::Resolved(_, path) = qpath; + if let Res::Def(_, def_id) = path.res; + // match the type of the field + let ty = cx.tcx.type_of(def_id); + // check it is an anchor account type + if match_type(cx, ty, &paths::ANCHOR_ACCOUNT); + // check the type of T, the second generic arg + let account_id = get_anchor_account_type(&path.segments[0]).unwrap(); + then { + if let Some(v) = self.accounts.get_mut(&account_id) { + v.push((field.ident.name, field.span)); + } else { + self.accounts.insert(account_id, vec![(field.ident.name, field.span)]); + } + } + } + }); + } + } + + fn check_attribute(&mut self, _: &LateContext<'tcx>, attribute: &'tcx Attribute) { + // println!("{:#?}", self.accounts); + if_chain! { + if let AttrKind::Normal(attr_item, _) = &attribute.kind; + let name = attr_item.path.segments[0].ident.name; + // for some reason #[account] doesn't match when no args, maybe take away + // the code to check name, and just check it has constraint args? + if name.as_str() == "account"; + if let MacArgs::Delimited(_, _, token_stream) = &attr_item.args; + then { + self.streams.push(Stream(token_stream.clone())); + // println!("{:#?}", attribute); + } + } + } + + fn check_crate_post(&mut self, cx: &LateContext<'tcx>) { + // println!("{:#?}", self); + for (_k, v) in self.accounts.iter() { + // if multiple same accounts, check that there is a tokenstream such that + // all necessary expressions are in it: x.key(), y.key(), != + // where x and y are the field name from self.accounts + if v.len() > 1 { + if !has_satisfying_stream(&self.streams, v) { + span_lint_and_help( + cx, + DUPLICATE_MUTABLE_ACCOUNTS, + v[0].1, + "identical account types", + Some(v[1].1), + &format!("add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]", v[0].0, v[1].0) + ); + } + } + } + } +} + +fn get_anchor_account_type(segment: &PathSegment<'_>) -> Option { + if_chain! { + if let Some(generic_args) = segment.args; + if let GenericArg::Type(ty) = &generic_args.args[1]; // the account type is the second generic arg + if let TyKind::Path(qpath) = &ty.kind; + if let QPath::Resolved(_, path) = qpath; + if let Res::Def(_, def_id) = path.res; + then { + Some(def_id) + } else { + None + } + } +} + +fn has_satisfying_stream(streams: &Vec, field_names: &Vec<(Symbol, Span)>) -> bool { + for stream in streams { + if stream.contains(TokenKind::Ne) + && field_names + .iter() + // TODO: if true, will not match. figure out what the bool signifies + .all(|(sym, _)| stream.contains(TokenKind::Ident(*sym, false))) + { + return true; + } + } + return false; +} + +#[derive(Debug)] +pub struct Stream(TokenStream); + +impl Stream { + fn contains(&self, x: TokenKind) -> bool { + for token_tree in self.0.trees() { + if let TokenTree::Token(t) = token_tree { + if t.kind == x { + // println!("The type {:?} matches {:?}", t.kind, x); + return true; + } + } + } + return false; + } +} + +#[test] +fn insecure() { + dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "insecure"); } #[test] -fn ui() { - dylint_testing::ui_test( - env!("CARGO_PKG_NAME"), - &std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("ui"), - ); +fn secure() { + dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "secure"); } diff --git a/lints/duplicate-mutable-accounts/ui/insecure/Cargo.lock b/lints/duplicate-mutable-accounts/ui/insecure/Cargo.lock new file mode 100644 index 0000000..9cb8d20 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/insecure/Cargo.lock @@ -0,0 +1,1315 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.7", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "anchor-attribute-access-control" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "anchor-attribute-account" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" +dependencies = [ + "anchor-syn", + "anyhow", + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "anchor-attribute-constant" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" +dependencies = [ + "anchor-syn", + "proc-macro2", + "syn", +] + +[[package]] +name = "anchor-attribute-error" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" +dependencies = [ + "anchor-syn", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-event" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-interface" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" +dependencies = [ + "anchor-syn", + "anyhow", + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-program" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-state" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-derive-accounts" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-lang" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" +dependencies = [ + "anchor-attribute-access-control", + "anchor-attribute-account", + "anchor-attribute-constant", + "anchor-attribute-error", + "anchor-attribute-event", + "anchor-attribute-interface", + "anchor-attribute-program", + "anchor-attribute-state", + "anchor-derive-accounts", + "arrayref", + "base64 0.13.0", + "bincode", + "borsh", + "bytemuck", + "solana-program", + "thiserror", +] + +[[package]] +name = "anchor-syn" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" +dependencies = [ + "anyhow", + "bs58 0.3.1", + "heck", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "serde", + "serde_json", + "sha2", + "syn", + "thiserror", +] + +[[package]] +name = "anyhow" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "blake3" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "digest 0.10.3", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive", + "hashbrown", +] + +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate", + "proc-macro2", + "syn", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "bs58" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" + +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bumpalo" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" + +[[package]] +name = "bv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" +dependencies = [ + "feature-probe", + "serde", +] + +[[package]] +name = "bytemuck" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "console_log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" +dependencies = [ + "log", + "web-sys", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "cpufeatures" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer 0.10.2", + "crypto-common", + "subtle", +] + +[[package]] +name = "duplicate-mutable-accounts-insecure" +version = "0.1.0" +dependencies = [ + "anchor-lang", +] + +[[package]] +name = "either" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" + +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "generic-array" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +dependencies = [ + "serde", + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" + +[[package]] +name = "js-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] +name = "libsecp256k1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memmap2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" +dependencies = [ + "libc", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro2" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proc-macro2-diagnostics" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "version_check", + "yansi", +] + +[[package]] +name = "quote" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf" + +[[package]] +name = "ryu" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "semver" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" + +[[package]] +name = "serde" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug", +] + +[[package]] +name = "smallvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" + +[[package]] +name = "solana-frozen-abi" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" +dependencies = [ + "bs58 0.4.0", + "bv", + "generic-array", + "log", + "memmap2", + "rustc_version", + "serde", + "serde_derive", + "sha2", + "solana-frozen-abi-macro", + "solana-logger", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn", +] + +[[package]] +name = "solana-logger" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" +dependencies = [ + "env_logger", + "lazy_static", + "log", +] + +[[package]] +name = "solana-program" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" +dependencies = [ + "base64 0.13.0", + "bincode", + "bitflags", + "blake3", + "borsh", + "borsh-derive", + "bs58 0.4.0", + "bv", + "bytemuck", + "console_error_panic_hook", + "console_log", + "curve25519-dalek", + "getrandom 0.1.16", + "itertools", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "num-derive", + "num-traits", + "parking_lot", + "rand", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "sha2", + "sha3", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-sdk-macro", + "thiserror", + "wasm-bindgen", +] + +[[package]] +name = "solana-sdk-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" +dependencies = [ + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "unicode-ident" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" + +[[package]] +name = "unicode-segmentation" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" + +[[package]] +name = "web-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/lints/duplicate-mutable-accounts/ui/insecure/Cargo.toml b/lints/duplicate-mutable-accounts/ui/insecure/Cargo.toml index adcf234..8ade494 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure/Cargo.toml +++ b/lints/duplicate-mutable-accounts/ui/insecure/Cargo.toml @@ -15,5 +15,7 @@ no-log-ix-name = [] cpi = ["no-entrypoint"] default = [] +[workspace] + [dependencies] -anchor-lang = "0.20.1" +anchor-lang = "0.24.2" diff --git a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.rs b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.rs index 0427589..2e1d708 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.rs +++ b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.rs @@ -6,7 +6,11 @@ declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); pub mod duplicate_mutable_accounts_insecure { use super::*; - pub fn update(ctx: Context, a: u64, b: u64) -> ProgramResult { + pub fn update( + ctx: Context, + a: u64, + b: u64, + ) -> anchor_lang::solana_program::entrypoint::ProgramResult { let user_a = &mut ctx.accounts.user_a; let user_b = &mut ctx.accounts.user_b; @@ -26,3 +30,5 @@ pub struct Update<'info> { pub struct User { data: u64, } + +fn main() {} diff --git a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr new file mode 100644 index 0000000..48cda15 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr @@ -0,0 +1,15 @@ +error: identical account types + --> $DIR/lib.rs:25:5 + | +LL | user_a: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D duplicate-mutable-accounts` implied by `-D warnings` +help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_b.key())] + --> $DIR/lib.rs:26:5 + | +LL | user_b: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/lints/duplicate-mutable-accounts/ui/secure/Cargo.lock b/lints/duplicate-mutable-accounts/ui/secure/Cargo.lock new file mode 100644 index 0000000..ad9c1fd --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/secure/Cargo.lock @@ -0,0 +1,1315 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.7", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "anchor-attribute-access-control" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "anchor-attribute-account" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" +dependencies = [ + "anchor-syn", + "anyhow", + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "anchor-attribute-constant" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" +dependencies = [ + "anchor-syn", + "proc-macro2", + "syn", +] + +[[package]] +name = "anchor-attribute-error" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" +dependencies = [ + "anchor-syn", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-event" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-interface" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" +dependencies = [ + "anchor-syn", + "anyhow", + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-program" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-state" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-derive-accounts" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-lang" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" +dependencies = [ + "anchor-attribute-access-control", + "anchor-attribute-account", + "anchor-attribute-constant", + "anchor-attribute-error", + "anchor-attribute-event", + "anchor-attribute-interface", + "anchor-attribute-program", + "anchor-attribute-state", + "anchor-derive-accounts", + "arrayref", + "base64 0.13.0", + "bincode", + "borsh", + "bytemuck", + "solana-program", + "thiserror", +] + +[[package]] +name = "anchor-syn" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" +dependencies = [ + "anyhow", + "bs58 0.3.1", + "heck", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "serde", + "serde_json", + "sha2", + "syn", + "thiserror", +] + +[[package]] +name = "anyhow" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "blake3" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "digest 0.10.3", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive", + "hashbrown", +] + +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate", + "proc-macro2", + "syn", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "bs58" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" + +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bumpalo" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" + +[[package]] +name = "bv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" +dependencies = [ + "feature-probe", + "serde", +] + +[[package]] +name = "bytemuck" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "console_log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" +dependencies = [ + "log", + "web-sys", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "cpufeatures" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer 0.10.2", + "crypto-common", + "subtle", +] + +[[package]] +name = "duplicate-mutable-accounts-secure" +version = "0.1.0" +dependencies = [ + "anchor-lang", +] + +[[package]] +name = "either" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" + +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "generic-array" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +dependencies = [ + "serde", + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" + +[[package]] +name = "js-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] +name = "libsecp256k1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memmap2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" +dependencies = [ + "libc", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro2" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proc-macro2-diagnostics" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "version_check", + "yansi", +] + +[[package]] +name = "quote" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf" + +[[package]] +name = "ryu" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "semver" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" + +[[package]] +name = "serde" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug", +] + +[[package]] +name = "smallvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" + +[[package]] +name = "solana-frozen-abi" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" +dependencies = [ + "bs58 0.4.0", + "bv", + "generic-array", + "log", + "memmap2", + "rustc_version", + "serde", + "serde_derive", + "sha2", + "solana-frozen-abi-macro", + "solana-logger", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn", +] + +[[package]] +name = "solana-logger" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" +dependencies = [ + "env_logger", + "lazy_static", + "log", +] + +[[package]] +name = "solana-program" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" +dependencies = [ + "base64 0.13.0", + "bincode", + "bitflags", + "blake3", + "borsh", + "borsh-derive", + "bs58 0.4.0", + "bv", + "bytemuck", + "console_error_panic_hook", + "console_log", + "curve25519-dalek", + "getrandom 0.1.16", + "itertools", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "num-derive", + "num-traits", + "parking_lot", + "rand", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "sha2", + "sha3", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-sdk-macro", + "thiserror", + "wasm-bindgen", +] + +[[package]] +name = "solana-sdk-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" +dependencies = [ + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "unicode-ident" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" + +[[package]] +name = "unicode-segmentation" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" + +[[package]] +name = "web-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml b/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml index 43d63ca..b32565c 100644 --- a/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml +++ b/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml @@ -15,5 +15,7 @@ no-log-ix-name = [] cpi = ["no-entrypoint"] default = [] +[workspace] + [dependencies] -anchor-lang = "0.20.1" +anchor-lang = "0.24.2" diff --git a/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs b/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs index d98454f..12924e1 100644 --- a/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs +++ b/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs @@ -6,7 +6,11 @@ declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); pub mod duplicate_mutable_accounts_secure { use super::*; - pub fn update_secure(ctx: Context, a: u64, b: u64) -> ProgramResult { + pub fn update_secure( + ctx: Context, + a: u64, + b: u64, + ) -> anchor_lang::solana_program::entrypoint::ProgramResult { let user_a = &mut ctx.accounts.user_a; let user_b = &mut ctx.accounts.user_b; @@ -27,3 +31,5 @@ pub struct Update<'info> { pub struct User { data: u64, } + +fn main() {} diff --git a/lints/duplicate-mutable-accounts/ui/secure/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/secure/src/lib.stderr new file mode 100644 index 0000000..e69de29 From f012a325212df7e1a0c04accbeadcd0ed3372a85 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Thu, 14 Jul 2022 11:03:33 -0500 Subject: [PATCH 03/24] drafting of upgrade --- lints/duplicate-mutable-accounts/Cargo.toml | 6 + lints/duplicate-mutable-accounts/src/lib.rs | 122 +- .../ui/insecure-2/Cargo.lock | 1315 +++++++++++++++++ .../ui/insecure-2/Cargo.toml | 21 + .../ui/insecure-2/Xargo.toml | 2 + .../ui/insecure-2/src/lib.rs | 37 + .../ui/insecure-2/src/lib.stderr | 15 + .../ui/secure/src/lib.rs | 6 +- 8 files changed, 1480 insertions(+), 44 deletions(-) create mode 100644 lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.lock create mode 100644 lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.toml create mode 100644 lints/duplicate-mutable-accounts/ui/insecure-2/Xargo.toml create mode 100644 lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs create mode 100644 lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr diff --git a/lints/duplicate-mutable-accounts/Cargo.toml b/lints/duplicate-mutable-accounts/Cargo.toml index 64ad973..4acd5ce 100644 --- a/lints/duplicate-mutable-accounts/Cargo.toml +++ b/lints/duplicate-mutable-accounts/Cargo.toml @@ -13,6 +13,10 @@ crate-type = ["cdylib"] name = "insecure" path = "ui/insecure/src/lib.rs" +[[example]] +name = "insecure-2" +path = "ui/insecure-2/src/lib.rs" + [[example]] name = "secure" path = "ui/secure/src/lib.rs" @@ -21,6 +25,8 @@ path = "ui/secure/src/lib.rs" clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "7b2896a8fc9f0b275692677ee6d2d66a7cbde16a" } dylint_linting = "2.0.1" if_chain = "1.0.2" +proc-macro2 = "1.0.40" +quote = "1.0.20" solana-lints = { path = "../../crate" } [dev-dependencies] diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index 1613aea..1667e23 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -5,6 +5,10 @@ extern crate rustc_ast; extern crate rustc_hir; extern crate rustc_span; +use proc_macro2::*; +use quote::quote; +use std::str::FromStr; + use rustc_ast::{ token::TokenKind, tokenstream::{TokenStream, TokenTree}, @@ -14,7 +18,7 @@ use rustc_hir::def::Res; use rustc_hir::*; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::{def_id::DefId, symbol::Symbol, Span}; -use std::collections::HashMap; +use std::collections::{HashMap, HashSet, VecDeque}; use std::default::Default; use clippy_utils::{diagnostics::span_lint_and_help, ty::match_type}; @@ -46,7 +50,7 @@ dylint_linting::impl_late_lint! { #[derive(Default, Debug)] struct DuplicateMutableAccounts { accounts: HashMap>, - streams: Vec, + streams: Streams, } impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { @@ -81,13 +85,16 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { // println!("{:#?}", self.accounts); if_chain! { if let AttrKind::Normal(attr_item, _) = &attribute.kind; - let name = attr_item.path.segments[0].ident.name; + let name = attr_item.path.segments[0].ident.name; // TODO: can use name_or_empty // for some reason #[account] doesn't match when no args, maybe take away // the code to check name, and just check it has constraint args? if name.as_str() == "account"; if let MacArgs::Delimited(_, _, token_stream) = &attr_item.args; then { - self.streams.push(Stream(token_stream.clone())); + // TODO: figure out stream representation. At this point, may parse? + // TODO: filter mechanism: only insert constraints that match form "constraint = _.key() != _.key()" + // TODO: may need to parse each constraint as a separate stream, as comma-delimited + self.streams.0.push(token_stream.clone()); // println!("{:#?}", attribute); } } @@ -96,19 +103,22 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { fn check_crate_post(&mut self, cx: &LateContext<'tcx>) { // println!("{:#?}", self); for (_k, v) in self.accounts.iter() { - // if multiple same accounts, check that there is a tokenstream such that - // all necessary expressions are in it: x.key(), y.key(), != - // where x and y are the field name from self.accounts if v.len() > 1 { - if !has_satisfying_stream(&self.streams, v) { - span_lint_and_help( - cx, - DUPLICATE_MUTABLE_ACCOUNTS, - v[0].1, - "identical account types", - Some(v[1].1), - &format!("add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]", v[0].0, v[1].0) - ); + // generate static set of possible constraints + let gen_constraints = generate_possible_expected_constraints(v); + + // assert the following checks: + for (one, reflexive) in gen_constraints { + if !(self.streams.contains(one) || self.streams.contains(reflexive)) { + // span_lint_and_help( + // cx, + // DUPLICATE_MUTABLE_ACCOUNTS, + // v[0].1, + // "identical account types", + // Some(v[1].1), + // &format!("add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]", v[0].0, v[1].0) + // ); + } } } } @@ -117,6 +127,7 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { fn get_anchor_account_type(segment: &PathSegment<'_>) -> Option { if_chain! { + // TODO: the following logic to get def_id is a repeated pattern if let Some(generic_args) = segment.args; if let GenericArg::Type(ty) = &generic_args.args[1]; // the account type is the second generic arg if let TyKind::Path(qpath) = &ty.kind; @@ -130,34 +141,38 @@ fn get_anchor_account_type(segment: &PathSegment<'_>) -> Option { } } -fn has_satisfying_stream(streams: &Vec, field_names: &Vec<(Symbol, Span)>) -> bool { - for stream in streams { - if stream.contains(TokenKind::Ne) - && field_names - .iter() - // TODO: if true, will not match. figure out what the bool signifies - .all(|(sym, _)| stream.contains(TokenKind::Ident(*sym, false))) - { - return true; +/// Generates a static set of a possible expected key check constraints necessary for `values`. +fn generate_possible_expected_constraints(values: &Vec<(Symbol, Span)>) -> Vec<(proc_macro2::TokenStream, proc_macro2::TokenStream)> { + // TODO: may start with a VecDeque in the first place? + let mut deq = VecDeque::from(values.clone()); + let mut gen_set = Vec::new(); + + for _ in 0..deq.len() - 1 { + let first = deq.pop_front().unwrap().0; + // generate stream for all other values in vec + for (other, _) in &deq { + let constraint = format!("constraint = {}.key() != {}.key()", first.as_str(), other.as_str()); + let reflexive = format!("constraint = {}.key() != {}.key()", other.as_str(), first.as_str()); + + // using quote + // let stream = quote!(constraint = first.as_str().key() != other.as_str().key()); + + let stream: proc_macro2::TokenStream = constraint.parse().unwrap(); + let reflex_stream: proc_macro2::TokenStream = reflexive.parse().unwrap(); + // println!("{:#?}", stream); + + gen_set.push((stream, reflex_stream)); } } - return false; + gen_set } -#[derive(Debug)] -pub struct Stream(TokenStream); +#[derive(Debug, Default)] +pub struct Streams(Vec); -impl Stream { - fn contains(&self, x: TokenKind) -> bool { - for token_tree in self.0.trees() { - if let TokenTree::Token(t) = token_tree { - if t.kind == x { - // println!("The type {:?} matches {:?}", t.kind, x); - return true; - } - } - } - return false; +impl Streams { + fn contains(&self, other: TokenStream) -> bool { + self.0.iter().any(|stream| stream == &other) } } @@ -166,7 +181,36 @@ fn insecure() { dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "insecure"); } +#[test] +fn insecure_2() { + dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "insecure-2"); +} + #[test] fn secure() { dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "secure"); } + +// fn has_satisfying_stream(streams: &Vec, field_names: &Vec<(Symbol, Span)>) -> bool { +// for stream in streams { +// if stream.contains(TokenKind::Ne) +// && field_names +// .iter() +// // TODO: if true, will not match. figure out what the bool signifies +// .all(|(sym, _)| stream.contains(TokenKind::Ident(*sym, false))) +// { +// return true; +// } +// } +// return false; +// } + +// Generates a TokenStream that matches `constraint = a.key() != b.key()` and its reflexive +// fn generate_key_check_constraint(a: Symbol, b: Symbol) -> (TokenStream, TokenStream) { +// let mut tree_and_spacing = vec![]; +// // create token +// let tree = TokenTree::token(TokenKind::Ident(Symbol::intern("constraint"), false), span); // TODO: generate span somehow +// tree_and_spacing.push(TreeAndSpacing::from(tree)); + +// TokenStream::new(tree_and_spacing) +// } diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.lock b/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.lock new file mode 100644 index 0000000..9cb8d20 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.lock @@ -0,0 +1,1315 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.7", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "anchor-attribute-access-control" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "anchor-attribute-account" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" +dependencies = [ + "anchor-syn", + "anyhow", + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "anchor-attribute-constant" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" +dependencies = [ + "anchor-syn", + "proc-macro2", + "syn", +] + +[[package]] +name = "anchor-attribute-error" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" +dependencies = [ + "anchor-syn", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-event" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-interface" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" +dependencies = [ + "anchor-syn", + "anyhow", + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-program" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-state" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-derive-accounts" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-lang" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" +dependencies = [ + "anchor-attribute-access-control", + "anchor-attribute-account", + "anchor-attribute-constant", + "anchor-attribute-error", + "anchor-attribute-event", + "anchor-attribute-interface", + "anchor-attribute-program", + "anchor-attribute-state", + "anchor-derive-accounts", + "arrayref", + "base64 0.13.0", + "bincode", + "borsh", + "bytemuck", + "solana-program", + "thiserror", +] + +[[package]] +name = "anchor-syn" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" +dependencies = [ + "anyhow", + "bs58 0.3.1", + "heck", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "serde", + "serde_json", + "sha2", + "syn", + "thiserror", +] + +[[package]] +name = "anyhow" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "blake3" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "digest 0.10.3", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive", + "hashbrown", +] + +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate", + "proc-macro2", + "syn", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "bs58" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" + +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bumpalo" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" + +[[package]] +name = "bv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" +dependencies = [ + "feature-probe", + "serde", +] + +[[package]] +name = "bytemuck" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "console_log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" +dependencies = [ + "log", + "web-sys", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "cpufeatures" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer 0.10.2", + "crypto-common", + "subtle", +] + +[[package]] +name = "duplicate-mutable-accounts-insecure" +version = "0.1.0" +dependencies = [ + "anchor-lang", +] + +[[package]] +name = "either" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" + +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "generic-array" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +dependencies = [ + "serde", + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" + +[[package]] +name = "js-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] +name = "libsecp256k1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memmap2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" +dependencies = [ + "libc", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro2" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proc-macro2-diagnostics" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "version_check", + "yansi", +] + +[[package]] +name = "quote" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf" + +[[package]] +name = "ryu" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "semver" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" + +[[package]] +name = "serde" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug", +] + +[[package]] +name = "smallvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" + +[[package]] +name = "solana-frozen-abi" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" +dependencies = [ + "bs58 0.4.0", + "bv", + "generic-array", + "log", + "memmap2", + "rustc_version", + "serde", + "serde_derive", + "sha2", + "solana-frozen-abi-macro", + "solana-logger", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn", +] + +[[package]] +name = "solana-logger" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" +dependencies = [ + "env_logger", + "lazy_static", + "log", +] + +[[package]] +name = "solana-program" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" +dependencies = [ + "base64 0.13.0", + "bincode", + "bitflags", + "blake3", + "borsh", + "borsh-derive", + "bs58 0.4.0", + "bv", + "bytemuck", + "console_error_panic_hook", + "console_log", + "curve25519-dalek", + "getrandom 0.1.16", + "itertools", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "num-derive", + "num-traits", + "parking_lot", + "rand", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "sha2", + "sha3", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-sdk-macro", + "thiserror", + "wasm-bindgen", +] + +[[package]] +name = "solana-sdk-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" +dependencies = [ + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "unicode-ident" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" + +[[package]] +name = "unicode-segmentation" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" + +[[package]] +name = "web-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.toml b/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.toml new file mode 100644 index 0000000..e0b71e3 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "duplicate-mutable-accounts-insecure-2" +version = "0.1.0" +description = "Created with Anchor" +edition = "2018" + +[lib] +crate-type = ["cdylib", "lib"] +name = "duplicate_mutable_accounts_insecure_2" + +[features] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +cpi = ["no-entrypoint"] +default = [] + +[workspace] + +[dependencies] +anchor-lang = "0.24.2" diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/Xargo.toml b/lints/duplicate-mutable-accounts/ui/insecure-2/Xargo.toml new file mode 100644 index 0000000..475fb71 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs new file mode 100644 index 0000000..4324688 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs @@ -0,0 +1,37 @@ +use anchor_lang::prelude::*; + +declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); + +#[program] +pub mod duplicate_mutable_accounts_insecure { + use super::*; + + pub fn update( + ctx: Context, + a: u64, + b: u64, + ) -> anchor_lang::solana_program::entrypoint::ProgramResult { + let user_a = &mut ctx.accounts.user_a; + let user_b = &mut ctx.accounts.user_b; + + user_a.data = a; + user_b.data = b; + Ok(()) + } +} + +#[derive(Accounts)] +pub struct Update<'info> { + #[account(constraint = user_a.key() != user_b.key())] + user_a: Account<'info, User>, + #[account(constraint = user_c.key() != user_b.key())] + user_b: Account<'info, User>, + user_c: Account<'info, User>, +} + +#[account] +pub struct User { + data: u64, +} + +fn main() {} diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr new file mode 100644 index 0000000..48cda15 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr @@ -0,0 +1,15 @@ +error: identical account types + --> $DIR/lib.rs:25:5 + | +LL | user_a: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D duplicate-mutable-accounts` implied by `-D warnings` +help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_b.key())] + --> $DIR/lib.rs:26:5 + | +LL | user_b: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs b/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs index 12924e1..df1057d 100644 --- a/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs +++ b/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs @@ -6,11 +6,7 @@ declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); pub mod duplicate_mutable_accounts_secure { use super::*; - pub fn update_secure( - ctx: Context, - a: u64, - b: u64, - ) -> anchor_lang::solana_program::entrypoint::ProgramResult { + pub fn update_secure(ctx: Context, a: u64, b: u64) -> anchor_lang::solana_program::entrypoint::ProgramResult { let user_a = &mut ctx.accounts.user_a; let user_b = &mut ctx.accounts.user_b; From e9cd6d2dcc7913bb928df1d97d411594fb7c90f6 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Sat, 16 Jul 2022 08:17:33 -0500 Subject: [PATCH 04/24] complete working impl of lint-6 for anchor constraint checks --- lints/duplicate-mutable-accounts/Cargo.toml | 2 +- .../duplicate-mutable-accounts/rust-toolchain | 2 +- lints/duplicate-mutable-accounts/src/lib.rs | 177 ++++++++++++------ .../ui/insecure-2/src/lib.rs | 3 +- .../ui/secure/src/lib.rs | 6 +- 5 files changed, 126 insertions(+), 64 deletions(-) diff --git a/lints/duplicate-mutable-accounts/Cargo.toml b/lints/duplicate-mutable-accounts/Cargo.toml index 4acd5ce..b8aff35 100644 --- a/lints/duplicate-mutable-accounts/Cargo.toml +++ b/lints/duplicate-mutable-accounts/Cargo.toml @@ -22,7 +22,7 @@ name = "secure" path = "ui/secure/src/lib.rs" [dependencies] -clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "7b2896a8fc9f0b275692677ee6d2d66a7cbde16a" } +clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "0cb0f7636851f9fcc57085cf80197a2ef6db098f" } dylint_linting = "2.0.1" if_chain = "1.0.2" proc-macro2 = "1.0.40" diff --git a/lints/duplicate-mutable-accounts/rust-toolchain b/lints/duplicate-mutable-accounts/rust-toolchain index e348c78..2056264 100644 --- a/lints/duplicate-mutable-accounts/rust-toolchain +++ b/lints/duplicate-mutable-accounts/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2022-02-24" +channel = "nightly-2022-06-30" components = ["llvm-tools-preview", "rustc-dev"] diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index 1667e23..580df4f 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -5,22 +5,24 @@ extern crate rustc_ast; extern crate rustc_hir; extern crate rustc_span; -use proc_macro2::*; -use quote::quote; -use std::str::FromStr; - use rustc_ast::{ - token::TokenKind, - tokenstream::{TokenStream, TokenTree}, + token::{Delimiter, Token, TokenKind}, + tokenstream::{CursorRef, DelimSpan, TokenStream, TokenTree, TreeAndSpacing}, AttrKind, Attribute, MacArgs, }; use rustc_hir::def::Res; use rustc_hir::*; use rustc_lint::{LateContext, LateLintPass}; -use rustc_span::{def_id::DefId, symbol::Symbol, Span}; -use std::collections::{HashMap, HashSet, VecDeque}; +use rustc_span::{ + def_id::DefId, + symbol::{Ident, Symbol}, + Span, DUMMY_SP, +}; +use std::collections::{HashMap, VecDeque}; use std::default::Default; + + use clippy_utils::{diagnostics::span_lint_and_help, ty::match_type}; use if_chain::if_chain; use solana_lints::paths; @@ -54,6 +56,27 @@ struct DuplicateMutableAccounts { } impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { + // fn check_mod( + // &mut self, + // cx: &LateContext<'tcx>, + // _: &'tcx Mod<'tcx>, + // span: Span, + // _: HirId + // ) { + // println!("new"); + // for _ in 0..3 { + // println!("linting"); + // span_lint_and_help( + // cx, + // DUPLICATE_MUTABLE_ACCOUNTS, + // span, + // "dummy", + // None, + // "" + // ); + // } + // } + fn check_struct_def(&mut self, cx: &LateContext<'tcx>, variant_data: &'tcx VariantData<'tcx>) { if let VariantData::Struct(fields, _) = variant_data { fields.iter().for_each(|field| { @@ -91,11 +114,11 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { if name.as_str() == "account"; if let MacArgs::Delimited(_, _, token_stream) = &attr_item.args; then { - // TODO: figure out stream representation. At this point, may parse? - // TODO: filter mechanism: only insert constraints that match form "constraint = _.key() != _.key()" - // TODO: may need to parse each constraint as a separate stream, as comma-delimited - self.streams.0.push(token_stream.clone()); - // println!("{:#?}", attribute); + for split in split(token_stream.trees(), TokenKind::Comma) { + // println!("{:#?}", split); + self.streams.0.push(split); + } + } } } @@ -107,17 +130,29 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { // generate static set of possible constraints let gen_constraints = generate_possible_expected_constraints(v); - // assert the following checks: - for (one, reflexive) in gen_constraints { - if !(self.streams.contains(one) || self.streams.contains(reflexive)) { - // span_lint_and_help( - // cx, - // DUPLICATE_MUTABLE_ACCOUNTS, - // v[0].1, - // "identical account types", - // Some(v[1].1), - // &format!("add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]", v[0].0, v[1].0) - // ); + for ((one, symmetric), symbols) in gen_constraints { + // println!("{:#?}\n {:#?}", one, symmetric); + if !(self.streams.contains(one) || self.streams.contains(symmetric)) { + println!("lint for {} {}", symbols.0, symbols.1); + + // stupid way to get spans for offending types + let mut spans: Vec = Vec::new(); + for (sym, span) in v { + if &symbols.0 == sym || &symbols.1 == sym { + spans.push(span.clone()); + } + } + + // TODO: for some reason, will only print out 2 messages, not 3 + // println!("{:?}", spans); + span_lint_and_help( + cx, + DUPLICATE_MUTABLE_ACCOUNTS, + spans[0], + "identical account types without a key check constraint", + Some(spans[1]), + &format!("add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]", symbols.0, symbols.1) + ); } } } @@ -141,8 +176,29 @@ fn get_anchor_account_type(segment: &PathSegment<'_>) -> Option { } } +// collect elements into a TokenStream until encounter delim then stop collecting. create a new vec. +// continue until reaching end of stream +fn split(stream: CursorRef, delimiter: TokenKind) -> Vec { + let mut split_streams: Vec = Vec::new(); + let mut temp: Vec = Vec::new(); + let delim = TokenTree::Token(Token::new(delimiter, DUMMY_SP)); + + stream.for_each(|t| { + if t.eq_unspanned(&delim) { + split_streams.push(TokenStream::new(temp.clone())); + temp.clear(); + } else { + temp.push(TreeAndSpacing::from(t.to_owned())); + } + }); + split_streams.push(TokenStream::new(temp)); + split_streams +} + /// Generates a static set of a possible expected key check constraints necessary for `values`. -fn generate_possible_expected_constraints(values: &Vec<(Symbol, Span)>) -> Vec<(proc_macro2::TokenStream, proc_macro2::TokenStream)> { +fn generate_possible_expected_constraints( + values: &Vec<(Symbol, Span)>, +) -> Vec<((TokenStream, TokenStream), (Symbol, Symbol))> { // TODO: may start with a VecDeque in the first place? let mut deq = VecDeque::from(values.clone()); let mut gen_set = Vec::new(); @@ -151,28 +207,55 @@ fn generate_possible_expected_constraints(values: &Vec<(Symbol, Span)>) -> Vec<( let first = deq.pop_front().unwrap().0; // generate stream for all other values in vec for (other, _) in &deq { - let constraint = format!("constraint = {}.key() != {}.key()", first.as_str(), other.as_str()); - let reflexive = format!("constraint = {}.key() != {}.key()", other.as_str(), first.as_str()); - - // using quote - // let stream = quote!(constraint = first.as_str().key() != other.as_str().key()); - - let stream: proc_macro2::TokenStream = constraint.parse().unwrap(); - let reflex_stream: proc_macro2::TokenStream = reflexive.parse().unwrap(); + let stream = create_key_check_constraint_tokenstream(&first, other); + let symmetric_stream = create_key_check_constraint_tokenstream(other, &first); // println!("{:#?}", stream); - gen_set.push((stream, reflex_stream)); + gen_set.push(((stream, symmetric_stream), (first, other.clone()))); } } gen_set } +// TODO: figure out more efficient way to do this +fn create_key_check_constraint_tokenstream(a: &Symbol, b: &Symbol) -> TokenStream { + let constraint = vec![ + // TODO: test string matching by changing some string + TreeAndSpacing::from(create_token("constraint")), + TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Eq, DUMMY_SP))), + TreeAndSpacing::from(create_token(a.as_str())), + TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP))), + TreeAndSpacing::from(create_token("key")), + TreeAndSpacing::from(TokenTree::Delimited( + DelimSpan::dummy(), + Delimiter::Parenthesis, + TokenStream::new(vec![]), + )), + TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Ne, DUMMY_SP))), + TreeAndSpacing::from(create_token(b.as_str())), + TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP))), + TreeAndSpacing::from(create_token("key")), + TreeAndSpacing::from(TokenTree::Delimited( + DelimSpan::dummy(), + Delimiter::Parenthesis, + TokenStream::new(vec![]), + )), + ]; + + TokenStream::new(constraint) +} + +fn create_token(s: &str) -> TokenTree { + let ident = Ident::from_str(s); + TokenTree::Token(Token::from_ast_ident(ident)) +} + #[derive(Debug, Default)] pub struct Streams(Vec); impl Streams { fn contains(&self, other: TokenStream) -> bool { - self.0.iter().any(|stream| stream == &other) + self.0.iter().any(|stream| stream.eq_unspanned(&other)) } } @@ -190,27 +273,3 @@ fn insecure_2() { fn secure() { dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "secure"); } - -// fn has_satisfying_stream(streams: &Vec, field_names: &Vec<(Symbol, Span)>) -> bool { -// for stream in streams { -// if stream.contains(TokenKind::Ne) -// && field_names -// .iter() -// // TODO: if true, will not match. figure out what the bool signifies -// .all(|(sym, _)| stream.contains(TokenKind::Ident(*sym, false))) -// { -// return true; -// } -// } -// return false; -// } - -// Generates a TokenStream that matches `constraint = a.key() != b.key()` and its reflexive -// fn generate_key_check_constraint(a: Symbol, b: Symbol) -> (TokenStream, TokenStream) { -// let mut tree_and_spacing = vec![]; -// // create token -// let tree = TokenTree::token(TokenKind::Ident(Symbol::intern("constraint"), false), span); // TODO: generate span somehow -// tree_and_spacing.push(TreeAndSpacing::from(tree)); - -// TokenStream::new(tree_and_spacing) -// } diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs index 4324688..285fc47 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs @@ -22,9 +22,8 @@ pub mod duplicate_mutable_accounts_insecure { #[derive(Accounts)] pub struct Update<'info> { - #[account(constraint = user_a.key() != user_b.key())] + #[account(constraint = user_a.key() != user_b.key(), constraint = user_b.key() != user_c.key())] user_a: Account<'info, User>, - #[account(constraint = user_c.key() != user_b.key())] user_b: Account<'info, User>, user_c: Account<'info, User>, } diff --git a/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs b/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs index df1057d..12924e1 100644 --- a/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs +++ b/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs @@ -6,7 +6,11 @@ declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); pub mod duplicate_mutable_accounts_secure { use super::*; - pub fn update_secure(ctx: Context, a: u64, b: u64) -> anchor_lang::solana_program::entrypoint::ProgramResult { + pub fn update_secure( + ctx: Context, + a: u64, + b: u64, + ) -> anchor_lang::solana_program::entrypoint::ProgramResult { let user_a = &mut ctx.accounts.user_a; let user_b = &mut ctx.accounts.user_b; From cef270dc7079a8b6edf04dde816d790678663631 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Sat, 16 Jul 2022 09:51:57 -0500 Subject: [PATCH 05/24] clean up code and add rustdocs --- lints/duplicate-mutable-accounts/src/lib.rs | 131 +++++++++----------- 1 file changed, 58 insertions(+), 73 deletions(-) diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index 580df4f..d24ddfd 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -5,28 +5,28 @@ extern crate rustc_ast; extern crate rustc_hir; extern crate rustc_span; +use std::collections::{HashMap, VecDeque}; +use std::default::Default; + use rustc_ast::{ token::{Delimiter, Token, TokenKind}, tokenstream::{CursorRef, DelimSpan, TokenStream, TokenTree, TreeAndSpacing}, AttrKind, Attribute, MacArgs, }; -use rustc_hir::def::Res; -use rustc_hir::*; +use rustc_hir::{def::Res, FieldDef, GenericArg, QPath, TyKind, VariantData}; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::{ def_id::DefId, symbol::{Ident, Symbol}, Span, DUMMY_SP, }; -use std::collections::{HashMap, VecDeque}; -use std::default::Default; - - use clippy_utils::{diagnostics::span_lint_and_help, ty::match_type}; use if_chain::if_chain; use solana_lints::paths; +const ANCHOR_ACCOUNT_GENERIC_ARG_COUNT: usize = 2; + dylint_linting::impl_late_lint! { /// **What it does:** /// @@ -56,42 +56,14 @@ struct DuplicateMutableAccounts { } impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { - // fn check_mod( - // &mut self, - // cx: &LateContext<'tcx>, - // _: &'tcx Mod<'tcx>, - // span: Span, - // _: HirId - // ) { - // println!("new"); - // for _ in 0..3 { - // println!("linting"); - // span_lint_and_help( - // cx, - // DUPLICATE_MUTABLE_ACCOUNTS, - // span, - // "dummy", - // None, - // "" - // ); - // } - // } - fn check_struct_def(&mut self, cx: &LateContext<'tcx>, variant_data: &'tcx VariantData<'tcx>) { if let VariantData::Struct(fields, _) = variant_data { fields.iter().for_each(|field| { if_chain! { - // grab the def_id of the field type - let ty = field.ty; - if let TyKind::Path(qpath) = &ty.kind; - if let QPath::Resolved(_, path) = qpath; - if let Res::Def(_, def_id) = path.res; - // match the type of the field - let ty = cx.tcx.type_of(def_id); - // check it is an anchor account type - if match_type(cx, ty, &paths::ANCHOR_ACCOUNT); - // check the type of T, the second generic arg - let account_id = get_anchor_account_type(&path.segments[0]).unwrap(); + if let Some(def_id) = get_def_id(field.ty); + let middle_ty = cx.tcx.type_of(def_id); + if match_type(cx, middle_ty, &paths::ANCHOR_ACCOUNT); + if let Some(account_id) = get_anchor_account_type_def_id(field); then { if let Some(v) = self.accounts.get_mut(&account_id) { v.push((field.ident.name, field.span)); @@ -105,37 +77,29 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { } fn check_attribute(&mut self, _: &LateContext<'tcx>, attribute: &'tcx Attribute) { - // println!("{:#?}", self.accounts); if_chain! { if let AttrKind::Normal(attr_item, _) = &attribute.kind; - let name = attr_item.path.segments[0].ident.name; // TODO: can use name_or_empty - // for some reason #[account] doesn't match when no args, maybe take away - // the code to check name, and just check it has constraint args? + let name = attribute.name_or_empty(); if name.as_str() == "account"; if let MacArgs::Delimited(_, _, token_stream) = &attr_item.args; then { - for split in split(token_stream.trees(), TokenKind::Comma) { - // println!("{:#?}", split); - self.streams.0.push(split); + // Parse each constraint as a separate TokenStream + for delimited_stream in split(token_stream.trees(), TokenKind::Comma) { + self.streams.0.push(delimited_stream); } - } } } fn check_crate_post(&mut self, cx: &LateContext<'tcx>) { // println!("{:#?}", self); - for (_k, v) in self.accounts.iter() { + for (_, v) in self.accounts.iter() { if v.len() > 1 { - // generate static set of possible constraints let gen_constraints = generate_possible_expected_constraints(v); for ((one, symmetric), symbols) in gen_constraints { - // println!("{:#?}\n {:#?}", one, symmetric); if !(self.streams.contains(one) || self.streams.contains(symmetric)) { - println!("lint for {} {}", symbols.0, symbols.1); - - // stupid way to get spans for offending types + // get spans for offending types let mut spans: Vec = Vec::new(); for (sym, span) in v { if &symbols.0 == sym || &symbols.1 == sym { @@ -144,7 +108,6 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { } // TODO: for some reason, will only print out 2 messages, not 3 - // println!("{:?}", spans); span_lint_and_help( cx, DUPLICATE_MUTABLE_ACCOUNTS, @@ -160,11 +123,27 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { } } -fn get_anchor_account_type(segment: &PathSegment<'_>) -> Option { +/// Returns the `DefId` of the anchor account type, ie, `T` in `Account<'info, T>`. +/// Returns `None` if the type of `field` is not an anchor account. +fn get_anchor_account_type_def_id(field: &FieldDef) -> Option { + if_chain! { + if let TyKind::Path(qpath) = &field.ty.kind; + if let QPath::Resolved(_, path) = qpath; + if path.segments.len() > 0; + if let Some(generic_args) = path.segments[0].args; + if generic_args.args.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; + if let GenericArg::Type(hir_ty) = &generic_args.args[1]; + then { + get_def_id(hir_ty) + } else { + None + } + } +} + +/// Returns the `DefId` of `ty`, an hir type. Returns `None` if cannot resolve type. +fn get_def_id(ty: &rustc_hir::Ty) -> Option { if_chain! { - // TODO: the following logic to get def_id is a repeated pattern - if let Some(generic_args) = segment.args; - if let GenericArg::Type(ty) = &generic_args.args[1]; // the account type is the second generic arg if let TyKind::Path(qpath) = &ty.kind; if let QPath::Resolved(_, path) = qpath; if let Res::Def(_, def_id) = path.res; @@ -176,8 +155,7 @@ fn get_anchor_account_type(segment: &PathSegment<'_>) -> Option { } } -// collect elements into a TokenStream until encounter delim then stop collecting. create a new vec. -// continue until reaching end of stream +/// Splits `stream` into a vector of substreams, separated by `delimiter`. fn split(stream: CursorRef, delimiter: TokenKind) -> Vec { let mut split_streams: Vec = Vec::new(); let mut temp: Vec = Vec::new(); @@ -195,12 +173,17 @@ fn split(stream: CursorRef, delimiter: TokenKind) -> Vec { split_streams } -/// Generates a static set of a possible expected key check constraints necessary for `values`. +/// Generates a static set of possible expected key check constraints necessary for `identical_types`. +/// `identical_types` is a set of identical types that must have a key check constraint. A vector of tuples +/// is returned, where each element represents a particular constraint. +/// +/// Specifically, the first field of the tuple is a tuple of `TokenStream`s, which represent the constraint and its +/// symmetric value, e.g., `a!=b` and `b!=a`. The second field of the tuple is a tuple of symbols, which +/// represent the identifiers being compared. Following the previous example, this would be `(a, b)`. fn generate_possible_expected_constraints( - values: &Vec<(Symbol, Span)>, + identical_types: &Vec<(Symbol, Span)>, ) -> Vec<((TokenStream, TokenStream), (Symbol, Symbol))> { - // TODO: may start with a VecDeque in the first place? - let mut deq = VecDeque::from(values.clone()); + let mut deq = VecDeque::from(identical_types.clone()); let mut gen_set = Vec::new(); for _ in 0..deq.len() - 1 { @@ -209,32 +192,31 @@ fn generate_possible_expected_constraints( for (other, _) in &deq { let stream = create_key_check_constraint_tokenstream(&first, other); let symmetric_stream = create_key_check_constraint_tokenstream(other, &first); - // println!("{:#?}", stream); - gen_set.push(((stream, symmetric_stream), (first, other.clone()))); } } gen_set } -// TODO: figure out more efficient way to do this +/// Returns a `TokenStream` of form: constraint = `a`.key() != `b`.key(). fn create_key_check_constraint_tokenstream(a: &Symbol, b: &Symbol) -> TokenStream { + // TODO: may be more efficient way to do this, since the stream is effectively fixed + // and determined. Only two tokens are variable. let constraint = vec![ - // TODO: test string matching by changing some string - TreeAndSpacing::from(create_token("constraint")), + TreeAndSpacing::from(create_token_from_ident("constraint")), TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Eq, DUMMY_SP))), - TreeAndSpacing::from(create_token(a.as_str())), + TreeAndSpacing::from(create_token_from_ident(a.as_str())), TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP))), - TreeAndSpacing::from(create_token("key")), + TreeAndSpacing::from(create_token_from_ident("key")), TreeAndSpacing::from(TokenTree::Delimited( DelimSpan::dummy(), Delimiter::Parenthesis, TokenStream::new(vec![]), )), TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Ne, DUMMY_SP))), - TreeAndSpacing::from(create_token(b.as_str())), + TreeAndSpacing::from(create_token_from_ident(b.as_str())), TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP))), - TreeAndSpacing::from(create_token("key")), + TreeAndSpacing::from(create_token_from_ident("key")), TreeAndSpacing::from(TokenTree::Delimited( DelimSpan::dummy(), Delimiter::Parenthesis, @@ -245,7 +227,8 @@ fn create_key_check_constraint_tokenstream(a: &Symbol, b: &Symbol) -> TokenStrea TokenStream::new(constraint) } -fn create_token(s: &str) -> TokenTree { +/// Returns a `TokenTree::Token` which has `TokenKind::Ident`, with the string set to `s`. +fn create_token_from_ident(s: &str) -> TokenTree { let ident = Ident::from_str(s); TokenTree::Token(Token::from_ast_ident(ident)) } @@ -254,6 +237,8 @@ fn create_token(s: &str) -> TokenTree { pub struct Streams(Vec); impl Streams { + /// Returns true if `self` contains `other`, by comparing if there is an + /// identical `TokenStream` in `self` regardless of span. fn contains(&self, other: TokenStream) -> bool { self.0.iter().any(|stream| stream.eq_unspanned(&other)) } From a95e0f8e24aab67826a2c29452967cd95d51647f Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Sat, 16 Jul 2022 10:15:21 -0500 Subject: [PATCH 06/24] add tests for lint-6 --- lints/duplicate-mutable-accounts/Cargo.toml | 10 +- lints/duplicate-mutable-accounts/src/lib.rs | 36 +- .../ui/insecure-2/Cargo.lock | 1315 ----------------- .../ui/insecure-2/Cargo.toml | 2 +- .../ui/insecure-2/src/lib.stderr | 10 +- .../ui/insecure/Cargo.lock | 1315 ----------------- .../ui/insecure/src/lib.stderr | 2 +- .../ui/recommended-2/Cargo.toml | 19 + .../ui/recommended-2/Xargo.toml | 2 + .../ui/recommended-2/src/lib.rs | 38 + .../ui/recommended-2/src/lib.stderr | 0 .../ui/recommended/Cargo.toml | 19 + .../ui/recommended/Xargo.toml | 2 + .../ui/recommended/src/lib.rs | 35 + .../ui/recommended/src/lib.stderr | 0 .../ui/secure/Cargo.lock | 1315 ----------------- .../ui/secure/Cargo.toml | 2 - .../ui/secure/src/lib.rs | 6 +- 18 files changed, 158 insertions(+), 3970 deletions(-) delete mode 100644 lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.lock delete mode 100644 lints/duplicate-mutable-accounts/ui/insecure/Cargo.lock create mode 100644 lints/duplicate-mutable-accounts/ui/recommended-2/Cargo.toml create mode 100644 lints/duplicate-mutable-accounts/ui/recommended-2/Xargo.toml create mode 100644 lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.rs create mode 100644 lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.stderr create mode 100644 lints/duplicate-mutable-accounts/ui/recommended/Cargo.toml create mode 100644 lints/duplicate-mutable-accounts/ui/recommended/Xargo.toml create mode 100644 lints/duplicate-mutable-accounts/ui/recommended/src/lib.rs create mode 100644 lints/duplicate-mutable-accounts/ui/recommended/src/lib.stderr delete mode 100644 lints/duplicate-mutable-accounts/ui/secure/Cargo.lock diff --git a/lints/duplicate-mutable-accounts/Cargo.toml b/lints/duplicate-mutable-accounts/Cargo.toml index b8aff35..7a2cb05 100644 --- a/lints/duplicate-mutable-accounts/Cargo.toml +++ b/lints/duplicate-mutable-accounts/Cargo.toml @@ -21,6 +21,14 @@ path = "ui/insecure-2/src/lib.rs" name = "secure" path = "ui/secure/src/lib.rs" +[[example]] +name = "recommended" +path = "ui/recommended/src/lib.rs" + +[[example]] +name = "recommended-2" +path = "ui/recommended-2/src/lib.rs" + [dependencies] clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "0cb0f7636851f9fcc57085cf80197a2ef6db098f" } dylint_linting = "2.0.1" @@ -30,8 +38,8 @@ quote = "1.0.20" solana-lints = { path = "../../crate" } [dev-dependencies] -dylint_testing = "2.0.1" anchor-lang = "0.24.2" +dylint_testing = "2.0.1" [workspace] diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index d24ddfd..cc0e0ba 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -93,17 +93,17 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { fn check_crate_post(&mut self, cx: &LateContext<'tcx>) { // println!("{:#?}", self); - for (_, v) in self.accounts.iter() { + for v in self.accounts.values() { if v.len() > 1 { let gen_constraints = generate_possible_expected_constraints(v); for ((one, symmetric), symbols) in gen_constraints { - if !(self.streams.contains(one) || self.streams.contains(symmetric)) { + if !(self.streams.contains(&one) || self.streams.contains(&symmetric)) { // get spans for offending types let mut spans: Vec = Vec::new(); for (sym, span) in v { if &symbols.0 == sym || &symbols.1 == sym { - spans.push(span.clone()); + spans.push(*span); } } @@ -129,7 +129,7 @@ fn get_anchor_account_type_def_id(field: &FieldDef) -> Option { if_chain! { if let TyKind::Path(qpath) = &field.ty.kind; if let QPath::Resolved(_, path) = qpath; - if path.segments.len() > 0; + if !path.segments.is_empty(); if let Some(generic_args) = path.segments[0].args; if generic_args.args.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; if let GenericArg::Type(hir_ty) = &generic_args.args[1]; @@ -166,7 +166,7 @@ fn split(stream: CursorRef, delimiter: TokenKind) -> Vec { split_streams.push(TokenStream::new(temp.clone())); temp.clear(); } else { - temp.push(TreeAndSpacing::from(t.to_owned())); + temp.push(TreeAndSpacing::from(t.clone())); } }); split_streams.push(TokenStream::new(temp)); @@ -181,25 +181,25 @@ fn split(stream: CursorRef, delimiter: TokenKind) -> Vec { /// symmetric value, e.g., `a!=b` and `b!=a`. The second field of the tuple is a tuple of symbols, which /// represent the identifiers being compared. Following the previous example, this would be `(a, b)`. fn generate_possible_expected_constraints( - identical_types: &Vec<(Symbol, Span)>, + identical_types: &[(Symbol, Span)], ) -> Vec<((TokenStream, TokenStream), (Symbol, Symbol))> { - let mut deq = VecDeque::from(identical_types.clone()); + let mut deq = VecDeque::from(identical_types.to_owned()); let mut gen_set = Vec::new(); for _ in 0..deq.len() - 1 { let first = deq.pop_front().unwrap().0; // generate stream for all other values in vec for (other, _) in &deq { - let stream = create_key_check_constraint_tokenstream(&first, other); - let symmetric_stream = create_key_check_constraint_tokenstream(other, &first); - gen_set.push(((stream, symmetric_stream), (first, other.clone()))); + let stream = create_key_check_constraint_tokenstream(first, *other); + let symmetric_stream = create_key_check_constraint_tokenstream(*other, first); + gen_set.push(((stream, symmetric_stream), (first, *other))); } } gen_set } /// Returns a `TokenStream` of form: constraint = `a`.key() != `b`.key(). -fn create_key_check_constraint_tokenstream(a: &Symbol, b: &Symbol) -> TokenStream { +fn create_key_check_constraint_tokenstream(a: Symbol, b: Symbol) -> TokenStream { // TODO: may be more efficient way to do this, since the stream is effectively fixed // and determined. Only two tokens are variable. let constraint = vec![ @@ -239,8 +239,8 @@ pub struct Streams(Vec); impl Streams { /// Returns true if `self` contains `other`, by comparing if there is an /// identical `TokenStream` in `self` regardless of span. - fn contains(&self, other: TokenStream) -> bool { - self.0.iter().any(|stream| stream.eq_unspanned(&other)) + fn contains(&self, other: &TokenStream) -> bool { + self.0.iter().any(|stream| stream.eq_unspanned(other)) } } @@ -258,3 +258,13 @@ fn insecure_2() { fn secure() { dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "secure"); } + +#[test] +fn recommended() { + dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "recommended"); +} + +#[test] +fn recommended_2() { + dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "recommended-2"); +} diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.lock b/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.lock deleted file mode 100644 index 9cb8d20..0000000 --- a/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.lock +++ /dev/null @@ -1,1315 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.7", - "once_cell", - "version_check", -] - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "anchor-attribute-access-control" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "regex", - "syn", -] - -[[package]] -name = "anchor-attribute-account" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" -dependencies = [ - "anchor-syn", - "anyhow", - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "anchor-attribute-constant" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" -dependencies = [ - "anchor-syn", - "proc-macro2", - "syn", -] - -[[package]] -name = "anchor-attribute-error" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" -dependencies = [ - "anchor-syn", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-event" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-interface" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" -dependencies = [ - "anchor-syn", - "anyhow", - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-program" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-state" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-derive-accounts" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-lang" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" -dependencies = [ - "anchor-attribute-access-control", - "anchor-attribute-account", - "anchor-attribute-constant", - "anchor-attribute-error", - "anchor-attribute-event", - "anchor-attribute-interface", - "anchor-attribute-program", - "anchor-attribute-state", - "anchor-derive-accounts", - "arrayref", - "base64 0.13.0", - "bincode", - "borsh", - "bytemuck", - "solana-program", - "thiserror", -] - -[[package]] -name = "anchor-syn" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" -dependencies = [ - "anyhow", - "bs58 0.3.1", - "heck", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "serde", - "serde_json", - "sha2", - "syn", - "thiserror", -] - -[[package]] -name = "anyhow" -version = "1.0.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "blake3" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", - "digest 0.10.3", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "block-padding", - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive", - "hashbrown", -] - -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate", - "proc-macro2", - "syn", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "bs58" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bumpalo" -version = "3.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" - -[[package]] -name = "bv" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" -dependencies = [ - "feature-probe", - "serde", -] - -[[package]] -name = "bytemuck" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" -dependencies = [ - "log", - "web-sys", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "cpufeatures" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" -dependencies = [ - "libc", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" -dependencies = [ - "block-buffer 0.10.2", - "crypto-common", - "subtle", -] - -[[package]] -name = "duplicate-mutable-accounts-insecure" -version = "0.1.0" -dependencies = [ - "anchor-lang", -] - -[[package]] -name = "either" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" - -[[package]] -name = "env_logger" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "feature-probe" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" - -[[package]] -name = "generic-array" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" -dependencies = [ - "serde", - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest 0.9.0", - "generic-array", - "hmac", -] - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "itertools" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "js-sys" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "libsecp256k1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" -dependencies = [ - "arrayref", - "base64 0.12.3", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand", - "serde", - "sha2", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "lock_api" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memmap2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" -dependencies = [ - "libc", -] - -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro2" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proc-macro2-diagnostics" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "version_check", - "yansi", -] - -[[package]] -name = "quote" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustversion" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf" - -[[package]] -name = "ryu" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "semver" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" - -[[package]] -name = "serde" -version = "1.0.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug", -] - -[[package]] -name = "smallvec" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" - -[[package]] -name = "solana-frozen-abi" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" -dependencies = [ - "bs58 0.4.0", - "bv", - "generic-array", - "log", - "memmap2", - "rustc_version", - "serde", - "serde_derive", - "sha2", - "solana-frozen-abi-macro", - "solana-logger", - "thiserror", -] - -[[package]] -name = "solana-frozen-abi-macro" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn", -] - -[[package]] -name = "solana-logger" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" -dependencies = [ - "env_logger", - "lazy_static", - "log", -] - -[[package]] -name = "solana-program" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" -dependencies = [ - "base64 0.13.0", - "bincode", - "bitflags", - "blake3", - "borsh", - "borsh-derive", - "bs58 0.4.0", - "bv", - "bytemuck", - "console_error_panic_hook", - "console_log", - "curve25519-dalek", - "getrandom 0.1.16", - "itertools", - "js-sys", - "lazy_static", - "libsecp256k1", - "log", - "num-derive", - "num-traits", - "parking_lot", - "rand", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "sha2", - "sha3", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-logger", - "solana-sdk-macro", - "thiserror", - "wasm-bindgen", -] - -[[package]] -name = "solana-sdk-macro" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" -dependencies = [ - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] - -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "unicode-ident" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" - -[[package]] -name = "unicode-segmentation" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" - -[[package]] -name = "web-sys" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - -[[package]] -name = "zeroize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.toml b/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.toml index e0b71e3..8f90916 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.toml +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "duplicate-mutable-accounts-insecure-2" version = "0.1.0" -description = "Created with Anchor" +description = "Does not have all required key constraint checks" edition = "2018" [lib] diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr index 48cda15..d195376 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr @@ -1,14 +1,14 @@ -error: identical account types - --> $DIR/lib.rs:25:5 +error: identical account types without a key check constraint + --> $DIR/lib.rs:26:5 | LL | user_a: Account<'info, User>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D duplicate-mutable-accounts` implied by `-D warnings` -help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_b.key())] - --> $DIR/lib.rs:26:5 +help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_c.key())] + --> $DIR/lib.rs:28:5 | -LL | user_b: Account<'info, User>, +LL | user_c: Account<'info, User>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/lints/duplicate-mutable-accounts/ui/insecure/Cargo.lock b/lints/duplicate-mutable-accounts/ui/insecure/Cargo.lock deleted file mode 100644 index 9cb8d20..0000000 --- a/lints/duplicate-mutable-accounts/ui/insecure/Cargo.lock +++ /dev/null @@ -1,1315 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.7", - "once_cell", - "version_check", -] - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "anchor-attribute-access-control" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "regex", - "syn", -] - -[[package]] -name = "anchor-attribute-account" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" -dependencies = [ - "anchor-syn", - "anyhow", - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "anchor-attribute-constant" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" -dependencies = [ - "anchor-syn", - "proc-macro2", - "syn", -] - -[[package]] -name = "anchor-attribute-error" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" -dependencies = [ - "anchor-syn", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-event" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-interface" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" -dependencies = [ - "anchor-syn", - "anyhow", - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-program" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-state" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-derive-accounts" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-lang" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" -dependencies = [ - "anchor-attribute-access-control", - "anchor-attribute-account", - "anchor-attribute-constant", - "anchor-attribute-error", - "anchor-attribute-event", - "anchor-attribute-interface", - "anchor-attribute-program", - "anchor-attribute-state", - "anchor-derive-accounts", - "arrayref", - "base64 0.13.0", - "bincode", - "borsh", - "bytemuck", - "solana-program", - "thiserror", -] - -[[package]] -name = "anchor-syn" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" -dependencies = [ - "anyhow", - "bs58 0.3.1", - "heck", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "serde", - "serde_json", - "sha2", - "syn", - "thiserror", -] - -[[package]] -name = "anyhow" -version = "1.0.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "blake3" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", - "digest 0.10.3", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "block-padding", - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive", - "hashbrown", -] - -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate", - "proc-macro2", - "syn", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "bs58" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bumpalo" -version = "3.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" - -[[package]] -name = "bv" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" -dependencies = [ - "feature-probe", - "serde", -] - -[[package]] -name = "bytemuck" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" -dependencies = [ - "log", - "web-sys", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "cpufeatures" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" -dependencies = [ - "libc", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" -dependencies = [ - "block-buffer 0.10.2", - "crypto-common", - "subtle", -] - -[[package]] -name = "duplicate-mutable-accounts-insecure" -version = "0.1.0" -dependencies = [ - "anchor-lang", -] - -[[package]] -name = "either" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" - -[[package]] -name = "env_logger" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "feature-probe" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" - -[[package]] -name = "generic-array" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" -dependencies = [ - "serde", - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest 0.9.0", - "generic-array", - "hmac", -] - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "itertools" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "js-sys" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "libsecp256k1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" -dependencies = [ - "arrayref", - "base64 0.12.3", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand", - "serde", - "sha2", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "lock_api" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memmap2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" -dependencies = [ - "libc", -] - -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro2" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proc-macro2-diagnostics" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "version_check", - "yansi", -] - -[[package]] -name = "quote" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustversion" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf" - -[[package]] -name = "ryu" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "semver" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" - -[[package]] -name = "serde" -version = "1.0.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug", -] - -[[package]] -name = "smallvec" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" - -[[package]] -name = "solana-frozen-abi" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" -dependencies = [ - "bs58 0.4.0", - "bv", - "generic-array", - "log", - "memmap2", - "rustc_version", - "serde", - "serde_derive", - "sha2", - "solana-frozen-abi-macro", - "solana-logger", - "thiserror", -] - -[[package]] -name = "solana-frozen-abi-macro" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn", -] - -[[package]] -name = "solana-logger" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" -dependencies = [ - "env_logger", - "lazy_static", - "log", -] - -[[package]] -name = "solana-program" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" -dependencies = [ - "base64 0.13.0", - "bincode", - "bitflags", - "blake3", - "borsh", - "borsh-derive", - "bs58 0.4.0", - "bv", - "bytemuck", - "console_error_panic_hook", - "console_log", - "curve25519-dalek", - "getrandom 0.1.16", - "itertools", - "js-sys", - "lazy_static", - "libsecp256k1", - "log", - "num-derive", - "num-traits", - "parking_lot", - "rand", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "sha2", - "sha3", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-logger", - "solana-sdk-macro", - "thiserror", - "wasm-bindgen", -] - -[[package]] -name = "solana-sdk-macro" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" -dependencies = [ - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] - -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "unicode-ident" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" - -[[package]] -name = "unicode-segmentation" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" - -[[package]] -name = "web-sys" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - -[[package]] -name = "zeroize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr index 48cda15..6a4ef64 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr +++ b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr @@ -1,4 +1,4 @@ -error: identical account types +error: identical account types without a key check constraint --> $DIR/lib.rs:25:5 | LL | user_a: Account<'info, User>, diff --git a/lints/duplicate-mutable-accounts/ui/recommended-2/Cargo.toml b/lints/duplicate-mutable-accounts/ui/recommended-2/Cargo.toml new file mode 100644 index 0000000..631313c --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/recommended-2/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "duplicate-mutable-accounts-recommended" +version = "0.1.0" +description = "Contains all necessary constraints for more than 2 duplicate accounts" +edition = "2018" + +[lib] +crate-type = ["cdylib", "lib"] +name = "duplicate_mutable_accounts_recommended" + +[features] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +cpi = ["no-entrypoint"] +default = [] + +[dependencies] +anchor-lang = "0.24.2" diff --git a/lints/duplicate-mutable-accounts/ui/recommended-2/Xargo.toml b/lints/duplicate-mutable-accounts/ui/recommended-2/Xargo.toml new file mode 100644 index 0000000..475fb71 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/recommended-2/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.rs b/lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.rs new file mode 100644 index 0000000..2fbacd0 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.rs @@ -0,0 +1,38 @@ +use anchor_lang::prelude::*; + +declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); + +#[program] +pub mod duplicate_mutable_accounts_recommended { + use super::*; + + pub fn update( + ctx: Context, + a: u64, + b: u64, + ) -> anchor_lang::solana_program::entrypoint::ProgramResult { + let user_a = &mut ctx.accounts.user_a; + let user_b = &mut ctx.accounts.user_b; + + user_a.data = a; + user_b.data = b; + Ok(()) + } +} + +#[derive(Accounts)] +pub struct Update<'info> { + #[account(constraint = user_a.key() != user_b.key())] + #[account(constraint = user_a.key() != user_c.key())] + #[account(constraint = user_c.key() != user_b.key())] + user_a: Account<'info, User>, + user_b: Account<'info, User>, + user_c: Account<'info, User>, +} + +#[account] +pub struct User { + data: u64, +} + +fn main() {} diff --git a/lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.stderr new file mode 100644 index 0000000..e69de29 diff --git a/lints/duplicate-mutable-accounts/ui/recommended/Cargo.toml b/lints/duplicate-mutable-accounts/ui/recommended/Cargo.toml new file mode 100644 index 0000000..45a53d1 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/recommended/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "duplicate-mutable-accounts-recommended" +version = "0.1.0" +description = "Created with Anchor" +edition = "2018" + +[lib] +crate-type = ["cdylib", "lib"] +name = "duplicate_mutable_accounts_recommended" + +[features] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +cpi = ["no-entrypoint"] +default = [] + +[dependencies] +anchor-lang = "0.24.2" diff --git a/lints/duplicate-mutable-accounts/ui/recommended/Xargo.toml b/lints/duplicate-mutable-accounts/ui/recommended/Xargo.toml new file mode 100644 index 0000000..475fb71 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/recommended/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/lints/duplicate-mutable-accounts/ui/recommended/src/lib.rs b/lints/duplicate-mutable-accounts/ui/recommended/src/lib.rs new file mode 100644 index 0000000..059fef2 --- /dev/null +++ b/lints/duplicate-mutable-accounts/ui/recommended/src/lib.rs @@ -0,0 +1,35 @@ +use anchor_lang::prelude::*; + +declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); + +#[program] +pub mod duplicate_mutable_accounts_recommended { + use super::*; + + pub fn update( + ctx: Context, + a: u64, + b: u64, + ) -> anchor_lang::solana_program::entrypoint::ProgramResult { + let user_a = &mut ctx.accounts.user_a; + let user_b = &mut ctx.accounts.user_b; + + user_a.data = a; + user_b.data = b; + Ok(()) + } +} + +#[derive(Accounts)] +pub struct Update<'info> { + #[account(constraint = user_a.key() != user_b.key())] + user_a: Account<'info, User>, + user_b: Account<'info, User>, +} + +#[account] +pub struct User { + data: u64, +} + +fn main() {} diff --git a/lints/duplicate-mutable-accounts/ui/recommended/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/recommended/src/lib.stderr new file mode 100644 index 0000000..e69de29 diff --git a/lints/duplicate-mutable-accounts/ui/secure/Cargo.lock b/lints/duplicate-mutable-accounts/ui/secure/Cargo.lock deleted file mode 100644 index ad9c1fd..0000000 --- a/lints/duplicate-mutable-accounts/ui/secure/Cargo.lock +++ /dev/null @@ -1,1315 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.7", - "once_cell", - "version_check", -] - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "anchor-attribute-access-control" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "regex", - "syn", -] - -[[package]] -name = "anchor-attribute-account" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" -dependencies = [ - "anchor-syn", - "anyhow", - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "anchor-attribute-constant" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" -dependencies = [ - "anchor-syn", - "proc-macro2", - "syn", -] - -[[package]] -name = "anchor-attribute-error" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" -dependencies = [ - "anchor-syn", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-event" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-interface" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" -dependencies = [ - "anchor-syn", - "anyhow", - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-program" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-state" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-derive-accounts" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-lang" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" -dependencies = [ - "anchor-attribute-access-control", - "anchor-attribute-account", - "anchor-attribute-constant", - "anchor-attribute-error", - "anchor-attribute-event", - "anchor-attribute-interface", - "anchor-attribute-program", - "anchor-attribute-state", - "anchor-derive-accounts", - "arrayref", - "base64 0.13.0", - "bincode", - "borsh", - "bytemuck", - "solana-program", - "thiserror", -] - -[[package]] -name = "anchor-syn" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" -dependencies = [ - "anyhow", - "bs58 0.3.1", - "heck", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "serde", - "serde_json", - "sha2", - "syn", - "thiserror", -] - -[[package]] -name = "anyhow" -version = "1.0.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "blake3" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", - "digest 0.10.3", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "block-padding", - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive", - "hashbrown", -] - -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate", - "proc-macro2", - "syn", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "bs58" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bumpalo" -version = "3.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" - -[[package]] -name = "bv" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" -dependencies = [ - "feature-probe", - "serde", -] - -[[package]] -name = "bytemuck" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" -dependencies = [ - "log", - "web-sys", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "cpufeatures" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" -dependencies = [ - "libc", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" -dependencies = [ - "block-buffer 0.10.2", - "crypto-common", - "subtle", -] - -[[package]] -name = "duplicate-mutable-accounts-secure" -version = "0.1.0" -dependencies = [ - "anchor-lang", -] - -[[package]] -name = "either" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" - -[[package]] -name = "env_logger" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "feature-probe" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" - -[[package]] -name = "generic-array" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" -dependencies = [ - "serde", - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest 0.9.0", - "generic-array", - "hmac", -] - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "itertools" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "js-sys" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "libsecp256k1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" -dependencies = [ - "arrayref", - "base64 0.12.3", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand", - "serde", - "sha2", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "lock_api" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memmap2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" -dependencies = [ - "libc", -] - -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro2" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proc-macro2-diagnostics" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "version_check", - "yansi", -] - -[[package]] -name = "quote" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustversion" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf" - -[[package]] -name = "ryu" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "semver" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" - -[[package]] -name = "serde" -version = "1.0.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug", -] - -[[package]] -name = "smallvec" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" - -[[package]] -name = "solana-frozen-abi" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" -dependencies = [ - "bs58 0.4.0", - "bv", - "generic-array", - "log", - "memmap2", - "rustc_version", - "serde", - "serde_derive", - "sha2", - "solana-frozen-abi-macro", - "solana-logger", - "thiserror", -] - -[[package]] -name = "solana-frozen-abi-macro" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn", -] - -[[package]] -name = "solana-logger" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" -dependencies = [ - "env_logger", - "lazy_static", - "log", -] - -[[package]] -name = "solana-program" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" -dependencies = [ - "base64 0.13.0", - "bincode", - "bitflags", - "blake3", - "borsh", - "borsh-derive", - "bs58 0.4.0", - "bv", - "bytemuck", - "console_error_panic_hook", - "console_log", - "curve25519-dalek", - "getrandom 0.1.16", - "itertools", - "js-sys", - "lazy_static", - "libsecp256k1", - "log", - "num-derive", - "num-traits", - "parking_lot", - "rand", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "sha2", - "sha3", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-logger", - "solana-sdk-macro", - "thiserror", - "wasm-bindgen", -] - -[[package]] -name = "solana-sdk-macro" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" -dependencies = [ - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] - -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "unicode-ident" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" - -[[package]] -name = "unicode-segmentation" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" - -[[package]] -name = "web-sys" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - -[[package]] -name = "zeroize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml b/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml index b32565c..66812b2 100644 --- a/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml +++ b/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml @@ -15,7 +15,5 @@ no-log-ix-name = [] cpi = ["no-entrypoint"] default = [] -[workspace] - [dependencies] anchor-lang = "0.24.2" diff --git a/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs b/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs index 12924e1..b637022 100644 --- a/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs +++ b/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs @@ -6,11 +6,14 @@ declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); pub mod duplicate_mutable_accounts_secure { use super::*; - pub fn update_secure( + pub fn update( ctx: Context, a: u64, b: u64, ) -> anchor_lang::solana_program::entrypoint::ProgramResult { + if ctx.accounts.user_a.key() == ctx.accounts.user_b.key() { + return Err(ProgramError::InvalidArgument); + } let user_a = &mut ctx.accounts.user_a; let user_b = &mut ctx.accounts.user_b; @@ -22,7 +25,6 @@ pub mod duplicate_mutable_accounts_secure { #[derive(Accounts)] pub struct Update<'info> { - #[account(constraint = user_a.key() != user_b.key())] user_a: Account<'info, User>, user_b: Account<'info, User>, } From 6a309afb519414c82dbf0d64a50d29a5c0e4ace8 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Mon, 18 Jul 2022 14:43:50 -0500 Subject: [PATCH 07/24] make lint more efficient by not storing generated streams --- lints/duplicate-mutable-accounts/src/lib.rs | 65 +++++++-------------- 1 file changed, 20 insertions(+), 45 deletions(-) diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index cc0e0ba..9de1442 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -95,27 +95,27 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { // println!("{:#?}", self); for v in self.accounts.values() { if v.len() > 1 { - let gen_constraints = generate_possible_expected_constraints(v); - - for ((one, symmetric), symbols) in gen_constraints { - if !(self.streams.contains(&one) || self.streams.contains(&symmetric)) { - // get spans for offending types - let mut spans: Vec = Vec::new(); - for (sym, span) in v { - if &symbols.0 == sym || &symbols.1 == sym { - spans.push(*span); - } + let mut deq = VecDeque::from(v.to_owned()); + for _ in 0..deq.len() - 1 { + let (first, first_span) = deq.pop_front().unwrap(); + for (other, other_span) in &deq { + let stream = create_key_check_constraint_tokenstream(first, *other); + let symmetric_stream = + create_key_check_constraint_tokenstream(*other, first); + + if !(self.streams.contains(&stream) + || self.streams.contains(&symmetric_stream)) + { + // NOTE: for some reason, will only print out 2 messages, not 3 + span_lint_and_help( + cx, + DUPLICATE_MUTABLE_ACCOUNTS, + first_span, + "identical account types without a key check constraint", + Some(*other_span), + &format!("add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]", first, other) + ); } - - // TODO: for some reason, will only print out 2 messages, not 3 - span_lint_and_help( - cx, - DUPLICATE_MUTABLE_ACCOUNTS, - spans[0], - "identical account types without a key check constraint", - Some(spans[1]), - &format!("add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]", symbols.0, symbols.1) - ); } } } @@ -173,31 +173,6 @@ fn split(stream: CursorRef, delimiter: TokenKind) -> Vec { split_streams } -/// Generates a static set of possible expected key check constraints necessary for `identical_types`. -/// `identical_types` is a set of identical types that must have a key check constraint. A vector of tuples -/// is returned, where each element represents a particular constraint. -/// -/// Specifically, the first field of the tuple is a tuple of `TokenStream`s, which represent the constraint and its -/// symmetric value, e.g., `a!=b` and `b!=a`. The second field of the tuple is a tuple of symbols, which -/// represent the identifiers being compared. Following the previous example, this would be `(a, b)`. -fn generate_possible_expected_constraints( - identical_types: &[(Symbol, Span)], -) -> Vec<((TokenStream, TokenStream), (Symbol, Symbol))> { - let mut deq = VecDeque::from(identical_types.to_owned()); - let mut gen_set = Vec::new(); - - for _ in 0..deq.len() - 1 { - let first = deq.pop_front().unwrap().0; - // generate stream for all other values in vec - for (other, _) in &deq { - let stream = create_key_check_constraint_tokenstream(first, *other); - let symmetric_stream = create_key_check_constraint_tokenstream(*other, first); - gen_set.push(((stream, symmetric_stream), (first, *other))); - } - } - gen_set -} - /// Returns a `TokenStream` of form: constraint = `a`.key() != `b`.key(). fn create_key_check_constraint_tokenstream(a: Symbol, b: Symbol) -> TokenStream { // TODO: may be more efficient way to do this, since the stream is effectively fixed From 30ef2a064fe0e9d8604d1e92ad7d882f52add44e Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Mon, 18 Jul 2022 19:13:38 -0500 Subject: [PATCH 08/24] make lint-6v1 handle anchor constraints that are not comma-delimited --- lints/duplicate-mutable-accounts/src/lib.rs | 84 ++++++++++++------- .../ui/recommended-2/src/lib.rs | 3 +- 2 files changed, 57 insertions(+), 30 deletions(-) diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index 9de1442..40b497c 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -10,7 +10,7 @@ use std::default::Default; use rustc_ast::{ token::{Delimiter, Token, TokenKind}, - tokenstream::{CursorRef, DelimSpan, TokenStream, TokenTree, TreeAndSpacing}, + tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndSpacing}, AttrKind, Attribute, MacArgs, }; use rustc_hir::{def::Res, FieldDef, GenericArg, QPath, TyKind, VariantData}; @@ -84,9 +84,10 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { if let MacArgs::Delimited(_, _, token_stream) = &attr_item.args; then { // Parse each constraint as a separate TokenStream - for delimited_stream in split(token_stream.trees(), TokenKind::Comma) { - self.streams.0.push(delimited_stream); - } + // for delimited_stream in split(token_stream.trees(), TokenKind::Comma) { + // self.streams.0.push(delimited_stream); + // } + self.streams.0.push(token_stream.clone()); } } } @@ -107,6 +108,7 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { || self.streams.contains(&symmetric_stream)) { // NOTE: for some reason, will only print out 2 messages, not 3 + // println!("spanning lint"); span_lint_and_help( cx, DUPLICATE_MUTABLE_ACCOUNTS, @@ -155,31 +157,11 @@ fn get_def_id(ty: &rustc_hir::Ty) -> Option { } } -/// Splits `stream` into a vector of substreams, separated by `delimiter`. -fn split(stream: CursorRef, delimiter: TokenKind) -> Vec { - let mut split_streams: Vec = Vec::new(); - let mut temp: Vec = Vec::new(); - let delim = TokenTree::Token(Token::new(delimiter, DUMMY_SP)); - - stream.for_each(|t| { - if t.eq_unspanned(&delim) { - split_streams.push(TokenStream::new(temp.clone())); - temp.clear(); - } else { - temp.push(TreeAndSpacing::from(t.clone())); - } - }); - split_streams.push(TokenStream::new(temp)); - split_streams -} - -/// Returns a `TokenStream` of form: constraint = `a`.key() != `b`.key(). +/// Returns a `TokenStream` of form: `a`.key() != `b`.key(). fn create_key_check_constraint_tokenstream(a: Symbol, b: Symbol) -> TokenStream { // TODO: may be more efficient way to do this, since the stream is effectively fixed // and determined. Only two tokens are variable. let constraint = vec![ - TreeAndSpacing::from(create_token_from_ident("constraint")), - TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Eq, DUMMY_SP))), TreeAndSpacing::from(create_token_from_ident(a.as_str())), TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP))), TreeAndSpacing::from(create_token_from_ident("key")), @@ -212,13 +194,59 @@ fn create_token_from_ident(s: &str) -> TokenTree { pub struct Streams(Vec); impl Streams { - /// Returns true if `self` contains `other`, by comparing if there is an - /// identical `TokenStream` in `self` regardless of span. + /// Returns true if `self` has a TokenStream that `other` is a substream of fn contains(&self, other: &TokenStream) -> bool { - self.0.iter().any(|stream| stream.eq_unspanned(other)) + self.0 + .iter() + .any(|token_stream| Self::is_substream(token_stream, other)) + } + + /// Returns true if `other` is a substream of `stream`. By substream we mean in the + /// sense of a substring. + // NOTE: a possible optimization is when a match is found, to remove the matched + // TokenTrees from the TokenStream, since the constraint has been "checked" so it never + // needs to be validated again. This cuts down the number of comparisons. + fn is_substream(stream: &TokenStream, other: &TokenStream) -> bool { + let other_len = other.len(); + for i in 0..stream.len() { + for (j, other_token) in other.trees().enumerate() { + match stream.trees().nth(i + j) { + Some(token_tree) => { + // println!("Comparing {:#?} with {:#?}", token_tree, other_tokens[j]); + if !token_tree.eq_unspanned(other_token) { + break; + } + // reached last index, so we have a match + if j == other_len - 1 { + return true; + } + } + None => return false, // reached end of stream + } + } + } + false } } +// /// Splits `stream` into a vector of substreams, separated by `delimiter`. +// fn split(stream: CursorRef, delimiter: TokenKind) -> Vec { +// let mut split_streams: Vec = Vec::new(); +// let mut temp: Vec = Vec::new(); +// let delim = TokenTree::Token(Token::new(delimiter, DUMMY_SP)); + +// stream.for_each(|t| { +// if t.eq_unspanned(&delim) { +// split_streams.push(TokenStream::new(temp.clone())); +// temp.clear(); +// } else { +// temp.push(TreeAndSpacing::from(t.clone())); +// } +// }); +// split_streams.push(TokenStream::new(temp)); +// split_streams +// } + #[test] fn insecure() { dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "insecure"); diff --git a/lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.rs b/lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.rs index 2fbacd0..338054b 100644 --- a/lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.rs +++ b/lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.rs @@ -22,8 +22,7 @@ pub mod duplicate_mutable_accounts_recommended { #[derive(Accounts)] pub struct Update<'info> { - #[account(constraint = user_a.key() != user_b.key())] - #[account(constraint = user_a.key() != user_c.key())] + #[account(constraint = user_a.key() != user_b.key() && user_a.key() != user_c.key())] #[account(constraint = user_c.key() != user_b.key())] user_a: Account<'info, User>, user_b: Account<'info, User>, From a670bab93bf5520e4ef71a5eae228881409bb895 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Tue, 19 Jul 2022 07:39:57 -0500 Subject: [PATCH 09/24] fix lint spanning deduplication issue --- lints/duplicate-mutable-accounts/src/lib.rs | 27 +--------------- .../ui/insecure-2/src/lib.rs | 1 - .../ui/insecure-2/src/lib.stderr | 32 ++++++++++++++++--- .../ui/insecure/src/lib.stderr | 2 +- 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index 40b497c..e24bcac 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -83,10 +83,6 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { if name.as_str() == "account"; if let MacArgs::Delimited(_, _, token_stream) = &attr_item.args; then { - // Parse each constraint as a separate TokenStream - // for delimited_stream in split(token_stream.trees(), TokenKind::Comma) { - // self.streams.0.push(delimited_stream); - // } self.streams.0.push(token_stream.clone()); } } @@ -107,13 +103,11 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { if !(self.streams.contains(&stream) || self.streams.contains(&symmetric_stream)) { - // NOTE: for some reason, will only print out 2 messages, not 3 - // println!("spanning lint"); span_lint_and_help( cx, DUPLICATE_MUTABLE_ACCOUNTS, first_span, - "identical account types without a key check constraint", + &format!("{} and {} have identical account types but do not have a key check constraint", first, other), Some(*other_span), &format!("add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]", first, other) ); @@ -212,7 +206,6 @@ impl Streams { for (j, other_token) in other.trees().enumerate() { match stream.trees().nth(i + j) { Some(token_tree) => { - // println!("Comparing {:#?} with {:#?}", token_tree, other_tokens[j]); if !token_tree.eq_unspanned(other_token) { break; } @@ -229,24 +222,6 @@ impl Streams { } } -// /// Splits `stream` into a vector of substreams, separated by `delimiter`. -// fn split(stream: CursorRef, delimiter: TokenKind) -> Vec { -// let mut split_streams: Vec = Vec::new(); -// let mut temp: Vec = Vec::new(); -// let delim = TokenTree::Token(Token::new(delimiter, DUMMY_SP)); - -// stream.for_each(|t| { -// if t.eq_unspanned(&delim) { -// split_streams.push(TokenStream::new(temp.clone())); -// temp.clear(); -// } else { -// temp.push(TreeAndSpacing::from(t.clone())); -// } -// }); -// split_streams.push(TokenStream::new(temp)); -// split_streams -// } - #[test] fn insecure() { dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "insecure"); diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs index 285fc47..0bd77a5 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs @@ -22,7 +22,6 @@ pub mod duplicate_mutable_accounts_insecure { #[derive(Accounts)] pub struct Update<'info> { - #[account(constraint = user_a.key() != user_b.key(), constraint = user_b.key() != user_c.key())] user_a: Account<'info, User>, user_b: Account<'info, User>, user_c: Account<'info, User>, diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr index d195376..94e9791 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr @@ -1,15 +1,39 @@ -error: identical account types without a key check constraint - --> $DIR/lib.rs:26:5 +error: user_a and user_b have identical account types but do not have a key check constraint + --> $DIR/lib.rs:25:5 | LL | user_a: Account<'info, User>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D duplicate-mutable-accounts` implied by `-D warnings` +help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_b.key())] + --> $DIR/lib.rs:26:5 + | +LL | user_b: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: user_a and user_c have identical account types but do not have a key check constraint + --> $DIR/lib.rs:25:5 + | +LL | user_a: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_c.key())] - --> $DIR/lib.rs:28:5 + --> $DIR/lib.rs:27:5 + | +LL | user_c: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: user_b and user_c have identical account types but do not have a key check constraint + --> $DIR/lib.rs:26:5 + | +LL | user_b: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: add an anchor key check constraint: #[account(constraint = user_b.key() != user_c.key())] + --> $DIR/lib.rs:27:5 | LL | user_c: Account<'info, User>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 3 previous errors diff --git a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr index 6a4ef64..064418c 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr +++ b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr @@ -1,4 +1,4 @@ -error: identical account types without a key check constraint +error: user_a and user_b have identical account types but do not have a key check constraint --> $DIR/lib.rs:25:5 | LL | user_a: Account<'info, User>, From 2149980cff0a38bb70626bb0bd52be5ab05ff73e Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Sun, 17 Jul 2022 15:09:47 -0500 Subject: [PATCH 10/24] implement lint-6 v2 to handle constraints not in #[account] macro --- .../dup_mutable_accounts_2/.cargo/config.toml | 11 + lints/dup_mutable_accounts_2/.gitignore | 1 + lints/dup_mutable_accounts_2/Cargo.lock | 1797 +++++++++++++++++ lints/dup_mutable_accounts_2/Cargo.toml | 33 + lints/dup_mutable_accounts_2/README.md | 19 + lints/dup_mutable_accounts_2/rust-toolchain | 3 + lints/dup_mutable_accounts_2/src/lib.rs | 186 ++ .../ui/insecure/Cargo.toml | 19 + .../ui/insecure/Xargo.toml | 2 + .../ui/insecure/src/lib.rs | 34 + .../ui/insecure/src/lib.stderr | 27 + .../ui/secure/Cargo.lock | 1315 ++++++++++++ .../ui/secure/Cargo.toml | 19 + .../ui/secure/Xargo.toml | 2 + .../ui/secure/src/lib.rs | 37 + 15 files changed, 3505 insertions(+) create mode 100644 lints/dup_mutable_accounts_2/.cargo/config.toml create mode 100644 lints/dup_mutable_accounts_2/.gitignore create mode 100644 lints/dup_mutable_accounts_2/Cargo.lock create mode 100644 lints/dup_mutable_accounts_2/Cargo.toml create mode 100644 lints/dup_mutable_accounts_2/README.md create mode 100644 lints/dup_mutable_accounts_2/rust-toolchain create mode 100644 lints/dup_mutable_accounts_2/src/lib.rs create mode 100644 lints/dup_mutable_accounts_2/ui/insecure/Cargo.toml create mode 100644 lints/dup_mutable_accounts_2/ui/insecure/Xargo.toml create mode 100644 lints/dup_mutable_accounts_2/ui/insecure/src/lib.rs create mode 100644 lints/dup_mutable_accounts_2/ui/insecure/src/lib.stderr create mode 100644 lints/dup_mutable_accounts_2/ui/secure/Cargo.lock create mode 100644 lints/dup_mutable_accounts_2/ui/secure/Cargo.toml create mode 100644 lints/dup_mutable_accounts_2/ui/secure/Xargo.toml create mode 100644 lints/dup_mutable_accounts_2/ui/secure/src/lib.rs diff --git a/lints/dup_mutable_accounts_2/.cargo/config.toml b/lints/dup_mutable_accounts_2/.cargo/config.toml new file mode 100644 index 0000000..46d1571 --- /dev/null +++ b/lints/dup_mutable_accounts_2/.cargo/config.toml @@ -0,0 +1,11 @@ +[target.aarch64-apple-darwin] +linker = "dylint-link" + +[target.x86_64-apple-darwin] +linker = "dylint-link" + +[target.x86_64-unknown-linux-gnu] +linker = "dylint-link" + +[target.x86_64-pc-windows-msvc] +linker = "dylint-link" diff --git a/lints/dup_mutable_accounts_2/.gitignore b/lints/dup_mutable_accounts_2/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/lints/dup_mutable_accounts_2/.gitignore @@ -0,0 +1 @@ +/target diff --git a/lints/dup_mutable_accounts_2/Cargo.lock b/lints/dup_mutable_accounts_2/Cargo.lock new file mode 100644 index 0000000..76fde76 --- /dev/null +++ b/lints/dup_mutable_accounts_2/Cargo.lock @@ -0,0 +1,1797 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.7", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "anchor-attribute-access-control" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "anchor-attribute-account" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" +dependencies = [ + "anchor-syn", + "anyhow", + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "anchor-attribute-constant" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" +dependencies = [ + "anchor-syn", + "proc-macro2", + "syn", +] + +[[package]] +name = "anchor-attribute-error" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" +dependencies = [ + "anchor-syn", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-event" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-interface" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" +dependencies = [ + "anchor-syn", + "anyhow", + "heck 0.3.3", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-program" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-state" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-derive-accounts" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-lang" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" +dependencies = [ + "anchor-attribute-access-control", + "anchor-attribute-account", + "anchor-attribute-constant", + "anchor-attribute-error", + "anchor-attribute-event", + "anchor-attribute-interface", + "anchor-attribute-program", + "anchor-attribute-state", + "anchor-derive-accounts", + "arrayref", + "base64 0.13.0", + "bincode", + "borsh", + "bytemuck", + "solana-program", + "thiserror", +] + +[[package]] +name = "anchor-syn" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" +dependencies = [ + "anyhow", + "bs58 0.3.1", + "heck 0.3.3", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "serde", + "serde_json", + "sha2", + "syn", + "thiserror", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "blake3" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "digest 0.10.3", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive", + "hashbrown", +] + +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate", + "proc-macro2", + "syn", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "bs58" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" + +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bstr" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +dependencies = [ + "memchr", +] + +[[package]] +name = "bumpalo" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" + +[[package]] +name = "bv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" +dependencies = [ + "feature-probe", + "serde", +] + +[[package]] +name = "bytemuck" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "camino" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3abb7553d5b9b8421c6de7cb02606ff15e0c6eea7d8eadd75ef013fd636bec36" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", +] + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clippy_utils" +version = "0.1.64" +source = "git+https://github.com/rust-lang/rust-clippy?rev=0cb0f7636851f9fcc57085cf80197a2ef6db098f#0cb0f7636851f9fcc57085cf80197a2ef6db098f" +dependencies = [ + "arrayvec", + "if_chain", + "rustc-semver", +] + +[[package]] +name = "compiletest_rs" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "262134ef87408da1ddfe45e33daa0ca43b75286d6b1076446e602d264cf9847e" +dependencies = [ + "diff", + "filetime", + "getopts", + "lazy_static", + "libc", + "log", + "miow", + "regex", + "rustfix", + "serde", + "serde_derive", + "serde_json", + "tester", + "winapi", +] + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "console_log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" +dependencies = [ + "log", + "web-sys", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "cpufeatures" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer 0.10.2", + "crypto-common", + "subtle", +] + +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dup_mutable_accounts_2" +version = "0.1.0" +dependencies = [ + "anchor-lang", + "clippy_utils", + "dylint_linting", + "dylint_testing", + "if_chain", + "solana-lints", +] + +[[package]] +name = "dylint" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6efeb05f33ed8c407d9a7aac99fe9420316ea2d0ec00ae9de1f68eb2f86a792" +dependencies = [ + "ansi_term", + "anyhow", + "atty", + "cargo_metadata", + "dirs", + "dylint_internal", + "heck 0.4.0", + "lazy_static", + "log", + "once_cell", + "semver", + "serde", + "serde_json", + "tempfile", + "walkdir", +] + +[[package]] +name = "dylint_internal" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12d1bcddbf1c497f405112c76e053f76e42a0a505487135c6de2bcc1ad886dd" +dependencies = [ + "ansi_term", + "anyhow", + "cargo_metadata", + "if_chain", + "log", + "rust-embed", + "sedregex", + "walkdir", +] + +[[package]] +name = "dylint_linting" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66244dfe20633c437c5dba0835f1b6b67c196cce8b04aa3f1a312efd0faa886c" +dependencies = [ + "paste", +] + +[[package]] +name = "dylint_testing" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de76a43ff00d96ea108e848538e0d6c47dc2c0b99915f9e6303966c1ff673711" +dependencies = [ + "anyhow", + "cargo_metadata", + "compiletest_rs", + "dylint", + "dylint_internal", + "env_logger", + "lazy_static", + "once_cell", + "regex", + "serde_json", + "tempfile", +] + +[[package]] +name = "either" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" + +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "fastrand" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +dependencies = [ + "instant", +] + +[[package]] +name = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "filetime" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "windows-sys", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +dependencies = [ + "serde", + "typenum", + "version_check", +] + +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "globset" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "if_chain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" + +[[package]] +name = "js-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] +name = "libsecp256k1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memmap2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" +dependencies = [ + "libc", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "paste" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" + +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro2" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proc-macro2-diagnostics" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "version_check", + "yansi", +] + +[[package]] +name = "quote" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom 0.2.7", + "redox_syscall", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "rust-embed" +version = "6.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a17e5ac65b318f397182ae94e532da0ba56b88dd1200b774715d36c4943b1c3" +dependencies = [ + "rust-embed-impl", + "rust-embed-utils", + "walkdir", +] + +[[package]] +name = "rust-embed-impl" +version = "6.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94e763e24ba2bf0c72bc6be883f967f794a019fafd1b86ba1daff9c91a7edd30" +dependencies = [ + "proc-macro2", + "quote", + "rust-embed-utils", + "syn", + "walkdir", +] + +[[package]] +name = "rust-embed-utils" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756feca3afcbb1487a1d01f4ecd94cf8ec98ea074c55a69e7136d29fb6166029" +dependencies = [ + "globset", + "sha2", + "walkdir", +] + +[[package]] +name = "rustc-semver" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be1bdc7edf596692617627bbfeaba522131b18e06ca4df2b6b689e3c5d5ce84" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustfix" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd2853d9e26988467753bd9912c3a126f642d05d229a4b53f5752ee36c56481" +dependencies = [ + "anyhow", + "log", + "serde", + "serde_json", +] + +[[package]] +name = "rustversion" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24c8ad4f0c00e1eb5bc7614d236a7f1300e3dbd76b68cac8e06fb00b015ad8d8" + +[[package]] +name = "ryu" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "sedregex" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19411e23596093f03bbd11dc45603b6329bb4bfec77b9fd13e2b9fc9b02efe3e" +dependencies = [ + "regex", +] + +[[package]] +name = "semver" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug", +] + +[[package]] +name = "smallvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" + +[[package]] +name = "solana-frozen-abi" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" +dependencies = [ + "bs58 0.4.0", + "bv", + "generic-array", + "log", + "memmap2", + "rustc_version", + "serde", + "serde_derive", + "sha2", + "solana-frozen-abi-macro", + "solana-logger", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn", +] + +[[package]] +name = "solana-lints" +version = "0.1.0" + +[[package]] +name = "solana-logger" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" +dependencies = [ + "env_logger", + "lazy_static", + "log", +] + +[[package]] +name = "solana-program" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" +dependencies = [ + "base64 0.13.0", + "bincode", + "bitflags", + "blake3", + "borsh", + "borsh-derive", + "bs58 0.4.0", + "bv", + "bytemuck", + "console_error_panic_hook", + "console_log", + "curve25519-dalek", + "getrandom 0.1.16", + "itertools", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "num-derive", + "num-traits", + "parking_lot", + "rand", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "sha2", + "sha3", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-sdk-macro", + "thiserror", + "wasm-bindgen", +] + +[[package]] +name = "solana-sdk-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" +dependencies = [ + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "tester" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0639d10d8f4615f223a57275cf40f9bdb7cfbb806bcb7f7cc56e3beb55a576eb" +dependencies = [ + "cfg-if", + "getopts", + "libc", + "num_cpus", + "term", +] + +[[package]] +name = "thiserror" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "unicode-ident" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" + +[[package]] +name = "unicode-segmentation" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" + +[[package]] +name = "unicode-width" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" + +[[package]] +name = "web-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/lints/dup_mutable_accounts_2/Cargo.toml b/lints/dup_mutable_accounts_2/Cargo.toml new file mode 100644 index 0000000..4811999 --- /dev/null +++ b/lints/dup_mutable_accounts_2/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "dup_mutable_accounts_2" +version = "0.1.0" +authors = ["authors go here"] +description = "description goes here" +edition = "2018" +publish = false + +[lib] +crate-type = ["cdylib"] + +[[example]] +name = "insecure" +path = "ui/insecure/src/lib.rs" + +[[example]] +name = "secure" +path = "ui/secure/src/lib.rs" + +[dependencies] +clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "0cb0f7636851f9fcc57085cf80197a2ef6db098f" } +dylint_linting = "2.0.7" +if_chain = "1.0.2" +solana-lints = { path = "../../crate" } + +[dev-dependencies] +anchor-lang = "0.24.2" +dylint_testing = "2.0.7" + +[workspace] + +[package.metadata.rust-analyzer] +rustc_private = true diff --git a/lints/dup_mutable_accounts_2/README.md b/lints/dup_mutable_accounts_2/README.md new file mode 100644 index 0000000..f3079a7 --- /dev/null +++ b/lints/dup_mutable_accounts_2/README.md @@ -0,0 +1,19 @@ +# template + +**What it does:** + +**Why is this bad?** + +**Known problems:** None. + +**Example:** + +```rust +// example code where a warning is issued +``` + +Use instead: + +```rust +// example code that does not raise a warning +``` diff --git a/lints/dup_mutable_accounts_2/rust-toolchain b/lints/dup_mutable_accounts_2/rust-toolchain new file mode 100644 index 0000000..2056264 --- /dev/null +++ b/lints/dup_mutable_accounts_2/rust-toolchain @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly-2022-06-30" +components = ["llvm-tools-preview", "rustc-dev"] diff --git a/lints/dup_mutable_accounts_2/src/lib.rs b/lints/dup_mutable_accounts_2/src/lib.rs new file mode 100644 index 0000000..83f347f --- /dev/null +++ b/lints/dup_mutable_accounts_2/src/lib.rs @@ -0,0 +1,186 @@ +#![feature(rustc_private)] +#![warn(unused_extern_crates)] + +extern crate rustc_hir; +extern crate rustc_middle; +extern crate rustc_span; + +use clippy_utils::{ + diagnostics::{span_lint_and_help, span_lint_and_note}, + ty::match_type, + SpanlessEq, +}; +use if_chain::if_chain; +use rustc_hir::{ + def_id::DefId, + intravisit::{walk_expr, FnKind, Visitor}, + Body, Expr, ExprKind, FnDecl, HirId, Mutability, +}; +use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::TyKind; +use rustc_span::Span; +use solana_lints::{paths, utils::visit_expr_no_bodies}; + +use std::collections::HashMap; + +const ANCHOR_ACCOUNT_GENERIC_ARG_COUNT: usize = 2; + +dylint_linting::declare_late_lint! { + /// **What it does:** + /// + /// **Why is this bad?** + /// + /// **Known problems:** None. + /// + /// **Example:** + /// + /// ```rust + /// // example code where a warning is issued + /// ``` + /// Use instead: + /// ```rust + /// // example code that does not raise a warning + /// ``` + pub DUP_MUTABLE_ACCOUNTS_2, + Warn, + "description goes here" +} + +impl<'tcx> LateLintPass<'tcx> for DupMutableAccounts2 { + fn check_fn( + &mut self, + cx: &LateContext<'tcx>, + _: FnKind<'tcx>, + _: &'tcx FnDecl<'tcx>, + body: &'tcx Body<'tcx>, + span: Span, + _: HirId, + ) { + if !span.from_expansion() { + let accounts = get_referenced_accounts(cx, body); + + accounts.values().for_each(|exprs| { + // TODO: figure out handling of >2 accounts + match exprs.len() { + 2 => { + let first = exprs[0]; + let second = exprs[1]; + if !contains_key_call(cx, body, first) { + span_lint_and_help( + cx, + DUP_MUTABLE_ACCOUNTS_2, + first.span, + "this expression does not have a key check but has the same account type as another expression", + Some(second.span), + "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", + ); + } + if !contains_key_call(cx, body, second) { + span_lint_and_help( + cx, + DUP_MUTABLE_ACCOUNTS_2, + second.span, + "this expression does not have a key check but has the same account type as another expression", + Some(first.span), + "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", + ); + } + }, + n if n > 2 => { + span_lint_and_note( + cx, + DUP_MUTABLE_ACCOUNTS_2, + exprs[0].span, + &format!("the following expression has the same account type as {} other accounts", exprs.len()), + None, + "might not check that each account has a unique key" + ) + }, + _ => {} + } + }); + } + } +} + +struct AccountUses<'cx, 'tcx> { + cx: &'cx LateContext<'tcx>, + uses: HashMap>>, +} + +fn get_referenced_accounts<'tcx>( + cx: &LateContext<'tcx>, + body: &'tcx Body<'tcx>, +) -> HashMap>> { + let mut accounts = AccountUses { + cx, + uses: HashMap::new(), + }; + + accounts.visit_expr(&body.value); + accounts.uses +} + +impl<'cx, 'tcx> Visitor<'tcx> for AccountUses<'cx, 'tcx> { + fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { + if_chain! { + // get mutable reference expressions + if let ExprKind::AddrOf(_, mutability, mut_expr) = expr.kind; + if let Mutability::Mut = mutability; + // check type of expr == Account<'info, T> + let middle_ty = self.cx.typeck_results().expr_ty(mut_expr); + if match_type(self.cx, middle_ty, &paths::ANCHOR_ACCOUNT); + // grab T generic parameter + if let TyKind::Adt(_adt_def, substs) = middle_ty.kind(); + if substs.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; + let account_type = substs[1].expect_ty(); // TODO: could just store middle::Ty instead of DefId? + if let Some(adt_def) = account_type.ty_adt_def(); + then { + let def_id = adt_def.did(); + if let Some(exprs) = self.uses.get_mut(&def_id) { + let mut spanless_eq = SpanlessEq::new(self.cx); + // check that expr is not a duplicate within its particular key-pair + if exprs.iter().all(|e| !spanless_eq.eq_expr(e, mut_expr)) { + exprs.push(mut_expr); + } + } else { + self.uses.insert(def_id, vec![mut_expr]); + } + } + } + walk_expr(self, expr); + } +} + +/// Performs a walk on `body`, checking whether there exists an expression that contains +/// a `key()` method call on `account_expr`. +fn contains_key_call<'tcx>( + cx: &LateContext<'tcx>, + body: &'tcx Body<'tcx>, + account_expr: &Expr<'tcx>, +) -> bool { + visit_expr_no_bodies(&body.value, |expr| { + if_chain! { + if let ExprKind::MethodCall(path_seg, exprs, _span) = expr.kind; + if path_seg.ident.name.as_str() == "key"; + if !exprs.is_empty(); + let mut spanless_eq = SpanlessEq::new(cx); + if spanless_eq.eq_expr(&exprs[0], account_expr); + then { + true + } else { + false + } + } + }) +} + +#[test] +fn insecure() { + dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "insecure"); +} + +#[test] +fn secure() { + dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "secure"); +} diff --git a/lints/dup_mutable_accounts_2/ui/insecure/Cargo.toml b/lints/dup_mutable_accounts_2/ui/insecure/Cargo.toml new file mode 100644 index 0000000..6ab1b59 --- /dev/null +++ b/lints/dup_mutable_accounts_2/ui/insecure/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "duplicate-mutable-accounts-insecure" +version = "0.1.0" +description = "Created with Anchor" +edition = "2018" + +[lib] +crate-type = ["cdylib", "lib"] +name = "duplicate_mutable_accounts_insecure" + +[features] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +cpi = ["no-entrypoint"] +default = [] + +[dependencies] +anchor-lang = "0.24.2" diff --git a/lints/dup_mutable_accounts_2/ui/insecure/Xargo.toml b/lints/dup_mutable_accounts_2/ui/insecure/Xargo.toml new file mode 100644 index 0000000..475fb71 --- /dev/null +++ b/lints/dup_mutable_accounts_2/ui/insecure/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/lints/dup_mutable_accounts_2/ui/insecure/src/lib.rs b/lints/dup_mutable_accounts_2/ui/insecure/src/lib.rs new file mode 100644 index 0000000..2e1d708 --- /dev/null +++ b/lints/dup_mutable_accounts_2/ui/insecure/src/lib.rs @@ -0,0 +1,34 @@ +use anchor_lang::prelude::*; + +declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); + +#[program] +pub mod duplicate_mutable_accounts_insecure { + use super::*; + + pub fn update( + ctx: Context, + a: u64, + b: u64, + ) -> anchor_lang::solana_program::entrypoint::ProgramResult { + let user_a = &mut ctx.accounts.user_a; + let user_b = &mut ctx.accounts.user_b; + + user_a.data = a; + user_b.data = b; + Ok(()) + } +} + +#[derive(Accounts)] +pub struct Update<'info> { + user_a: Account<'info, User>, + user_b: Account<'info, User>, +} + +#[account] +pub struct User { + data: u64, +} + +fn main() {} diff --git a/lints/dup_mutable_accounts_2/ui/insecure/src/lib.stderr b/lints/dup_mutable_accounts_2/ui/insecure/src/lib.stderr new file mode 100644 index 0000000..5a5c4ee --- /dev/null +++ b/lints/dup_mutable_accounts_2/ui/insecure/src/lib.stderr @@ -0,0 +1,27 @@ +error: this expression does not have a key check but has the same account type as another expression + --> $DIR/lib.rs:14:27 + | +LL | let user_a = &mut ctx.accounts.user_a; + | ^^^^^^^^^^^^^^^^^^^ + | + = note: `-D dup-mutable-accounts-2` implied by `-D warnings` +help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() + --> $DIR/lib.rs:15:27 + | +LL | let user_b = &mut ctx.accounts.user_b; + | ^^^^^^^^^^^^^^^^^^^ + +error: this expression does not have a key check but has the same account type as another expression + --> $DIR/lib.rs:15:27 + | +LL | let user_b = &mut ctx.accounts.user_b; + | ^^^^^^^^^^^^^^^^^^^ + | +help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() + --> $DIR/lib.rs:14:27 + | +LL | let user_a = &mut ctx.accounts.user_a; + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/lints/dup_mutable_accounts_2/ui/secure/Cargo.lock b/lints/dup_mutable_accounts_2/ui/secure/Cargo.lock new file mode 100644 index 0000000..9090753 --- /dev/null +++ b/lints/dup_mutable_accounts_2/ui/secure/Cargo.lock @@ -0,0 +1,1315 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.7", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "anchor-attribute-access-control" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "anchor-attribute-account" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" +dependencies = [ + "anchor-syn", + "anyhow", + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "anchor-attribute-constant" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" +dependencies = [ + "anchor-syn", + "proc-macro2", + "syn", +] + +[[package]] +name = "anchor-attribute-error" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" +dependencies = [ + "anchor-syn", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-event" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-interface" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" +dependencies = [ + "anchor-syn", + "anyhow", + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-program" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-state" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-derive-accounts" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-lang" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" +dependencies = [ + "anchor-attribute-access-control", + "anchor-attribute-account", + "anchor-attribute-constant", + "anchor-attribute-error", + "anchor-attribute-event", + "anchor-attribute-interface", + "anchor-attribute-program", + "anchor-attribute-state", + "anchor-derive-accounts", + "arrayref", + "base64 0.13.0", + "bincode", + "borsh", + "bytemuck", + "solana-program", + "thiserror", +] + +[[package]] +name = "anchor-syn" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" +dependencies = [ + "anyhow", + "bs58 0.3.1", + "heck", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "serde", + "serde_json", + "sha2", + "syn", + "thiserror", +] + +[[package]] +name = "anyhow" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "blake3" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "digest 0.10.3", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive", + "hashbrown", +] + +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate", + "proc-macro2", + "syn", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "bs58" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" + +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bumpalo" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" + +[[package]] +name = "bv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" +dependencies = [ + "feature-probe", + "serde", +] + +[[package]] +name = "bytemuck" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "console_log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" +dependencies = [ + "log", + "web-sys", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "cpufeatures" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer 0.10.2", + "crypto-common", + "subtle", +] + +[[package]] +name = "duplicate-mutable-accounts-secure" +version = "0.1.0" +dependencies = [ + "anchor-lang", +] + +[[package]] +name = "either" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" + +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "generic-array" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +dependencies = [ + "serde", + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" + +[[package]] +name = "js-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] +name = "libsecp256k1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memmap2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" +dependencies = [ + "libc", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro2" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proc-macro2-diagnostics" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "version_check", + "yansi", +] + +[[package]] +name = "quote" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24c8ad4f0c00e1eb5bc7614d236a7f1300e3dbd76b68cac8e06fb00b015ad8d8" + +[[package]] +name = "ryu" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "semver" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" + +[[package]] +name = "serde" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug", +] + +[[package]] +name = "smallvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" + +[[package]] +name = "solana-frozen-abi" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" +dependencies = [ + "bs58 0.4.0", + "bv", + "generic-array", + "log", + "memmap2", + "rustc_version", + "serde", + "serde_derive", + "sha2", + "solana-frozen-abi-macro", + "solana-logger", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn", +] + +[[package]] +name = "solana-logger" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" +dependencies = [ + "env_logger", + "lazy_static", + "log", +] + +[[package]] +name = "solana-program" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" +dependencies = [ + "base64 0.13.0", + "bincode", + "bitflags", + "blake3", + "borsh", + "borsh-derive", + "bs58 0.4.0", + "bv", + "bytemuck", + "console_error_panic_hook", + "console_log", + "curve25519-dalek", + "getrandom 0.1.16", + "itertools", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "num-derive", + "num-traits", + "parking_lot", + "rand", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "sha2", + "sha3", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-sdk-macro", + "thiserror", + "wasm-bindgen", +] + +[[package]] +name = "solana-sdk-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" +dependencies = [ + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "unicode-ident" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" + +[[package]] +name = "unicode-segmentation" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" + +[[package]] +name = "web-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/lints/dup_mutable_accounts_2/ui/secure/Cargo.toml b/lints/dup_mutable_accounts_2/ui/secure/Cargo.toml new file mode 100644 index 0000000..66812b2 --- /dev/null +++ b/lints/dup_mutable_accounts_2/ui/secure/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "duplicate-mutable-accounts-secure" +version = "0.1.0" +description = "Created with Anchor" +edition = "2018" + +[lib] +crate-type = ["cdylib", "lib"] +name = "duplicate_mutable_accounts_secure" + +[features] +no-entrypoint = [] +no-idl = [] +no-log-ix-name = [] +cpi = ["no-entrypoint"] +default = [] + +[dependencies] +anchor-lang = "0.24.2" diff --git a/lints/dup_mutable_accounts_2/ui/secure/Xargo.toml b/lints/dup_mutable_accounts_2/ui/secure/Xargo.toml new file mode 100644 index 0000000..475fb71 --- /dev/null +++ b/lints/dup_mutable_accounts_2/ui/secure/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] diff --git a/lints/dup_mutable_accounts_2/ui/secure/src/lib.rs b/lints/dup_mutable_accounts_2/ui/secure/src/lib.rs new file mode 100644 index 0000000..b637022 --- /dev/null +++ b/lints/dup_mutable_accounts_2/ui/secure/src/lib.rs @@ -0,0 +1,37 @@ +use anchor_lang::prelude::*; + +declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); + +#[program] +pub mod duplicate_mutable_accounts_secure { + use super::*; + + pub fn update( + ctx: Context, + a: u64, + b: u64, + ) -> anchor_lang::solana_program::entrypoint::ProgramResult { + if ctx.accounts.user_a.key() == ctx.accounts.user_b.key() { + return Err(ProgramError::InvalidArgument); + } + let user_a = &mut ctx.accounts.user_a; + let user_b = &mut ctx.accounts.user_b; + + user_a.data = a; + user_b.data = b; + Ok(()) + } +} + +#[derive(Accounts)] +pub struct Update<'info> { + user_a: Account<'info, User>, + user_b: Account<'info, User>, +} + +#[account] +pub struct User { + data: u64, +} + +fn main() {} From 70d7c5706e27a3eaafe5a26c198cac1a6a116f87 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Mon, 18 Jul 2022 08:34:36 -0500 Subject: [PATCH 11/24] start merging lint 6 into one lint --- lints/duplicate-mutable-accounts/src/lib.rs | 230 +++++++++++++++++--- 1 file changed, 196 insertions(+), 34 deletions(-) diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index e24bcac..669d644 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -115,41 +115,101 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { } } } + } else { + // perform alternate constraint check, e.g., check fn bodies, then check key checks + self.check_fn() + } + + // TODO: how to enforce that this is only called when necessary? + fn check_fn( + &mut self, + cx: &LateContext<'tcx>, + _: FnKind<'tcx>, + _: &'tcx FnDecl<'tcx>, + body: &'tcx Body<'tcx>, + span: Span, + _: HirId, + ) { + if !span.from_expansion() { + let accounts = get_referenced_accounts(cx, body); + + accounts.values().for_each(|exprs| { + // TODO: figure out handling of >2 accounts + match exprs.len() { + 2 => { + let first = exprs[0]; + let second = exprs[1]; + if !contains_key_call(cx, body, first) { + span_lint_and_help( + cx, + DUP_MUTABLE_ACCOUNTS_2, + first.span, + "this expression does not have a key check but has the same account type as another expression", + Some(second.span), + "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", + ); + } + if !contains_key_call(cx, body, second) { + span_lint_and_help( + cx, + DUP_MUTABLE_ACCOUNTS_2, + second.span, + "this expression does not have a key check but has the same account type as another expression", + Some(first.span), + "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", + ); + } + }, + n if n > 2 => { + span_lint_and_note( + cx, + DUP_MUTABLE_ACCOUNTS_2, + exprs[0].span, + &format!("the following expression has the same account type as {} other accounts", exprs.len()), + None, + "might not check that each account has a unique key" + ) + }, + _ => {} + } + }); + } } } } -/// Returns the `DefId` of the anchor account type, ie, `T` in `Account<'info, T>`. -/// Returns `None` if the type of `field` is not an anchor account. -fn get_anchor_account_type_def_id(field: &FieldDef) -> Option { - if_chain! { - if let TyKind::Path(qpath) = &field.ty.kind; - if let QPath::Resolved(_, path) = qpath; - if !path.segments.is_empty(); - if let Some(generic_args) = path.segments[0].args; - if generic_args.args.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; - if let GenericArg::Type(hir_ty) = &generic_args.args[1]; - then { - get_def_id(hir_ty) - } else { - None +mod anchor_constraint_check { + /// Returns the `DefId` of the anchor account type, ie, `T` in `Account<'info, T>`. + /// Returns `None` if the type of `field` is not an anchor account. + fn get_anchor_account_type_def_id(field: &FieldDef) -> Option { + if_chain! { + if let TyKind::Path(qpath) = &field.ty.kind; + if let QPath::Resolved(_, path) = qpath; + if !path.segments.is_empty(); + if let Some(generic_args) = path.segments[0].args; + if generic_args.args.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; + if let GenericArg::Type(hir_ty) = &generic_args.args[1]; + then { + get_def_id(hir_ty) + } else { + None + } } } -} -/// Returns the `DefId` of `ty`, an hir type. Returns `None` if cannot resolve type. -fn get_def_id(ty: &rustc_hir::Ty) -> Option { - if_chain! { - if let TyKind::Path(qpath) = &ty.kind; - if let QPath::Resolved(_, path) = qpath; - if let Res::Def(_, def_id) = path.res; - then { - Some(def_id) - } else { - None + /// Returns the `DefId` of `ty`, an hir type. Returns `None` if cannot resolve type. + fn get_def_id(ty: &rustc_hir::Ty) -> Option { + if_chain! { + if let TyKind::Path(qpath) = &ty.kind; + if let QPath::Resolved(_, path) = qpath; + if let Res::Def(_, def_id) = path.res; + then { + Some(def_id) + } else { + None + } } } -} /// Returns a `TokenStream` of form: `a`.key() != `b`.key(). fn create_key_check_constraint_tokenstream(a: Symbol, b: Symbol) -> TokenStream { @@ -175,17 +235,27 @@ fn create_key_check_constraint_tokenstream(a: Symbol, b: Symbol) -> TokenStream )), ]; - TokenStream::new(constraint) -} + TokenStream::new(constraint) + } + + /// Returns a `TokenTree::Token` which has `TokenKind::Ident`, with the string set to `s`. + fn create_token_from_ident(s: &str) -> TokenTree { + let ident = Ident::from_str(s); + TokenTree::Token(Token::from_ast_ident(ident)) + } + + #[derive(Debug, Default)] + pub struct Streams(Vec); -/// Returns a `TokenTree::Token` which has `TokenKind::Ident`, with the string set to `s`. -fn create_token_from_ident(s: &str) -> TokenTree { - let ident = Ident::from_str(s); - TokenTree::Token(Token::from_ast_ident(ident)) + impl Streams { + /// Returns true if `self` contains `other`, by comparing if there is an + /// identical `TokenStream` in `self` regardless of span. + fn contains(&self, other: &TokenStream) -> bool { + self.0.iter().any(|stream| stream.eq_unspanned(other)) + } + } } -#[derive(Debug, Default)] -pub struct Streams(Vec); impl Streams { /// Returns true if `self` has a TokenStream that `other` is a substream of @@ -222,6 +292,98 @@ impl Streams { } } +mod alternate_constraint_check { + struct AccountUses<'cx, 'tcx> { + cx: &'cx LateContext<'tcx>, + uses: HashMap>>, + } + + fn get_referenced_accounts<'tcx>( + cx: &LateContext<'tcx>, + body: &'tcx Body<'tcx>, + ) -> HashMap>> { + let mut accounts = AccountUses { + cx, + uses: HashMap::new(), + }; + + accounts.visit_expr(&body.value); + accounts.uses + } + + impl<'cx, 'tcx> Visitor<'tcx> for AccountUses<'cx, 'tcx> { + fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { + if_chain! { + // get mutable reference expressions + if let ExprKind::AddrOf(_, mutability, mut_expr) = expr.kind; + if let Mutability::Mut = mutability; + // check type of expr == Account<'info, T> + let middle_ty = self.cx.typeck_results().expr_ty(mut_expr); + if match_type(self.cx, middle_ty, &paths::ANCHOR_ACCOUNT); + // grab T generic parameter + if let TyKind::Adt(_adt_def, substs) = middle_ty.kind(); + if substs.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; + let account_type = substs[1].expect_ty(); // TODO: could just store middle::Ty instead of DefId? + if let Some(adt_def) = account_type.ty_adt_def(); + then { + let def_id = adt_def.did(); + if let Some(exprs) = self.uses.get_mut(&def_id) { + let mut spanless_eq = SpanlessEq::new(self.cx); + // check that expr is not a duplicate within its particular key-pair + if exprs.iter().all(|e| !spanless_eq.eq_expr(e, mut_expr)) { + exprs.push(mut_expr); + } + } else { + self.uses.insert(def_id, vec![mut_expr]); + } + } + } + walk_expr(self, expr); + } + } + + /// Performs a walk on `body`, checking whether there exists an expression that contains + /// a `key()` method call on `account_expr`. + fn contains_key_call<'tcx>( + cx: &LateContext<'tcx>, + body: &'tcx Body<'tcx>, + account_expr: &Expr<'tcx>, + ) -> bool { + visit_expr_no_bodies(&body.value, |expr| { + if_chain! { + if let ExprKind::MethodCall(path_seg, exprs, _span) = expr.kind; + if path_seg.ident.name.as_str() == "key"; + if !exprs.is_empty(); + let mut spanless_eq = SpanlessEq::new(cx); + if spanless_eq.eq_expr(&exprs[0], account_expr); + then { + true + } else { + false + } + } + }) + } +} + +// /// Splits `stream` into a vector of substreams, separated by `delimiter`. +// fn split(stream: CursorRef, delimiter: TokenKind) -> Vec { +// let mut split_streams: Vec = Vec::new(); +// let mut temp: Vec = Vec::new(); +// let delim = TokenTree::Token(Token::new(delimiter, DUMMY_SP)); + +// stream.for_each(|t| { +// if t.eq_unspanned(&delim) { +// split_streams.push(TokenStream::new(temp.clone())); +// temp.clear(); +// } else { +// temp.push(TreeAndSpacing::from(t.clone())); +// } +// }); +// split_streams.push(TokenStream::new(temp)); +// split_streams +// } + #[test] fn insecure() { dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "insecure"); From 5abb5e3054a0b8c44c71e75b6dbb3bcdc061a776 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Mon, 18 Jul 2022 11:17:00 -0500 Subject: [PATCH 12/24] implement lint6v2 to better handle more than 2 identical accounts --- lints/dup_mutable_accounts_2/src/lib.rs | 175 ++++++++++-------- .../ui/secure/src/lib.rs | 5 + 2 files changed, 104 insertions(+), 76 deletions(-) diff --git a/lints/dup_mutable_accounts_2/src/lib.rs b/lints/dup_mutable_accounts_2/src/lib.rs index 83f347f..df99235 100644 --- a/lints/dup_mutable_accounts_2/src/lib.rs +++ b/lints/dup_mutable_accounts_2/src/lib.rs @@ -14,7 +14,7 @@ use if_chain::if_chain; use rustc_hir::{ def_id::DefId, intravisit::{walk_expr, FnKind, Visitor}, - Body, Expr, ExprKind, FnDecl, HirId, Mutability, + BinOpKind, Body, Expr, ExprKind, FnDecl, HirId, Mutability, }; use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::ty::TyKind; @@ -57,71 +57,80 @@ impl<'tcx> LateLintPass<'tcx> for DupMutableAccounts2 { _: HirId, ) { if !span.from_expansion() { - let accounts = get_referenced_accounts(cx, body); - - accounts.values().for_each(|exprs| { - // TODO: figure out handling of >2 accounts - match exprs.len() { - 2 => { - let first = exprs[0]; - let second = exprs[1]; - if !contains_key_call(cx, body, first) { - span_lint_and_help( - cx, - DUP_MUTABLE_ACCOUNTS_2, - first.span, - "this expression does not have a key check but has the same account type as another expression", - Some(second.span), - "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", - ); - } - if !contains_key_call(cx, body, second) { - span_lint_and_help( - cx, - DUP_MUTABLE_ACCOUNTS_2, - second.span, - "this expression does not have a key check but has the same account type as another expression", - Some(first.span), - "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", - ); + // get all mutable references to Accounts and if_statements in body + let mut values = Values::new(cx); + values.get_referenced_accounts_and_if_statements(cx, body); + // println!("{:#?}", values.if_statements); + + values.accounts.values().for_each(|exprs| { + if exprs.len() > 1 { + for current in 0..exprs.len() - 1 { + for next in current + 1..exprs.len() { + if !values.check_key_constraint(exprs[current], exprs[next]) { + span_lint_and_help( + cx, + DUP_MUTABLE_ACCOUNTS_2, + exprs[current].span, + "the following expressions have equivalent Account types, yet do not contain a proper key check.", + Some(exprs[next].span), + "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", + ); + } } - }, - n if n > 2 => { - span_lint_and_note( - cx, - DUP_MUTABLE_ACCOUNTS_2, - exprs[0].span, - &format!("the following expression has the same account type as {} other accounts", exprs.len()), - None, - "might not check that each account has a unique key" - ) - }, - _ => {} + } } }); } } } -struct AccountUses<'cx, 'tcx> { +struct Values<'cx, 'tcx> { cx: &'cx LateContext<'tcx>, - uses: HashMap>>, + accounts: HashMap>>, + if_statements: Vec<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>)>, } -fn get_referenced_accounts<'tcx>( - cx: &LateContext<'tcx>, - body: &'tcx Body<'tcx>, -) -> HashMap>> { - let mut accounts = AccountUses { - cx, - uses: HashMap::new(), - }; - - accounts.visit_expr(&body.value); - accounts.uses +impl<'cx, 'tcx> Values<'cx, 'tcx> { + fn new(cx: &'cx LateContext<'tcx>) -> Self { + Values { + cx, + accounts: HashMap::new(), + if_statements: Vec::new(), + } + } + + fn get_referenced_accounts_and_if_statements( + &mut self, + cx: &'cx LateContext<'tcx>, + body: &'tcx Body<'tcx>, + ) -> &Self { + self.visit_expr(&body.value); + self + } + + /// Checks if there is a valid key constraint for `first_account` and `second_account`. + /// NOTE: currently only considers `first.key() == second.key()` or the symmetric relation as valid constraints. + /// TODO: if == relation used, should return some error in the THEN block + fn check_key_constraint(&self, first_account: &Expr<'_>, second_account: &Expr<'_>) -> bool { + for (left, right) in &self.if_statements { + if_chain! { + if let ExprKind::MethodCall(path_seg_left, exprs_left, _span) = left.kind; + if let ExprKind::MethodCall(path_seg_right, exprs_right, _span) = right.kind; + if path_seg_left.ident.name.as_str() == "key" && path_seg_right.ident.name.as_str() == "key"; + if !exprs_left.is_empty() && !exprs_right.is_empty(); + let mut spanless_eq = SpanlessEq::new(self.cx); + if (spanless_eq.eq_expr(&exprs_left[0], first_account) && spanless_eq.eq_expr(&exprs_right[0], second_account)) + || (spanless_eq.eq_expr(&exprs_left[0], second_account) && spanless_eq.eq_expr(&exprs_right[0], first_account)); + then { + return true; + } + } + } + return false; + } } -impl<'cx, 'tcx> Visitor<'tcx> for AccountUses<'cx, 'tcx> { +impl<'cx, 'tcx> Visitor<'tcx> for Values<'cx, 'tcx> { fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { if_chain! { // get mutable reference expressions @@ -137,44 +146,58 @@ impl<'cx, 'tcx> Visitor<'tcx> for AccountUses<'cx, 'tcx> { if let Some(adt_def) = account_type.ty_adt_def(); then { let def_id = adt_def.did(); - if let Some(exprs) = self.uses.get_mut(&def_id) { + if let Some(exprs) = self.accounts.get_mut(&def_id) { let mut spanless_eq = SpanlessEq::new(self.cx); // check that expr is not a duplicate within its particular key-pair if exprs.iter().all(|e| !spanless_eq.eq_expr(e, mut_expr)) { exprs.push(mut_expr); } } else { - self.uses.insert(def_id, vec![mut_expr]); + self.accounts.insert(def_id, vec![mut_expr]); } } } - walk_expr(self, expr); - } -} -/// Performs a walk on `body`, checking whether there exists an expression that contains -/// a `key()` method call on `account_expr`. -fn contains_key_call<'tcx>( - cx: &LateContext<'tcx>, - body: &'tcx Body<'tcx>, - account_expr: &Expr<'tcx>, -) -> bool { - visit_expr_no_bodies(&body.value, |expr| { + // get if statements if_chain! { - if let ExprKind::MethodCall(path_seg, exprs, _span) = expr.kind; - if path_seg.ident.name.as_str() == "key"; - if !exprs.is_empty(); - let mut spanless_eq = SpanlessEq::new(cx); - if spanless_eq.eq_expr(&exprs[0], account_expr); + if let ExprKind::If(wrapped_if_expr, then, _else_opt) = expr.kind; + if let ExprKind::DropTemps(if_expr) = wrapped_if_expr.kind; + if let ExprKind::Binary(op, left, right) = if_expr.kind; + // TODO: leaves out || or &&. Could implement something that pulls apart + // an if expr that is of this form into individual == or != comparisons + if let BinOpKind::Ne | BinOpKind::Eq = op.node; then { - true - } else { - false + // println!("{:#?}, {:#?}", expr, then); + self.if_statements.push((left, right)); } } - }) + walk_expr(self, expr); + } } +// /// Performs a walk on `body`, checking whether there exists an expression that contains +// /// a `key()` method call on `account_expr`. +// fn contains_key_call<'tcx>( +// cx: &LateContext<'tcx>, +// body: &'tcx Body<'tcx>, +// account_expr: &Expr<'tcx>, +// ) -> bool { +// visit_expr_no_bodies(&body.value, |expr| { +// if_chain! { +// if let ExprKind::MethodCall(path_seg, exprs, _span) = expr.kind; +// if path_seg.ident.name.as_str() == "key"; +// if !exprs.is_empty(); +// let mut spanless_eq = SpanlessEq::new(cx); +// if spanless_eq.eq_expr(&exprs[0], account_expr); +// then { +// true +// } else { +// false +// } +// } +// }) +// } + #[test] fn insecure() { dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "insecure"); diff --git a/lints/dup_mutable_accounts_2/ui/secure/src/lib.rs b/lints/dup_mutable_accounts_2/ui/secure/src/lib.rs index b637022..0f62931 100644 --- a/lints/dup_mutable_accounts_2/ui/secure/src/lib.rs +++ b/lints/dup_mutable_accounts_2/ui/secure/src/lib.rs @@ -14,6 +14,11 @@ pub mod duplicate_mutable_accounts_secure { if ctx.accounts.user_a.key() == ctx.accounts.user_b.key() { return Err(ProgramError::InvalidArgument); } + + // if ctx.accounts.user_a.key() != ctx.accounts.user_b.key() { + // // do program stuff + // } + let user_a = &mut ctx.accounts.user_a; let user_b = &mut ctx.accounts.user_b; From 14e850e138fb949c70ba437ec4faee8eff79b7f8 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Tue, 19 Jul 2022 13:00:45 -0500 Subject: [PATCH 13/24] merge lint-6v2 into lint-6v1, creating single lint --- .../src/alternate_constraint.rs | 107 ++++++ .../src/anchor_constraint.rs | 118 ++++++ lints/duplicate-mutable-accounts/src/lib.rs | 359 ++++-------------- 3 files changed, 295 insertions(+), 289 deletions(-) create mode 100644 lints/duplicate-mutable-accounts/src/alternate_constraint.rs create mode 100644 lints/duplicate-mutable-accounts/src/anchor_constraint.rs diff --git a/lints/duplicate-mutable-accounts/src/alternate_constraint.rs b/lints/duplicate-mutable-accounts/src/alternate_constraint.rs new file mode 100644 index 0000000..4771fd9 --- /dev/null +++ b/lints/duplicate-mutable-accounts/src/alternate_constraint.rs @@ -0,0 +1,107 @@ +use std::collections::HashMap; + +use rustc_hir::{ + def_id::DefId, + intravisit::{walk_expr, Visitor}, + BinOpKind, Body, Expr, ExprKind, Mutability, +}; +use rustc_lint::LateContext; +use rustc_middle::ty::TyKind as MiddleTyKind; + +use crate::ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; +use clippy_utils::{ty::match_type, SpanlessEq}; +use if_chain::if_chain; +use solana_lints::paths; + +pub struct Values<'cx, 'tcx> { + cx: &'cx LateContext<'tcx>, + pub accounts: HashMap>>, + pub if_statements: Vec<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>)>, +} + +impl<'cx, 'tcx> Values<'cx, 'tcx> { + pub fn new(cx: &'cx LateContext<'tcx>) -> Self { + Values { + cx, + accounts: HashMap::new(), + if_statements: Vec::new(), + } + } + + pub fn get_referenced_accounts_and_if_statements(&mut self, body: &'tcx Body<'tcx>) -> &Self { + self.visit_expr(&body.value); + self + } + + /// Checks if there is a valid key constraint for `first_account` and `second_account`. + /// NOTE: currently only considers `first.key() == second.key()` or the symmetric relation as valid constraints. + /// TODO: if == relation used, should return some error in the THEN block + pub fn check_key_constraint( + &self, + first_account: &Expr<'_>, + second_account: &Expr<'_>, + ) -> bool { + for (left, right) in &self.if_statements { + if_chain! { + if let ExprKind::MethodCall(path_seg_left, exprs_left, _span) = left.kind; + if let ExprKind::MethodCall(path_seg_right, exprs_right, _span) = right.kind; + if path_seg_left.ident.name.as_str() == "key" && path_seg_right.ident.name.as_str() == "key"; + if !exprs_left.is_empty() && !exprs_right.is_empty(); + let mut spanless_eq = SpanlessEq::new(self.cx); + if (spanless_eq.eq_expr(&exprs_left[0], first_account) && spanless_eq.eq_expr(&exprs_right[0], second_account)) + || (spanless_eq.eq_expr(&exprs_left[0], second_account) && spanless_eq.eq_expr(&exprs_right[0], first_account)); + then { + return true; + } + } + } + false + } +} + +impl<'cx, 'tcx> Visitor<'tcx> for Values<'cx, 'tcx> { + fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { + if_chain! { + // get mutable reference expressions + if let ExprKind::AddrOf(_, mutability, mut_expr) = expr.kind; + if let Mutability::Mut = mutability; + // check type of expr == Account<'info, T> + let middle_ty = self.cx.typeck_results().expr_ty(mut_expr); + // let mut_expr_def_id = self.cx.tcx.hir().local_def_id(mut_expr.hir_id).to_def_id(); + // let middle_ty = self.cx.tcx.type_of(mut_expr_def_id); + if match_type(self.cx, middle_ty, &paths::ANCHOR_ACCOUNT); + // grab T generic parameter + if let MiddleTyKind::Adt(_adt_def, substs) = middle_ty.kind(); + if substs.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; + let account_type = substs[1].expect_ty(); + if let Some(adt_def) = account_type.ty_adt_def(); + then { + let def_id = adt_def.did(); + if let Some(exprs) = self.accounts.get_mut(&def_id) { + let mut spanless_eq = SpanlessEq::new(self.cx); + // check that expr is not a duplicate within its particular key-pair + if exprs.iter().all(|e| !spanless_eq.eq_expr(e, mut_expr)) { + exprs.push(mut_expr); + } + } else { + self.accounts.insert(def_id, vec![mut_expr]); + } + } + } + + // get if statements + if_chain! { + if let ExprKind::If(wrapped_if_expr, _then, _else_opt) = expr.kind; + if let ExprKind::DropTemps(if_expr) = wrapped_if_expr.kind; + if let ExprKind::Binary(op, left, right) = if_expr.kind; + // TODO: leaves out || or &&. Could implement something that pulls apart + // an if expr that is of this form into individual == or != comparisons + if let BinOpKind::Ne | BinOpKind::Eq = op.node; + then { + // println!("{:#?}, {:#?}", expr, then); + self.if_statements.push((left, right)); + } + } + walk_expr(self, expr); + } +} diff --git a/lints/duplicate-mutable-accounts/src/anchor_constraint.rs b/lints/duplicate-mutable-accounts/src/anchor_constraint.rs new file mode 100644 index 0000000..a6fad9c --- /dev/null +++ b/lints/duplicate-mutable-accounts/src/anchor_constraint.rs @@ -0,0 +1,118 @@ +use std::default::Default; + +use rustc_ast::{ + token::{Delimiter, Token, TokenKind}, + tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndSpacing}, +}; +use rustc_hir::{def::Res, FieldDef, GenericArg, QPath, TyKind}; +use rustc_span::{ + def_id::DefId, + symbol::{Ident, Symbol}, + DUMMY_SP, +}; + +use crate::ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; +use if_chain::if_chain; + +/// Returns the `DefId` of the anchor account type, ie, `T` in `Account<'info, T>`. +/// Returns `None` if the type of `field` is not an anchor account. +pub fn get_anchor_account_type_def_id(field: &FieldDef) -> Option { + if_chain! { + if let TyKind::Path(qpath) = &field.ty.kind; + if let QPath::Resolved(_, path) = qpath; + if !path.segments.is_empty(); + if let Some(generic_args) = path.segments[0].args; + if generic_args.args.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; + if let GenericArg::Type(hir_ty) = &generic_args.args[1]; + then { + get_def_id(hir_ty) + } else { + None + } + } +} + +/// Returns the `DefId` of `ty`, an hir type. Returns `None` if cannot resolve type. +pub fn get_def_id(ty: &rustc_hir::Ty) -> Option { + if_chain! { + if let TyKind::Path(qpath) = &ty.kind; + if let QPath::Resolved(_, path) = qpath; + if let Res::Def(_, def_id) = path.res; + then { + Some(def_id) + } else { + None + } + } +} + +/// Returns a `TokenStream` of form: `a`.key() != `b`.key(). +pub fn create_key_check_constraint_tokenstream(a: Symbol, b: Symbol) -> TokenStream { + // TODO: may be more efficient way to do this, since the stream is effectively fixed + // and determined. Only two tokens are variable. + let constraint = vec![ + TreeAndSpacing::from(create_token_from_ident(a.as_str())), + TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP))), + TreeAndSpacing::from(create_token_from_ident("key")), + TreeAndSpacing::from(TokenTree::Delimited( + DelimSpan::dummy(), + Delimiter::Parenthesis, + TokenStream::new(vec![]), + )), + TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Ne, DUMMY_SP))), + TreeAndSpacing::from(create_token_from_ident(b.as_str())), + TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP))), + TreeAndSpacing::from(create_token_from_ident("key")), + TreeAndSpacing::from(TokenTree::Delimited( + DelimSpan::dummy(), + Delimiter::Parenthesis, + TokenStream::new(vec![]), + )), + ]; + + TokenStream::new(constraint) +} + +/// Returns a `TokenTree::Token` which has `TokenKind::Ident`, with the string set to `s`. +fn create_token_from_ident(s: &str) -> TokenTree { + let ident = Ident::from_str(s); + TokenTree::Token(Token::from_ast_ident(ident)) +} + +#[derive(Debug, Default)] +pub struct Streams(pub Vec); + +impl Streams { + /// Returns true if `self` has a TokenStream that `other` is a substream of + pub fn contains(&self, other: &TokenStream) -> bool { + self.0 + .iter() + .any(|token_stream| Self::is_substream(token_stream, other)) + } + + /// Returns true if `other` is a substream of `stream`. By substream we mean in the + /// sense of a substring. + // NOTE: a possible optimization is when a match is found, to remove the matched + // TokenTrees from the TokenStream, since the constraint has been "checked" so it never + // needs to be validated again. This cuts down the number of comparisons. + fn is_substream(stream: &TokenStream, other: &TokenStream) -> bool { + let other_len = other.len(); + for i in 0..stream.len() { + for (j, other_token) in other.trees().enumerate() { + match stream.trees().nth(i + j) { + Some(token_tree) => { + if !token_tree.eq_unspanned(other_token) { + break; + } + // reached last index, so we have a match + if j == other_len - 1 { + return true; + } + } + None => return false, // reached end of stream + } + } + } + false + } +} diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index 669d644..3f31f83 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -3,23 +3,22 @@ extern crate rustc_ast; extern crate rustc_hir; +extern crate rustc_middle; extern crate rustc_span; +mod alternate_constraint; +mod anchor_constraint; + +use crate::alternate_constraint::*; +use crate::anchor_constraint::*; + use std::collections::{HashMap, VecDeque}; use std::default::Default; -use rustc_ast::{ - token::{Delimiter, Token, TokenKind}, - tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndSpacing}, - AttrKind, Attribute, MacArgs, -}; -use rustc_hir::{def::Res, FieldDef, GenericArg, QPath, TyKind, VariantData}; +use rustc_ast::{AttrKind, Attribute, MacArgs}; +use rustc_hir::{intravisit::FnKind, Body, FnDecl, HirId, VariantData}; use rustc_lint::{LateContext, LateLintPass}; -use rustc_span::{ - def_id::DefId, - symbol::{Ident, Symbol}, - Span, DUMMY_SP, -}; +use rustc_span::{def_id::DefId, symbol::Symbol, Span}; use clippy_utils::{diagnostics::span_lint_and_help, ty::match_type}; use if_chain::if_chain; @@ -53,6 +52,7 @@ dylint_linting::impl_late_lint! { struct DuplicateMutableAccounts { accounts: HashMap>, streams: Streams, + spans: Vec<(Span, Span)>, } impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { @@ -88,302 +88,83 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { } } - fn check_crate_post(&mut self, cx: &LateContext<'tcx>) { - // println!("{:#?}", self); - for v in self.accounts.values() { - if v.len() > 1 { - let mut deq = VecDeque::from(v.to_owned()); - for _ in 0..deq.len() - 1 { - let (first, first_span) = deq.pop_front().unwrap(); - for (other, other_span) in &deq { - let stream = create_key_check_constraint_tokenstream(first, *other); - let symmetric_stream = - create_key_check_constraint_tokenstream(*other, first); - - if !(self.streams.contains(&stream) - || self.streams.contains(&symmetric_stream)) - { - span_lint_and_help( - cx, - DUPLICATE_MUTABLE_ACCOUNTS, - first_span, - &format!("{} and {} have identical account types but do not have a key check constraint", first, other), - Some(*other_span), - &format!("add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]", first, other) - ); + fn check_fn( + &mut self, + cx: &LateContext<'tcx>, + _: FnKind<'tcx>, + _: &'tcx FnDecl<'tcx>, + body: &'tcx Body<'tcx>, + span: Span, + _: HirId, + ) { + if !span.from_expansion() { + // get all mutable references to Accounts and if_statements in body + let mut values = Values::new(cx); + values.get_referenced_accounts_and_if_statements(body); + + // NOTE: could do this check in check_post_crate if exprs are replaced with HirId, then use + // the HirId to fetch the expr + values.accounts.values().for_each(|exprs| { + if exprs.len() > 1 { + for current in 0..exprs.len() - 1 { + for next in current + 1..exprs.len() { + if !values.check_key_constraint(exprs[current], exprs[next]) { + // store for later spanning + self.spans.push((exprs[current].span, exprs[next].span)); + } } } } - } - } else { - // perform alternate constraint check, e.g., check fn bodies, then check key checks - self.check_fn() + }); } + } - // TODO: how to enforce that this is only called when necessary? - fn check_fn( - &mut self, - cx: &LateContext<'tcx>, - _: FnKind<'tcx>, - _: &'tcx FnDecl<'tcx>, - body: &'tcx Body<'tcx>, - span: Span, - _: HirId, - ) { - if !span.from_expansion() { - let accounts = get_referenced_accounts(cx, body); - - accounts.values().for_each(|exprs| { - // TODO: figure out handling of >2 accounts - match exprs.len() { - 2 => { - let first = exprs[0]; - let second = exprs[1]; - if !contains_key_call(cx, body, first) { - span_lint_and_help( - cx, - DUP_MUTABLE_ACCOUNTS_2, - first.span, - "this expression does not have a key check but has the same account type as another expression", - Some(second.span), - "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", - ); - } - if !contains_key_call(cx, body, second) { + fn check_crate_post(&mut self, cx: &LateContext<'tcx>) { + // if collected some anchor macro constraints then perform v1 lint + if !self.streams.0.is_empty() { + for v in self.accounts.values() { + if v.len() > 1 { + let mut deq = VecDeque::from(v.to_owned()); + for _ in 0..deq.len() - 1 { + let (first, first_span) = deq.pop_front().unwrap(); + for (other, other_span) in &deq { + let stream = create_key_check_constraint_tokenstream(first, *other); + let symmetric_stream = + create_key_check_constraint_tokenstream(*other, first); + + if !(self.streams.contains(&stream) + || self.streams.contains(&symmetric_stream)) + { span_lint_and_help( cx, - DUP_MUTABLE_ACCOUNTS_2, - second.span, - "this expression does not have a key check but has the same account type as another expression", - Some(first.span), - "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", + DUPLICATE_MUTABLE_ACCOUNTS, + first_span, + &format!("{} and {} have identical account types but do not have a key check constraint", first, other), + Some(*other_span), + &format!("add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]", first, other) ); } - }, - n if n > 2 => { - span_lint_and_note( - cx, - DUP_MUTABLE_ACCOUNTS_2, - exprs[0].span, - &format!("the following expression has the same account type as {} other accounts", exprs.len()), - None, - "might not check that each account has a unique key" - ) - }, - _ => {} - } - }); - } - } - } -} - -mod anchor_constraint_check { - /// Returns the `DefId` of the anchor account type, ie, `T` in `Account<'info, T>`. - /// Returns `None` if the type of `field` is not an anchor account. - fn get_anchor_account_type_def_id(field: &FieldDef) -> Option { - if_chain! { - if let TyKind::Path(qpath) = &field.ty.kind; - if let QPath::Resolved(_, path) = qpath; - if !path.segments.is_empty(); - if let Some(generic_args) = path.segments[0].args; - if generic_args.args.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; - if let GenericArg::Type(hir_ty) = &generic_args.args[1]; - then { - get_def_id(hir_ty) - } else { - None - } - } - } - - /// Returns the `DefId` of `ty`, an hir type. Returns `None` if cannot resolve type. - fn get_def_id(ty: &rustc_hir::Ty) -> Option { - if_chain! { - if let TyKind::Path(qpath) = &ty.kind; - if let QPath::Resolved(_, path) = qpath; - if let Res::Def(_, def_id) = path.res; - then { - Some(def_id) - } else { - None - } - } - } - -/// Returns a `TokenStream` of form: `a`.key() != `b`.key(). -fn create_key_check_constraint_tokenstream(a: Symbol, b: Symbol) -> TokenStream { - // TODO: may be more efficient way to do this, since the stream is effectively fixed - // and determined. Only two tokens are variable. - let constraint = vec![ - TreeAndSpacing::from(create_token_from_ident(a.as_str())), - TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP))), - TreeAndSpacing::from(create_token_from_ident("key")), - TreeAndSpacing::from(TokenTree::Delimited( - DelimSpan::dummy(), - Delimiter::Parenthesis, - TokenStream::new(vec![]), - )), - TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Ne, DUMMY_SP))), - TreeAndSpacing::from(create_token_from_ident(b.as_str())), - TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP))), - TreeAndSpacing::from(create_token_from_ident("key")), - TreeAndSpacing::from(TokenTree::Delimited( - DelimSpan::dummy(), - Delimiter::Parenthesis, - TokenStream::new(vec![]), - )), - ]; - - TokenStream::new(constraint) - } - - /// Returns a `TokenTree::Token` which has `TokenKind::Ident`, with the string set to `s`. - fn create_token_from_ident(s: &str) -> TokenTree { - let ident = Ident::from_str(s); - TokenTree::Token(Token::from_ast_ident(ident)) - } - - #[derive(Debug, Default)] - pub struct Streams(Vec); - - impl Streams { - /// Returns true if `self` contains `other`, by comparing if there is an - /// identical `TokenStream` in `self` regardless of span. - fn contains(&self, other: &TokenStream) -> bool { - self.0.iter().any(|stream| stream.eq_unspanned(other)) - } - } -} - - -impl Streams { - /// Returns true if `self` has a TokenStream that `other` is a substream of - fn contains(&self, other: &TokenStream) -> bool { - self.0 - .iter() - .any(|token_stream| Self::is_substream(token_stream, other)) - } - - /// Returns true if `other` is a substream of `stream`. By substream we mean in the - /// sense of a substring. - // NOTE: a possible optimization is when a match is found, to remove the matched - // TokenTrees from the TokenStream, since the constraint has been "checked" so it never - // needs to be validated again. This cuts down the number of comparisons. - fn is_substream(stream: &TokenStream, other: &TokenStream) -> bool { - let other_len = other.len(); - for i in 0..stream.len() { - for (j, other_token) in other.trees().enumerate() { - match stream.trees().nth(i + j) { - Some(token_tree) => { - if !token_tree.eq_unspanned(other_token) { - break; - } - // reached last index, so we have a match - if j == other_len - 1 { - return true; } } - None => return false, // reached end of stream } } - } - false - } -} - -mod alternate_constraint_check { - struct AccountUses<'cx, 'tcx> { - cx: &'cx LateContext<'tcx>, - uses: HashMap>>, - } - - fn get_referenced_accounts<'tcx>( - cx: &LateContext<'tcx>, - body: &'tcx Body<'tcx>, - ) -> HashMap>> { - let mut accounts = AccountUses { - cx, - uses: HashMap::new(), - }; - - accounts.visit_expr(&body.value); - accounts.uses - } - - impl<'cx, 'tcx> Visitor<'tcx> for AccountUses<'cx, 'tcx> { - fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { - if_chain! { - // get mutable reference expressions - if let ExprKind::AddrOf(_, mutability, mut_expr) = expr.kind; - if let Mutability::Mut = mutability; - // check type of expr == Account<'info, T> - let middle_ty = self.cx.typeck_results().expr_ty(mut_expr); - if match_type(self.cx, middle_ty, &paths::ANCHOR_ACCOUNT); - // grab T generic parameter - if let TyKind::Adt(_adt_def, substs) = middle_ty.kind(); - if substs.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; - let account_type = substs[1].expect_ty(); // TODO: could just store middle::Ty instead of DefId? - if let Some(adt_def) = account_type.ty_adt_def(); - then { - let def_id = adt_def.did(); - if let Some(exprs) = self.uses.get_mut(&def_id) { - let mut spanless_eq = SpanlessEq::new(self.cx); - // check that expr is not a duplicate within its particular key-pair - if exprs.iter().all(|e| !spanless_eq.eq_expr(e, mut_expr)) { - exprs.push(mut_expr); - } - } else { - self.uses.insert(def_id, vec![mut_expr]); - } - } + } else { + // TODO: Not a fan of having it span lints for this check when there are no checks whatsoever. + // I'd rather have it span lints to recommended anchor macros, if no checks are found at all + for (first, second) in &self.spans { + span_lint_and_help( + cx, + DUPLICATE_MUTABLE_ACCOUNTS, + *first, + "the following expressions have equivalent Account types, yet do not contain a proper key check.", + Some(*second), + "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", + ); } - walk_expr(self, expr); } } - - /// Performs a walk on `body`, checking whether there exists an expression that contains - /// a `key()` method call on `account_expr`. - fn contains_key_call<'tcx>( - cx: &LateContext<'tcx>, - body: &'tcx Body<'tcx>, - account_expr: &Expr<'tcx>, - ) -> bool { - visit_expr_no_bodies(&body.value, |expr| { - if_chain! { - if let ExprKind::MethodCall(path_seg, exprs, _span) = expr.kind; - if path_seg.ident.name.as_str() == "key"; - if !exprs.is_empty(); - let mut spanless_eq = SpanlessEq::new(cx); - if spanless_eq.eq_expr(&exprs[0], account_expr); - then { - true - } else { - false - } - } - }) - } } -// /// Splits `stream` into a vector of substreams, separated by `delimiter`. -// fn split(stream: CursorRef, delimiter: TokenKind) -> Vec { -// let mut split_streams: Vec = Vec::new(); -// let mut temp: Vec = Vec::new(); -// let delim = TokenTree::Token(Token::new(delimiter, DUMMY_SP)); - -// stream.for_each(|t| { -// if t.eq_unspanned(&delim) { -// split_streams.push(TokenStream::new(temp.clone())); -// temp.clear(); -// } else { -// temp.push(TreeAndSpacing::from(t.clone())); -// } -// }); -// split_streams.push(TokenStream::new(temp)); -// split_streams -// } - #[test] fn insecure() { dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "insecure"); From af02a30605c2f96005a48b889112cbe00567cb2c Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Tue, 19 Jul 2022 14:12:38 -0500 Subject: [PATCH 14/24] fix lint-6 tests and add readme --- lints/duplicate-mutable-accounts/README.md | 47 ++++++++++++++++++ lints/duplicate-mutable-accounts/src/lib.rs | 43 +++++++++++++---- .../ui/insecure-2/src/lib.rs | 3 ++ .../ui/insecure-2/src/lib.stderr | 48 +++++++++---------- .../ui/insecure/src/lib.stderr | 16 +++---- 5 files changed, 117 insertions(+), 40 deletions(-) create mode 100644 lints/duplicate-mutable-accounts/README.md diff --git a/lints/duplicate-mutable-accounts/README.md b/lints/duplicate-mutable-accounts/README.md new file mode 100644 index 0000000..7f9e941 --- /dev/null +++ b/lints/duplicate-mutable-accounts/README.md @@ -0,0 +1,47 @@ +# duplicate_mutable_accounts + +**What it does:** Checks to make sure there is a key check on identical Anchor accounts. +The key check serves to make sure that two identical accounts do not have the same key, +ie, they are unique. An Anchor account (`Account<'info, T>`) is identical to another if +the generic parameter `T` is the same type for each account. + +**Why is this bad?** If a program contains two identical, mutable Anchor accounts, and +performs some operation on those accounts, then a user could pass in the same account +twice. Then any previous operations may be overwritten by the last operation, which may +not be what the program wanted if it expected different accounts. + +**Known problems:** If a program is not using the anchor `#[account]` macro constraints, +and is instead using checks in the function bodies, and the program uses boolean operator +&& or || to link constraints in a single if statement, the lint will flag this as a false +positive since the lint only catches statements with `==` or `!=`. + +Another issue is if a program uses an if statement such as `a.key() == b.key()` and then +continues to modify the accounts, then this will not be caught. The reason is because the +lint regards expressions with `==` as a secure check, since it assumes the program will +then return an error (see the secure example). However, it does not explicitly check that +an error is returned. + +In general, this lint will catch all vulnerabilities if the anchor macro constraints are +used (see the recommended example). It is not as robust if alternative methods are utilized. +Thus it is encouraged to use the anchor `#[account]` macro constraints. + +**Example:** + +```rust +#[derive(Accounts)] +pub struct Update<'info> { + user_a: Account<'info, User>, + user_b: Account<'info, User>, +} +``` + +Use instead: + +```rust +#[derive(Accounts)] +pub struct Update<'info> { + #[account(constraint = user_a.key() != user_b.key())] + user_a: Account<'info, User>, + user_b: Account<'info, User>, +} +``` diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index 3f31f83..60c16b1 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -27,24 +27,51 @@ use solana_lints::paths; const ANCHOR_ACCOUNT_GENERIC_ARG_COUNT: usize = 2; dylint_linting::impl_late_lint! { - /// **What it does:** + /// **What it does:** Checks to make sure there is a key check on identical Anchor accounts. + /// The key check serves to make sure that two identical accounts do not have the same key, + /// ie, they are unique. An Anchor account (`Account<'info, T>`) is identical to another if + /// the generic parameter `T` is the same type for each account. /// - /// **Why is this bad?** + /// **Why is this bad?** If a program contains two identical, mutable Anchor accounts, and + /// performs some operation on those accounts, then a user could pass in the same account + /// twice. Then any previous operations may be overwritten by the last operation, which may + /// not be what the program wanted if it expected different accounts. /// - /// **Known problems:** None. + /// **Known problems:** If a program is not using the anchor #[account] macro constraints, + /// and is instead using checks in the function bodies, and the program uses boolean operator + /// && or || to link constraints in a single if statement, the lint will flag this as a false + /// positive since the lint only catches statements with `==` or `!=`. + /// Another issue is if a program uses an if statement such as `a.key() == b.key()` and then + /// continues to modify the accounts, then this will not be caught. The reason is because the + /// lint regards expressions with `==` as a secure check, since it assumes the program will + /// then return an error (see the secure example). However, it does not explicitly check that + /// an error is returned. + /// + /// In general, this lint will catch all vulnerabilities if the anchor macro constraints are + /// used (see the recommended example). It is not as robust if alternative methods are utilized. + /// Thus it is encouraged to use the anchor `#[account]` macro constraints. /// - /// **Example:** + /// **Example:** /// /// ```rust - /// // example code where a warning is issued + /// #[derive(Accounts)] + /// pub struct Update<'info> { + /// user_a: Account<'info, User>, + /// user_b: Account<'info, User>, + /// } /// ``` /// Use instead: /// ```rust - /// // example code that does not raise a warning + /// #[derive(Accounts)] + /// pub struct Update<'info> { + /// #[account(constraint = user_a.key() != user_b.key())] + /// user_a: Account<'info, User>, + /// user_b: Account<'info, User>, + /// } /// ``` pub DUPLICATE_MUTABLE_ACCOUNTS, Warn, - "description goes here", + "does not check if multiple identical Anchor accounts have different keys", DuplicateMutableAccounts::default() } @@ -156,7 +183,7 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { cx, DUPLICATE_MUTABLE_ACCOUNTS, *first, - "the following expressions have equivalent Account types, yet do not contain a proper key check.", + &format!("the expressions on line {:?} and {:?} have identical Account types, yet do not contain a proper key check.", first, second), Some(*second), "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", ); diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs index 0bd77a5..1ab1576 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs @@ -10,12 +10,15 @@ pub mod duplicate_mutable_accounts_insecure { ctx: Context, a: u64, b: u64, + c: u64, ) -> anchor_lang::solana_program::entrypoint::ProgramResult { let user_a = &mut ctx.accounts.user_a; let user_b = &mut ctx.accounts.user_b; + let user_c = &mut ctx.accounts.user_c; user_a.data = a; user_b.data = b; + user_c.data = c; Ok(()) } } diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr index 94e9791..06a1eca 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr @@ -1,39 +1,39 @@ -error: user_a and user_b have identical account types but do not have a key check constraint - --> $DIR/lib.rs:25:5 +error: the expressions on line $DIR/lib.rs:15:27: 15:46 (#0) and $DIR/lib.rs:16:27: 16:46 (#0) have identical Account types, yet do not contain a proper key check. + --> $DIR/lib.rs:15:27 | -LL | user_a: Account<'info, User>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let user_a = &mut ctx.accounts.user_a; + | ^^^^^^^^^^^^^^^^^^^ | = note: `-D duplicate-mutable-accounts` implied by `-D warnings` -help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_b.key())] - --> $DIR/lib.rs:26:5 +help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() + --> $DIR/lib.rs:16:27 | -LL | user_b: Account<'info, User>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let user_b = &mut ctx.accounts.user_b; + | ^^^^^^^^^^^^^^^^^^^ -error: user_a and user_c have identical account types but do not have a key check constraint - --> $DIR/lib.rs:25:5 +error: the expressions on line $DIR/lib.rs:15:27: 15:46 (#0) and $DIR/lib.rs:17:27: 17:46 (#0) have identical Account types, yet do not contain a proper key check. + --> $DIR/lib.rs:15:27 | -LL | user_a: Account<'info, User>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let user_a = &mut ctx.accounts.user_a; + | ^^^^^^^^^^^^^^^^^^^ | -help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_c.key())] - --> $DIR/lib.rs:27:5 +help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() + --> $DIR/lib.rs:17:27 | -LL | user_c: Account<'info, User>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let user_c = &mut ctx.accounts.user_c; + | ^^^^^^^^^^^^^^^^^^^ -error: user_b and user_c have identical account types but do not have a key check constraint - --> $DIR/lib.rs:26:5 +error: the expressions on line $DIR/lib.rs:16:27: 16:46 (#0) and $DIR/lib.rs:17:27: 17:46 (#0) have identical Account types, yet do not contain a proper key check. + --> $DIR/lib.rs:16:27 | -LL | user_b: Account<'info, User>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let user_b = &mut ctx.accounts.user_b; + | ^^^^^^^^^^^^^^^^^^^ | -help: add an anchor key check constraint: #[account(constraint = user_b.key() != user_c.key())] - --> $DIR/lib.rs:27:5 +help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() + --> $DIR/lib.rs:17:27 | -LL | user_c: Account<'info, User>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let user_c = &mut ctx.accounts.user_c; + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr index 064418c..d86ec52 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr +++ b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr @@ -1,15 +1,15 @@ -error: user_a and user_b have identical account types but do not have a key check constraint - --> $DIR/lib.rs:25:5 +error: the expressions on line $DIR/lib.rs:14:27: 14:46 (#0) and $DIR/lib.rs:15:27: 15:46 (#0) have identical Account types, yet do not contain a proper key check. + --> $DIR/lib.rs:14:27 | -LL | user_a: Account<'info, User>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let user_a = &mut ctx.accounts.user_a; + | ^^^^^^^^^^^^^^^^^^^ | = note: `-D duplicate-mutable-accounts` implied by `-D warnings` -help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_b.key())] - --> $DIR/lib.rs:26:5 +help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() + --> $DIR/lib.rs:15:27 | -LL | user_b: Account<'info, User>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let user_b = &mut ctx.accounts.user_b; + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error From bd2e0b970cf157dfb3755e74095f724ba1dd503b Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Tue, 19 Jul 2022 14:13:00 -0500 Subject: [PATCH 15/24] remove lint6v2 --- .../dup_mutable_accounts_2/.cargo/config.toml | 11 - lints/dup_mutable_accounts_2/.gitignore | 1 - lints/dup_mutable_accounts_2/Cargo.lock | 1797 ----------------- lints/dup_mutable_accounts_2/Cargo.toml | 33 - lints/dup_mutable_accounts_2/README.md | 19 - lints/dup_mutable_accounts_2/rust-toolchain | 3 - lints/dup_mutable_accounts_2/src/lib.rs | 209 -- .../ui/insecure/Cargo.toml | 19 - .../ui/insecure/Xargo.toml | 2 - .../ui/insecure/src/lib.rs | 34 - .../ui/insecure/src/lib.stderr | 27 - .../ui/secure/Cargo.lock | 1315 ------------ .../ui/secure/Cargo.toml | 19 - .../ui/secure/Xargo.toml | 2 - .../ui/secure/src/lib.rs | 42 - lints/duplicate-mutable-accounts/src/lib.rs | 6 +- 16 files changed, 3 insertions(+), 3536 deletions(-) delete mode 100644 lints/dup_mutable_accounts_2/.cargo/config.toml delete mode 100644 lints/dup_mutable_accounts_2/.gitignore delete mode 100644 lints/dup_mutable_accounts_2/Cargo.lock delete mode 100644 lints/dup_mutable_accounts_2/Cargo.toml delete mode 100644 lints/dup_mutable_accounts_2/README.md delete mode 100644 lints/dup_mutable_accounts_2/rust-toolchain delete mode 100644 lints/dup_mutable_accounts_2/src/lib.rs delete mode 100644 lints/dup_mutable_accounts_2/ui/insecure/Cargo.toml delete mode 100644 lints/dup_mutable_accounts_2/ui/insecure/Xargo.toml delete mode 100644 lints/dup_mutable_accounts_2/ui/insecure/src/lib.rs delete mode 100644 lints/dup_mutable_accounts_2/ui/insecure/src/lib.stderr delete mode 100644 lints/dup_mutable_accounts_2/ui/secure/Cargo.lock delete mode 100644 lints/dup_mutable_accounts_2/ui/secure/Cargo.toml delete mode 100644 lints/dup_mutable_accounts_2/ui/secure/Xargo.toml delete mode 100644 lints/dup_mutable_accounts_2/ui/secure/src/lib.rs diff --git a/lints/dup_mutable_accounts_2/.cargo/config.toml b/lints/dup_mutable_accounts_2/.cargo/config.toml deleted file mode 100644 index 46d1571..0000000 --- a/lints/dup_mutable_accounts_2/.cargo/config.toml +++ /dev/null @@ -1,11 +0,0 @@ -[target.aarch64-apple-darwin] -linker = "dylint-link" - -[target.x86_64-apple-darwin] -linker = "dylint-link" - -[target.x86_64-unknown-linux-gnu] -linker = "dylint-link" - -[target.x86_64-pc-windows-msvc] -linker = "dylint-link" diff --git a/lints/dup_mutable_accounts_2/.gitignore b/lints/dup_mutable_accounts_2/.gitignore deleted file mode 100644 index ea8c4bf..0000000 --- a/lints/dup_mutable_accounts_2/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/lints/dup_mutable_accounts_2/Cargo.lock b/lints/dup_mutable_accounts_2/Cargo.lock deleted file mode 100644 index 76fde76..0000000 --- a/lints/dup_mutable_accounts_2/Cargo.lock +++ /dev/null @@ -1,1797 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.7", - "once_cell", - "version_check", -] - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "anchor-attribute-access-control" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "regex", - "syn", -] - -[[package]] -name = "anchor-attribute-account" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" -dependencies = [ - "anchor-syn", - "anyhow", - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "anchor-attribute-constant" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" -dependencies = [ - "anchor-syn", - "proc-macro2", - "syn", -] - -[[package]] -name = "anchor-attribute-error" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" -dependencies = [ - "anchor-syn", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-event" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-interface" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" -dependencies = [ - "anchor-syn", - "anyhow", - "heck 0.3.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-program" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-state" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-derive-accounts" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-lang" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" -dependencies = [ - "anchor-attribute-access-control", - "anchor-attribute-account", - "anchor-attribute-constant", - "anchor-attribute-error", - "anchor-attribute-event", - "anchor-attribute-interface", - "anchor-attribute-program", - "anchor-attribute-state", - "anchor-derive-accounts", - "arrayref", - "base64 0.13.0", - "bincode", - "borsh", - "bytemuck", - "solana-program", - "thiserror", -] - -[[package]] -name = "anchor-syn" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" -dependencies = [ - "anyhow", - "bs58 0.3.1", - "heck 0.3.3", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "serde", - "serde_json", - "sha2", - "syn", - "thiserror", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "anyhow" -version = "1.0.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "blake3" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", - "digest 0.10.3", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "block-padding", - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive", - "hashbrown", -] - -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate", - "proc-macro2", - "syn", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "bs58" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bstr" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" -dependencies = [ - "memchr", -] - -[[package]] -name = "bumpalo" -version = "3.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" - -[[package]] -name = "bv" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" -dependencies = [ - "feature-probe", - "serde", -] - -[[package]] -name = "bytemuck" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "camino" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3abb7553d5b9b8421c6de7cb02606ff15e0c6eea7d8eadd75ef013fd636bec36" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", -] - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clippy_utils" -version = "0.1.64" -source = "git+https://github.com/rust-lang/rust-clippy?rev=0cb0f7636851f9fcc57085cf80197a2ef6db098f#0cb0f7636851f9fcc57085cf80197a2ef6db098f" -dependencies = [ - "arrayvec", - "if_chain", - "rustc-semver", -] - -[[package]] -name = "compiletest_rs" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "262134ef87408da1ddfe45e33daa0ca43b75286d6b1076446e602d264cf9847e" -dependencies = [ - "diff", - "filetime", - "getopts", - "lazy_static", - "libc", - "log", - "miow", - "regex", - "rustfix", - "serde", - "serde_derive", - "serde_json", - "tester", - "winapi", -] - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" -dependencies = [ - "log", - "web-sys", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "cpufeatures" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" -dependencies = [ - "libc", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" -dependencies = [ - "block-buffer 0.10.2", - "crypto-common", - "subtle", -] - -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "dup_mutable_accounts_2" -version = "0.1.0" -dependencies = [ - "anchor-lang", - "clippy_utils", - "dylint_linting", - "dylint_testing", - "if_chain", - "solana-lints", -] - -[[package]] -name = "dylint" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6efeb05f33ed8c407d9a7aac99fe9420316ea2d0ec00ae9de1f68eb2f86a792" -dependencies = [ - "ansi_term", - "anyhow", - "atty", - "cargo_metadata", - "dirs", - "dylint_internal", - "heck 0.4.0", - "lazy_static", - "log", - "once_cell", - "semver", - "serde", - "serde_json", - "tempfile", - "walkdir", -] - -[[package]] -name = "dylint_internal" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12d1bcddbf1c497f405112c76e053f76e42a0a505487135c6de2bcc1ad886dd" -dependencies = [ - "ansi_term", - "anyhow", - "cargo_metadata", - "if_chain", - "log", - "rust-embed", - "sedregex", - "walkdir", -] - -[[package]] -name = "dylint_linting" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66244dfe20633c437c5dba0835f1b6b67c196cce8b04aa3f1a312efd0faa886c" -dependencies = [ - "paste", -] - -[[package]] -name = "dylint_testing" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de76a43ff00d96ea108e848538e0d6c47dc2c0b99915f9e6303966c1ff673711" -dependencies = [ - "anyhow", - "cargo_metadata", - "compiletest_rs", - "dylint", - "dylint_internal", - "env_logger", - "lazy_static", - "once_cell", - "regex", - "serde_json", - "tempfile", -] - -[[package]] -name = "either" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" - -[[package]] -name = "env_logger" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "fastrand" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" -dependencies = [ - "instant", -] - -[[package]] -name = "feature-probe" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" - -[[package]] -name = "filetime" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "windows-sys", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "generic-array" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" -dependencies = [ - "serde", - "typenum", - "version_check", -] - -[[package]] -name = "getopts" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "globset" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" -dependencies = [ - "aho-corasick", - "bstr", - "fnv", - "log", - "regex", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "heck" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest 0.9.0", - "generic-array", - "hmac", -] - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "if_chain" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "itertools" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "js-sys" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "libsecp256k1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" -dependencies = [ - "arrayref", - "base64 0.12.3", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand", - "serde", - "sha2", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "lock_api" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memmap2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" -dependencies = [ - "libc", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", -] - -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "once_cell" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "paste" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro2" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proc-macro2-diagnostics" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "version_check", - "yansi", -] - -[[package]] -name = "quote" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom 0.2.7", - "redox_syscall", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "rust-embed" -version = "6.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a17e5ac65b318f397182ae94e532da0ba56b88dd1200b774715d36c4943b1c3" -dependencies = [ - "rust-embed-impl", - "rust-embed-utils", - "walkdir", -] - -[[package]] -name = "rust-embed-impl" -version = "6.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e763e24ba2bf0c72bc6be883f967f794a019fafd1b86ba1daff9c91a7edd30" -dependencies = [ - "proc-macro2", - "quote", - "rust-embed-utils", - "syn", - "walkdir", -] - -[[package]] -name = "rust-embed-utils" -version = "7.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "756feca3afcbb1487a1d01f4ecd94cf8ec98ea074c55a69e7136d29fb6166029" -dependencies = [ - "globset", - "sha2", - "walkdir", -] - -[[package]] -name = "rustc-semver" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be1bdc7edf596692617627bbfeaba522131b18e06ca4df2b6b689e3c5d5ce84" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustfix" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd2853d9e26988467753bd9912c3a126f642d05d229a4b53f5752ee36c56481" -dependencies = [ - "anyhow", - "log", - "serde", - "serde_json", -] - -[[package]] -name = "rustversion" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24c8ad4f0c00e1eb5bc7614d236a7f1300e3dbd76b68cac8e06fb00b015ad8d8" - -[[package]] -name = "ryu" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "sedregex" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19411e23596093f03bbd11dc45603b6329bb4bfec77b9fd13e2b9fc9b02efe3e" -dependencies = [ - "regex", -] - -[[package]] -name = "semver" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" -dependencies = [ - "serde", -] - -[[package]] -name = "serde" -version = "1.0.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug", -] - -[[package]] -name = "smallvec" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" - -[[package]] -name = "solana-frozen-abi" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" -dependencies = [ - "bs58 0.4.0", - "bv", - "generic-array", - "log", - "memmap2", - "rustc_version", - "serde", - "serde_derive", - "sha2", - "solana-frozen-abi-macro", - "solana-logger", - "thiserror", -] - -[[package]] -name = "solana-frozen-abi-macro" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn", -] - -[[package]] -name = "solana-lints" -version = "0.1.0" - -[[package]] -name = "solana-logger" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" -dependencies = [ - "env_logger", - "lazy_static", - "log", -] - -[[package]] -name = "solana-program" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" -dependencies = [ - "base64 0.13.0", - "bincode", - "bitflags", - "blake3", - "borsh", - "borsh-derive", - "bs58 0.4.0", - "bv", - "bytemuck", - "console_error_panic_hook", - "console_log", - "curve25519-dalek", - "getrandom 0.1.16", - "itertools", - "js-sys", - "lazy_static", - "libsecp256k1", - "log", - "num-derive", - "num-traits", - "parking_lot", - "rand", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "sha2", - "sha3", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-logger", - "solana-sdk-macro", - "thiserror", - "wasm-bindgen", -] - -[[package]] -name = "solana-sdk-macro" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" -dependencies = [ - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" -dependencies = [ - "cfg-if", - "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "tester" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0639d10d8f4615f223a57275cf40f9bdb7cfbb806bcb7f7cc56e3beb55a576eb" -dependencies = [ - "cfg-if", - "getopts", - "libc", - "num_cpus", - "term", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] - -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "unicode-ident" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" - -[[package]] -name = "unicode-segmentation" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "walkdir" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -dependencies = [ - "same-file", - "winapi", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" - -[[package]] -name = "web-sys" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - -[[package]] -name = "zeroize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/lints/dup_mutable_accounts_2/Cargo.toml b/lints/dup_mutable_accounts_2/Cargo.toml deleted file mode 100644 index 4811999..0000000 --- a/lints/dup_mutable_accounts_2/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "dup_mutable_accounts_2" -version = "0.1.0" -authors = ["authors go here"] -description = "description goes here" -edition = "2018" -publish = false - -[lib] -crate-type = ["cdylib"] - -[[example]] -name = "insecure" -path = "ui/insecure/src/lib.rs" - -[[example]] -name = "secure" -path = "ui/secure/src/lib.rs" - -[dependencies] -clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "0cb0f7636851f9fcc57085cf80197a2ef6db098f" } -dylint_linting = "2.0.7" -if_chain = "1.0.2" -solana-lints = { path = "../../crate" } - -[dev-dependencies] -anchor-lang = "0.24.2" -dylint_testing = "2.0.7" - -[workspace] - -[package.metadata.rust-analyzer] -rustc_private = true diff --git a/lints/dup_mutable_accounts_2/README.md b/lints/dup_mutable_accounts_2/README.md deleted file mode 100644 index f3079a7..0000000 --- a/lints/dup_mutable_accounts_2/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# template - -**What it does:** - -**Why is this bad?** - -**Known problems:** None. - -**Example:** - -```rust -// example code where a warning is issued -``` - -Use instead: - -```rust -// example code that does not raise a warning -``` diff --git a/lints/dup_mutable_accounts_2/rust-toolchain b/lints/dup_mutable_accounts_2/rust-toolchain deleted file mode 100644 index 2056264..0000000 --- a/lints/dup_mutable_accounts_2/rust-toolchain +++ /dev/null @@ -1,3 +0,0 @@ -[toolchain] -channel = "nightly-2022-06-30" -components = ["llvm-tools-preview", "rustc-dev"] diff --git a/lints/dup_mutable_accounts_2/src/lib.rs b/lints/dup_mutable_accounts_2/src/lib.rs deleted file mode 100644 index df99235..0000000 --- a/lints/dup_mutable_accounts_2/src/lib.rs +++ /dev/null @@ -1,209 +0,0 @@ -#![feature(rustc_private)] -#![warn(unused_extern_crates)] - -extern crate rustc_hir; -extern crate rustc_middle; -extern crate rustc_span; - -use clippy_utils::{ - diagnostics::{span_lint_and_help, span_lint_and_note}, - ty::match_type, - SpanlessEq, -}; -use if_chain::if_chain; -use rustc_hir::{ - def_id::DefId, - intravisit::{walk_expr, FnKind, Visitor}, - BinOpKind, Body, Expr, ExprKind, FnDecl, HirId, Mutability, -}; -use rustc_lint::{LateContext, LateLintPass}; -use rustc_middle::ty::TyKind; -use rustc_span::Span; -use solana_lints::{paths, utils::visit_expr_no_bodies}; - -use std::collections::HashMap; - -const ANCHOR_ACCOUNT_GENERIC_ARG_COUNT: usize = 2; - -dylint_linting::declare_late_lint! { - /// **What it does:** - /// - /// **Why is this bad?** - /// - /// **Known problems:** None. - /// - /// **Example:** - /// - /// ```rust - /// // example code where a warning is issued - /// ``` - /// Use instead: - /// ```rust - /// // example code that does not raise a warning - /// ``` - pub DUP_MUTABLE_ACCOUNTS_2, - Warn, - "description goes here" -} - -impl<'tcx> LateLintPass<'tcx> for DupMutableAccounts2 { - fn check_fn( - &mut self, - cx: &LateContext<'tcx>, - _: FnKind<'tcx>, - _: &'tcx FnDecl<'tcx>, - body: &'tcx Body<'tcx>, - span: Span, - _: HirId, - ) { - if !span.from_expansion() { - // get all mutable references to Accounts and if_statements in body - let mut values = Values::new(cx); - values.get_referenced_accounts_and_if_statements(cx, body); - // println!("{:#?}", values.if_statements); - - values.accounts.values().for_each(|exprs| { - if exprs.len() > 1 { - for current in 0..exprs.len() - 1 { - for next in current + 1..exprs.len() { - if !values.check_key_constraint(exprs[current], exprs[next]) { - span_lint_and_help( - cx, - DUP_MUTABLE_ACCOUNTS_2, - exprs[current].span, - "the following expressions have equivalent Account types, yet do not contain a proper key check.", - Some(exprs[next].span), - "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", - ); - } - } - } - } - }); - } - } -} - -struct Values<'cx, 'tcx> { - cx: &'cx LateContext<'tcx>, - accounts: HashMap>>, - if_statements: Vec<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>)>, -} - -impl<'cx, 'tcx> Values<'cx, 'tcx> { - fn new(cx: &'cx LateContext<'tcx>) -> Self { - Values { - cx, - accounts: HashMap::new(), - if_statements: Vec::new(), - } - } - - fn get_referenced_accounts_and_if_statements( - &mut self, - cx: &'cx LateContext<'tcx>, - body: &'tcx Body<'tcx>, - ) -> &Self { - self.visit_expr(&body.value); - self - } - - /// Checks if there is a valid key constraint for `first_account` and `second_account`. - /// NOTE: currently only considers `first.key() == second.key()` or the symmetric relation as valid constraints. - /// TODO: if == relation used, should return some error in the THEN block - fn check_key_constraint(&self, first_account: &Expr<'_>, second_account: &Expr<'_>) -> bool { - for (left, right) in &self.if_statements { - if_chain! { - if let ExprKind::MethodCall(path_seg_left, exprs_left, _span) = left.kind; - if let ExprKind::MethodCall(path_seg_right, exprs_right, _span) = right.kind; - if path_seg_left.ident.name.as_str() == "key" && path_seg_right.ident.name.as_str() == "key"; - if !exprs_left.is_empty() && !exprs_right.is_empty(); - let mut spanless_eq = SpanlessEq::new(self.cx); - if (spanless_eq.eq_expr(&exprs_left[0], first_account) && spanless_eq.eq_expr(&exprs_right[0], second_account)) - || (spanless_eq.eq_expr(&exprs_left[0], second_account) && spanless_eq.eq_expr(&exprs_right[0], first_account)); - then { - return true; - } - } - } - return false; - } -} - -impl<'cx, 'tcx> Visitor<'tcx> for Values<'cx, 'tcx> { - fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { - if_chain! { - // get mutable reference expressions - if let ExprKind::AddrOf(_, mutability, mut_expr) = expr.kind; - if let Mutability::Mut = mutability; - // check type of expr == Account<'info, T> - let middle_ty = self.cx.typeck_results().expr_ty(mut_expr); - if match_type(self.cx, middle_ty, &paths::ANCHOR_ACCOUNT); - // grab T generic parameter - if let TyKind::Adt(_adt_def, substs) = middle_ty.kind(); - if substs.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; - let account_type = substs[1].expect_ty(); // TODO: could just store middle::Ty instead of DefId? - if let Some(adt_def) = account_type.ty_adt_def(); - then { - let def_id = adt_def.did(); - if let Some(exprs) = self.accounts.get_mut(&def_id) { - let mut spanless_eq = SpanlessEq::new(self.cx); - // check that expr is not a duplicate within its particular key-pair - if exprs.iter().all(|e| !spanless_eq.eq_expr(e, mut_expr)) { - exprs.push(mut_expr); - } - } else { - self.accounts.insert(def_id, vec![mut_expr]); - } - } - } - - // get if statements - if_chain! { - if let ExprKind::If(wrapped_if_expr, then, _else_opt) = expr.kind; - if let ExprKind::DropTemps(if_expr) = wrapped_if_expr.kind; - if let ExprKind::Binary(op, left, right) = if_expr.kind; - // TODO: leaves out || or &&. Could implement something that pulls apart - // an if expr that is of this form into individual == or != comparisons - if let BinOpKind::Ne | BinOpKind::Eq = op.node; - then { - // println!("{:#?}, {:#?}", expr, then); - self.if_statements.push((left, right)); - } - } - walk_expr(self, expr); - } -} - -// /// Performs a walk on `body`, checking whether there exists an expression that contains -// /// a `key()` method call on `account_expr`. -// fn contains_key_call<'tcx>( -// cx: &LateContext<'tcx>, -// body: &'tcx Body<'tcx>, -// account_expr: &Expr<'tcx>, -// ) -> bool { -// visit_expr_no_bodies(&body.value, |expr| { -// if_chain! { -// if let ExprKind::MethodCall(path_seg, exprs, _span) = expr.kind; -// if path_seg.ident.name.as_str() == "key"; -// if !exprs.is_empty(); -// let mut spanless_eq = SpanlessEq::new(cx); -// if spanless_eq.eq_expr(&exprs[0], account_expr); -// then { -// true -// } else { -// false -// } -// } -// }) -// } - -#[test] -fn insecure() { - dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "insecure"); -} - -#[test] -fn secure() { - dylint_testing::ui_test_example(env!("CARGO_PKG_NAME"), "secure"); -} diff --git a/lints/dup_mutable_accounts_2/ui/insecure/Cargo.toml b/lints/dup_mutable_accounts_2/ui/insecure/Cargo.toml deleted file mode 100644 index 6ab1b59..0000000 --- a/lints/dup_mutable_accounts_2/ui/insecure/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "duplicate-mutable-accounts-insecure" -version = "0.1.0" -description = "Created with Anchor" -edition = "2018" - -[lib] -crate-type = ["cdylib", "lib"] -name = "duplicate_mutable_accounts_insecure" - -[features] -no-entrypoint = [] -no-idl = [] -no-log-ix-name = [] -cpi = ["no-entrypoint"] -default = [] - -[dependencies] -anchor-lang = "0.24.2" diff --git a/lints/dup_mutable_accounts_2/ui/insecure/Xargo.toml b/lints/dup_mutable_accounts_2/ui/insecure/Xargo.toml deleted file mode 100644 index 475fb71..0000000 --- a/lints/dup_mutable_accounts_2/ui/insecure/Xargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.bpfel-unknown-unknown.dependencies.std] -features = [] diff --git a/lints/dup_mutable_accounts_2/ui/insecure/src/lib.rs b/lints/dup_mutable_accounts_2/ui/insecure/src/lib.rs deleted file mode 100644 index 2e1d708..0000000 --- a/lints/dup_mutable_accounts_2/ui/insecure/src/lib.rs +++ /dev/null @@ -1,34 +0,0 @@ -use anchor_lang::prelude::*; - -declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); - -#[program] -pub mod duplicate_mutable_accounts_insecure { - use super::*; - - pub fn update( - ctx: Context, - a: u64, - b: u64, - ) -> anchor_lang::solana_program::entrypoint::ProgramResult { - let user_a = &mut ctx.accounts.user_a; - let user_b = &mut ctx.accounts.user_b; - - user_a.data = a; - user_b.data = b; - Ok(()) - } -} - -#[derive(Accounts)] -pub struct Update<'info> { - user_a: Account<'info, User>, - user_b: Account<'info, User>, -} - -#[account] -pub struct User { - data: u64, -} - -fn main() {} diff --git a/lints/dup_mutable_accounts_2/ui/insecure/src/lib.stderr b/lints/dup_mutable_accounts_2/ui/insecure/src/lib.stderr deleted file mode 100644 index 5a5c4ee..0000000 --- a/lints/dup_mutable_accounts_2/ui/insecure/src/lib.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error: this expression does not have a key check but has the same account type as another expression - --> $DIR/lib.rs:14:27 - | -LL | let user_a = &mut ctx.accounts.user_a; - | ^^^^^^^^^^^^^^^^^^^ - | - = note: `-D dup-mutable-accounts-2` implied by `-D warnings` -help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() - --> $DIR/lib.rs:15:27 - | -LL | let user_b = &mut ctx.accounts.user_b; - | ^^^^^^^^^^^^^^^^^^^ - -error: this expression does not have a key check but has the same account type as another expression - --> $DIR/lib.rs:15:27 - | -LL | let user_b = &mut ctx.accounts.user_b; - | ^^^^^^^^^^^^^^^^^^^ - | -help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() - --> $DIR/lib.rs:14:27 - | -LL | let user_a = &mut ctx.accounts.user_a; - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/lints/dup_mutable_accounts_2/ui/secure/Cargo.lock b/lints/dup_mutable_accounts_2/ui/secure/Cargo.lock deleted file mode 100644 index 9090753..0000000 --- a/lints/dup_mutable_accounts_2/ui/secure/Cargo.lock +++ /dev/null @@ -1,1315 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.7", - "once_cell", - "version_check", -] - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "anchor-attribute-access-control" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "regex", - "syn", -] - -[[package]] -name = "anchor-attribute-account" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" -dependencies = [ - "anchor-syn", - "anyhow", - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "anchor-attribute-constant" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" -dependencies = [ - "anchor-syn", - "proc-macro2", - "syn", -] - -[[package]] -name = "anchor-attribute-error" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" -dependencies = [ - "anchor-syn", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-event" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-interface" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" -dependencies = [ - "anchor-syn", - "anyhow", - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-program" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-attribute-state" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-derive-accounts" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" -dependencies = [ - "anchor-syn", - "anyhow", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "anchor-lang" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" -dependencies = [ - "anchor-attribute-access-control", - "anchor-attribute-account", - "anchor-attribute-constant", - "anchor-attribute-error", - "anchor-attribute-event", - "anchor-attribute-interface", - "anchor-attribute-program", - "anchor-attribute-state", - "anchor-derive-accounts", - "arrayref", - "base64 0.13.0", - "bincode", - "borsh", - "bytemuck", - "solana-program", - "thiserror", -] - -[[package]] -name = "anchor-syn" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" -dependencies = [ - "anyhow", - "bs58 0.3.1", - "heck", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "serde", - "serde_json", - "sha2", - "syn", - "thiserror", -] - -[[package]] -name = "anyhow" -version = "1.0.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "blake3" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", - "digest 0.10.3", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "block-padding", - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive", - "hashbrown", -] - -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate", - "proc-macro2", - "syn", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "bs58" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bumpalo" -version = "3.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" - -[[package]] -name = "bv" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" -dependencies = [ - "feature-probe", - "serde", -] - -[[package]] -name = "bytemuck" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" -dependencies = [ - "log", - "web-sys", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "cpufeatures" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" -dependencies = [ - "libc", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" -dependencies = [ - "block-buffer 0.10.2", - "crypto-common", - "subtle", -] - -[[package]] -name = "duplicate-mutable-accounts-secure" -version = "0.1.0" -dependencies = [ - "anchor-lang", -] - -[[package]] -name = "either" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" - -[[package]] -name = "env_logger" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "feature-probe" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" - -[[package]] -name = "generic-array" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" -dependencies = [ - "serde", - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest 0.9.0", - "generic-array", - "hmac", -] - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "itertools" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "js-sys" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "libsecp256k1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" -dependencies = [ - "arrayref", - "base64 0.12.3", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand", - "serde", - "sha2", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "lock_api" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memmap2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" -dependencies = [ - "libc", -] - -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro2" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proc-macro2-diagnostics" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "version_check", - "yansi", -] - -[[package]] -name = "quote" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustversion" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24c8ad4f0c00e1eb5bc7614d236a7f1300e3dbd76b68cac8e06fb00b015ad8d8" - -[[package]] -name = "ryu" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "semver" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" - -[[package]] -name = "serde" -version = "1.0.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug", -] - -[[package]] -name = "smallvec" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" - -[[package]] -name = "solana-frozen-abi" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" -dependencies = [ - "bs58 0.4.0", - "bv", - "generic-array", - "log", - "memmap2", - "rustc_version", - "serde", - "serde_derive", - "sha2", - "solana-frozen-abi-macro", - "solana-logger", - "thiserror", -] - -[[package]] -name = "solana-frozen-abi-macro" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn", -] - -[[package]] -name = "solana-logger" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" -dependencies = [ - "env_logger", - "lazy_static", - "log", -] - -[[package]] -name = "solana-program" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" -dependencies = [ - "base64 0.13.0", - "bincode", - "bitflags", - "blake3", - "borsh", - "borsh-derive", - "bs58 0.4.0", - "bv", - "bytemuck", - "console_error_panic_hook", - "console_log", - "curve25519-dalek", - "getrandom 0.1.16", - "itertools", - "js-sys", - "lazy_static", - "libsecp256k1", - "log", - "num-derive", - "num-traits", - "parking_lot", - "rand", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "sha2", - "sha3", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-logger", - "solana-sdk-macro", - "thiserror", - "wasm-bindgen", -] - -[[package]] -name = "solana-sdk-macro" -version = "1.9.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" -dependencies = [ - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde", -] - -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "unicode-ident" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" - -[[package]] -name = "unicode-segmentation" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" - -[[package]] -name = "web-sys" -version = "0.3.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - -[[package]] -name = "zeroize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" diff --git a/lints/dup_mutable_accounts_2/ui/secure/Cargo.toml b/lints/dup_mutable_accounts_2/ui/secure/Cargo.toml deleted file mode 100644 index 66812b2..0000000 --- a/lints/dup_mutable_accounts_2/ui/secure/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "duplicate-mutable-accounts-secure" -version = "0.1.0" -description = "Created with Anchor" -edition = "2018" - -[lib] -crate-type = ["cdylib", "lib"] -name = "duplicate_mutable_accounts_secure" - -[features] -no-entrypoint = [] -no-idl = [] -no-log-ix-name = [] -cpi = ["no-entrypoint"] -default = [] - -[dependencies] -anchor-lang = "0.24.2" diff --git a/lints/dup_mutable_accounts_2/ui/secure/Xargo.toml b/lints/dup_mutable_accounts_2/ui/secure/Xargo.toml deleted file mode 100644 index 475fb71..0000000 --- a/lints/dup_mutable_accounts_2/ui/secure/Xargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.bpfel-unknown-unknown.dependencies.std] -features = [] diff --git a/lints/dup_mutable_accounts_2/ui/secure/src/lib.rs b/lints/dup_mutable_accounts_2/ui/secure/src/lib.rs deleted file mode 100644 index 0f62931..0000000 --- a/lints/dup_mutable_accounts_2/ui/secure/src/lib.rs +++ /dev/null @@ -1,42 +0,0 @@ -use anchor_lang::prelude::*; - -declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); - -#[program] -pub mod duplicate_mutable_accounts_secure { - use super::*; - - pub fn update( - ctx: Context, - a: u64, - b: u64, - ) -> anchor_lang::solana_program::entrypoint::ProgramResult { - if ctx.accounts.user_a.key() == ctx.accounts.user_b.key() { - return Err(ProgramError::InvalidArgument); - } - - // if ctx.accounts.user_a.key() != ctx.accounts.user_b.key() { - // // do program stuff - // } - - let user_a = &mut ctx.accounts.user_a; - let user_b = &mut ctx.accounts.user_b; - - user_a.data = a; - user_b.data = b; - Ok(()) - } -} - -#[derive(Accounts)] -pub struct Update<'info> { - user_a: Account<'info, User>, - user_b: Account<'info, User>, -} - -#[account] -pub struct User { - data: u64, -} - -fn main() {} diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index 60c16b1..42eab8a 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -29,7 +29,7 @@ const ANCHOR_ACCOUNT_GENERIC_ARG_COUNT: usize = 2; dylint_linting::impl_late_lint! { /// **What it does:** Checks to make sure there is a key check on identical Anchor accounts. /// The key check serves to make sure that two identical accounts do not have the same key, - /// ie, they are unique. An Anchor account (`Account<'info, T>`) is identical to another if + /// ie, they are unique. An Anchor account (`Account<'info, T>`) is identical to another if /// the generic parameter `T` is the same type for each account. /// /// **Why is this bad?** If a program contains two identical, mutable Anchor accounts, and @@ -46,12 +46,12 @@ dylint_linting::impl_late_lint! { /// lint regards expressions with `==` as a secure check, since it assumes the program will /// then return an error (see the secure example). However, it does not explicitly check that /// an error is returned. - /// + /// /// In general, this lint will catch all vulnerabilities if the anchor macro constraints are /// used (see the recommended example). It is not as robust if alternative methods are utilized. /// Thus it is encouraged to use the anchor `#[account]` macro constraints. /// - /// **Example:** + /// **Example:** /// /// ```rust /// #[derive(Accounts)] From d1fe4c58a61a37b5386b2e7fbb4f43efb4e743a6 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Tue, 19 Jul 2022 14:33:52 -0500 Subject: [PATCH 16/24] make ci happy --- lints/duplicate-mutable-accounts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lints/duplicate-mutable-accounts/README.md b/lints/duplicate-mutable-accounts/README.md index 7f9e941..2acf315 100644 --- a/lints/duplicate-mutable-accounts/README.md +++ b/lints/duplicate-mutable-accounts/README.md @@ -2,7 +2,7 @@ **What it does:** Checks to make sure there is a key check on identical Anchor accounts. The key check serves to make sure that two identical accounts do not have the same key, -ie, they are unique. An Anchor account (`Account<'info, T>`) is identical to another if +ie, they are unique. An Anchor account (`Account<'info, T>`) is identical to another if the generic parameter `T` is the same type for each account. **Why is this bad?** If a program contains two identical, mutable Anchor accounts, and From 3e8785e965da25bacaf4fcb31267e078bd44c2c2 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Tue, 19 Jul 2022 14:54:05 -0500 Subject: [PATCH 17/24] fix clippy errors --- .../src/anchor_constraint.rs | 2 +- lints/duplicate-mutable-accounts/src/lib.rs | 36 ++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lints/duplicate-mutable-accounts/src/anchor_constraint.rs b/lints/duplicate-mutable-accounts/src/anchor_constraint.rs index a6fad9c..10d3a37 100644 --- a/lints/duplicate-mutable-accounts/src/anchor_constraint.rs +++ b/lints/duplicate-mutable-accounts/src/anchor_constraint.rs @@ -83,7 +83,7 @@ fn create_token_from_ident(s: &str) -> TokenTree { pub struct Streams(pub Vec); impl Streams { - /// Returns true if `self` has a TokenStream that `other` is a substream of + /// Returns true if `self` has a `TokenStream` that `other` is a substream of pub fn contains(&self, other: &TokenStream) -> bool { self.0 .iter() diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index 42eab8a..aa9ab52 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -9,8 +9,10 @@ extern crate rustc_span; mod alternate_constraint; mod anchor_constraint; -use crate::alternate_constraint::*; -use crate::anchor_constraint::*; +use crate::alternate_constraint::Values; +use crate::anchor_constraint::{ + create_key_check_constraint_tokenstream, get_anchor_account_type_def_id, get_def_id, Streams, +}; use std::collections::{HashMap, VecDeque}; use std::default::Default; @@ -148,10 +150,23 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { fn check_crate_post(&mut self, cx: &LateContext<'tcx>) { // if collected some anchor macro constraints then perform v1 lint - if !self.streams.0.is_empty() { + if self.streams.0.is_empty() { + // TODO: Not a fan of having it span lints for this check when there are no checks whatsoever. + // I'd rather have it span lints to recommended anchor macros, if no checks are found at all + for (first, second) in &self.spans { + span_lint_and_help( + cx, + DUPLICATE_MUTABLE_ACCOUNTS, + *first, + &format!("the expressions on line {:?} and {:?} have identical Account types, yet do not contain a proper key check.", first, second), + Some(*second), + "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", + ); + } + } else { for v in self.accounts.values() { if v.len() > 1 { - let mut deq = VecDeque::from(v.to_owned()); + let mut deq = VecDeque::from(v.clone()); for _ in 0..deq.len() - 1 { let (first, first_span) = deq.pop_front().unwrap(); for (other, other_span) in &deq { @@ -175,19 +190,6 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { } } } - } else { - // TODO: Not a fan of having it span lints for this check when there are no checks whatsoever. - // I'd rather have it span lints to recommended anchor macros, if no checks are found at all - for (first, second) in &self.spans { - span_lint_and_help( - cx, - DUPLICATE_MUTABLE_ACCOUNTS, - *first, - &format!("the expressions on line {:?} and {:?} have identical Account types, yet do not contain a proper key check.", first, second), - Some(*second), - "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", - ); - } } } } From dc3d01df3b53b3106930ec8f023b3b249923bfb0 Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Thu, 21 Jul 2022 02:01:53 +0000 Subject: [PATCH 18/24] Remove .gitignore file; add Cargo.lock --- lints/duplicate-mutable-accounts/.gitignore | 2 - lints/duplicate-mutable-accounts/Cargo.lock | 1799 +++++++++++++++++++ 2 files changed, 1799 insertions(+), 2 deletions(-) delete mode 100644 lints/duplicate-mutable-accounts/.gitignore create mode 100644 lints/duplicate-mutable-accounts/Cargo.lock diff --git a/lints/duplicate-mutable-accounts/.gitignore b/lints/duplicate-mutable-accounts/.gitignore deleted file mode 100644 index 4fffb2f..0000000 --- a/lints/duplicate-mutable-accounts/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target -/Cargo.lock diff --git a/lints/duplicate-mutable-accounts/Cargo.lock b/lints/duplicate-mutable-accounts/Cargo.lock new file mode 100644 index 0000000..739d821 --- /dev/null +++ b/lints/duplicate-mutable-accounts/Cargo.lock @@ -0,0 +1,1799 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.7", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "anchor-attribute-access-control" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b75d05b6b4ac9d95bb6e3b786b27d3a708c4c5a87c92ffaa25bbe9ae4c5d91" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "regex", + "syn", +] + +[[package]] +name = "anchor-attribute-account" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "485351a6d8157750d10d88c8e256f1bf8339262b2220ae9125aed3471309b5de" +dependencies = [ + "anchor-syn", + "anyhow", + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "anchor-attribute-constant" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc632c540913dd051a78b00587cc47f57013d303163ddfaf4fa18717f7ccc1e0" +dependencies = [ + "anchor-syn", + "proc-macro2", + "syn", +] + +[[package]] +name = "anchor-attribute-error" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b5bd1dcfa7f3bc22dacef233d70a9e0bee269c4ac484510662f257cba2353a1" +dependencies = [ + "anchor-syn", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-event" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c6f9e6ce551ac9a177a45c99a65699a860c9e95fac68675138af1246e2591b0" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-interface" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d104aa17418cb329ed7418b227e083d5f326a27f26ce98f5d92e33da62a5f459" +dependencies = [ + "anchor-syn", + "anyhow", + "heck 0.3.3", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-program" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6831b920b173c004ddf7ae1167d1d25e9f002ffcb1773bbc5c7ce532a4441e1" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-attribute-state" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde147b10c71d95dc679785db0b5f3abac0091f789167aa62ac0135e2f54e8b9" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-derive-accounts" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cde98a0e1a56046b040ff591dfda391f88917af2b6487d02b45093c05be3514" +dependencies = [ + "anchor-syn", + "anyhow", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "anchor-lang" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a85dd2c5e29e20c7f4701a43724d6cd5406d0ee5694705522e43da0f26542a84" +dependencies = [ + "anchor-attribute-access-control", + "anchor-attribute-account", + "anchor-attribute-constant", + "anchor-attribute-error", + "anchor-attribute-event", + "anchor-attribute-interface", + "anchor-attribute-program", + "anchor-attribute-state", + "anchor-derive-accounts", + "arrayref", + "base64 0.13.0", + "bincode", + "borsh", + "bytemuck", + "solana-program", + "thiserror", +] + +[[package]] +name = "anchor-syn" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03549dc2eae0b20beba6333b14520e511822a6321cdb1760f841064a69347316" +dependencies = [ + "anyhow", + "bs58 0.3.1", + "heck 0.3.3", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "serde", + "serde_json", + "sha2", + "syn", + "thiserror", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "blake3" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "digest 0.10.3", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive", + "hashbrown", +] + +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate", + "proc-macro2", + "syn", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "bs58" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" + +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bstr" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +dependencies = [ + "memchr", +] + +[[package]] +name = "bumpalo" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" + +[[package]] +name = "bv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" +dependencies = [ + "feature-probe", + "serde", +] + +[[package]] +name = "bytemuck" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c53dfa917ec274df8ed3c572698f381a24eef2efba9492d797301b72b6db408a" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfd2f4180c5721da6335cc9e9061cce522b87a35e51cc57636d28d22a9863c80" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "camino" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3abb7553d5b9b8421c6de7cb02606ff15e0c6eea7d8eadd75ef013fd636bec36" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", +] + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clippy_utils" +version = "0.1.64" +source = "git+https://github.com/rust-lang/rust-clippy?rev=0cb0f7636851f9fcc57085cf80197a2ef6db098f#0cb0f7636851f9fcc57085cf80197a2ef6db098f" +dependencies = [ + "arrayvec", + "if_chain", + "rustc-semver", +] + +[[package]] +name = "compiletest_rs" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "262134ef87408da1ddfe45e33daa0ca43b75286d6b1076446e602d264cf9847e" +dependencies = [ + "diff", + "filetime", + "getopts", + "lazy_static", + "libc", + "log", + "miow", + "regex", + "rustfix", + "serde", + "serde_derive", + "serde_json", + "tester", + "winapi", +] + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "console_log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" +dependencies = [ + "log", + "web-sys", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "cpufeatures" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer 0.10.2", + "crypto-common", + "subtle", +] + +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "duplicate_mutable_accounts" +version = "0.1.0" +dependencies = [ + "anchor-lang", + "clippy_utils", + "dylint_linting", + "dylint_testing", + "if_chain", + "proc-macro2", + "quote", + "solana-lints", +] + +[[package]] +name = "dylint" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd14a51dd176304a879c6d41bcce9b537618c7cbe67a0e0edf8015681ad5d3d" +dependencies = [ + "ansi_term", + "anyhow", + "atty", + "cargo_metadata", + "dirs", + "dylint_internal", + "heck 0.4.0", + "lazy_static", + "log", + "once_cell", + "semver", + "serde", + "serde_json", + "tempfile", + "walkdir", +] + +[[package]] +name = "dylint_internal" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fbed59f03a099ecc70f53214c4da67aa92ffb75c115418b6e74364b9185837" +dependencies = [ + "ansi_term", + "anyhow", + "cargo_metadata", + "if_chain", + "log", + "rust-embed", + "sedregex", + "walkdir", +] + +[[package]] +name = "dylint_linting" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0d3be89f70c448bbecb3dcb30d76caeae6c14a4cc826d86226b7862ef778f8d" +dependencies = [ + "paste", +] + +[[package]] +name = "dylint_testing" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d39ee540202ded889a1f660b3cbf25dce88c453bdccbb59eb8d5e2d4079883f9" +dependencies = [ + "anyhow", + "cargo_metadata", + "compiletest_rs", + "dylint", + "dylint_internal", + "env_logger", + "lazy_static", + "once_cell", + "regex", + "serde_json", + "tempfile", +] + +[[package]] +name = "either" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" + +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "fastrand" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +dependencies = [ + "instant", +] + +[[package]] +name = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "filetime" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "windows-sys", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +dependencies = [ + "serde", + "typenum", + "version_check", +] + +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "globset" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "if_chain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" + +[[package]] +name = "js-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] +name = "libsecp256k1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memmap2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" +dependencies = [ + "libc", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "paste" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" + +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro2" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proc-macro2-diagnostics" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "version_check", + "yansi", +] + +[[package]] +name = "quote" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom 0.2.7", + "redox_syscall", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "rust-embed" +version = "6.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a17e5ac65b318f397182ae94e532da0ba56b88dd1200b774715d36c4943b1c3" +dependencies = [ + "rust-embed-impl", + "rust-embed-utils", + "walkdir", +] + +[[package]] +name = "rust-embed-impl" +version = "6.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94e763e24ba2bf0c72bc6be883f967f794a019fafd1b86ba1daff9c91a7edd30" +dependencies = [ + "proc-macro2", + "quote", + "rust-embed-utils", + "syn", + "walkdir", +] + +[[package]] +name = "rust-embed-utils" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756feca3afcbb1487a1d01f4ecd94cf8ec98ea074c55a69e7136d29fb6166029" +dependencies = [ + "globset", + "sha2", + "walkdir", +] + +[[package]] +name = "rustc-semver" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be1bdc7edf596692617627bbfeaba522131b18e06ca4df2b6b689e3c5d5ce84" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustfix" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd2853d9e26988467753bd9912c3a126f642d05d229a4b53f5752ee36c56481" +dependencies = [ + "anyhow", + "log", + "serde", + "serde_json", +] + +[[package]] +name = "rustversion" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24c8ad4f0c00e1eb5bc7614d236a7f1300e3dbd76b68cac8e06fb00b015ad8d8" + +[[package]] +name = "ryu" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "sedregex" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19411e23596093f03bbd11dc45603b6329bb4bfec77b9fd13e2b9fc9b02efe3e" +dependencies = [ + "regex", +] + +[[package]] +name = "semver" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug", +] + +[[package]] +name = "smallvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" + +[[package]] +name = "solana-frozen-abi" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d4fcb89eb3d0f30bd4b4a31ad1825c9d95cd638509acead00969d7601713288" +dependencies = [ + "bs58 0.4.0", + "bv", + "generic-array", + "log", + "memmap2", + "rustc_version", + "serde", + "serde_derive", + "sha2", + "solana-frozen-abi-macro", + "solana-logger", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d63ab101db88ecccd8da34065b9097b88367e0744fdfd05cb7de87b4ede3717f" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn", +] + +[[package]] +name = "solana-lints" +version = "0.1.0" + +[[package]] +name = "solana-logger" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1805d52fc8277a84c4803c7850c8f41471b57fb0dec7750338955ad6e43e2" +dependencies = [ + "env_logger", + "lazy_static", + "log", +] + +[[package]] +name = "solana-program" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5deafc4902425d40197f74166640300dd20b078e4ffd518c1bb56ceb7e01680" +dependencies = [ + "base64 0.13.0", + "bincode", + "bitflags", + "blake3", + "borsh", + "borsh-derive", + "bs58 0.4.0", + "bv", + "bytemuck", + "console_error_panic_hook", + "console_log", + "curve25519-dalek", + "getrandom 0.1.16", + "itertools", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "num-derive", + "num-traits", + "parking_lot", + "rand", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "sha2", + "sha3", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-sdk-macro", + "thiserror", + "wasm-bindgen", +] + +[[package]] +name = "solana-sdk-macro" +version = "1.9.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db4c93bd43c91290ad54fe6ff86179a859954f196507c4789a4876d38a62f17" +dependencies = [ + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "tester" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0639d10d8f4615f223a57275cf40f9bdb7cfbb806bcb7f7cc56e3beb55a576eb" +dependencies = [ + "cfg-if", + "getopts", + "libc", + "num_cpus", + "term", +] + +[[package]] +name = "thiserror" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "unicode-ident" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" + +[[package]] +name = "unicode-segmentation" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" + +[[package]] +name = "unicode-width" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" + +[[package]] +name = "web-sys" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" From 5ac4c860d0324a8d6d6860ab1103f9f5aca1f95c Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Thu, 21 Jul 2022 15:09:41 -0500 Subject: [PATCH 19/24] fix lint messages when no constraints at all to recommend anchor constraints --- .../src/alternate_constraint.rs | 4 +- lints/duplicate-mutable-accounts/src/lib.rs | 81 ++++++++++++------- .../ui/insecure-2/src/lib.stderr | 48 +++++------ .../ui/insecure/src/lib.stderr | 16 ++-- 4 files changed, 89 insertions(+), 60 deletions(-) diff --git a/lints/duplicate-mutable-accounts/src/alternate_constraint.rs b/lints/duplicate-mutable-accounts/src/alternate_constraint.rs index 4771fd9..4cb38de 100644 --- a/lints/duplicate-mutable-accounts/src/alternate_constraint.rs +++ b/lints/duplicate-mutable-accounts/src/alternate_constraint.rs @@ -13,9 +13,12 @@ use clippy_utils::{ty::match_type, SpanlessEq}; use if_chain::if_chain; use solana_lints::paths; +/// Stores the accounts and if-statements (constraints) found in a function body. pub struct Values<'cx, 'tcx> { cx: &'cx LateContext<'tcx>, + /// Lists of account expressions, partitioned by the Account type T pub accounts: HashMap>>, + /// List of tuples, where (x, y), where x is the left operand of the if statement and y is the right pub if_statements: Vec<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>)>, } @@ -34,7 +37,6 @@ impl<'cx, 'tcx> Values<'cx, 'tcx> { } /// Checks if there is a valid key constraint for `first_account` and `second_account`. - /// NOTE: currently only considers `first.key() == second.key()` or the symmetric relation as valid constraints. /// TODO: if == relation used, should return some error in the THEN block pub fn check_key_constraint( &self, diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index aa9ab52..88e444b 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -79,9 +79,14 @@ dylint_linting::impl_late_lint! { #[derive(Default, Debug)] struct DuplicateMutableAccounts { - accounts: HashMap>, - streams: Streams, + /// Lists of Anchor accounts found in structs that derive Anchor `Accounts` trait, partitioned by Anchor account type + anchor_accounts: HashMap>, + /// List of Anchor `#[account]` macro constraints + anchor_macro_constraints: Streams, + /// List of pairs of Anchor accounts with same types, without any alternate constraint spans: Vec<(Span, Span)>, + /// Indicates if alternate constraints were used or not + no_alternate_constraints: bool, } impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { @@ -94,10 +99,10 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { if match_type(cx, middle_ty, &paths::ANCHOR_ACCOUNT); if let Some(account_id) = get_anchor_account_type_def_id(field); then { - if let Some(v) = self.accounts.get_mut(&account_id) { + if let Some(v) = self.anchor_accounts.get_mut(&account_id) { v.push((field.ident.name, field.span)); } else { - self.accounts.insert(account_id, vec![(field.ident.name, field.span)]); + self.anchor_accounts.insert(account_id, vec![(field.ident.name, field.span)]); } } } @@ -112,7 +117,7 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { if name.as_str() == "account"; if let MacArgs::Delimited(_, _, token_stream) = &attr_item.args; then { - self.streams.0.push(token_stream.clone()); + self.anchor_macro_constraints.0.push(token_stream.clone()); } } } @@ -127,19 +132,19 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { _: HirId, ) { if !span.from_expansion() { - // get all mutable references to Accounts and if_statements in body let mut values = Values::new(cx); values.get_referenced_accounts_and_if_statements(body); - // NOTE: could do this check in check_post_crate if exprs are replaced with HirId, then use - // the HirId to fetch the expr values.accounts.values().for_each(|exprs| { if exprs.len() > 1 { + self.no_alternate_constraints = true; // assume no alternate constraints for current in 0..exprs.len() - 1 { for next in current + 1..exprs.len() { if !values.check_key_constraint(exprs[current], exprs[next]) { - // store for later spanning self.spans.push((exprs[current].span, exprs[next].span)); + } else { + // if there is at least one alt constraint, set flag to false + self.no_alternate_constraints = false; } } } @@ -149,24 +154,46 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { } fn check_crate_post(&mut self, cx: &LateContext<'tcx>) { - // if collected some anchor macro constraints then perform v1 lint - if self.streams.0.is_empty() { - // TODO: Not a fan of having it span lints for this check when there are no checks whatsoever. - // I'd rather have it span lints to recommended anchor macros, if no checks are found at all - for (first, second) in &self.spans { - span_lint_and_help( - cx, - DUPLICATE_MUTABLE_ACCOUNTS, - *first, - &format!("the expressions on line {:?} and {:?} have identical Account types, yet do not contain a proper key check.", first, second), - Some(*second), - "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", - ); + // if no anchor constraints, check for alternate constraints + if self.anchor_macro_constraints.0.is_empty() { + // if no alternate constraints either, recommend using anchor constraints + if self.no_alternate_constraints { + for ident_accounts in self.anchor_accounts.values() { + if ident_accounts.len() > 1 { + for current in 0..ident_accounts.len() - 1 { + for next in current + 1..ident_accounts.len() { + let first = ident_accounts[current]; + let second = ident_accounts[next]; + span_lint_and_help( + cx, + DUPLICATE_MUTABLE_ACCOUNTS, + first.1, + &format!("{} and {} have identical account types but do not have a key check constraint", first.0, second.0), + Some(second.1), + &format!("add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]", first.0, second.0) + ); + } + } + } + } + } else { + // flag lint for missing alternate constraints + for (first, second) in &self.spans { + span_lint_and_help( + cx, + DUPLICATE_MUTABLE_ACCOUNTS, + *first, + &format!("the expressions on line {:?} and {:?} have identical Account types, yet do not contain a proper key check.", first, second), + Some(*second), + "add a key check to make sure the accounts have different keys, e.g., x.key() != y.key()", + ); + } } } else { - for v in self.accounts.values() { - if v.len() > 1 { - let mut deq = VecDeque::from(v.clone()); + // if using anchor constraints, check and flag for missing anchor constraints + for ident_accounts in self.anchor_accounts.values() { + if ident_accounts.len() > 1 { + let mut deq = VecDeque::from(ident_accounts.clone()); for _ in 0..deq.len() - 1 { let (first, first_span) = deq.pop_front().unwrap(); for (other, other_span) in &deq { @@ -174,8 +201,8 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { let symmetric_stream = create_key_check_constraint_tokenstream(*other, first); - if !(self.streams.contains(&stream) - || self.streams.contains(&symmetric_stream)) + if !(self.anchor_macro_constraints.contains(&stream) + || self.anchor_macro_constraints.contains(&symmetric_stream)) { span_lint_and_help( cx, diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr index 06a1eca..2dcf128 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr +++ b/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr @@ -1,39 +1,39 @@ -error: the expressions on line $DIR/lib.rs:15:27: 15:46 (#0) and $DIR/lib.rs:16:27: 16:46 (#0) have identical Account types, yet do not contain a proper key check. - --> $DIR/lib.rs:15:27 +error: user_a and user_b have identical account types but do not have a key check constraint + --> $DIR/lib.rs:28:5 | -LL | let user_a = &mut ctx.accounts.user_a; - | ^^^^^^^^^^^^^^^^^^^ +LL | user_a: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D duplicate-mutable-accounts` implied by `-D warnings` -help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() - --> $DIR/lib.rs:16:27 +help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_b.key())] + --> $DIR/lib.rs:29:5 | -LL | let user_b = &mut ctx.accounts.user_b; - | ^^^^^^^^^^^^^^^^^^^ +LL | user_b: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: the expressions on line $DIR/lib.rs:15:27: 15:46 (#0) and $DIR/lib.rs:17:27: 17:46 (#0) have identical Account types, yet do not contain a proper key check. - --> $DIR/lib.rs:15:27 +error: user_a and user_c have identical account types but do not have a key check constraint + --> $DIR/lib.rs:28:5 | -LL | let user_a = &mut ctx.accounts.user_a; - | ^^^^^^^^^^^^^^^^^^^ +LL | user_a: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() - --> $DIR/lib.rs:17:27 +help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_c.key())] + --> $DIR/lib.rs:30:5 | -LL | let user_c = &mut ctx.accounts.user_c; - | ^^^^^^^^^^^^^^^^^^^ +LL | user_c: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: the expressions on line $DIR/lib.rs:16:27: 16:46 (#0) and $DIR/lib.rs:17:27: 17:46 (#0) have identical Account types, yet do not contain a proper key check. - --> $DIR/lib.rs:16:27 +error: user_b and user_c have identical account types but do not have a key check constraint + --> $DIR/lib.rs:29:5 | -LL | let user_b = &mut ctx.accounts.user_b; - | ^^^^^^^^^^^^^^^^^^^ +LL | user_b: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() - --> $DIR/lib.rs:17:27 +help: add an anchor key check constraint: #[account(constraint = user_b.key() != user_c.key())] + --> $DIR/lib.rs:30:5 | -LL | let user_c = &mut ctx.accounts.user_c; - | ^^^^^^^^^^^^^^^^^^^ +LL | user_c: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr index d86ec52..064418c 100644 --- a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr +++ b/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr @@ -1,15 +1,15 @@ -error: the expressions on line $DIR/lib.rs:14:27: 14:46 (#0) and $DIR/lib.rs:15:27: 15:46 (#0) have identical Account types, yet do not contain a proper key check. - --> $DIR/lib.rs:14:27 +error: user_a and user_b have identical account types but do not have a key check constraint + --> $DIR/lib.rs:25:5 | -LL | let user_a = &mut ctx.accounts.user_a; - | ^^^^^^^^^^^^^^^^^^^ +LL | user_a: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D duplicate-mutable-accounts` implied by `-D warnings` -help: add a key check to make sure the accounts have different keys, e.g., x.key() != y.key() - --> $DIR/lib.rs:15:27 +help: add an anchor key check constraint: #[account(constraint = user_a.key() != user_b.key())] + --> $DIR/lib.rs:26:5 | -LL | let user_b = &mut ctx.accounts.user_b; - | ^^^^^^^^^^^^^^^^^^^ +LL | user_b: Account<'info, User>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error From 1371f3f976ecc568b168596343a439376f07887d Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Fri, 22 Jul 2022 09:36:38 -0500 Subject: [PATCH 20/24] clean up is_substream logic --- .../src/alternate_constraint.rs | 9 ++++--- .../src/anchor_constraint.rs | 26 +++++++------------ lints/duplicate-mutable-accounts/src/lib.rs | 9 ++++--- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/lints/duplicate-mutable-accounts/src/alternate_constraint.rs b/lints/duplicate-mutable-accounts/src/alternate_constraint.rs index 4cb38de..230d1f9 100644 --- a/lints/duplicate-mutable-accounts/src/alternate_constraint.rs +++ b/lints/duplicate-mutable-accounts/src/alternate_constraint.rs @@ -47,11 +47,14 @@ impl<'cx, 'tcx> Values<'cx, 'tcx> { if_chain! { if let ExprKind::MethodCall(path_seg_left, exprs_left, _span) = left.kind; if let ExprKind::MethodCall(path_seg_right, exprs_right, _span) = right.kind; - if path_seg_left.ident.name.as_str() == "key" && path_seg_right.ident.name.as_str() == "key"; + if path_seg_left.ident.name.as_str() == "key" + && path_seg_right.ident.name.as_str() == "key"; if !exprs_left.is_empty() && !exprs_right.is_empty(); let mut spanless_eq = SpanlessEq::new(self.cx); - if (spanless_eq.eq_expr(&exprs_left[0], first_account) && spanless_eq.eq_expr(&exprs_right[0], second_account)) - || (spanless_eq.eq_expr(&exprs_left[0], second_account) && spanless_eq.eq_expr(&exprs_right[0], first_account)); + if (spanless_eq.eq_expr(&exprs_left[0], first_account) + && spanless_eq.eq_expr(&exprs_right[0], second_account)) + || (spanless_eq.eq_expr(&exprs_left[0], second_account) + && spanless_eq.eq_expr(&exprs_right[0], first_account)); then { return true; } diff --git a/lints/duplicate-mutable-accounts/src/anchor_constraint.rs b/lints/duplicate-mutable-accounts/src/anchor_constraint.rs index 10d3a37..dada579 100644 --- a/lints/duplicate-mutable-accounts/src/anchor_constraint.rs +++ b/lints/duplicate-mutable-accounts/src/anchor_constraint.rs @@ -90,27 +90,21 @@ impl Streams { .any(|token_stream| Self::is_substream(token_stream, other)) } - /// Returns true if `other` is a substream of `stream`. By substream we mean in the - /// sense of a substring. + /// Returns true if `other` is a substream of `stream`. By substream we mean in the sense of a substring. // NOTE: a possible optimization is when a match is found, to remove the matched // TokenTrees from the TokenStream, since the constraint has been "checked" so it never // needs to be validated again. This cuts down the number of comparisons. fn is_substream(stream: &TokenStream, other: &TokenStream) -> bool { - let other_len = other.len(); for i in 0..stream.len() { - for (j, other_token) in other.trees().enumerate() { - match stream.trees().nth(i + j) { - Some(token_tree) => { - if !token_tree.eq_unspanned(other_token) { - break; - } - // reached last index, so we have a match - if j == other_len - 1 { - return true; - } - } - None => return false, // reached end of stream - } + if other + .trees() + .enumerate() + .all(|(j, other_token)| match stream.trees().nth(i + j) { + Some(token_tree) => token_tree.eq_unspanned(other_token), + None => false, + }) + { + return true; } } false diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate-mutable-accounts/src/lib.rs index 88e444b..2ce4a02 100644 --- a/lints/duplicate-mutable-accounts/src/lib.rs +++ b/lints/duplicate-mutable-accounts/src/lib.rs @@ -102,7 +102,8 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { if let Some(v) = self.anchor_accounts.get_mut(&account_id) { v.push((field.ident.name, field.span)); } else { - self.anchor_accounts.insert(account_id, vec![(field.ident.name, field.span)]); + self.anchor_accounts + .insert(account_id, vec![(field.ident.name, field.span)]); } } } @@ -140,11 +141,11 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { self.no_alternate_constraints = true; // assume no alternate constraints for current in 0..exprs.len() - 1 { for next in current + 1..exprs.len() { - if !values.check_key_constraint(exprs[current], exprs[next]) { - self.spans.push((exprs[current].span, exprs[next].span)); - } else { + if values.check_key_constraint(exprs[current], exprs[next]) { // if there is at least one alt constraint, set flag to false self.no_alternate_constraints = false; + } else { + self.spans.push((exprs[current].span, exprs[next].span)); } } } From f2aa39ed7e033416bced55bcab7828a6e75acc69 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Tue, 26 Jul 2022 10:52:30 -0500 Subject: [PATCH 21/24] rename lint 6 --- .../.cargo/config.toml | 0 .../Cargo.lock | 0 .../Cargo.toml | 0 .../README.md | 0 .../rust-toolchain | 0 .../src/alternate_constraint.rs | 0 .../src/anchor_constraint.rs | 0 .../src/lib.rs | 0 .../ui/insecure-2/Cargo.toml | 0 .../ui/insecure-2/Xargo.toml | 0 .../ui/insecure-2/src/lib.rs | 0 .../ui/insecure-2/src/lib.stderr | 0 .../ui/insecure/Cargo.toml | 0 .../ui/insecure/Xargo.toml | 0 .../ui/insecure/src/lib.rs | 0 .../ui/insecure/src/lib.stderr | 0 .../ui/recommended-2/Cargo.toml | 0 .../ui/recommended-2/Xargo.toml | 0 .../ui/recommended-2/src/lib.rs | 0 .../ui/recommended-2/src/lib.stderr | 0 .../ui/recommended/Cargo.toml | 0 .../ui/recommended/Xargo.toml | 0 .../ui/recommended/src/lib.rs | 0 .../ui/recommended/src/lib.stderr | 0 .../ui/secure/Cargo.toml | 0 .../ui/secure/Xargo.toml | 0 .../ui/secure/src/lib.rs | 0 .../ui/secure/src/lib.stderr | 0 28 files changed, 0 insertions(+), 0 deletions(-) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/.cargo/config.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/Cargo.lock (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/Cargo.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/README.md (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/rust-toolchain (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/src/alternate_constraint.rs (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/src/anchor_constraint.rs (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/src/lib.rs (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/insecure-2/Cargo.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/insecure-2/Xargo.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/insecure-2/src/lib.rs (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/insecure-2/src/lib.stderr (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/insecure/Cargo.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/insecure/Xargo.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/insecure/src/lib.rs (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/insecure/src/lib.stderr (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/recommended-2/Cargo.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/recommended-2/Xargo.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/recommended-2/src/lib.rs (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/recommended-2/src/lib.stderr (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/recommended/Cargo.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/recommended/Xargo.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/recommended/src/lib.rs (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/recommended/src/lib.stderr (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/secure/Cargo.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/secure/Xargo.toml (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/secure/src/lib.rs (100%) rename lints/{duplicate-mutable-accounts => duplicate_mutable_accounts}/ui/secure/src/lib.stderr (100%) diff --git a/lints/duplicate-mutable-accounts/.cargo/config.toml b/lints/duplicate_mutable_accounts/.cargo/config.toml similarity index 100% rename from lints/duplicate-mutable-accounts/.cargo/config.toml rename to lints/duplicate_mutable_accounts/.cargo/config.toml diff --git a/lints/duplicate-mutable-accounts/Cargo.lock b/lints/duplicate_mutable_accounts/Cargo.lock similarity index 100% rename from lints/duplicate-mutable-accounts/Cargo.lock rename to lints/duplicate_mutable_accounts/Cargo.lock diff --git a/lints/duplicate-mutable-accounts/Cargo.toml b/lints/duplicate_mutable_accounts/Cargo.toml similarity index 100% rename from lints/duplicate-mutable-accounts/Cargo.toml rename to lints/duplicate_mutable_accounts/Cargo.toml diff --git a/lints/duplicate-mutable-accounts/README.md b/lints/duplicate_mutable_accounts/README.md similarity index 100% rename from lints/duplicate-mutable-accounts/README.md rename to lints/duplicate_mutable_accounts/README.md diff --git a/lints/duplicate-mutable-accounts/rust-toolchain b/lints/duplicate_mutable_accounts/rust-toolchain similarity index 100% rename from lints/duplicate-mutable-accounts/rust-toolchain rename to lints/duplicate_mutable_accounts/rust-toolchain diff --git a/lints/duplicate-mutable-accounts/src/alternate_constraint.rs b/lints/duplicate_mutable_accounts/src/alternate_constraint.rs similarity index 100% rename from lints/duplicate-mutable-accounts/src/alternate_constraint.rs rename to lints/duplicate_mutable_accounts/src/alternate_constraint.rs diff --git a/lints/duplicate-mutable-accounts/src/anchor_constraint.rs b/lints/duplicate_mutable_accounts/src/anchor_constraint.rs similarity index 100% rename from lints/duplicate-mutable-accounts/src/anchor_constraint.rs rename to lints/duplicate_mutable_accounts/src/anchor_constraint.rs diff --git a/lints/duplicate-mutable-accounts/src/lib.rs b/lints/duplicate_mutable_accounts/src/lib.rs similarity index 100% rename from lints/duplicate-mutable-accounts/src/lib.rs rename to lints/duplicate_mutable_accounts/src/lib.rs diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.toml b/lints/duplicate_mutable_accounts/ui/insecure-2/Cargo.toml similarity index 100% rename from lints/duplicate-mutable-accounts/ui/insecure-2/Cargo.toml rename to lints/duplicate_mutable_accounts/ui/insecure-2/Cargo.toml diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/Xargo.toml b/lints/duplicate_mutable_accounts/ui/insecure-2/Xargo.toml similarity index 100% rename from lints/duplicate-mutable-accounts/ui/insecure-2/Xargo.toml rename to lints/duplicate_mutable_accounts/ui/insecure-2/Xargo.toml diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs b/lints/duplicate_mutable_accounts/ui/insecure-2/src/lib.rs similarity index 100% rename from lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.rs rename to lints/duplicate_mutable_accounts/ui/insecure-2/src/lib.rs diff --git a/lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr b/lints/duplicate_mutable_accounts/ui/insecure-2/src/lib.stderr similarity index 100% rename from lints/duplicate-mutable-accounts/ui/insecure-2/src/lib.stderr rename to lints/duplicate_mutable_accounts/ui/insecure-2/src/lib.stderr diff --git a/lints/duplicate-mutable-accounts/ui/insecure/Cargo.toml b/lints/duplicate_mutable_accounts/ui/insecure/Cargo.toml similarity index 100% rename from lints/duplicate-mutable-accounts/ui/insecure/Cargo.toml rename to lints/duplicate_mutable_accounts/ui/insecure/Cargo.toml diff --git a/lints/duplicate-mutable-accounts/ui/insecure/Xargo.toml b/lints/duplicate_mutable_accounts/ui/insecure/Xargo.toml similarity index 100% rename from lints/duplicate-mutable-accounts/ui/insecure/Xargo.toml rename to lints/duplicate_mutable_accounts/ui/insecure/Xargo.toml diff --git a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.rs b/lints/duplicate_mutable_accounts/ui/insecure/src/lib.rs similarity index 100% rename from lints/duplicate-mutable-accounts/ui/insecure/src/lib.rs rename to lints/duplicate_mutable_accounts/ui/insecure/src/lib.rs diff --git a/lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr b/lints/duplicate_mutable_accounts/ui/insecure/src/lib.stderr similarity index 100% rename from lints/duplicate-mutable-accounts/ui/insecure/src/lib.stderr rename to lints/duplicate_mutable_accounts/ui/insecure/src/lib.stderr diff --git a/lints/duplicate-mutable-accounts/ui/recommended-2/Cargo.toml b/lints/duplicate_mutable_accounts/ui/recommended-2/Cargo.toml similarity index 100% rename from lints/duplicate-mutable-accounts/ui/recommended-2/Cargo.toml rename to lints/duplicate_mutable_accounts/ui/recommended-2/Cargo.toml diff --git a/lints/duplicate-mutable-accounts/ui/recommended-2/Xargo.toml b/lints/duplicate_mutable_accounts/ui/recommended-2/Xargo.toml similarity index 100% rename from lints/duplicate-mutable-accounts/ui/recommended-2/Xargo.toml rename to lints/duplicate_mutable_accounts/ui/recommended-2/Xargo.toml diff --git a/lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.rs b/lints/duplicate_mutable_accounts/ui/recommended-2/src/lib.rs similarity index 100% rename from lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.rs rename to lints/duplicate_mutable_accounts/ui/recommended-2/src/lib.rs diff --git a/lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.stderr b/lints/duplicate_mutable_accounts/ui/recommended-2/src/lib.stderr similarity index 100% rename from lints/duplicate-mutable-accounts/ui/recommended-2/src/lib.stderr rename to lints/duplicate_mutable_accounts/ui/recommended-2/src/lib.stderr diff --git a/lints/duplicate-mutable-accounts/ui/recommended/Cargo.toml b/lints/duplicate_mutable_accounts/ui/recommended/Cargo.toml similarity index 100% rename from lints/duplicate-mutable-accounts/ui/recommended/Cargo.toml rename to lints/duplicate_mutable_accounts/ui/recommended/Cargo.toml diff --git a/lints/duplicate-mutable-accounts/ui/recommended/Xargo.toml b/lints/duplicate_mutable_accounts/ui/recommended/Xargo.toml similarity index 100% rename from lints/duplicate-mutable-accounts/ui/recommended/Xargo.toml rename to lints/duplicate_mutable_accounts/ui/recommended/Xargo.toml diff --git a/lints/duplicate-mutable-accounts/ui/recommended/src/lib.rs b/lints/duplicate_mutable_accounts/ui/recommended/src/lib.rs similarity index 100% rename from lints/duplicate-mutable-accounts/ui/recommended/src/lib.rs rename to lints/duplicate_mutable_accounts/ui/recommended/src/lib.rs diff --git a/lints/duplicate-mutable-accounts/ui/recommended/src/lib.stderr b/lints/duplicate_mutable_accounts/ui/recommended/src/lib.stderr similarity index 100% rename from lints/duplicate-mutable-accounts/ui/recommended/src/lib.stderr rename to lints/duplicate_mutable_accounts/ui/recommended/src/lib.stderr diff --git a/lints/duplicate-mutable-accounts/ui/secure/Cargo.toml b/lints/duplicate_mutable_accounts/ui/secure/Cargo.toml similarity index 100% rename from lints/duplicate-mutable-accounts/ui/secure/Cargo.toml rename to lints/duplicate_mutable_accounts/ui/secure/Cargo.toml diff --git a/lints/duplicate-mutable-accounts/ui/secure/Xargo.toml b/lints/duplicate_mutable_accounts/ui/secure/Xargo.toml similarity index 100% rename from lints/duplicate-mutable-accounts/ui/secure/Xargo.toml rename to lints/duplicate_mutable_accounts/ui/secure/Xargo.toml diff --git a/lints/duplicate-mutable-accounts/ui/secure/src/lib.rs b/lints/duplicate_mutable_accounts/ui/secure/src/lib.rs similarity index 100% rename from lints/duplicate-mutable-accounts/ui/secure/src/lib.rs rename to lints/duplicate_mutable_accounts/ui/secure/src/lib.rs diff --git a/lints/duplicate-mutable-accounts/ui/secure/src/lib.stderr b/lints/duplicate_mutable_accounts/ui/secure/src/lib.stderr similarity index 100% rename from lints/duplicate-mutable-accounts/ui/secure/src/lib.stderr rename to lints/duplicate_mutable_accounts/ui/secure/src/lib.stderr From 8a3dfe47b38b07e53a4ccca55343a59d5ef06ba2 Mon Sep 17 00:00:00 2001 From: Victor Wei Date: Fri, 12 Aug 2022 10:37:24 -0500 Subject: [PATCH 22/24] upgrade toolchain --- lints/duplicate_mutable_accounts/Cargo.lock | 4 +-- lints/duplicate_mutable_accounts/Cargo.toml | 2 +- .../duplicate_mutable_accounts/rust-toolchain | 2 +- .../src/anchor_constraint.rs | 26 +++++++++---------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lints/duplicate_mutable_accounts/Cargo.lock b/lints/duplicate_mutable_accounts/Cargo.lock index 739d821..1d625fe 100644 --- a/lints/duplicate_mutable_accounts/Cargo.lock +++ b/lints/duplicate_mutable_accounts/Cargo.lock @@ -446,8 +446,8 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clippy_utils" -version = "0.1.64" -source = "git+https://github.com/rust-lang/rust-clippy?rev=0cb0f7636851f9fcc57085cf80197a2ef6db098f#0cb0f7636851f9fcc57085cf80197a2ef6db098f" +version = "0.1.65" +source = "git+https://github.com/rust-lang/rust-clippy?rev=2b2190cb5667cdd276a24ef8b9f3692209c54a89#2b2190cb5667cdd276a24ef8b9f3692209c54a89" dependencies = [ "arrayvec", "if_chain", diff --git a/lints/duplicate_mutable_accounts/Cargo.toml b/lints/duplicate_mutable_accounts/Cargo.toml index 7a2cb05..567f9f5 100644 --- a/lints/duplicate_mutable_accounts/Cargo.toml +++ b/lints/duplicate_mutable_accounts/Cargo.toml @@ -30,7 +30,7 @@ name = "recommended-2" path = "ui/recommended-2/src/lib.rs" [dependencies] -clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "0cb0f7636851f9fcc57085cf80197a2ef6db098f" } +clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "2b2190cb5667cdd276a24ef8b9f3692209c54a89" } dylint_linting = "2.0.1" if_chain = "1.0.2" proc-macro2 = "1.0.40" diff --git a/lints/duplicate_mutable_accounts/rust-toolchain b/lints/duplicate_mutable_accounts/rust-toolchain index 2056264..ccdc31c 100644 --- a/lints/duplicate_mutable_accounts/rust-toolchain +++ b/lints/duplicate_mutable_accounts/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2022-06-30" +channel = "nightly-2022-08-11" components = ["llvm-tools-preview", "rustc-dev"] diff --git a/lints/duplicate_mutable_accounts/src/anchor_constraint.rs b/lints/duplicate_mutable_accounts/src/anchor_constraint.rs index dada579..4a44c4a 100644 --- a/lints/duplicate_mutable_accounts/src/anchor_constraint.rs +++ b/lints/duplicate_mutable_accounts/src/anchor_constraint.rs @@ -2,7 +2,7 @@ use std::default::Default; use rustc_ast::{ token::{Delimiter, Token, TokenKind}, - tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndSpacing}, + tokenstream::{DelimSpan, Spacing, TokenStream, TokenTree}, }; use rustc_hir::{def::Res, FieldDef, GenericArg, QPath, TyKind}; use rustc_span::{ @@ -51,23 +51,23 @@ pub fn create_key_check_constraint_tokenstream(a: Symbol, b: Symbol) -> TokenStr // TODO: may be more efficient way to do this, since the stream is effectively fixed // and determined. Only two tokens are variable. let constraint = vec![ - TreeAndSpacing::from(create_token_from_ident(a.as_str())), - TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP))), - TreeAndSpacing::from(create_token_from_ident("key")), - TreeAndSpacing::from(TokenTree::Delimited( + create_token_from_ident(a.as_str()), + TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP), Spacing::Alone), + create_token_from_ident("key"), + TokenTree::Delimited( DelimSpan::dummy(), Delimiter::Parenthesis, TokenStream::new(vec![]), - )), - TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Ne, DUMMY_SP))), - TreeAndSpacing::from(create_token_from_ident(b.as_str())), - TreeAndSpacing::from(TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP))), - TreeAndSpacing::from(create_token_from_ident("key")), - TreeAndSpacing::from(TokenTree::Delimited( + ), + TokenTree::Token(Token::new(TokenKind::Ne, DUMMY_SP), Spacing::Alone), + create_token_from_ident(b.as_str()), + TokenTree::Token(Token::new(TokenKind::Dot, DUMMY_SP), Spacing::Alone), + create_token_from_ident("key"), + TokenTree::Delimited( DelimSpan::dummy(), Delimiter::Parenthesis, TokenStream::new(vec![]), - )), + ), ]; TokenStream::new(constraint) @@ -76,7 +76,7 @@ pub fn create_key_check_constraint_tokenstream(a: Symbol, b: Symbol) -> TokenStr /// Returns a `TokenTree::Token` which has `TokenKind::Ident`, with the string set to `s`. fn create_token_from_ident(s: &str) -> TokenTree { let ident = Ident::from_str(s); - TokenTree::Token(Token::from_ast_ident(ident)) + TokenTree::Token(Token::from_ast_ident(ident), Spacing::Alone) } #[derive(Debug, Default)] From 539854415bd7c5e0b28a1dc3fd1effce32a5c9e3 Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Sun, 14 Aug 2022 18:12:18 +0000 Subject: [PATCH 23/24] Adjust path names --- lints/duplicate_mutable_accounts/src/alternate_constraint.rs | 2 +- lints/duplicate_mutable_accounts/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lints/duplicate_mutable_accounts/src/alternate_constraint.rs b/lints/duplicate_mutable_accounts/src/alternate_constraint.rs index 230d1f9..b95aed5 100644 --- a/lints/duplicate_mutable_accounts/src/alternate_constraint.rs +++ b/lints/duplicate_mutable_accounts/src/alternate_constraint.rs @@ -74,7 +74,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for Values<'cx, 'tcx> { let middle_ty = self.cx.typeck_results().expr_ty(mut_expr); // let mut_expr_def_id = self.cx.tcx.hir().local_def_id(mut_expr.hir_id).to_def_id(); // let middle_ty = self.cx.tcx.type_of(mut_expr_def_id); - if match_type(self.cx, middle_ty, &paths::ANCHOR_ACCOUNT); + if match_type(self.cx, middle_ty, &paths::ANCHOR_LANG_ACCOUNT); // grab T generic parameter if let MiddleTyKind::Adt(_adt_def, substs) = middle_ty.kind(); if substs.len() == ANCHOR_ACCOUNT_GENERIC_ARG_COUNT; diff --git a/lints/duplicate_mutable_accounts/src/lib.rs b/lints/duplicate_mutable_accounts/src/lib.rs index 2ce4a02..611dfe4 100644 --- a/lints/duplicate_mutable_accounts/src/lib.rs +++ b/lints/duplicate_mutable_accounts/src/lib.rs @@ -96,7 +96,7 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts { if_chain! { if let Some(def_id) = get_def_id(field.ty); let middle_ty = cx.tcx.type_of(def_id); - if match_type(cx, middle_ty, &paths::ANCHOR_ACCOUNT); + if match_type(cx, middle_ty, &paths::ANCHOR_LANG_ACCOUNT); if let Some(account_id) = get_anchor_account_type_def_id(field); then { if let Some(v) = self.anchor_accounts.get_mut(&account_id) { From e3d777b3d3323e985b35ea579a21d1e09076d539 Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Sun, 14 Aug 2022 18:26:26 +0000 Subject: [PATCH 24/24] Use shared target directory --- lints/duplicate_mutable_accounts/.cargo/config.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lints/duplicate_mutable_accounts/.cargo/config.toml b/lints/duplicate_mutable_accounts/.cargo/config.toml index 46d1571..6f48fa3 100644 --- a/lints/duplicate_mutable_accounts/.cargo/config.toml +++ b/lints/duplicate_mutable_accounts/.cargo/config.toml @@ -1,3 +1,6 @@ +[build] +target-dir = "../../target" + [target.aarch64-apple-darwin] linker = "dylint-link"