Description
Cross-contract retries or batch fallbacks can cause EventEmitter to emit the same logical event twice. Add a monotonic per-(emitter, topic) nonce so consumers can dedupe at-most-once even if upstream retries fire repeatedly.
Requirements and Context
- Nonce stored under
DataKey::EventNonce(topic)
- Embedded in the event payload as
nonce: u64
- Reset only on contract upgrade (documented)
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b feature/event-emitter-replay-nonce
- Implement changes
contracts/predictify-hybrid/src/events.rs
- New test file under
tests/
- Test and commit
cargo test -p predictify-hybrid event_replay_nonce
- Cover edge cases
- Include test output and notes in the PR
Example commit message
feat: add per-topic replay nonce to EventEmitter
Acceptance Criteria
Guidelines
- Clear documentation and inline comments
- Real Soroban SDK idioms in any new helper code
- Timeframe: 96 hours
Description
Cross-contract retries or batch fallbacks can cause
EventEmitterto emit the same logical event twice. Add a monotonic per-(emitter, topic) nonce so consumers can dedupe at-most-once even if upstream retries fire repeatedly.Requirements and Context
DataKey::EventNonce(topic)nonce: u64Suggested Execution
contracts/predictify-hybrid/src/events.rstests/cargo test -p predictify-hybrid event_replay_nonceExample commit message
Acceptance Criteria
Guidelines