Repository navigation
Conversation
charge computes now + interval_ledgers with checked_add. An interval near u32::MAX therefore made every charge fail with Overflow, although subscribe accepted it. subscribe now refuses an interval that does not fit at the current ledger with InvalidInterval. Tests cover the rejected case and the largest interval that still fits, which must charge. Not covered: a ledger that advances far enough for an accepted interval to overflow later. Charges after that still fail with Overflow, so a full fix needs a rule for that case and is left as a follow-up. Closes stellar-sub#51 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
…sub#50) Add a ChargeStatus enum (Chargeable, Paused, Cancelled, Exhausted, TooEarly, CapWouldBeExceeded, IntervalOverflows) and a charge_status(id) view. It runs the same checks as is_chargeable, in the same order, so Chargeable is returned exactly when is_chargeable is true. Tests cover each reason, and check that the two views agree in each case. IntervalOverflows is defined but is not covered by a test, because it needs a ledger far enough along for an interval to overflow. Closes stellar-sub#50 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
|
@edwina105 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Subscription: charge_status view and interval validation, and design proposals for #49 and #52
ChargeStatusenum and acharge_status(id)view. It runs the same checks asis_chargeable, in the same order, soChargeableis returned exactly whenis_chargeableis true. Tests cover each refusal reason and check that the two views agree.IntervalOverflowsis defined but not covered by a test, because it needs a ledger far enough along for an interval to overflow.subscribenow refuses, withInvalidInterval, an interval that does not fit at the current ledger (now + intervaloverflows). Before this change such a subscription was accepted and every charge failed withOverflow. Tests cover the rejected case and the largest interval that still fits, which must charge.docs/design/49-batch-charge.mdanddocs/design/52-expires-at.md. No contract code is written for them. They are linked withRefs, not closed.Closes #50
Closes #51
Refs #49 (design proposal: docs/design/49-batch-charge.md)
Refs #52 (design proposal: docs/design/52-expires-at.md)
Known gap in #51: a ledger that advances far enough for an accepted interval to overflow would still fail later with
Overflow. A complete fix needs a rule for that case, which is left as a follow-up.Notes for review:
🤖 Generated with Claude Code