Skip to content

fix: Forward fix for swap instruction breaking change - #21

Merged
denys-cb merged 4 commits into
coinbase:mainfrom
OliverCai0:oliver/readd_whitelist
Sep 10, 2026
Merged

denys-cb merged 4 commits into
coinbase:mainfrom
OliverCai0:oliver/readd_whitelist

Conversation

@OliverCai0

@OliverCai0 OliverCai0 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Restores the whitelist account to swap's account list, matching the instruction signature swap had 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-removal swap account list (with a whitelist account 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, whitelist is now UncheckedAccount<'info>, constrained only by seeds = [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.whitelist is now UncheckedAccount (seeds-validated only, never deserialized); removed the dead enabled/is_whitelisted check from swap(); removed whitelist account creation from initialize() and the Initialize accounts struct (no longer needed since it's never deserialized).
  • state.rs / constants.rs: removed the now-unused AddressWhitelist struct and MAX_WHITELISTED_ADDRESSES.
  • errors.rs: reverted NotWhitelisted back to the DeprecatedNotWhitelisted placeholder pattern used for the other deprecated whitelist errors, since nothing throws it anymore.
  • Removed an ad hoc mainnet verification script that had no place in this PR.

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 AccountNotInitialized and cascading state corruption from it). cargo fmt --check and cargo check both pass.

This branch was also rebased onto main after 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

  • Bug fix
  • New feature
  • Breaking change
  • Dependency update
  • Documentation
  • Refactor / cleanup
  • Other (describe below)

Checklist

  • Tests are included and passing
  • Code is formatted and linted
  • Build succeeds
  • Documentation is updated for any public API changes
  • All commits are signed

@cb-heimdall

cb-heimdall commented Sep 10, 2026 •

Copy link
Copy Markdown

✅ Heimdall Review Status

Requirement Status More Info
Reviews ✅ 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@OliverCai0
OliverCai0 force-pushed the oliver/readd_whitelist branch 2 times, most recently from 94c81f6 to 1ff1e5d Compare September 10, 2026 17:21
@OliverCai0
OliverCai0 force-pushed the oliver/readd_whitelist branch from 1ff1e5d to 933339e Compare September 10, 2026 17:25
@OliverCai0 OliverCai0 changed the title fix: Oliver/readd whitelist fix: Forward fix for swap instruction breaking change Sep 10, 2026
@OliverCai0
OliverCai0 marked this pull request as ready for review September 10, 2026 18:23
@denys-cb
denys-cb merged commit b193204 into coinbase:main Sep 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants