Skip to content

Fix decode_set_authority rejecting Token-2022 authority types - #718

Open
Amadeus-22 wants to merge 1 commit into
michaelhly:masterfrom
Amadeus-22:fix-token-2022-authority-types
Open

Amadeus-22 wants to merge 1 commit into
michaelhly:masterfrom
Amadeus-22:fix-token-2022-authority-types

Conversation

@Amadeus-22

Copy link
Copy Markdown
Contributor

AuthorityType stopped at CLOSE_ACCOUNT (3), but Token-2022 defines authority types up to 17. As a result:

  • decode_set_authority() raised ValueError: 4 is not a valid AuthorityType on any Token-2022 SetAuthority for an extension authority, such as TransferFeeConfig.
  • set_authority() couldn't build one, because SetAuthorityParams rejects the value.
  • The transfer fee authorities set by initialize_transfer_fee_config() could not be rotated or revoked.

This adds authority types 4–17, matching AuthorityType in the token-2022 interface crate (interface/src/instruction.rs). The new test decodes a raw Token-2022 SetAuthority ([6, 4, 1] + pubkey) and round-trips a WithheldWithdraw revoke. It fails on master and passes with this change. Unit tests: 144 passed; ruff check and ruff format --check clean.

🤖 Generated with Claude Code

AuthorityType stopped at CLOSE_ACCOUNT (3), so decode_set_authority()
raised ValueError on any Token-2022 SetAuthority instruction for an
extension authority, and set_authority() could not build one. The
transfer fee authorities set by initialize_transfer_fee_config() could
not be rotated or revoked. Add the Token-2022 authority types 4-17,
matching the token-2022 interface crate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.47%. Comparing base (2ed6b2f) to head (7cac5ed).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #718      +/-   ##
==========================================
+ Coverage   95.41%   95.47%   +0.06%     
==========================================
  Files          25       25              
  Lines        1918     1946      +28     
==========================================
+ Hits         1830     1858      +28     
  Misses         88       88              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Amadeus-22

Copy link
Copy Markdown
Contributor Author

The macOS 3.11 failure is a flaky websocket integration test (test_logs_subscribe_filter_all, connection reset), unrelated to this change; the other jobs pass. Could you re-run it?

@kingsznhone

Copy link
Copy Markdown
Collaborator

looks good

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants