-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Disallow duplicate *mutable* accounts by default #3946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jacobcreech
merged 46 commits into
solana-foundation:master
from
swaroop-osec:feat/issue-3825
Dec 9, 2025
Merged
Changes from 24 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
b425392
feat: Add duplicate mutable account constraint
swaroop-osec 505727e
feat: tests for duplicate mutable accounts
swaroop-osec e42b1bc
feat: add test for duplicate mutable accounts in workflow
swaroop-osec da757c8
style(tests): prettier
swaroop-osec b077343
chore: update benchmarks
swaroop-osec 62b76d0
feat: exclude UncheckedAccounts from duplicate mutable account checks
swaroop-osec 4b3b85c
feat(tests): add duplicate-mutable-accounts to test scripts
swaroop-osec da22fa8
feat: enhance duplicate mutable account checks for optional fields
swaroop-osec 0ee61f8
chore(bench): update
swaroop-osec a6f6c57
fix: update program IDs
swaroop-osec 4035b0e
feat: allow duplicate accounts in realloc2 ix
swaroop-osec c65be84
chore(bench): update
swaroop-osec d55c2ef
chore(bench): update
swaroop-osec 5c228f5
feat(tests): allow duplicate accounts in misc tests
swaroop-osec 8dd5c8d
fix(bench):update
swaroop-osec a42335a
fix: update program ID for duplicate mutable accounts
swaroop-osec 5237b78
fix: update program ID
swaroop-osec 4a1503e
fix(bench): update
swaroop-osec 6389a61
chore(docs): Updated docs and CHANGELOG.md
swaroop-osec bd20367
refactor: ignore init accounts
swaroop-osec e5fd855
fix(bench): update
swaroop-osec 3d5406a
Merge branch 'master' into feat/issue-3825
swaroop-osec bb5a597
chore: formating
swaroop-osec 6c3535b
refactor: optimize duplicate mutable checks generation
swaroop-osec 3110653
refactor: replace BTreeSet with HashSet
swaroop-osec c3e4f45
Merge branch 'master' into feat/issue-3825
swaroop-osec a289a6d
Merge branch 'master' into feat/issue-3825
swaroop-osec 8e61e4a
(chore): Update benchmarks
swaroop-osec 9bebf80
test(events): use confirmOptions for transaction handling
swaroop-osec 9516a8f
Merge branch 'master' into feat/issue-3825
swaroop-osec 5f52676
chore: Update CHANGELOG.md
swaroop-osec 8fa5a37
feat(lang): Added checks for duplicate mutable accounts in `remaining…
swaroop-osec 7797270
feat(tests): Add nested duplicate account test to prevent mutable acc…
swaroop-osec bbff6e9
chore(bench): Update benchmarks
swaroop-osec 74f1898
fix(lang): Exclude Signer accounts from duplicate mutable checks in a…
swaroop-osec 2ab93ce
feat(tests): Add test to initialize multiple accounts with the same p…
swaroop-osec 10da01a
chore(bench): Update
swaroop-osec 116bf4c
Merge branch 'master' into feat/issue-3825
swaroop-osec 21b3461
fix: package.json
swaroop-osec a196525
refactor: remove unused confirmOptions from event tests
swaroop-osec 11c7e47
chore: update benchmarks
swaroop-osec 0557e75
chore: update benchmarks
swaroop-osec ad3f631
Merge branch 'master' into feat/issue-3825
swaroop-osec aea833c
Update benchmarks
swaroop-osec b1a06c4
Merge branch 'master' into feat/issue-3825
swaroop-osec 6f0944f
chore: Update benchmarks
swaroop-osec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [provider] | ||
| cluster = "localnet" | ||
| wallet = "~/.config/solana/id.json" | ||
|
|
||
| [programs.localnet] | ||
| duplicate_mutable_accounts = "4D6rvpR7TSPwmFottLGa5gpzMcJ76kN8bimQHV9rogjH" | ||
|
|
||
| [scripts] | ||
| test = "yarn run ts-mocha -t 1000000 tests/*.ts" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [workspace] | ||
| members = [ | ||
| "programs/duplicate-mutable-accounts", | ||
| ] | ||
| resolver = "2" | ||
|
|
||
| [profile.release] | ||
| overflow-checks = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "name": "duplicate-mutable-accounts", | ||
| "version": "0.31.1", | ||
| "license": "(MIT OR Apache-2.0)", | ||
| "homepage": "https://github.com/coral-xyz/anchor#readme", | ||
| "bugs": { | ||
| "url": "https://github.com/coral-xyz/anchor/issues" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/coral-xyz/anchor.git" | ||
| }, | ||
| "engines": { | ||
| "node": ">=17" | ||
| }, | ||
| "scripts": { | ||
| "test": "anchor test" | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
tests/duplicate-mutable-accounts/programs/duplicate-mutable-accounts/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| [package] | ||
| name = "duplicate-mutable-accounts" | ||
| version = "0.1.0" | ||
| description = "Created with Anchor" | ||
| edition = "2018" | ||
|
|
||
| [lib] | ||
| crate-type = ["cdylib", "lib"] | ||
| name = "duplicate_mutable_accounts" | ||
|
|
||
| [features] | ||
| no-entrypoint = [] | ||
| cpi = ["no-entrypoint"] | ||
| idl-build = ["anchor-lang/idl-build"] | ||
|
|
||
| [dependencies] | ||
| anchor-lang = { path = "../../../../lang" } |
2 changes: 2 additions & 0 deletions
2
tests/duplicate-mutable-accounts/programs/duplicate-mutable-accounts/Xargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [target.bpfel-unknown-unknown.dependencies.std] | ||
| features = [] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.