You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit baeed30
Browse filesBrowse the repository at this point in the historyBrowse files
Order book (Anchor v1): port eviction from the Anchor v2 copy
CONTRIBUTING.md now says an Anchor v1 copy tracks its v2 counterpart, so
eviction goes into all three variants rather than only Anchor v2 and Quasar.
The port matches the v2 copy: worst_leaf and OrderBook::worst, the
512-order capacity fix, credit_unfilled_lock shared with cancel_order, the
MissingEvictedAccounts and EvictedAccountMismatch errors, the eviction step
in place_order, the README and CHANGELOG, and the same five tests. When the
worst order is the caller's own, only the order is passed and the caller's
market_user is credited, as in v2. Anchor v1 would accept the caller's
MarketUser a second time, but a second loaded copy would be overwritten
when the instruction writes its accounts back, so the rule matters here too.
This copy is not rustfmt-clean on main and is outside the workspace CI
formats, so the change is left unformatted to keep the diff to the port.
Claude-Session: https://claude.ai/code/session_01RBfNjrQd2J6muoi3thCUin
Copy file name to clipboardExpand all lines: finance/order-book/anchor-v1/README.md
+59-11Lines changed: 59 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,7 +74,7 @@ call `settle_funds` to pull their balances out.
74
74
(base vault, quote vault, fee vault, order book), and the pubkey
75
75
that can withdraw accumulated fees.
76
76
- An **OrderBook** account - two stores: bids sorted highest-first,
77
-
asks sorted lowest-first, each holding up to 1024 entries. Rather
77
+
asks sorted lowest-first, each holding up to 512 orders. Rather
78
78
than a plain list of orders, each side uses a depth-bounded tree (a
79
79
critbit trie) for fast lookup - see [Ensuring fast order matching performance](#ensuring-fast-order-matching-performance).
80
80
Each entry stores enough to drive matching (price, quantity,
@@ -372,7 +372,7 @@ Alice's remaining 2-NVDAx [bid](https://www.investopedia.com/terms/b/bid.asp) st
372
372
### State / data accounts
373
373
374
374
-`Market`: PDA yes, seeds `["market", base_mint, quote_mint]`, authority program, holds fee rate, tick size, min order size, base/quote mint pubkeys, vault pubkeys, order book pubkey, `authority` wallet (allowed to withdraw fees)
375
-
-`OrderBook`: PDA no (client-allocated at a public key the client generates), seeds n/a: too large (~180 KB) for an `init`/CPI PDA, so created via `create_account` (which needs a signing key a PDA lacks); tied to its market via `has_one`; authority program, holds two critbit trees (bids highest-first, asks lowest-first, 1024 leaves each), `next_order_id`
375
+
-`OrderBook`: PDA no (client-allocated at a public key the client generates), seeds n/a: too large (~180 KB) for an `init`/CPI PDA, so created via `create_account` (which needs a signing key a PDA lacks); tied to its market via `has_one`; authority program, holds two critbit trees (bids highest-first, asks lowest-first, 512 orders each: every order after the first adds a leaf and an inner node to a 1024-node tree), `next_order_id`
0 commit comments