Conversation
There was a problem hiding this comment.
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
CddAndFeeDetailsto track authorization IDs and decrement authorization retry counts on failed dispatch. - Updates
ChargeTransactionPaymentto capture anauth_idinpre_dispatchand decrement onpost_dispatchfailure. - Introduces a new
MaxAuthRetriesruntime constant and uses it to initializeAuthorization.count, withget_non_expired_authnow requiringcount > 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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| expiry, | ||
| auth_id: new_auth_id, | ||
| count: 50, | ||
| count: T::MaxAuthRetries::get() as u32, |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
probably worth adding some basic authorization tests to check if retry count is properly decreased and user is rejected when count reaches 0
other
Authorization.count] every time the any of the following extrinsics fail: