Pure-book hybrid: require belief_price or min_return (#334) #819

Merged
PlasticDigits merged 4 commits from cursor/gitlab-issue-workflow-dd14 into main 2026-06-05 14:27:53 +00:00
PlasticDigits commented 2026-06-05 14:09:06 +00:00 (Migrated from gitlab.com)

Summary

Implements #334: hybrid execute with book_input > 0 and no belief_price requires min_return (pair hook) or router per-hop min_return.

Acceptance checklist

Criterion Verification Result
Pure-book hybrid without floor reverts cargo test -p cl8y-dex-tests hybrid_pure_book_requires_slippage_floor_without_belief PASS
Dapp + router coordinated SwapPage, TradeMarketOrderPanel, router/pair services PASS
make test-contracts + make test-frontend CI / local PASS
Docs integrators + L9 MR diff PASS
Close #273 Post-merge follow-up SKIP

Third-party verification

make test-contracts
make test-frontend
cd smartcontracts && cargo test -p cl8y-dex-tests hybrid_pure_book_requires_slippage_floor_without_belief

Note

Medium Risk
Changes swap execution validation and message shapes on pair and router; incorrect min_return wiring could block legitimate trades or leave integrators failing until they set floors, but the rule closes an intentional slippage blind spot for book legs.

Overview
Closes the #334 gap for hybrid swaps with book_input > 0 and no belief_price: execute must include a hard output floor via pair min_return (or belief_price), because the unified max_spread metric does not bound pure-book legs.

On-chain: dex_common::max_spread::validate_hybrid_book_requires_slippage_floor runs on pair swap (no belief) and on each router hop; swap messages gain optional min_return, enforced after settlement with MinReturnAssertion. New errors: BookHybridRequiresSlippageFloor, MinReturnAssertion.

Frontend: Swap and trade market submit paths call enrichSwapOperationsWithHopMinReturns / computeDirectHybridMinReturn so book hops get per-hop min_return from slippage on simulated output; preflight tracks anyHopMissingSlippageFloor.

Docs/tests: L9 and integrator slippage docs updated; integration test hybrid_pure_book_requires_slippage_floor_without_belief; existing hybrid tests pass min_return where needed.

Reviewed by Cursor Bugbot for commit 2f6fd97095. Bugbot is set up for automated code reviews on this repo. Configure here.

## Summary Implements [#334](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/334): hybrid execute with `book_input > 0` and no `belief_price` requires `min_return` (pair hook) or router per-hop `min_return`. ## Acceptance checklist | Criterion | Verification | Result | |-----------|--------------|--------| | Pure-book hybrid without floor reverts | `cargo test -p cl8y-dex-tests hybrid_pure_book_requires_slippage_floor_without_belief` | PASS | | Dapp + router coordinated | `SwapPage`, `TradeMarketOrderPanel`, router/pair services | PASS | | `make test-contracts` + `make test-frontend` | CI / local | PASS | | Docs integrators + L9 | MR diff | PASS | | Close #273 | Post-merge follow-up | SKIP | ## Third-party verification ```bash make test-contracts make test-frontend cd smartcontracts && cargo test -p cl8y-dex-tests hybrid_pure_book_requires_slippage_floor_without_belief ``` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes swap execution validation and message shapes on pair and router; incorrect min_return wiring could block legitimate trades or leave integrators failing until they set floors, but the rule closes an intentional slippage blind spot for book legs. > > **Overview** > Closes the **#334** gap for hybrid swaps with **`book_input > 0`** and no **`belief_price`**: execute must include a hard output floor via pair **`min_return`** (or **`belief_price`**), because the unified **`max_spread`** metric does not bound pure-book legs. > > **On-chain:** **`dex_common::max_spread::validate_hybrid_book_requires_slippage_floor`** runs on pair swap (no belief) and on each router hop; swap messages gain optional **`min_return`**, enforced after settlement with **`MinReturnAssertion`**. New errors: **`BookHybridRequiresSlippageFloor`**, **`MinReturnAssertion`**. > > **Frontend:** Swap and trade market submit paths call **`enrichSwapOperationsWithHopMinReturns`** / **`computeDirectHybridMinReturn`** so book hops get per-hop **`min_return`** from slippage on simulated output; preflight tracks **`anyHopMissingSlippageFloor`**. > > **Docs/tests:** L9 and integrator slippage docs updated; integration test **`hybrid_pure_book_requires_slippage_floor_without_belief`**; existing hybrid tests pass **`min_return`** where needed. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 2f6fd97095385acd5bd1bae54daefab3678f56be. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
PlasticDigits commented 2026-06-05 14:09:15 +00:00 (Migrated from gitlab.com)

mentioned in issue #334

mentioned in issue #334
ghost1 commented 2026-06-05 14:09:19 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
ghost1 commented 2026-06-05 14:09:26 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
ghost1 commented 2026-06-05 14:10:59 +00:00 (Migrated from gitlab.com)
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.

<details> <summary>Stale Security Review comment</summary> <details> <summary>Stale Security Review comment</summary> <!-- BUGBOT_REVIEW --> Cursor Bugbot has reviewed your changes and found 1 potential issue.<!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN --> <sup>Bugbot Autofix is [ON](https://www.cursor.com/dashboard/bugbot). A cloud agent has been kicked off to fix the reported issue. <!-- BUGBOT_AUTOFIX_AGENT_LINK --></sup> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END --> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ce83a11750602ecae8ba1789e5dac77fcb55a64b. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> </details> </details>
ghost1 commented 2026-06-05 14:11:00 +00:00 (Migrated from gitlab.com)

Zero min_return bypasses floor

Medium Severity

validate_hybrid_book_requires_slippage_floor treats any present min_return, including zero, as satisfying the #334 execute guard. A hybrid with book_input > 0 and min_return: 0 passes validation and only fails if net output is negative, so the intended slippage floor can be bypassed without belief_price.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ce83a11750. Configure here.

### Zero min_return bypasses floor **Medium Severity** <!-- DESCRIPTION START --> `validate_hybrid_book_requires_slippage_floor` treats any present `min_return`, including zero, as satisfying the #334 execute guard. A hybrid with `book_input > 0` and `min_return: 0` passes validation and only fails if net output is negative, so the intended slippage floor can be bypassed without `belief_price`. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: e7c1fc12-b155-4ebb-ac04-7cce81334999 --> <!-- LOCATIONS START smartcontracts/packages/dex-common/src/max_spread.rs#L69-L81 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmRkOTYyZDRiLTE2M2UtNDgzYy05MTkzLWY5Y2ExM2MxZjVjYSIsImVuY3J5cHRpb25LZXkiOiJPSC11Rnl2cGNMRllxdGlUT3RWeC1hbklDeVJIVVNPemtOd2RtMFh1RDFBIiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1kZDE0IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmRkOTYyZDRiLTE2M2UtNDgzYy05MTkzLWY5Y2ExM2MxZjVjYSIsImVuY3J5cHRpb25LZXkiOiJPSC11Rnl2cGNMRllxdGlUT3RWeC1hbklDeVJIVVNPemtOd2RtMFh1RDFBIiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1kZDE0IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIiwicHJOdW1iZXIiOjEwMSwiY29tbWl0U2hhIjoiY2U4M2ExMTc1MDYwMmVjYWU4YmExNzg5ZTVkYWM3N2ZjYjU1YTY0YiIsInByb3ZpZGVyIjoiZ2l0bGFiIiwiaG9zdG5hbWUiOiJnaXRsYWIuY29tIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ce83a11750602ecae8ba1789e5dac77fcb55a64b. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
PlasticDigits commented 2026-06-05 14:11:11 +00:00 (Migrated from gitlab.com)

Security review (automated)

Commit reviewed: ce83a11750602ecae8ba1789e5dac77fcb55a64b
Diff 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, pair min_return + MinReturnAssertion, router per-hop min_return forwarding), 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 pair execute_swap / CW20 hook and router execute_swap_operations / reply_swap_hop. Checked for bypass via minimum_receive alone, 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_price now reverts unless min_return is set (pair hook or router per-hop), with post-settlement MinReturnAssertion on the pair. Router always passes belief_price: None on 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

## Security review (automated) **Commit reviewed:** `ce83a11750602ecae8ba1789e5dac77fcb55a64b` **Diff 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`, pair `min_return` + `MinReturnAssertion`, router per-hop `min_return` forwarding), 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 pair `execute_swap` / CW20 hook and router `execute_swap_operations` / `reply_swap_hop`. Checked for bypass via `minimum_receive` alone, 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_price` now reverts unless `min_return` is set (pair hook or router per-hop), with post-settlement `MinReturnAssertion` on the pair. Router always passes `belief_price: None` on 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*
ghost1 commented 2026-06-05 14:12:33 +00:00 (Migrated from gitlab.com)

added 1 commit

  • 1fbca4fb - Reject zero min_return as hybrid slippage floor (#334)

Compare with previous version

added 1 commit <ul><li>1fbca4fb - Reject zero min_return as hybrid slippage floor (#334)</li></ul> [Compare with previous version](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/101/diffs?diff_id=1836894922&start_sha=ce83a11750602ecae8ba1789e5dac77fcb55a64b)
ghost1 commented 2026-06-05 14:12:46 +00:00 (Migrated from gitlab.com)

resolved all threads

resolved all threads
ghost1 commented 2026-06-05 14:12:46 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
PlasticDigits commented 2026-06-05 14:14:28 +00:00 (Migrated from gitlab.com)

Security review (automated)

Commit reviewed: 1fbca4fba664d39667dec3b5414f6878809a966e
Diff 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, pair min_return + MinReturnAssertion, router per-hop min_return forwarding), 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 pair execute_swap / CW20 hook and router execute_swap_operations / reply_swap_hop. Checked bypass via router minimum_receive alone, ExecuteMsg::Swap direct path, book_input = 0 declaration 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_price now reverts unless min_return is a positive value (pair hook or router per-hop). Router always passes belief_price: None on hops, so book legs cannot skip the floor via the router path. The prior zero-min_return bypass noted on ce83a11 is remediated in 1fbca4f. 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

## Security review (automated) **Commit reviewed:** `1fbca4fba664d39667dec3b5414f6878809a966e` **Diff 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`, pair `min_return` + `MinReturnAssertion`, router per-hop `min_return` forwarding), 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 pair `execute_swap` / CW20 hook and router `execute_swap_operations` / `reply_swap_hop`. Checked bypass via router `minimum_receive` alone, `ExecuteMsg::Swap` direct path, `book_input = 0` declaration 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_price` now reverts unless `min_return` is a **positive** value (pair hook or router per-hop). Router always passes `belief_price: None` on hops, so book legs cannot skip the floor via the router path. The prior zero-`min_return` bypass noted on `ce83a11` is remediated in `1fbca4f`. 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*
ghost1 commented 2026-06-05 14:14:32 +00:00 (Migrated from gitlab.com)
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.

<details> <summary>Stale Security Review comment</summary> <!-- BUGBOT_REVIEW --> Cursor Bugbot has reviewed your changes and found 1 potential issue.<!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN --> <sup>Bugbot Autofix is [ON](https://www.cursor.com/dashboard/bugbot). A cloud agent has been kicked off to fix the reported issue. <!-- BUGBOT_AUTOFIX_AGENT_LINK --></sup> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END --> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1fbca4fba664d39667dec3b5414f6878809a966e. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> </details>
ghost1 commented 2026-06-05 14:14:33 +00:00 (Migrated from gitlab.com)

Pool-only quote drives hybrid floor

Medium Severity

For direct single-hop swaps with book_input > 0, minReturn is taken from minReceived, 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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1fbca4fba6. Configure here.

### Pool-only quote drives hybrid floor **Medium Severity** <!-- DESCRIPTION START --> For direct single-hop swaps with `book_input > 0`, `minReturn` is taken from `minReceived`, 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. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: a89ebf4f-da3f-4922-b10f-2fc6638a6730 --> <!-- LOCATIONS START frontend-dapp/src/pages/SwapPage.tsx#L617-L622 frontend-dapp/src/components/trade/TradeMarketOrderPanel.tsx#L375-L378 LOCATIONS END --> <details> <summary>Additional Locations (1)</summary> - [`frontend-dapp/src/components/trade/TradeMarketOrderPanel.tsx#L375-L378`](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-//blob/1fbca4fba664d39667dec3b5414f6878809a966e/frontend-dapp/src/components/trade/TradeMarketOrderPanel.tsx#L375-L378) </details> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmY3NmNmNGQ4LTVjNTctNGFjZC1iMjA5LTA4NWQzOTZiMTUwYiIsImVuY3J5cHRpb25LZXkiOiJjeHRoU0pEOUp3aFRSckhlb2prSC1FTzhRQ2lVMFlEZnY1bTcxcTJyMWxnIiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1kZDE0IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmY3NmNmNGQ4LTVjNTctNGFjZC1iMjA5LTA4NWQzOTZiMTUwYiIsImVuY3J5cHRpb25LZXkiOiJjeHRoU0pEOUp3aFRSckhlb2prSC1FTzhRQ2lVMFlEZnY1bTcxcTJyMWxnIiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1kZDE0IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIiwicHJOdW1iZXIiOjEwMSwiY29tbWl0U2hhIjoiMWZiY2E0ZmJhNjY0ZDM5NjY3ZGVjM2I1NDE0ZjY4Nzg4MDlhOTY2ZSIsInByb3ZpZGVyIjoiZ2l0bGFiIiwiaG9zdG5hbWUiOiJnaXRsYWIuY29tIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1fbca4fba664d39667dec3b5414f6878809a966e. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
ghost1 commented 2026-06-05 14:16:24 +00:00 (Migrated from gitlab.com)

added 1 commit

  • 2bb73bb9 - Fix direct hybrid min_return using pool-only quote floor

Compare with previous version

added 1 commit <ul><li>2bb73bb9 - Fix direct hybrid min_return using pool-only quote floor</li></ul> [Compare with previous version](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/101/diffs?diff_id=1836903764&start_sha=1fbca4fba664d39667dec3b5414f6878809a966e)
ghost1 commented 2026-06-05 14:16:36 +00:00 (Migrated from gitlab.com)

resolved all threads

resolved all threads
ghost1 commented 2026-06-05 14:16:44 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
ghost1 commented 2026-06-05 14:18:11 +00:00 (Migrated from gitlab.com)

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

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.

<!-- BUGBOT_REVIEW --> Cursor Bugbot has reviewed your changes and found 1 potential issue. <!-- BUGBOT_FIX_ALL --> <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTo2N2U1N2U0OC1lZDk3LTQxOWUtYWYyZC1kMDgzYzAwYjVhY2YiLCJlbmNyeXB0aW9uS2V5IjoidEJ5dlRsYW1teHJ1TnlsUUR6QlFRR1BhVDhzODFVNXJ5dDljNF85bjV3TSIsImJyYW5jaCI6ImN1cnNvci9naXRsYWItaXNzdWUtd29ya2Zsb3ctZGQxNCIsInJlcG9Pd25lciI6IlBsYXN0aWNEaWdpdHMiLCJyZXBvTmFtZSI6ImNsOHktZGV4LXRlcnJhY2xhc3NpYyJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <!-- /BUGBOT_FIX_ALL --> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN --> <sup>Bugbot Autofix is [ON](https://www.cursor.com/dashboard/bugbot). A cloud agent has been kicked off to fix the reported issue. <!-- BUGBOT_AUTOFIX_AGENT_LINK --></sup> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END --> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 2bb73bb90fbc4646a13732e0805caac8fbdda184. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
ghost1 commented 2026-06-05 14:18:12 +00:00 (Migrated from gitlab.com)

Zero min_return treated as valid

Low Severity

hybridBookRequiresSlippageFloor treats any non-empty min_return (including "0") as satisfying the #334 floor, but pair and router execute reject zero via validate_hybrid_book_requires_slippage_floor. Preflight can miss a failing hop, and enrichSwapOperationsWithHopMinReturns may forward a "0" floor from slippage math when tolerance is 100%.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2bb73bb90f. Configure here.

### Zero min_return treated as valid **Low Severity** <!-- DESCRIPTION START --> `hybridBookRequiresSlippageFloor` treats any non-empty `min_return` (including `"0"`) as satisfying the #334 floor, but pair and router execute reject zero via `validate_hybrid_book_requires_slippage_floor`. Preflight can miss a failing hop, and `enrichSwapOperationsWithHopMinReturns` may forward a `"0"` floor from slippage math when tolerance is 100%. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: bfc31db7-420a-486c-ade9-70962a1a0256 --> <!-- LOCATIONS START frontend-dapp/src/utils/swapMaxSpread.ts#L46-L55 frontend-dapp/src/services/terraclassic/swapRoutePreflight.ts#L132-L135 LOCATIONS END --> <details> <summary>Additional Locations (1)</summary> - [`frontend-dapp/src/services/terraclassic/swapRoutePreflight.ts#L132-L135`](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-//blob/2bb73bb90fbc4646a13732e0805caac8fbdda184/frontend-dapp/src/services/terraclassic/swapRoutePreflight.ts#L132-L135) </details> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmJiYTM0NTk2LTg3YmItNGYwMi1iYzg3LWY3MGE5ODcxMGQyMSIsImVuY3J5cHRpb25LZXkiOiJja1c5eWJNd0U3bm43SXJaYjR6YXlKdk5VaXhMLWdIQ25RU0QxZHhiUnc0IiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1kZDE0IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmJiYTM0NTk2LTg3YmItNGYwMi1iYzg3LWY3MGE5ODcxMGQyMSIsImVuY3J5cHRpb25LZXkiOiJja1c5eWJNd0U3bm43SXJaYjR6YXlKdk5VaXhMLWdIQ25RU0QxZHhiUnc0IiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1kZDE0IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIiwicHJOdW1iZXIiOjEwMSwiY29tbWl0U2hhIjoiMmJiNzNiYjkwZmJjNDY0NmExMzczMmUwODA1Y2FhYzhmYmRkYTE4NCIsInByb3ZpZGVyIjoiZ2l0bGFiIiwiaG9zdG5hbWUiOiJnaXRsYWIuY29tIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 2bb73bb90fbc4646a13732e0805caac8fbdda184. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
PlasticDigits commented 2026-06-05 14:18:19 +00:00 (Migrated from gitlab.com)

Security review (automated)

Commit reviewed: 2bb73bb90fbc4646a13732e0805caac8fbdda184
Diff 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, pair min_return + MinReturnAssertion, router per-hop min_return forwarding), 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 pair execute_swap / CW20 hook and router execute_swap_operations / reply_swap_hop. Re-checked prior threads: zero min_return bypass (requires positive min_return), router belief_price: None on 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_price reverts unless min_return is positive (pair hook or router per-hop). The zero-min_return execute bypass from earlier commits is remediated (!m.is_zero() in validate_hybrid_book_requires_slippage_floor). Direct single-hop submits use computeDirectHybridMinReturn (hybrid simulation + slippage floor) instead of pool-only minReceived. 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

## Security review (automated) **Commit reviewed:** `2bb73bb90fbc4646a13732e0805caac8fbdda184` **Diff 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`, pair `min_return` + `MinReturnAssertion`, router per-hop `min_return` forwarding), 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 pair `execute_swap` / CW20 hook and router `execute_swap_operations` / `reply_swap_hop`. Re-checked prior threads: zero `min_return` bypass (requires positive `min_return`), router `belief_price: None` on 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_price` reverts unless `min_return` is **positive** (pair hook or router per-hop). The zero-`min_return` execute bypass from earlier commits is remediated (`!m.is_zero()` in `validate_hybrid_book_requires_slippage_floor`). Direct single-hop submits use `computeDirectHybridMinReturn` (hybrid simulation + slippage floor) instead of pool-only `minReceived`. 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*
ghost1 commented 2026-06-05 14:20:02 +00:00 (Migrated from gitlab.com)

added 1 commit

  • 2f6fd970 - fix: treat zero min_return as missing slippage floor (#334)

Compare with previous version

added 1 commit <ul><li>2f6fd970 - fix: treat zero min_return as missing slippage floor (#334)</li></ul> [Compare with previous version](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/101/diffs?diff_id=1836911902&start_sha=2bb73bb90fbc4646a13732e0805caac8fbdda184)
ghost1 commented 2026-06-05 14:20:16 +00:00 (Migrated from gitlab.com)

resolved all threads

resolved all threads
ghost1 commented 2026-06-05 14:20:16 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
PlasticDigits commented 2026-06-05 14:22:18 +00:00 (Migrated from gitlab.com)

Security review (automated)

Commit reviewed: 2f6fd97095385acd5bd1bae54daefab3678f56be
Diff 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, pair min_return + MinReturnAssertion, router per-hop min_return forwarding), 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 pair execute_swap / CW20 hook and router execute_swap_operations / reply_swap_hop. Re-checked prior threads: zero min_return bypass (on-chain !m.is_zero() and frontend hybridBookRequiresSlippageFloor parity in 2f6fd97), router belief_price: None on 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_price reverts unless min_return is 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

## Security review (automated) **Commit reviewed:** `2f6fd97095385acd5bd1bae54daefab3678f56be` **Diff 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`, pair `min_return` + `MinReturnAssertion`, router per-hop `min_return` forwarding), 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 pair `execute_swap` / CW20 hook and router `execute_swap_operations` / `reply_swap_hop`. Re-checked prior threads: zero `min_return` bypass (on-chain `!m.is_zero()` and frontend `hybridBookRequiresSlippageFloor` parity in `2f6fd97`), router `belief_price: None` on 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_price` reverts unless `min_return` is **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*
PlasticDigits (Migrated from gitlab.com) merged commit 6e2ebbe1d0 into main 2026-06-05 14:27:53 +00:00
PlasticDigits commented 2026-06-05 14:27:54 +00:00 (Migrated from gitlab.com)

mentioned in commit 6e2ebbe1d0

mentioned in commit 6e2ebbe1d05d0bb30969ebada1b1275e8fc77b29
PlasticDigits commented 2026-06-08 08:43:13 +00:00 (Migrated from gitlab.com)

mentioned in commit d5d0c6a8bc

mentioned in commit d5d0c6a8bc1cfb1c560b52de7df858f59b83b290
PlasticDigits commented 2026-06-08 13:42:28 +00:00 (Migrated from gitlab.com)

mentioned in commit 05ee14db17

mentioned in commit 05ee14db17272ba4b982f75df859491565454067
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!819
No description provided.