Skip to content

feat(contracts): version contract event schemas across all contracts - #89

Open
guptakumarranjeet150 wants to merge 1 commit into
FinesseStudioLab:mainfrom
guptakumarranjeet150:feat/version-event-schema-78
Open

guptakumarranjeet150 wants to merge 1 commit into
FinesseStudioLab:mainfrom
guptakumarranjeet150:feat/version-event-schema-78

Conversation

@guptakumarranjeet150

Copy link
Copy Markdown

Closes #78

Summary of Changes

Implements a formal, canonical event schema versioning standard across audit-registry, usage-meter, and payment-router before downstream integrators and indexers depend on unversioned topics:

  1. Canonical Schema Version Constant:
    • Added pub const EVENT_SCHEMA_VERSION: u32 = 1; across all contracts.
  2. Versioned Event Topics:
    • Updated all event definitions (CallerAllowed, CallerRevoked, AttestationRecorded, AttestationSuperseded, UsageRecorded, PolicySet, RegistrySet, EscrowOpened, PartialReleased, Claimed, Disputed, DisputeResolved, EscrowClosed, SettlementFailed, SettlementRecovered, DeadLettered) to include #[topic] pub version: u32 as their first indexed topic.
    • Updated all event publication call sites across the contracts to emit EVENT_SCHEMA_VERSION.
  3. Comprehensive Event Catalogue & Compatibility Documentation:
    • Added docs/event-catalogue-and-schema-versioning.md documenting every contract event, topic layout convention, payload mapping, emitting entrypoints, and the backward-compatibility / migration policy.
  4. Regression Shape Assertions:
    • Added tests in all contracts (audit_registry::test::test_event_schema_version_and_shape, usage_meter::test::test_usage_meter_event_schema_version_and_shape, payment_router::test::test_payment_router_event_schema_version_and_shape) verifying exact topic indices, schema version presence, and payload shapes.
    • All 69 unit and invariant tests across the workspace pass cleanly.

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.

Version the contract event schema before integrators depend on it

1 participant