feat(events): emit state-change event - #432
Merged
mikewheeleer merged 2 commits intoJul 29, 2026
Merged
Conversation
env.events().all() reflects only the most recent contract invocation, not a running total across separate calls (consistent with every other event test in this file). The test compared post-transfer event count against a pre-transfer count captured after a *different* call (set_service_metadata), expecting accumulation that never happens, so it failed on every run regardless of contract behavior. Fixed to assert directly on this call's own event count.
…sal and cancellation
Jagadeeshftw
force-pushed
the
feature/events-05-event
branch
from
July 28, 2026 21:18
b3d4b61 to
533a9b5
Compare
Contributor
|
solid PR @Jagadeeshftw — green build, merging 🙌 |
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.
Summary
propose_admin_transferandcancel_admin_transferwriteDataKey::PendingAdmin(set / remove respectively) but were the only two admin-facing entrypoints that emit no event —accept_admin_transfer(step 2 of the same handover flow) already emitsadmin_chg.propose_admin_transfernow emitsadmin_prp(admin, new_admin)after the storage write, including on a re-proposal that overwrites a still-pending entry.cancel_admin_transfernow emitsadmin_can(admin, cancelled)after the storage write, wherecancelled: Option<Address>is the pending address that was cleared —Nonewhen the call was a documented no-op, so indexers can distinguish a deliberate no-op cancel from a call that never happened.symbol_short!limit, and distinct from every existing topic (no collision, verified againstdocs/escrow/events.md's catalog).accept_admin_transfer's existingadmin_chgevent.Tests added
test_propose_admin_transfer_emits_admin_prp_event— payload correctnesstest_repropose_admin_transfer_emits_event_with_new_target— re-proposing emits a fresh event with the new targettest_cancel_admin_transfer_emits_admin_can_event_with_cancelled_target— cancelling a pending proposal reports the cancelled addresstest_cancel_admin_transfer_noop_emits_event_with_none— the no-op path still emits, withNoneCloses #292
Validation
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test -p escrow— 356 passed (4 new), 1 pre-existing failure unrelated to this change (test_transfer_service_ownership_genuine_transfer_emits_event, fails identically onmain)