Skip to content

fix(sol): minor issues and code quality#562

Open
kiseln wants to merge 8 commits intomainfrom
fix/solana-max-used-nonce
Open

fix(sol): minor issues and code quality#562
kiseln wants to merge 8 commits intomainfrom
fix/solana-max-used-nonce

Conversation

@kiseln
Copy link
Contributor

@kiseln kiseln commented Feb 20, 2026

max_used_nonce not updating

When finalizing a transfer, max_used_nonce value must be updated in the config account. This is needed to properly calculate rent required for nonce accounts. This wasn't happening because the config instance in the common WormholeCPI struct is not marked mutable.

Fix

I decided to keep the config in the shared struct immutable. It's used in 6 different methods and only two (finalize_transfer and finalize_transfer_sol) need to mutate the config. Instead, I added a separate mutable config instance, same way it is already done for finalize_transfer_sol

Wrong account passed to metaplex instruction

The program id is internally ovewritten with the correct instruction, so the code was working as intended. Still rather fix this.

Remove unwraps

Minor code quality cleanup

Remove unsafe code

unsafe block in used_nonces.rs was unnecessary

@kiseln kiseln requested a review from a team February 20, 2026 11:15
@kiseln kiseln changed the title fix: max used nonce not updating fix: minor fix and code quality Feb 20, 2026
@kiseln kiseln changed the title fix: minor fix and code quality fix: minor issues and code quality Feb 20, 2026
Copy link
Collaborator

@karim-en karim-en left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's cover these changes by test using LiteSVM or Mollusk
https://www.anchor-lang.com/docs/testing

@karim-en
Copy link
Collaborator

karim-en commented Mar 7, 2026

@kiseln

@kiseln kiseln changed the title fix: minor issues and code quality fix(sol): minor issues and code quality Mar 9, 2026
@kiseln kiseln requested review from frolvanya and karim-en March 9, 2026 16:47
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.

3 participants