fix(amm): disable unsafe dynamic liquidity markets#136
Draft
rndrntwrk wants to merge 2 commits into
Draft
Conversation
Adding `DynamicMarketsDisabled` to `PredictionMarketError` shifts the
generated IDL's error array. Anchor regenerates the IDL on every build,
and `Solana Program Build Gate` requires every downstream IDL mirror to
match the canonical generated artifact.
Propagates the regenerated IDL into:
- packages/hyperbet-avax/keeper/src/idl
- packages/hyperbet-bsc/{app,keeper}/src/idl
- packages/hyperbet-evm/keeper/src/idl
- packages/hyperbet-ui/src/idl
- packages/market-maker-bot/src/idl
Mechanical sync only, produced by
`bun run --cwd packages/hyperbet-solana/anchor build` through the
existing `sync-anchor-artifacts` script. No runtime behavior change;
the dynamic-create rejection lives in
`programs/lvr_amm/src/instructions/create_bet.rs`.
745b51c to
f8137a6
Compare
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
Disables dynamic LVR AMM market creation across EVM and Solana until the dynamic liquidity math can be redesigned and differentially verified.
This is a short-term safety gate, not the final dynamic-market implementation. It is scoped to
enoomian/stagingso the staging product can continue on static AMM markets without carrying the unsafe dynamic path.Why
Audit triage showed the current dynamic AMM path can quote/drain nearly the whole reserve on a small trade under the dynamic pricing model. That is not safe to expose while the dynamic model is unresolved.
The safest forward fix is to fail closed at market creation on every supported runtime:
Router.create(..., isDynamic=true, ...)reverts.create_bet(..., is_dynamic=true, ...)returnsDynamicMarketsDisabled.Static markets remain available and continue to cover the current staging flow.
Changes
DynamicMarketsDisabledto the EVM router and rejects dynamic market creation.DynamicMarketsDisabledto the end of the SolanaPredictionMarketErrorenum to avoid shifting existing Anchor error codes.create_bet.Validation
FOUNDRY_LIBS='["../../node_modules","lib"]' forge test --match-path test/LvrMarket.t.solanchor buildANCHOR_MANUAL_TEST_SKIP_BUILD=1 bun run test tests/lvr_amm_security.anchor.ts tests/lvr_amm_authoritative_settlement.tsTargeted results:
LvrMarket.t.sol: 33 passinglvr_amm security: 8 passinglvr_amm authoritative settlement: 5 passingRollout Notes
This intentionally disables dynamic market creation only. It does not delete the dynamic pricing code or claim the dynamic model is fixed. Re-enabling dynamic liquidity should require a follow-up PR with a corrected model plus EVM/Rust/TS differential tests.
This PR should merge into
enoomian/stagingfirst for staging validation before promotion into any broader release path.