Skip to content

docs(events): document the model and invariants - #429

Merged
mikewheeleer merged 2 commits into
Agentpay-Org:mainfrom
Jagadeeshftw:docs/events-01-model
Jul 28, 2026
Merged

docs(events): document the model and invariants#429
mikewheeleer merged 2 commits into
Agentpay-Org:mainfrom
Jagadeeshftw:docs/events-01-model

Conversation

@Jagadeeshftw

Copy link
Copy Markdown
Contributor

Summary

The escrow contract publishes 22 distinct event topics but had no catalog of them. Adds docs/escrow/events.md:

  • A full table of every topic, its payload shape, emitting entrypoint(s), and firing condition.
  • Documents the two shared topics (cfg_set with its 6 config tags, and dispute with its open/resolve actions) so indexers know how to disambiguate them.
  • States the invariants that hold across all events: no unintended topic collisions, the 9-char symbol_short! limit (compile-time enforced), and that every publish follows its storage write.
  • Gaps found and documented, not fixed here: set_agent_allowed, set_agent_blocked, propose_admin_transfer, and cancel_admin_transfer write storage but emit no event, unlike every other setter in the contract. Cross-referenced against docs/escrow/storage.md's note that UsageAlertThreshold (which would drive usage_hi) has no setter either.
  • Links the new doc from README.md's documentation index.

No contract code changes — docs only.

Closes #291

Validation

  • cargo fmt --all -- --check
  • cargo build -p escrow
  • cargo test -p escrow — 352 passed, 1 pre-existing failure unrelated to this change (test_transfer_service_ownership_genuine_transfer_emits_event, fails identically on main)

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.
@Jagadeeshftw
Jagadeeshftw force-pushed the docs/events-01-model branch from e7f503f to a344813 Compare July 28, 2026 21:18
@mikewheeleer
mikewheeleer merged commit 7028be3 into Agentpay-Org:main Jul 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document the events model and its invariants

2 participants