Skip to content

hey team, fixed sign chain id panic, empty-body http ok on errors, and silent query string failure#18

Open
mooncitydev wants to merge 1 commit intoPolymarket:mainfrom
mooncitydev:fix/sign-empty-status-query
Open

hey team, fixed sign chain id panic, empty-body http ok on errors, and silent query string failure#18
mooncitydev wants to merge 1 commit intoPolymarket:mainfrom
mooncitydev:fix/sign-empty-status-query

Conversation

@mooncitydev
Copy link
Copy Markdown

@mooncitydev mooncitydev commented Apr 26, 2026

hi, mooncitydev here. was going through the sdk and fixed a few things that seemed worth shipping together.

sign and chain id \sign()\ used \expect\ on \signer.chain_id()\ as if only the authenticated signer could be passed, but any signer is allowed. if someone passed a signer without \with_chain_id, it panicked. it now returns a validation error with a hint to set chain id.

empty response endpoints and http status \delete_notifications, \update_balance_allowance, and
evoke_builder_api_key\ called \execute\ and returned \Ok(())\ even when the server responded 4xx/5xx. \delete_readonly_api_key\ already did the right thing; i added a shared
equest_empty\ in \lib.rs\ and routed the no-body endpoints through it (and refactored delete readonly to use the same path).

query string encoding \ToQueryParams::query_params\ used \unwrap_or_default()\ when \serde_html_form::to_string\ failed, so you could get an empty query string and the wrong request without an error. it now returns \Result\ with an internal error. downstream call sites that build urls from this trait need to handle the result (small breaking change; the old behavior was misleading).

i could not run \cargo test\ on the machine i used (toolchain/linker issue on this box) so please let ci run.

cheers

…te integrators

sign() had expect on chain_id with a comment about authenticate, but sign takes any signer. different signer or signer without with_chain_id used to panic. now it returns a validation error.

delete_notifications, update_balance_allowance, and revoke_builder_api_key only did execute() without checking http status, so 401/500 still returned Ok(()). same pattern is now shared with delete_readonly via a request_empty helper.

ToQueryParams::query_params had unwrap_or_default on serde_html_form errors, so a struct that failed to encode could turn into an empty query string and hit the wrong server behavior. that path now returns Err.

this is a small api break for anyone calling query_params on custom types, but the old silent empty string was worse.

cheers

Made-with: Cursor
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