Skip to content

Add deterministic event ordering test for emit sequence in resolve_market #617

Description

@greatest0fallt1me

Description

resolve_market in lib.rs emits multiple events (MarketResolvedEvent, OracleResultEvent, FeeCollectedEvent). Off-chain indexers depend on order. Add a test that captures env.events().all() and asserts the expected sequence.

Requirements and Context

  • Use env.events() introspection
  • Assert ordering and topic shapes
  • Document the ordering contract in lib.rs rustdoc
  • 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 test/resolve-market-event-ordering
  2. Implement changes
    • contracts/predictify-hybrid/tests/resolve_market_event_order.rs (new)
    • contracts/predictify-hybrid/src/lib.rs (only doc comments)
  3. Test and commit
    • cargo test -p predictify-hybrid resolve_market_event_order -- --nocapture
    • Cover edge cases: tie outcome, single-winner outcome
    • Include test output and notes in the PR

Example commit message

test: lock event emission order in resolve_market

Acceptance Criteria

  • Ordering documented in lib.rs
  • Test asserts exact sequence
  • Includes a regression note in test header
  • No unwrap() introduced

Guidelines

  • Avoid using exact ledger timestamps in assertions
  • Minimum 95% coverage of touched files
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Labels

GRANTFOX OSSGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programrustRust implementationsmart-contractSoroban smart-contract worksorobanSoroban SDK / StellartestingTests and coverage

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions