fix: Forward fix for swap instruction breaking change - #21
Merged
Merged
Conversation
✅ Heimdall Review Status
|
OliverCai0
force-pushed
the
oliver/readd_whitelist
branch
2 times, most recently
from
September 10, 2026 17:21
94c81f6 to
1ff1e5d
Compare
OliverCai0
force-pushed
the
oliver/readd_whitelist
branch
from
September 10, 2026 17:25
1ff1e5d to
933339e
Compare
OliverCai0
marked this pull request as ready for review
September 10, 2026 18:23
denys-cb
approved these changes
Sep 10, 2026
6 of 12 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Restores the
whitelistaccount toswap's account list, matching the instruction signatureswaphad before whitelist support was removed. This is purely an interface-compatibility fix — whitelist enforcement remains fully deprecated; this PR does not resurrect any gating logic. It exists so callers/indexers that still encode the pre-removalswapaccount list (with awhitelistaccount in it) don't break.Why not just restore the old
Account<'info, AddressWhitelist>field?Doing so requires the account to already exist and deserialize on-chain, which broke CI (
AccountNotInitialized) for freshly-initialized pools — a fresh devnet/test deployment never had a whitelist account created for it. Since enforcement is dead either way,whitelistis nowUncheckedAccount<'info>, constrained only byseeds = [ADDRESS_WHITELIST_SEED], bump: the caller must still pass the correct PDA address, but Anchor no longer requires that account to be initialized or owned by the program. This works whether that PDA is the real orphaned account left on mainnet from before whitelist removal, or an address that's never been created (fresh devnet/local pools).Changes
lib.rs:Swap.whitelistis nowUncheckedAccount(seeds-validated only, never deserialized); removed the deadenabled/is_whitelistedcheck fromswap(); removed whitelist account creation frominitialize()and theInitializeaccounts struct (no longer needed since it's never deserialized).state.rs/constants.rs: removed the now-unusedAddressWhiteliststruct andMAX_WHITELISTED_ADDRESSES.errors.rs: revertedNotWhitelistedback to theDeprecatedNotWhitelistedplaceholder pattern used for the other deprecated whitelist errors, since nothing throws it anymore.Testing
Ran the full Anchor test suite against a local validator set up the same way CI does (ephemeral program ID, upgradeable deploy, funded wallet): 93 passing, 0 failing (previously 22 failing with
AccountNotInitializedand cascading state corruption from it).cargo fmt --checkandcargo checkboth pass.This branch was also rebased onto
mainafter PR #20 (RBAC) merged, to resolve the merge conflicts GitHub was reporting — no functional changes from that, just replaying the whitelist-specific commits on the current base.Type of Change
Checklist