Closed
Conversation
* program: fix stuck in liquidation status * add tests * update changelog
* exclude isolated perp positions in is_cross_margin_bankrupt * try to fix test * update changelog
* filter out stink bids/asks from perp twap crank * fix fmt * fix fmt
…ance margin (#2130) * feat: margin type config for override margin type behavior * feat: tests for margin override * feat: idl, anchor tests, more cargo tests * feat: helpful comments * fix: logic for user margin ratio evaluated on per position basis * chore: use maintenance check on cross account place order req on iso margin calc * feat: margin type config on transfer isolated + tests * feat: transfer to isolated conditional margin overrides + fulfill_perp_order * fix: recalc is high lev on each perp position calc margin req * fix: tests and build errors * fix: cargo fmt * feat: additional test scenarios * fix: using wrong margin type on fulfill perp order margin type config * fix: anchor tests wrong oracle prices on order margin checks * fix: bug with custom margin ratios * fix: incorrect comments on anchor tests w oracle prices * fix: another anchor test fix * feat: isolated transfer anchor tests * fix: anchor tests broken for iso transfer * fix: fulfill order pr feedback how define is isolated flag * fix: perp order fulfillment maker is isolated flag * fix: tests for maker_fills map
… payload (#2133) * feat: pyth lazer feed_update_timestamp + rm pyth pull + push * feat: restore pyth pull and push branches on market init for now * feat: update package.lock * fix: cargo 2021 on pyth lazer * fix: pyth lazer tests broken + mocha broken * fix: pyth-lazer anchor tests feat mising * fix: broken lp anchor test * fix: more anchor tests broken from new SOL price * fix: more tests broken * fix: lint issues * fix: todo on broken anchor test * fix: it.todo not available * fix: rm extra pyth lazer sdk code * fix: broken tests pyth lazer * refactor: cleaner comparison on pyth lazer oracle ix * fix: backwards pyth timestamp logic
* fix: settle before full withdraw isolated position (#2129) * sdk: release v2.158.0-beta.1 * fix: pnl settle will also clear out iso balance on market always * feat: tests for settle pnl with iso withdrawal * fix: broken pnl esttle iso clear out tests * feat: add perp position validation after iso balance clear out * feat: safer borrowing on pnl clear out * feat: anchor test for pnl iso balance clear out * fix: broken tests settle pnl iso pos * feat: test improvements --------- Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
* add bit flag * add tests * update idl + add sdk ix * add helpers * validate bit before set * add bankrun * update changelog * add to test script * minor fix * use hot admin for fast disabling only * skip in adjust_amm * update test * add normal condition to test * minor fix * improve tests * clean up * fix assertions in test * update devnet idl
…if-vaults Chakos/be 107 withdraw from if vaults
* spike: PropAMM poc * wip * hardening * fixes * updates * fix * revert: remove large-liq-safety changes from prop-amm branch Liquidation size threshold feature (large_liq_notional_threshold, large_liq_duration on PerpMarket, liquidation.rs slow-liq logic) is unrelated to PropAMM. Moved to spike/large-liq-safety. Also adds close_account and transfer_authority bankrun tests, and fixes two pre-existing prettier/lint issues in the test file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix tests * add unified matching (vAMM + DLOB + PropAMM) and comprehensive margin tests Extends prop_amm matching to support three fill sources with true price priority: PropAMM book levels, DLOB limit orders, and vAMM. Adds 33 new tests covering unified matching, security scenarios, and margin behavior (taker margin type selection for open/close/reduce/flip/increase, maker margin filter skip semantics with delta recalculation). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * add order versioning header, CU optimizations, and comprehensive test coverage - Header v2: add order_entry_size (u16) at offset 112, 6 bytes reserved at 114, shifting ORDERS_DATA_OFFSET from 112 to 120. Runtime stride via detect_layout(). - CU optimizations: remove happy-path log, authority_matches_32 for stored authority, inline increment_sequence_number (skip MidpriceBookViewMut construction). - Fix prop_amm.rs test helper missing ORDER_ENTRY_SIZE_OFFSET write (broke 20 tests). - Add regression tests: reserved-byte passthrough, margin filter drops external_fills, partial fills, AMM zero-fill fallthrough, pro-rata allocation, short-side fills, taker position_before overflow, all-sources-above-limit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix bankrun tests and add mixed DLOB+vAMM fill tests - Update MIDPRICE_ACCOUNT_MIN_LEN 112→120 for header v2 - Fix shared taker order: each test places its own via placeTakerLimitOrder() - Fix DLOB maker setup: addUser() after init tx so client finds on-chain account - Fix bankrunConnection.ts TS error (empty tuple type mismatch) - Rebuild midprice_pino.so with latest header changes - Add 5 new mixed fill source tests: vAMM-only, DLOB-only, PropAMM+DLOB, all sources combined, and 2+2 CU measurement - 15/15 bankrun tests passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update bun.lock * add market/oracle order support for PropAMM matching and signed msg e2e tests - Use order.get_limit_price() instead of raw order.price for proper auction/oracle price resolution - Accept Market and Oracle order types in prop_amm match validation - Add atomic signed msg taker tests: limit, market, and oracle order variants - Fix ts-mocha hanging on failure with --exit flag Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * add fee handling, order validation, and optional taker_order_id to PropAMM match - Add taker fee calculation and settlement for all three fill sources (PropAMM makers, DLOB makers, vAMM) using standard drift fee functions - Change taker_order_id from u32 to Option<u32>; None resolves to user.get_last_order_id(), eliminating race conditions in atomic place+fill transactions - Add DLOB maker validation: is_resting_limit_order, max_ts expiry, reduce-only enforcement - Add taker validation: max_ts expiry, reduce-only via existing position, MarketStatus::ReduceOnly enforcement - Update TS tests to use null for atomic signed-msg place+fill cases Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * rename match_perp_order_via_prop_amm to fill_perp_order2 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * add correctness fixes to fill_perp_order2: margin simulation, preflight checks, oracle gating, funding settlement, order bookkeeping, post-fill finalization Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactors + fixes * add oracle paging system for propamm fill efficiency * use PropAMM fill event enum to distinguish * add propamm-sdk: Rust SDK + maker bot for PropAMM quoting Standalone workspace with: - propamm-sdk crate: PDA derivations, instruction builders (midprice-pino native + Drift Anchor CPI), Pyth oracle parsing, async PropAmmClient, sequence/fill monitoring - maker-bot example: full quoting loop with clap CLI + env var config - one-shot-quote example: minimal single-quote demo - rust-toolchain.toml pinned to stable (parent repo uses 1.76) 10/10 unit tests passing (instruction serialization, PDA determinism). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * oracle price cache: resizable entries, optional account, SDK admin methods SetOracleCacheEntries now reallocs both buffers to fit the new entry count (grow or shrink), with seed constraints to prevent cross-shard misuse. Native handler updated for parity. Cache account is optional in FillPerpOrder2 — pass drift program ID as sentinel to skip. Added AdminClient methods: initializeOraclePriceCache, setOracleCacheEntries, updateOracleCacheConfig, updateOraclePriceCache. PDA helper exported from SDK. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * PropAMM registry, oracle cache publish_ts, CI + SDK fixes - PropAMM registry: approve/disable/remove instructions with hot-wallet authority support, SDK PDA helper, rollout doc - Oracle cache: publish_ts-based staleness (prefer timestamp over slot), get_oracle_ts for Pyth Pull/Lazer sources, should_update_from method - CI: new propamm-tests job (midprice_pino unit + propAmmCUs bankrun), oracle cache SDK tests in verify-sdk-configs - SDK: export oracleCache module from index, fix build script echo Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix tests * fix: remove duplicate import and clean up unused deps in test files - isolated_transfer_tests.rs: fix duplicate create_account_info import - user/tests.rs: remove unused imports and prefix unused variables - liquidation/tests.rs: remove unused imports and unnecessary mut Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fmt * fix error code order * fix tests * fix tests, optimize order layout --------- Co-authored-by: jordy25519 <beauchjord@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: 0xahzam <ahzam.main@gmail.com>
|
Caution Review failedPull request was closed or merged during review WalkthroughThe PR introduces comprehensive PropAMM (market maker program) integration with Drift, featuring a new Changes
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120+ minutes Possibly related PRs
Poem
✨ Finishing Touches⚔️ Resolve merge conflicts
|
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 by CodeRabbit
New Features
propamm-sdkwith maker-bot and quoting examples.Bug Fixes
Documentation