Skip to content

Adopt structured event schema registry for OracleResultEvent and DisputeCreatedEvent #601

Description

@greatest0fallt1me

Description

Contract events in events.rs are emitted with ad-hoc topics, making indexing fragile. Introduce a single EventSchemaRegistry that names each event, lists its topic tuple, and pins a schema_version for OracleResultEvent and DisputeCreatedEvent first.

Requirements and Context

  • Centralize topic construction in events.rs::EventSchemaRegistry
  • Each emit site reads (name_symbol, schema_version) from the registry instead of inline literals
  • Document the registry in contracts/predictify-hybrid/src/events.rs rustdoc and surface a public read function for clients
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b feat/event-schema-registry
  2. Implement changes
    • contracts/predictify-hybrid/src/events.rs
    • contracts/predictify-hybrid/src/resolution.rs (OracleResultEvent emit site)
    • contracts/predictify-hybrid/src/disputes.rs (DisputeCreatedEvent emit site)
  3. Test and commit
    • cargo test -p predictify-hybrid events -- --nocapture
    • Cover edge cases: registry lookup miss, schema-version mismatch
    • Include test output and notes in the PR

Example commit message

feat: centralize event schema registry for oracle and dispute events

Acceptance Criteria

  • EventSchemaRegistry covers OracleResultEvent and DisputeCreatedEvent
  • Emit sites no longer construct topics with inline symbol_short! literals
  • Tests assert exact topic tuples and schema version
  • No unwrap() in emit paths

Guidelines

  • Use symbol_short! only inside the registry, never at emit sites
  • Minimum 95% coverage of changed branches
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GRANTFOX OSSGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveStellar Wave Program issuedocumentationDocumentationenhancementNew feature or improvementrustRust implementationsmart-contractSoroban smart-contract worksorobanSoroban SDK / Stellar

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions