Skip to content

Change Fee Handler#1869

Merged
Neopallium merged 5 commits intodevelopfrom
fix-fee-payer
Jan 29, 2026
Merged

Change Fee Handler#1869
Neopallium merged 5 commits intodevelopfrom
fix-fee-payer

Conversation

@HenriqueNogara
Copy link
Copy Markdown
Contributor

@HenriqueNogara HenriqueNogara commented Jan 22, 2026

other

  • Update CddHandler to decrease [Authorization.count] every time the any of the following extrinsics fail:
    • pallet-identity (accept_primary_key, join_identity_as_key, rotate_primary_key_to_secondary);
    • pallet-relayer (accept_paying_key)
    • pallet-multisig (accept_multisig_signer)

Copy link
Copy Markdown
Contributor

@Neopallium Neopallium left a comment

Choose a reason for hiding this comment

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

Looks good.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates Polymesh fee-handling and identity authorization retry behavior so that certain authorization-based extrinsics can have their retry counters decremented when the extrinsic fails.

Changes:

  • Extends CddAndFeeDetails to track authorization IDs and decrement authorization retry counts on failed dispatch.
  • Updates ChargeTransactionPayment to capture an auth_id in pre_dispatch and decrement on post_dispatch failure.
  • Introduces a new MaxAuthRetries runtime constant and uses it to initialize Authorization.count, with get_non_expired_auth now requiring count > 0.

Reviewed changes

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

Show a summary per file
File Description
primitives/src/traits.rs Extends CddAndFeeDetails with payer-context helpers plus authorization-id/retry hooks; changes get_valid_payer signature to take AccountId by value.
pallets/transaction-payment/src/lib.rs Tracks auth_id in signed extension Pre and decrements authorization retry count when dispatch fails.
pallets/runtime/tests/src/storage.rs Updates test runtime to implement new CddAndFeeDetails methods and adds MaxAuthRetries.
pallets/runtime/tests/src/staking/mock.rs Updates staking mock runtime to wire MaxAuthRetries and new CddAndFeeDetails signatures.
pallets/runtime/tests/src/relayer_test.rs Updates test callsites for get_valid_payer signature change.
pallets/runtime/tests/src/identity_test.rs Updates test callsites for get_valid_payer signature change.
pallets/runtime/tests/src/fee_details.rs Updates test callsites for get_valid_payer signature change (clones/moves).
pallets/runtime/testnet/src/runtime.rs Wires MaxAuthRetries into the runtime’s pallet_identity::Config.
pallets/runtime/mainnet/src/runtime.rs Wires MaxAuthRetries into the runtime’s pallet_identity::Config.
pallets/runtime/develop/src/runtime.rs Wires MaxAuthRetries into the runtime’s pallet_identity::Config.
pallets/runtime/common/src/fee_details.rs Refactors CddHandler logic and implements authorization-id extraction + decrement hook.
pallets/identity/src/lib.rs Adds new Config associated constant MaxAuthRetries.
pallets/identity/src/auth.rs Initializes Authorization.count from MaxAuthRetries, requires count > 0 for get_non_expired_auth, and adds a decrement helper.

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

@Neopallium Neopallium requested a review from tgntr January 26, 2026 14:00
@Neopallium Neopallium changed the title WIP: Change Fee Handler Change Fee Handler Jan 26, 2026
Neopallium and others added 2 commits January 29, 2026 20:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Neopallium Neopallium merged commit 2c8e2dd into develop Jan 29, 2026
19 checks passed
@Neopallium Neopallium deleted the fix-fee-payer branch January 29, 2026 13:37
expiry,
auth_id: new_auth_id,
count: 50,
count: T::MaxAuthRetries::get() as u32,
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.

nit: MaxAuthRetries const is u8 while Authorization.count param is u32, which requires a type conversion, which is safe but may be unnecessary and probably worth unifying the type for consistency. Probably u8 is enough for the purpose of the param (0-255)

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.

probably worth adding some basic authorization tests to check if retry count is properly decreased and user is rejected when count reaches 0

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.

4 participants