Skip to content

Add secondary key permissions check in transfer_funds#1963

Merged
Neopallium merged 1 commit into
developfrom
check-secondary_key-perms
Jun 12, 2026
Merged

Add secondary key permissions check in transfer_funds#1963
Neopallium merged 1 commit into
developfrom
check-secondary_key-perms

Conversation

@HenriqueNogara

Copy link
Copy Markdown
Contributor

changelog

other

Add secondary key permissions check in transfer_funds

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR strengthens settlement::transfer_funds authorization by ensuring that when the source is a portfolio, secondary keys must also have explicit portfolio permissions (in addition to custody checks). This aligns transfer_funds with existing portfolio permission enforcement patterns used elsewhere in the runtime.

Changes:

  • Extend PortfolioFnTrait to support an AccountId-parameterized secondary-key permission check via ensure_portfolio_custody_and_permission.
  • Update pallet_settlement::transfer_funds authorization to call the new custody+permission check for portfolio sources.
  • Add a runtime test covering rejection of portfolio transfers initiated by a secondary key without portfolio permissions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
primitives/src/traits.rs Extends the portfolio custody trait to include secondary-key portfolio permission checks.
pallets/settlement/src/lib.rs Enforces portfolio secondary-key permission checks during transfer_funds authorization.
pallets/runtime/tests/src/settlement_pallet/transfer_funds.rs Adds regression test ensuring unauthorized secondary keys cannot transfer from portfolios.
pallets/portfolio/src/lib.rs Implements the updated PortfolioFnTrait (now generic over AccountId) and forwards to existing pallet logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Neopallium Neopallium merged commit 440dac4 into develop Jun 12, 2026
20 checks passed
@Neopallium Neopallium deleted the check-secondary_key-perms branch June 12, 2026 11:19
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