Skip to content

fix: add explicit serde/strum rename for MAKER_REBATE#17

Open
yovanoc wants to merge 1 commit intoPolymarket:mainfrom
yovanoc:fix/maker-rebate-deserialization
Open

fix: add explicit serde/strum rename for MAKER_REBATE#17
yovanoc wants to merge 1 commit intoPolymarket:mainfrom
yovanoc:fix/maker-rebate-deserialization

Conversation

@yovanoc
Copy link
Copy Markdown

@yovanoc yovanoc commented Apr 26, 2026

MakerRebate was deserializing to Unknown("MAKER_REBATE") because rename_all = "UPPERCASE" produces "MAKERREBATE" not "MAKER_REBATE". Added explicit serde/strum rename attributes.


Note

Low Risk
Low risk: a small serialization/deserialization mapping fix limited to ActivityType, with no logic or data-flow changes beyond correcting the wire-format string.

Overview
Fixes ActivityType::MakerRebate string mapping by adding explicit serde and strum renames to MAKER_REBATE, ensuring the enum correctly serializes/deserializes this API value instead of falling back to Unknown.

Reviewed by Cursor Bugbot for commit f9523b9. Bugbot is set up for automated code reviews on this repo. Configure here.

MakerRebate was deserializing to Unknown("MAKER_REBATE") because
rename_all = "UPPERCASE" produces "MAKERREBATE" not "MAKER_REBATE".
Added explicit serde/strum rename attributes.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f9523b9. Configure here.

Comment thread src/data/types/mod.rs
/// Yield
Yield,
/// Maker rebate (fee rebate for providing liquidity).
#[serde(rename = "MAKER_REBATE")]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong rename_all rule invites repeat of same bug

Low Severity

The ActivityType enum uses rename_all = "UPPERCASE", which doesn't insert underscores between words — that's exactly what caused the MakerRebate bug this PR fixes. Using rename_all = "SCREAMING_SNAKE_CASE" (and serialize_all = "SCREAMING_SNAKE_CASE" for strum) would produce identical results for all existing single-word variants while correctly handling multi-word variants automatically. This would eliminate the need for the explicit rename on MakerRebate and prevent any future multi-word variant from silently falling through to Unknown.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f9523b9. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant