feat(predict): add FAK order type support#26718
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Add fakOrdersEnabled to PredictFeatureFlags interface and resolve predictFakOrders version-gated remote flag in resolveFeatureFlags(). Defaults to false when the remote flag is absent or invalid.
…re active When a Permit2 fee authorization is used AND fakOrdersEnabled is true, submit the order with OrderType.FAK instead of FOK. Falls back to FOK in all other cases (no Permit2, no allowance, or fakOrdersEnabled false).
ba7ae0d to
7d29258
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Hoist fee/permit2/FAK determination before clobOrder construction so the HMAC signature covers the correct orderType (FAK vs FOK) instead of always signing FOK and overriding afterward.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Selected tags based on tag descriptions:
The risk is medium because:
Performance Test Selection: |
The committed fixture schema is out of date. To update, comment: |
Description
Adds Fill-and-Kill (FAK) order type support, feature-flagged OFF by default via the
predictFakOrdersversion-gated remote flag.How it works:
When both conditions are met:
fakOrdersEnabledflag is true (viapredictFakOrdersremote flag)→ The order is submitted with
OrderType.FAKinstead ofOrderType.FOK.In all other cases (no Permit2, fallback to Safe tx, or
fakOrdersEnabledfalse), orders continue to useOrderType.FOK.Changes (~20 lines of logic):
fakOrdersEnabled: booleantoPredictFeatureFlagspredictFakOrdersversion-gated remote flag inresolveFeatureFlags()placeOrder(): when Permit2 path is taken ANDfakOrdersEnabled→OrderType.FAKDouble-gated safety: FAK requires both Permit2 AND the FAK flag. The
predictFakOrdersflag is version-gated, so old app versions won't get FAK even if the remote flag is enabled.Depends on: #26711 (Permit2 fee authorization)
Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/PRED-715
Manual testing steps
Screenshots/Recordings
N/A — backend logic, no UI changes.
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes Polymarket order submission to conditionally use a new
FAKorder type, which can affect trade execution semantics and request signing when enabled. Risk is mitigated by a version-gated remote flag and only applying the behavior on the Permit2 fee-authorization path.Overview
Adds a new
fakOrdersEnabledfeature flag (resolved from the version-gated remote flagpredictFakOrders) to control whether Predict orders may be submitted as Fill-and-Kill.Updates Polymarket
placeOrderto chooseOrderType.FAKonly when Permit2 fee authorization is actually used andfakOrdersEnabledis true (otherwise it remainsFOK), and restructures header signing so the HMAC covers the selectedorderType.Expands Polymarket provider tests to cover
FAKvsFOKselection across Permit2, Safe fallback, and flag combinations.Written by Cursor Bugbot for commit 054dccc. This will update automatically on new commits. Configure here.