-
Notifications
You must be signed in to change notification settings - Fork 261
fix: lease close reason #2037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: lease close reason #2037
Conversation
WalkthroughThe MarketKeeper.OnGroupClosed API gained a Group_State parameter. Call sites and implementations were updated to pass and act on that state; keeper logic maps group state to lease state/reason, closes related leases and bids, and attempts to close associated escrow payments. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant MarketKeeper
participant LeaseModule as Lease
participant PaymentModule as Payment
Caller->>MarketKeeper: OnGroupClosed(ctx, groupID, state)
activate MarketKeeper
alt state == GroupInsufficientFunds
MarketKeeper->>Lease: OnLeaseClosed(ctx, leaseID, LeaseInsufficientFunds, LeaseClosedReasonInsufficientFunds)
else state == GroupClosed
MarketKeeper->>Lease: OnLeaseClosed(ctx, leaseID, LeaseClosed, LeaseClosedReasonOwner)
else
MarketKeeper->>Lease: OnLeaseClosed(ctx, leaseID, <mapped state/reason>)
end
activate Lease
Lease->>Lease: update state and reason
deactivate Lease
MarketKeeper->>Payment: PaymentClose(ctx, paymentID)
activate Payment
Payment->>Payment: close escrow (log errors, don't fail)
deactivate Payment
deactivate MarketKeeper
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
2b0a8b6 to
6ddfa56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
x/deployment/handler/server.go (1)
156-162: Don’t ignoreOnGroupClosederrors.If
OnGroupClosedfails, the deployment group is closed but market state can remain partially open. Propagating the error keeps state transitions atomic.🔧 Proposed fix
- _ = ms.market.OnGroupClosed(ctx, group.ID, types.GroupClosed) + if err := ms.market.OnGroupClosed(ctx, group.ID, types.GroupClosed); err != nil { + return nil, err + }- _ = ms.market.OnGroupClosed(ctx, group.ID, types.GroupPaused) + if err := ms.market.OnGroupClosed(ctx, group.ID, types.GroupPaused); err != nil { + return nil, err + }Also applies to: 180-186
Description
Closes: akash-network/support#403
Manual testing results
Insufficient funds scenario:
Unstable deployment scenario:
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.
I have...
!to the type prefix if API or client breaking changeCHANGELOG.md