refactor(morpho-sdk): extract public reallocation data#655
Conversation
169a678 to
be6a428
Compare
ab3488d to
9aad98e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74ed816128
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
74ed816 to
5eb6445
Compare
5eb6445 to
fd7e814
Compare
fd7e814 to
b5d0ec4
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21685c9693
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
I got this flagged by an agentic review:
But I believe holdings are actually used in the algorithm — could you double check? |
|
Otherwise, this looks very solid. |
|
@carapulse review |
|
@prd-carapulse[bot] review this PR deeply. Make sure it introduces no regressions in scope |
|
Verdict: changes requested. CI green, but regressions found. Blocking:
Release/merge:
Verified:
Track: https://carapulse.morpho.dev/dashboard/runs?run_id=gw_run_53dc11dd01e6 |
The algorithm only checks markets that are in the withdraw queue of a vault, so the market is implicitely enabled. Double-check this @prd-carapulse[bot]
Judged useless: shared liquidity is at worst under-estimated (conservative).
Same reason |
4d430a3 to
1ab3b0d
Compare
* refactor(liquidity-sdk-viem): use morpho reallocation data * feat(morpho-sdk): extract bundler action encoding * docs(morpho-sdk): document Permit2 expiration error * test(liquidity-sdk-viem): checksum loader owner fixture * fix(morpho-sdk): remove unused bundler signature error * fix(morpho-sdk): derive bundler transaction value * docs: document bundler encodeBundle errors * test(morpho-sdk): cover bundler value derivation * docs(morpho-sdk): clarify bundler encoding constraints * docs(morpho-sdk): document native transfer skip behavior * fix: account callback bundle value * test(liquidity-sdk-viem): update loader expectations * refactor(morpho-sdk): remove unused rewards ABI
* refactor(liquidity-sdk-viem): use morpho reallocation data * feat(morpho-sdk): re-export blue sdk surfaces * chore: align reallocation entity exports * fix(morpho-sdk): align re-export subpaths * docs: add package deprecation migration notes * fix(morpho-sdk): preserve source augment side effects
What changed
ReallocationDatastate container for public allocator reallocation computation.ReallocationDatainstead ofSimulationState._try(accessor, UnknownError)for optional domain lookups.Fixes SDK-185
Why
This decouples morpho-sdk reallocation computation from simulation-sdk block state while keeping timestamp-sensitive accrual and pending-cap behavior explicit at the call site. The partial-clone path also avoids repeatedly deep-cloning unrelated market, vault, position, and vault-market-config state during iterative public reallocation computation.
Performance
Local comparison while reviewing the copy strategy measured:
ReallocationData:21.23msReallocationDatareference:97.60ms(4.60xslower than partial clone)SimulationState/ immer implementation:76.28ms(3.59xslower than partial clone)The benchmark scaffolding was removed from the committed tests; the measurements are reported here for the PR discussion.
Validation
pnpm exec biome check packages/morpho-sdk/src/helpers/reallocationData.ts packages/morpho-sdk/src/helpers/reallocationData.test.tspnpm exec vitest run packages/morpho-sdk/src/helpers/reallocationData.test.ts --config vitest.config.ts --project morpho-sdkpnpm --filter @morpho-org/morpho-sdk exec tsc --noEmitgit diff --checkbiome check --write --no-errors-on-unmatched && lint:addressView Slack thread