Pure-book hybrid: require belief_price or min_return (#334) #819
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic!819
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "cursor/gitlab-issue-workflow-dd14"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements #334: hybrid execute with
book_input > 0and nobelief_pricerequiresmin_return(pair hook) or router per-hopmin_return.Acceptance checklist
cargo test -p cl8y-dex-tests hybrid_pure_book_requires_slippage_floor_without_beliefSwapPage,TradeMarketOrderPanel, router/pair servicesmake test-contracts+make test-frontendThird-party verification
mentioned in issue #334
changed the description
changed the description
Stale Security Review comment
Stale Security Review comment
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Reviewed by Cursor Bugbot for commit
ce83a11750. Configure here.Zero min_return bypasses floor
Medium Severity
validate_hybrid_book_requires_slippage_floortreats any presentmin_return, including zero, as satisfying the #334 execute guard. A hybrid withbook_input > 0andmin_return: 0passes validation and only fails if net output is negative, so the intended slippage floor can be bypassed withoutbelief_price.Reviewed by Cursor Bugbot for commit
ce83a11750. Configure here.Security review (automated)
Commit reviewed:
ce83a11750602ecae8ba1789e5dac77fcb55a64bDiff base:
04d38a98d8ba8e7c3c5d39c8575520d3cea25fde→ head (20 files)Scope
On-chain slippage floor for no-belief hybrid execute when
book_input > 0(validate_hybrid_book_requires_slippage_floor, pairmin_return+MinReturnAssertion, router per-hopmin_returnforwarding), plus dapp preflight/enrichment (enrichSwapOperationsWithHopMinReturns,hybridBookRequiresSlippageFloor) and docs/tests (L9 / #334).Method
Traced attacker-controlled swap params (
hybrid,belief_price,min_return, router ops) through pairexecute_swap/ CW20 hook and routerexecute_swap_operations/reply_swap_hop. Checked for bypass viaminimum_receivealone, pool-only paths,ExecuteMsg::Swap, and post-settlement assertion ordering (CosmWasm atomic rollback on failure).Outcome
FINDINGS: 0 medium+
This MR closes the documented pure-book gap (L9 / #334): execute without
belief_pricenow reverts unlessmin_returnis set (pair hook or router per-hop), with post-settlementMinReturnAssertionon the pair. Router always passesbelief_price: Noneon hops, so book legs cannot skip the floor via the router path. No new authz, injection, or fund-movement surfaces beyond the intended slippage guard.Inline threads: none (no findings).
Cursor security review automation — MR !819 open webhook
added 1 commit
1fbca4fb- Reject zero min_return as hybrid slippage floor (#334)Compare with previous version
resolved all threads
changed the description
Security review (automated)
Commit reviewed:
1fbca4fba664d39667dec3b5414f6878809a966eDiff base:
04d38a98d8ba8e7c3c5d39c8575520d3cea25fde→ head (20 files)Scope
On-chain slippage floor for no-belief hybrid execute when
book_input > 0(validate_hybrid_book_requires_slippage_floor, pairmin_return+MinReturnAssertion, router per-hopmin_returnforwarding), plus dapp preflight/enrichment (enrichSwapOperationsWithHopMinReturns,hybridBookRequiresSlippageFloor) and docs/tests (L9 / #334).Method
Traced attacker-controlled swap params (
hybrid,belief_price,min_return, router ops) through pairexecute_swap/ CW20 hook and routerexecute_swap_operations/reply_swap_hop. Checked bypass via routerminimum_receivealone,ExecuteMsg::Swapdirect path,book_input = 0declaration tricks, pool-only paths,Some(0)min_return (fixed in head commit), and post-settlement assertion ordering (CosmWasm atomic rollback on failure).Outcome
FINDINGS: 0 medium+
This MR closes the documented pure-book gap (L9 / #334): execute without
belief_pricenow reverts unlessmin_returnis a positive value (pair hook or router per-hop). Router always passesbelief_price: Noneon hops, so book legs cannot skip the floor via the router path. The prior zero-min_returnbypass noted once83a11is remediated in1fbca4f. No new authz, injection, or fund-movement surfaces beyond the intended slippage guard.Inline threads: none (no findings).
Cursor security review automation — MR !819 update webhook
Stale Security Review comment
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Reviewed by Cursor Bugbot for commit
1fbca4fba6. Configure here.Pool-only quote drives hybrid floor
Medium Severity
For direct single-hop swaps with
book_input > 0,minReturnis taken fromminReceived, which is often derived from a pool-only quote while execution still uses a hybrid split. The on-chain floor then compares hybrid net output to a minimum sized for a different execution path, causing avoidable reverts or a mismatched slippage guarantee.Additional Locations (1)
frontend-dapp/src/components/trade/TradeMarketOrderPanel.tsx#L375-L378Reviewed by Cursor Bugbot for commit
1fbca4fba6. Configure here.added 1 commit
2bb73bb9- Fix direct hybrid min_return using pool-only quote floorCompare with previous version
resolved all threads
changed the description
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Reviewed by Cursor Bugbot for commit
2bb73bb90f. Configure here.Zero min_return treated as valid
Low Severity
hybridBookRequiresSlippageFloortreats any non-emptymin_return(including"0") as satisfying the #334 floor, but pair and router execute reject zero viavalidate_hybrid_book_requires_slippage_floor. Preflight can miss a failing hop, andenrichSwapOperationsWithHopMinReturnsmay forward a"0"floor from slippage math when tolerance is 100%.Additional Locations (1)
frontend-dapp/src/services/terraclassic/swapRoutePreflight.ts#L132-L135Reviewed by Cursor Bugbot for commit
2bb73bb90f. Configure here.Security review (automated)
Commit reviewed:
2bb73bb90fbc4646a13732e0805caac8fbdda184Diff base:
04d38a98d8ba8e7c3c5d39c8575520d3cea25fde→ head (20 files)Scope
On-chain slippage floor for no-belief hybrid execute when
book_input > 0(validate_hybrid_book_requires_slippage_floor, pairmin_return+MinReturnAssertion, router per-hopmin_returnforwarding), plus dapp preflight/enrichment (enrichSwapOperationsWithHopMinReturns,computeDirectHybridMinReturn) and docs/tests (L9 / #334).Method
Traced attacker-controlled swap params (
hybrid,belief_price,min_return, router ops) through pairexecute_swap/ CW20 hook and routerexecute_swap_operations/reply_swap_hop. Re-checked prior threads: zeromin_returnbypass (requires positivemin_return), routerbelief_price: Noneon hops,minimum_receive-only bypass, declared-split / #307 dust-pool games, and post-settlement assertion ordering (CosmWasm atomic rollback).Outcome
FINDINGS: 0 medium+
This MR closes the documented pure-book gap (L9 / #334): execute without
belief_pricereverts unlessmin_returnis positive (pair hook or router per-hop). The zero-min_returnexecute bypass from earlier commits is remediated (!m.is_zero()invalidate_hybrid_book_requires_slippage_floor). Direct single-hop submits usecomputeDirectHybridMinReturn(hybrid simulation + slippage floor) instead of pool-onlyminReceived. No new authz, injection, or unintended fund-movement surfaces beyond the intended slippage guard.Inline threads: none (no findings).
Cursor security review automation — MR !819 update webhook
added 1 commit
2f6fd970- fix: treat zero min_return as missing slippage floor (#334)Compare with previous version
resolved all threads
changed the description
Security review (automated)
Commit reviewed:
2f6fd97095385acd5bd1bae54daefab3678f56beDiff base:
04d38a98d8ba8e7c3c5d39c8575520d3cea25fde→ head (20 files)Scope
On-chain slippage floor for no-belief hybrid execute when
book_input > 0(validate_hybrid_book_requires_slippage_floor, pairmin_return+MinReturnAssertion, router per-hopmin_returnforwarding), plus dapp preflight/enrichment (enrichSwapOperationsWithHopMinReturns,computeDirectHybridMinReturn,hybridBookRequiresSlippageFloor) and docs/tests (L9 / #334).Method
Traced attacker-controlled swap params (
hybrid,belief_price,min_return, router ops) through pairexecute_swap/ CW20 hook and routerexecute_swap_operations/reply_swap_hop. Re-checked prior threads: zeromin_returnbypass (on-chain!m.is_zero()and frontendhybridBookRequiresSlippageFloorparity in2f6fd97), routerbelief_price: Noneon hops,minimum_receive-only bypass, declared-split / #307 dust-pool games, pool-only vs hybrid quote mismatch (computeDirectHybridMinReturn), and post-settlement assertion ordering (CosmWasm atomic rollback on failure).Outcome
FINDINGS: 0 medium+
Security review: no medium+ findings on this diff.
This MR closes the documented pure-book gap (L9 / #334): execute without
belief_pricereverts unlessmin_returnis positive (pair hook or router per-hop). Frontend enrichment and preflight now mirror on-chain zero rejection. No new authz, injection, or unintended fund-movement surfaces beyond the intended slippage guard.Inline threads: none (no findings).
Cursor security review automation — MR !819 update webhook
mentioned in commit
6e2ebbe1d0mentioned in commit
d5d0c6a8bcmentioned in commit
05ee14db17