Skip to content

fix(schedule-transactions): derive magic fee vault from effective validator authority#1126

Open
vikions wants to merge 1 commit intomagicblock-labs:masterfrom
vikions:fix/effective-validator-authority-fee-vault
Open

fix(schedule-transactions): derive magic fee vault from effective validator authority#1126
vikions wants to merge 1 commit intomagicblock-labs:masterfrom
vikions:fix/effective-validator-authority-fee-vault

Conversation

@vikions
Copy link
Copy Markdown

@vikions vikions commented Apr 1, 2026

Summary

When a validator authority override is active, delegated fee-vault validation should derive the MagicBlock fee-vault PDA from the effective validator authority, not the base validator authority.

This change updates the delegated fee-vault path to use effective_validator_authority_id(), preserving the existing delegated payer flow when no override is set and making the override path consistent with the rest of the authority-handling logic.

It also adds regression coverage for delegated payer schedule commits under validator authority override, including a negative case showing that base-authority fee vaults are rejected while an override is active.

Testing

  • cargo test -p magicblock-program delegated_payer_charges_fee_vault -- --nocapture
  • cargo test -p magicblock-program delegated_payer_uses_override_fee_vault -- --nocapture
  • cargo test -p magicblock-program rejects_base_fee_vault_under_override -- --nocapture

Summary by CodeRabbit

Release Notes

  • Chores

    • Updated fee vault derivation logic for program address computation.
  • Tests

    • Enhanced test coverage for fee vault validation with delegated payers.
    • Added test cases to verify fee vault account validation and fee charging behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 67fe697b-b46a-4cad-9fe6-a7d3d480929b

📥 Commits

Reviewing files that changed from the base of the PR and between 28ced8d and b4e653e.

📒 Files selected for processing (2)
  • programs/magicblock/src/schedule_transactions/mod.rs
  • programs/magicblock/src/schedule_transactions/process_schedule_commit_tests.rs

📝 Walkthrough

Walkthrough

The changes update the PDA seed derivation in the fee vault logic and introduce test infrastructure to validate fee vault behavior under validator authority overrides. The main production change modifies magic_fee_vault_pubkey() to use effective_validator_authority_id() instead of validator_authority_id() for computing the magic-fee-vault program address. Test enhancements introduce a ValidatorAuthorityOverrideGuard for temporary test state management, refactor transaction preparation helpers to accept explicit fee vault parameters, and add validation tests confirming that fee vault derivation respects validator authority overrides and properly rejects mismatched vaults.

Suggested reviewers

  • GabrielePicco
  • taco-paco
  • thlorenz
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant