fix(events): emit events on completion, funding, release, and dispute resolution (#96) - #231
Open
Vyacheslav-Tomashevskiy wants to merge 1 commit into
Conversation
… resolution (vespera-labs#96) Off-chain indexers could not track several fund movements and status changes because the corresponding functions emitted no events. agent_registry: - add TransactionCompleted event; complete_transaction now emits it with the agent's running completed_agreements count. escrow: - add EscrowFunded (fund_escrow), EscrowReleased (full-release branch of approve_release), and DisputeResolved (resolve_dispute) events. - DisputeResolved carries a `refunded` flag distinguishing a refund to the depositor from a release to the beneficiary, plus resolver/recipient/amount. - field naming kept consistent with existing events (escrow_id topic, amount/recipient like PartialRelease). Tests assert each new event is published (agent_registry: 24 pass, escrow: 50 pass). Also restore the escrow test suite to a compiling state by aligning the remaining 5-tuple setup_test call sites with the current 6-tuple signature. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
|
This closes #96. All four acceptance criteria are implemented with tests (agent_registry 24 pass, escrow 50 pass, fmt/clippy clean), and the diff is limited to the four functions named in the issue plus the missing event definitions. For the record on assignment: #96 was assigned via GrantFox on 2026-06-18, but no PR has been opened against it in the 13 days since (the only prior attempt, #160, was closed unmerged). I put up a complete, tested implementation so it doesn't stay open — happy to defer or rework if the original assignee is still active. RTC wallet for any bounty payout: RTCd1554f0f35576faf01d386a6be1c947f560dd0b7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #96.
Off-chain indexers could not track several state changes because the functions that move funds or flip status emitted no events. This adds the missing events with naming consistent with the existing ones in each contract.
agent_registry
TransactionCompletedevent (topictxn_done, topics:transaction_id,agent; data:completed_agreements).complete_transactionnow publishes it with the agent's running completed-agreements total.escrow
EscrowFunded— emitted byfund_escrow(topicescrow_funded;depositor,amount).EscrowReleased— emitted by the full-release branch ofapprove_releaseonce the 2-of-3 threshold executes (topicescrow_released;recipient,amount).DisputeResolved— emitted byresolve_dispute(topicdispute_resolved;resolver,recipient,amount,refunded). Therefundedboolean distinguishes a refund to the depositor (true) from a release to the beneficiary (false), satisfying the "refund vs release distinguished" criterion. The status branch was refactored to deriverefundedonce (behaviour unchanged).Field naming mirrors the existing events (
escrow_idas the indexed topic;amount/recipientas inPartialRelease).Acceptance criteria
complete_transactionemits a newTransactionCompletedevent with relevant fieldsTests
Added targeted tests that assert each new event fires (and, for full release, that no release event fires before the threshold).
cargo test: agent_registry 24 passed, escrow 50 passed;rustfmt --checkclean on the touched files;cargo clippyno warnings.Note: the escrow test module did not compile on
main—setup_testreturns a 6-tuple but several call sites still destructured 5 elements. I added the missing_adminbinding at those sites so the suite (and the new tests) compile and run. This is a minimal, mechanical fix limited to test code.Scope
Only the four state-changing functions named in the issue are touched. Out-of-scope items (standardizing topics across all contracts, event-schema docs) are left alone.