fix: NewMarket/MarketResolved WS filtering + MAKER_REBATE deserialization#299
Open
yovanoc wants to merge 2 commits intoPolymarket:mainfrom
Open
fix: NewMarket/MarketResolved WS filtering + MAKER_REBATE deserialization#299yovanoc wants to merge 2 commits intoPolymarket:mainfrom
yovanoc wants to merge 2 commits intoPolymarket:mainfrom
Conversation
…assets and fix MAKER_REBATE deserialization
NewMarket and MarketResolved are broadcast events with new/different asset IDs
that will never match the subscriber's asset_ids_set, causing them to be
silently dropped. These events should always be yielded to consumers.
MakerRebate was deserializing to Unknown("MAKER_REBATE") because
rename_all = "UPPERCASE" produces "MAKERREBATE" not "MAKER_REBATE".
Added explicit serde/strum rename attributes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #299 +/- ##
==========================================
- Coverage 85.47% 85.46% -0.02%
==========================================
Files 32 32
Lines 5129 5124 -5
==========================================
- Hits 4384 4379 -5
Misses 745 745
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
Two bug fixes:
1. WS stream silently drops NewMarket/MarketResolved events
subscribe_market_with_optionsfilters all messages by the subscriber'sasset_ids_set. ForNewMarketandMarketResolved, this check always fails because:These are broadcast-style events and should always be yielded to consumers. The server correctly sends them to all connections with
custom_feature_enabled, but the client-side filter discards them.Fix: Always yield
NewMarketandMarketResolvedvariants regardless ofasset_ids_set.2.
MakerRebatedeserializes toUnknown("MAKER_REBATE")The
ActivityTypeenum uses#[serde(rename_all = "UPPERCASE")], which convertsMakerRebate→MAKERREBATE. The API returnsMAKER_REBATE(with underscore), so it falls through toUnknown("MAKER_REBATE").Fix: Add explicit
#[serde(rename = "MAKER_REBATE")]and#[strum(serialize = "MAKER_REBATE")]on theMakerRebatevariant.Note
Low Risk
Low risk: small, targeted fixes to client-side WS message filtering and enum (de)serialization; main risk is slightly increased WS message volume for market subscriptions.
Overview
Fixes market WebSocket subscriptions to always forward broadcast-style
WsMessage::NewMarketandWsMessage::MarketResolvedevents instead of filtering them out by subscribedasset_ids.Updates
ActivityType::MakerRebateto explicitly (de)serialize asMAKER_REBATE, preventing API values from falling through toUnknown.Written by Cursor Bugbot for commit 9160e60. This will update automatically on new commits. Configure here.