crytic / crytic/solana-lints

Make 6-duplicate-mutable-accounts lint handle more cases

Open
#7 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
48
Forks
11
PR merge metrics
No merged PRs in 30d

Description

The current lint implementation handles the case when there are only two duplicate accounts just fine. This is because there only needs to be one constraint, to check the keys between `a` and `b` are not equal.

If there are >2 duplicate mutable accounts in the program, things become more complex, because of two main reasons. First, as more identical accounts are added, the number of constraints does not scale linearly. For example, if we have 3 accounts, we don't have 1 extra constraint, but 2 extra constraints. If we add 1 account to bring the total to 4, we have to add 3 more constraints to make sure all keys are unique.

Second, as multiple constraints are added, they don't have to all be specified in a single `#[account]` macro. Instead of creating a single macro, with the constraints comma-separated, like `#[account(constraint = x, constraint = y...)]`, the program may choose to have many different macros, partitioning the set of required constraints in whatever way, for whatever reason.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.