-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Market: losing bids stuck BID_OPEN after lease creation
Describe the bug
When a lease is created for one bid on an order, other providers’ bids on that same order can stay BID_OPEN on chain with bid escrow still open, even though MsgCreateLease completes successfully (code 0).
Root cause
-
Escrow
onAccountClosedhooks ran for all escrow scopes. The market module registersOnEscrowAccountClosed, which treats the account ID as a deployment escrow and callsDeploymentIDFromEscrowID. That fails forScopeBid(bid escrows). The hook error bubbled up andAccountClosefailed for losing bids during lease creation. -
The
CreateLeaseloser loop stopped early on that error. TheWithBidsForOrdercallbackreturn truewhenAccountClosefailed, which ends iteration and skips remaining open bids. Those bids were never marked lost and their escrows were never closed.
Fix
-
In
x/escrow/keeper, invokeonAccountClosedhooks only whenobj.ID.Scope == ScopeDeployment(bid and other scopes skip hooks;AccountClosecan complete). -
In
x/market/handlerCreateLease, do notreturn trueonAccountClosefailure; log andreturn falseso every otherBID_OPENbid on the order is still processed.
To reproduce
-
Create a deployment and an order; have at least two providers place open bids on the same order (same dseq / gseq / oseq).
-
Create a lease for one of those bids (
akash tx market lease create …or equivalent). -
Query the other provider’s bid, e.g.
akash query market bid get ….
Observed (bug): That bid can remain state: open with bid escrow still open, while the winning bid is active and the lease exists.
Reproduction is deterministic when the pre-fix code runs bid
AccountClosethrough deployment-only hooks and the loser callback stops after the first failure.
Expected behavior
After a successful MsgCreateLease:
- Every other open bid on that order is
BID_LOST. - Each losing bid’s bid escrow is closed (normal return of bid deposit / settlement path).
- The winner remains
BID_ACTIVEwith bid escrow behavior unchanged for the lease.
Additional context (optional)
- Area:
x/escrow/keeper(saveAccount),x/market/handler/server.go(CreateLeaseloser loop). - Network: Consensus / state-machine change; coordinated node release required.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status