fix: MarketResolvedEvent market_id topic#886
Open
Killerjunior wants to merge 1 commit into
Open
Conversation
|
@Killerjunior Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Description
📋 Basic Information
Type of Change
Please select the type of change this PR introduces:
Related Issues
Closes #846
Priority Level
📝 Detailed Description
What does this PR do?
This PR ensures that when
MarketResolvedEventis emitted,market_idis populated astopic1. In the event emission methodemit_market_resolved, we bypassed the genericstore_eventpublisher helper which was emitting a redundant event with only 1 topic ("mkt_res"), and replaced it with a direct persistent storage set. This guarantees the event is published exactly once with the topic tuple format:("mkt_res", market_id, resolution_method).Why is this change needed?
Off-chain indexers and integrators filtering events on the
"mkt_res"topic expectmarket_idto be present at index 1 of the event topics. The genericstore_eventhelper was emitting a duplicate"mkt_res"event with only a single topic, causing indexers to encounter missing parameters/errors when trying to decode the second topic.How was this tested?
Added a focused unit test
test_event_market_resolved_publishedin event_management_tests.rs that:"mkt_res"event containsmarket_idat index 1 (topic1) of its topics list.Alternative Solutions Considered
We considered changing the generic
store_eventfunction signature to accept additional topics, but this would require updating 30+ invocation points across the codebase. Directly setting persistent storage and publishing with custom topics for this specific event is cleaner and avoids unnecessary double-publishing.🏗️ Smart Contract Specific
Contract Changes
Please check all that apply:
Oracle Integration
None
Market Resolution Logic
Security Considerations
market_idemission in the topics tuple)🧪 Testing
Test Coverage
Test Results