Add DeepBook core account wrapper#1091
Conversation
c3e4314 to
0d39c6a
Compare
0d39c6a to
06f0814
Compare
2ea041b to
f4f5932
Compare
Code reviewNo fund-loss or theft path found — custody is sound (the embedded manager's owner is a derived-object address no one can sign for, so the slot-held caps are the sole authority). The findings below are a keeper-liveness gap, an API-semantics footgun, and cleanup, ordered most severe first. Every finding was verified against the actual callee implementations ( Findings1. Permissionless settled-withdraw aborts when an initialized manager has nothing settled — and that branch is untested —
2. Cancel/withdraw paths call
3. Core has no max-cost concept ( 4. Unconditional 3-type settle wastes a Bag write + accumulator lookup per unused asset on the hottest path —
5. The sweep→deposit epilogue is copy-pasted in all six mutating entrypoints; the 9-line funding prologue is byte-identical between the two order functions — A missed edit in one of six sites would silently strand funds in the manager. A 6. Raw
Checked and cleared
One PR-description nit: the summary says the manager is funded "for order and swap calls," but the diff contains no swap wrappers — worth updating the description or noting swaps as follow-up. Standalone verdict: the package is isolated (nothing existing is touched), so it's safe as a standalone PR once findings 1–2 are addressed — 1 is a keeper-facing abort that would otherwise ship into the public API surface. Finding 3 is naming/docs only, but worth settling pre-deploy since the trading signatures are a permanent public API. 🤖 Generated with Claude Code |
Summary
deepbook_core_accountMove package that wraps DeepBook core trading APIs with account-model custody.DeepbookCoreAccountAppaccount data slot.Key decisions
AccountWrapper+Authinstead of exposing balance-manager custody to callers.AccountRegistryand usesDeepbookCoreAccountAppapp auth; it requires an already-initialized account slot because a never-initialized embedded manager cannot own settled orders.Test plan
npx -y prettier-move -c packages/deepbook_core_account/sources/deepbook_core_account.move packages/deepbook_core_account/tests/deepbook_core_account_tests.move --writesui move build --path packages/deepbook_core_account --build-env testnetsui move test --path packages/deepbook_core_account --build-env testnet --gas-limit 100000000000