fix(runtime): fail-closed CEX envelope size and slippage - #1160
fix(runtime): fail-closed CEX envelope size and slippage#1160proerror77 wants to merge 2 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
673e9e4 to
c9a0d0b
Compare
5f84842 to
7f41aa6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f848425c1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if self.lifecycle.max_order_notional.is_none() { | ||
| return Err(OrderIntentRejectReason::MissingMaxOrderNotional); | ||
| } |
There was a problem hiding this comment.
Require the signed quantity ceiling at the CEX gate
当 CEX envelope 提供 max_slippage_bps 和 max_order_notional、但遗漏 max_order_quantity 时,这个新 gate 仍会放行;validate_order_limits 对缺失的 quantity ceiling 也直接跳过。这样,直接到达 adapter 或丢失 engine 注入字段的 envelope 可以绕过 deployment 中 max_order_size 对应的数量限制,而本提交新增的 Bybit 成功用例正构造并接受了这种 envelope。这里也应对 max_order_quantity == None fail closed,确保最终 CEX 边界同时执行签名的 order-size 限制。
AGENTS.md reference: AGENTS.md:L26-L27
Useful? React with 👍 / 👎.
a378696 to
24da933
Compare
1cee072 to
7b860b8
Compare
Reject missing max_slippage_bps and max_order_notional on CEX pre-execution instead of treating None as allow. Reject cross_spread at require_supported_cex_execution. LiveSmall stays disabled. Co-authored-by: Wild Card <proerror77@users.noreply.github.com>
Require signed max_order_quantity at the CEX pre-execution boundary so a missing quantity ceiling is not treated as allow. LiveSmall stays disabled. Co-authored-by: Wild Card <proerror77@users.noreply.github.com>
24da933 to
45ac55f
Compare
Change
CEX
validate_cex_pre_executionnow rejects missingmax_slippage_bps, missingmax_order_notional, and missingmax_order_quantityinstead of treatingNoneas allow.require_supported_cex_executionrejectscross_spread. LiveSmall stays disabled.Stacked on #1153 (
cursor/emergency-sticky-degrade-3a89). Addresses the Codex P2 that a missing quantity ceiling still skippedvalidate_order_limits.Issue relationship
None
Validation
cargo test -p hft-ports --locked cex_envelope_does_not_treat_missing_size_or_slippage_as_allowcargo test -p hft-live --locked cross_spread_cex_execution_is_not_admittedorder_envelope_preserves_the_venue_link_idnow carries a signed quantity ceilingRuntime impact and rollback
Fail-closed CEX Paper/Shadow admission for unbounded size/slippage/quantity and for
cross_spread. Rollback is revert of this PR. This does not enable LiveSmall. Automatic artifact publication may follow merge; that is not deployment authority.