Repository navigation
Conversation
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
Problem
Several authenticated CLOB commands contacted authentication endpoints before parsing local arguments. Malformed values could therefore trigger credential-based network requests and return misleading authentication errors instead of local validation errors.
Approach
Token IDs, decimal values, CSV cardinality, amount semantics, and dates are parsed before the authenticated client is created. The existing authenticated paths are unchanged after validation succeeds.
Tests
cargo +1.91.1 fmt --checkcargo +1.91.1 clippy --locked -- -D warningsgit diff --checkRisk
Low to moderate. The change reorders deterministic parsing ahead of network setup but does not alter valid request construction or authentication.
Fixes #92
Note
Low Risk
Reorders deterministic parsing ahead of auth with no change to valid order submission or API call shapes; regression tests cover the new behavior.
Overview
Authenticated CLOB trading and reward commands now parse and validate local arguments before resolving the signer or opening an authenticated client, so bad token IDs, decimals, batch CSV lengths, amounts, and
YYYY-MM-DDdates fail with clear CLI errors instead of hitting auth/network first.Trading paths (
create-order,post-orders,market-order): token/price/size (or amount) validation runs ahead ofauthenticate_with_signer;post-ordersalso validates all prices and sizes in bulk before the order loop.Reward paths (
rewards,earnings,earnings-markets):parse_dateruns beforeauthenticated_clob_client.Tests add a loopback
RequestFixturethat pointsPOLYMARKET_CLOB_HOSTat a local server and asserts malformed inputs produce zero HTTP requests, with a control case confirming validcreate-orderinput still attempts authentication.Reviewed by Cursor Bugbot for commit 3681b29. Bugbot is set up for automated code reviews on this repo. Configure here.