Skip to content

Conversation

@xpanvictor
Copy link

BREAKING CHANGE: runtime must define MaxAutoRenewalRetries

Fixes #9548
Problem: After auto-renewal fails due to some error, the system disables autorenewal entirely contrary to the documentation.
Solution: A more robust retry which is configurable in the pallet config. This is compile time setting currently.
Introduce T::MaxAutoRenewalRetries constant in Config trait track retry count in AutoRenewalRetries storage map, increment on each failed renewal attempt. When retries >= max, emit AutoRenewalFailed, remove auto-renew record, and reset counter to 0. Add integration tests:

  • persistent retry when count < max
  • record removal when count >= max

Integration

Downstream projects using pallet-broker must define MaxAutoRenewalRetries config. They just need to pass a retries limit. Can be set to 0 for no retry. This is similar to current logic.

Review Notes

Changes:

  1. Added MaxAutoRenewalRetries to config trait. Default type is u8.
  2. Added a storage for renewal retries record. This increments for failed retries. It resets on success or when renewal is cancelled.
  3. Existing code needs to add the new configuration parameter.

Checklist

  • My PR includes a detailed description as outlined in the "Description" and its two subsections above.
  • My PR follows the labeling requirements of this project (at minimum one label for T required)
    • External contributors: Use /cmd label <label-name> to add labels
    • Maintainers can also add labels manually
  • [ ] I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

Introduce `T::MaxAutoRenewalRetries` constant in `Config` trait
track retry count in `AutoRenewalRetries` storage map, increment on each
failed renewal attempt. When retries >= max, emit `AutoRenewalFailed`, remove
auto-renew record, and reset counter to 0. Add integration tests:
- persistent retry when count < max
- record removal when count >= max

BREAKING CHANGE: runtime must define `MaxAutoRenewalRetries`
@xpanvictor xpanvictor requested a review from a team as a code owner October 31, 2025 16:36
@cla-bot-2021
Copy link

cla-bot-2021 bot commented Oct 31, 2025

User @xpanvictor, please sign the CLA here.

@xpanvictor
Copy link
Author

/cmd prdoc

@franciscoaguirre franciscoaguirre added the T2-pallets This PR/Issue is related to a particular pallet. label Oct 31, 2025
Copy link
Contributor

@franciscoaguirre franciscoaguirre left a comment

Choose a reason for hiding this comment

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

The logic looks good. @seadanda ?

@@ -0,0 +1,35 @@
title: Xpan auto retry limit
doc:
- audience: Todo
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- audience: Todo
- audience: Runtime Dev

title: Xpan auto retry limit
doc:
- audience: Todo
description: |-
Copy link
Contributor

Choose a reason for hiding this comment

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

You can probably just leave the description

Co-authored-by: Francisco Aguirre <[email protected]>
Copy link
Contributor

@franciscoaguirre franciscoaguirre left a comment

Choose a reason for hiding this comment

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

You should add this new config item to both coretime-westend and coretime-rococo

@xpanvictor
Copy link
Author

You should add this new config item to both coretime-westend and coretime-rococo

Ok. I'll do that.

@xpanvictor
Copy link
Author

You should add this new config item to both coretime-westend and coretime-rococo

Can you share a pointer to the crates? A bit large navigating the sdk.

@franciscoaguirre
Copy link
Contributor

@xpanvictor
Copy link
Author

They're both under https://github.com/paritytech/polkadot-sdk/tree/master/cumulus/parachains/runtimes/coretime

I've added them @franciscoaguirre, is that fine? Also used default constu8<2> as I used in test.

@xpanvictor
Copy link
Author

https://docs.polkadot.com/develop/parachains/deployment/coretime-renewal/#:~:text=Even%20if%20an,the%20following%20sections.

I will make changes to the docs to reflect the new structure.

Also what should we make the MaxAutoRenewalRetries value be for coretime-rococo and coretime-westend?

@franciscoaguirre
Copy link
Contributor

2 looks like a good value

@acatangiu acatangiu requested a review from seadanda November 5, 2025 09:45
Copy link
Contributor

@seadanda seadanda left a comment

Choose a reason for hiding this comment

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

Had a quick look, will take more time over the core approach and logic

@xpanvictor
Copy link
Author

@seadanda can you review, I've applied the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T2-pallets This PR/Issue is related to a particular pallet.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-renewal gets disabled after failed payment attempts

3 participants