Repository navigation
feat(contract): ADR 0012 + implementation: reclaim storage for settled escrows - #259
Cmitchelle7 wants to merge 1 commit into
Conversation
|
@Cmitchelle7 This PR now has merge conflicts with git fetch upstream # upstream = https://github.com/DocForum/docforum-escrow.git
git rebase upstream/main
# resolve the conflicts, re-run the tests, then:
git push --force-with-leaseThe usual culprits are shared docs like Automated message. It won't repeat unless the PR conflicts again after your next push. |
|
@Cmitchelle7 pls fix CI |
|
@Cmitchelle7 CI is failing on this branch against the latest Soroban contract (test + wasm build)
|
|
@Cmitchelle7 CI is failing in The test expects the escrow to be gone after cancel, but |
|
@Cmitchelle7 This PR now has merge conflicts with git fetch upstream # upstream = https://github.com/DocForum/docforum-escrow.git
git rebase upstream/main
# resolve the conflicts, re-run the tests, then:
git push --force-with-leaseThe usual culprits are shared docs like Automated message. It won't repeat unless the PR conflicts again after your next push. |
|
@Cmitchelle7 Heads-up: #268 just changed how contract PRs work in this repo. Your PR changes
This should also make your next merge from |
…d escrows (DocForum#48) Every terminal transition of an ordinary escrow goes through settle(): it now removes the persistent EscrowData and keeps only the DataKey::Status entry (the lightweight status read from the status-read optimization), before the payout, then publishes the existing ESCROW state event. get_status is unchanged and answers for settled ids (NotFound now means never created); get_escrow is funded-only; release, refund, top_up, accept, cancel and rotate_releaser on a settled id return NotFunded via load() (a non-releaser no longer gets Unauthorized there, since the releaser set is gone). settle_many inherits this through settle(). Pooled escrows are deliberately not reclaimed: contributions, pull-based refunds and get_pooled read their record after settlement (ADR 0011). Measured: the 628-byte record is reclaimed per settled escrow; a 28-byte Status entry remains. Includes ADR 0013, a changelog.d fragment, a changeset, regenerated SDK bindings (pinned Stellar CLI 28.1.0) and the affected snapshots (escrow and releaser-account). The liabilities oracle now walks ids with get_status.
6af6151 to
0bc8184
Compare
|
@Cmitchelle7 Thanks for the rebase. Two checks fail on
|
|
@Cmitchelle7 This PR now has merge conflicts with git fetch upstream # upstream = https://github.com/DocForum/docforum-escrow.git
git rebase upstream/main
# resolve the conflicts, re-run the tests, then:
git push --force-with-leaseThe usual culprits are shared docs like Automated message. It won't repeat unless the PR conflicts again after your next push. |
Closes #48.
Settled escrows stayed in persistent storage forever. ADR 0013 compares delete / keep-only-Status / keep-everything and picks keep only the existing
Statusentry.Behaviour
settle_many) goes throughsettle(). It now removes the persistentEscrowDataand keeps only theDataKey::Statusentry (the lightweight status read added in feat(perf): profile and optimize status reads #260), before the payout. The existingESCROWstate event carries the history.get_statusis unchanged and still answers for settled ids, soNotFoundnow means "never created".get_escrowreturnsNotFoundfor a settled id. Breaking; SDK minor via changeset.release/refund/top_up/accept/cancel/rotate_releaseron a settled id still returnNotFunded. A non-releaser now getsNotFundedinstead ofUnauthorizedthere, since the releaser set is gone. Funded escrows are unchanged.get_pooledread their record after settlement. Covered by a test and the ADR.Rent measured: the 628-byte record is reclaimed per settled escrow; a 28-byte
Statusentry remains.cargo test --test reclaim_storage status_entry -- --nocaptureprints it.Known gap: the state event omits
refund_toandrelease_not_before. Widening it breaks the indexer's fixed 12-field decoder, so it is left as a separate change (noted in the ADR and ROADMAP).Why this supersedes the earlier version: main added the
Statusentry (#260), which already is the minimal tombstone, so this no longer introduces aSettledEscrowtype. Rebuilt on current main; ADR renumbered to 0013.Tests: 220 contract tests pass, including 12 new in
tests/reclaim_storage.rs.cancel.rs,model.rsand theliabilities.rsoracle were updated for the documented read behaviour. Snapshots (escrow and releaser-account) and bindings are regenerated with the pinned Stellar CLI 28.1.0. SDK typecheck, build and offline tests pass; the resource-baseline check passes.Out of scope: TTL/rent policy (#10), testnet redeploy, SDK tarball publish.