Repository navigation
fix(contracts): extend Claimable TTL and reject evaluator == provider in escrow - #105
Conversation
Deploying puls3 with
|
| Latest commit: |
a03f51a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://706b7e9e.puls3-4lw.pages.dev |
| Branch Preview URL: | https://fix-95-escrow-claimable-ttl.puls3-4lw.pages.dev |
There was a problem hiding this comment.
Approved. The change is small and well-contained, and I couldn't find a way around the evaluator guard: verify_provider pins provider to the registry wallet and neither field changes after create_job. extend_claimable_ttl never reads or writes the balance, so leaving it permissionless is safe.
A few non-blocking follow-ups:
Tests
error_codes_are_stable_and_distinctstill stops at 116. AddingEvaluatorIsProviderthere (and dropping the standalone 117 test) keeps one source of truth, so a future duplicate of 117 gets caught.- The spec says the guard runs before the registry check, but
evaluator_cannot_be_the_provideruses a registered agent, so it would still pass if the order flipped. A case with an unregisteredagent_idexpectingEvaluatorIsProviderwould pin it. A third-party evaluator (neither client nor provider) being accepted is also untested. - In
extend_claimable_ttl_restores_a_decayed_entry, thecallerbalance assertions prove nothing, because that address never makes the call.
Spec
openspec/specs/agent-escrow-lifecycle/spec.md:550needs a blank line before### Requirement: R15., otherwise some renderers fold the heading into the previous bullet. Requirements also read R12, R14, R13, R15.
Docs and rollout
- Once a
Claimableentry is archived,extend_claimable_ttlandwithdrawno longer help.onchain.mdmentionsstellar contract restorebut not how to build the key for that entry. - Nobody owns calling
extend_claimable_ttlbefore the ~60 days run out. Worth a line on who does it (or a note in #101 so the tracker can do it later). onchain.mdshows the new command without the "only after the redeploy (#84)" caveat that the README has.- Server and Flutter should map 117 before the redeploy, so a bad
create_jobsurfaces as a clear error instead of a generic contract failure.
TOMOKI977
left a comment
There was a problem hiding this comment.
Approving. Notes above are non-blocking follow-ups.
|
@moises-cisneros merged into |
Closes #95
Summary
Fixes the two escrow gaps found in the review of #78, before the Testnet redeploy in #84:
ClaimableTTL. New permissionlessextend_claimable_ttl(recipient, token)bumps the instance and theClaimable(recipient, token)entry. It does nothing if the entry does not exist, credits nothing, and emits no event.extend_ttl(job_id)is unchanged.EscrowError::EvaluatorIsProvider = 117, returned bycreate_jobwhenevaluator == provider. The check runs right afterClientIsProviderand before the registry call.Docs are aligned with the API contract (#77):
docs/architecture/api.mdnow states the escrow rejects evaluator = provider, anddocs/verification/onchain.mdexplains how to keep a deferred payout alive. The SDD change is archived and the escrow spec is synced.Acceptance criteria
Claimablebalance can have its TTL extended without crediting it, and a test proves it stays withdrawable after the extension (extend_claimable_ttl_restores_a_decayed_entry).create_jobwithevaluator == providerreturns the new error, and a test covers it (evaluator_cannot_be_the_provider,evaluator_is_provider_has_code_117).cargo fmt,cargo clippy -D warnings,cargo testandstellar contract buildpass.contracts/README.mdlists the new function and error.Verification evidence
Spec verification: PASS (5 requirements, 27 scenarios, all covered by passing tests).
Notes for reviewers
core.autocrlfmakescargo testrewrite existing snapshots with line-ending changes only. Those were discarded and are not in this PR.refund_client(ADR-0005).