Skip to content

feat: default shared-liquidity target utilization to 90% and deprecate its tuning surface - #866

Merged
Foulks-Plb merged 3 commits into
mainfrom
hardcode-90-percent-utilization
Jul 23, 2026
Merged

feat: default shared-liquidity target utilization to 90% and deprecate its tuning surface#866
Foulks-Plb merged 3 commits into
mainfrom
hardcode-90-percent-utilization

Conversation

@Foulks-Plb

@Foulks-Plb Foulks-Plb commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Motivation

The shared-liquidity algorithm exposes configurable supply-target and source-market withdrawal utilizations (via PublicAllocatorOptions, ReallocationComputeOptions, and liquidity-sdk-viem's LiquidityParameters / the API's targetWithdrawUtilization). We want both knobs to converge on a single 90% default and to stop advertising them as tunable, without breaking existing integrators.

Solution

Non-breaking (minor): the defaults move to 90% and the whole tuning surface is @deprecated but still fully honored until the next major.

@morpho-org/morpho-sdk (minor):

  • DEFAULT_SUPPLY_TARGET_UTILIZATION and DEFAULT_WITHDRAWAL_TARGET_UTILIZATION are now both 90% (previously 90.5% and 92%). Callers passing no override trigger reallocations at 90% and cap phase-1 source-market withdrawals at 90%; the aggressive phase-2 fallback still drains to 100% as a last resort.
  • PublicAllocatorOptions.maxWithdrawalUtilization / defaultMaxWithdrawalUtilization and ReallocationComputeOptions.supplyTargetUtilization / defaultSupplyTargetUtilization are @deprecated. The per-market → default → constant resolution chain is unchanged, so explicit overrides behave exactly as before.

@morpho-org/liquidity-sdk-viem (minor):

  • LiquidityParameters and the LiquidityLoader parameters constructor argument are @deprecated. The loader no longer consults the Morpho API's per-market targetWithdrawUtilization; the ceiling defaults to 90% via morpho-sdk. Explicitly passed parameters overrides are still forwarded and honored.
  • The @morpho-org/morpho-sdk peer range moves to ^5.4.0, since the 90% default ceiling ships with that release (an older peer would silently keep the 92% default now that the API value is ignored).
  • The pinned-block fork tests' expected withdrawal plans are re-recorded against the 90% ceiling.

@morpho-org/wdk-protocol-lending-morpho-evm (patch): dependency-resolution cascade only.

Tests, JSDoc, and the changeset land with the change.

🤖 Generated with Claude Code

@Foulks-Plb Foulks-Plb added the enhancement New feature or request label Jul 10, 2026
@Foulks-Plb Foulks-Plb self-assigned this Jul 10, 2026
@Foulks-Plb

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 440c24280c

ℹ️ 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".

Reworks the "hardcode 90%" change to be non-breaking. Instead of removing
the tuning surface, keep it and mark it @deprecated, and change only the
default constant values. No public symbol is removed, renamed, or retyped,
so morpho-sdk and liquidity-sdk-viem stay on a minor bump.

morpho-sdk (minor):
- DEFAULT_SUPPLY_TARGET_UTILIZATION and DEFAULT_WITHDRAWAL_TARGET_UTILIZATION
  are now both 90% (were 90.5% and 92%).
- PublicAllocatorOptions.maxWithdrawalUtilization / defaultMaxWithdrawalUtilization
  and ReallocationComputeOptions.supplyTargetUtilization /
  defaultSupplyTargetUtilization are @deprecated but still honored.

liquidity-sdk-viem (minor):
- LiquidityParameters and the LiquidityLoader parameters argument are
  @deprecated. The source-market withdrawal ceiling defaults to 90% and the
  API targetWithdrawUtilization field is no longer consulted; explicit
  parameters overrides are still honored.

wdk-protocol-lending-morpho-evm cascades a patch. Tests, JSDoc, and the
changeset are updated; the parity suite pins the legacy 92% default so it
stays algorithm-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Foulks-Plb
Foulks-Plb force-pushed the hardcode-90-percent-utilization branch from daeb380 to eabd95c Compare July 23, 2026 11:14
@Foulks-Plb

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: eabd95cb83

ℹ️ 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".

… peer

The pinned-block fork tests in liquidity-sdk-viem/test/loader.test.ts still
asserted withdrawal plans computed with the API-provided per-market ceilings;
re-record them against the fixed 90% default. Bump the morpho-sdk peer range to
^5.4.0 since the 90% ceiling ships with that release — an older peer would
silently keep the 92% default now that the API value is ignored.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Foulks-Plb Foulks-Plb changed the title feat: hardcode shared-liquidity target utilization at 90% feat: default shared-liquidity target utilization to 90% and deprecate its tuning surface Jul 23, 2026
@Foulks-Plb
Foulks-Plb marked this pull request as ready for review July 23, 2026 14:53
@Foulks-Plb
Foulks-Plb requested a review from a team as a code owner July 23, 2026 14:53

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

0xbulma
0xbulma previously approved these changes Jul 23, 2026
… default

The withdrawal-utilization default is now always 90%, so the parity harness
pins the legacy SimulationState reference onto morpho-sdk's
DEFAULT_WITHDRAWAL_TARGET_UTILIZATION (90%) instead of a hardcoded 92%
LEGACY_DEFAULT_WITHDRAWAL_UTILIZATION constant. Single source of truth; the
comparison stays algorithm-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Foulks-Plb
Foulks-Plb merged commit fd9809c into main Jul 23, 2026
6 checks passed
@Foulks-Plb
Foulks-Plb deleted the hardcode-90-percent-utilization branch July 23, 2026 16:11
Foulks-Plb added a commit that referenced this pull request Jul 27, 2026
Resolves the conflicts by taking `main` as the base for every file and
re-applying only the deprecated-package removal on top, so nothing landed
on `main` since the branch point is reverted.

The branch had been rebased in a way that dropped work merged into `main`
after its branch point. Restored from `main` and kept out of the resolution:

- `ReallocationData.getPublicReallocationLiquidity` and
  `getAvailableLiquidityToUtilization` (#796, #813) plus their
  `reallocationData.metrics.test.ts` suite.
- `helpers/utilization.ts` (`getSupplyTargetUtilization`) and its use in
  `computeReallocations`, including the #866 target-utilization changes.
- `morpho-sdk` version 5.4.1 and its 4.1.0 → 5.4.1 CHANGELOG entries
  (the branch reset the manifest to 4.0.0).
- `docs/tibs/TIB-2026-06-16-shared-liquidity-target-utilization-metric.md`.
- The `README.md` "Secondary packages" wording and the `midnight-sdk` entry.
- `BundlerAction.morphoSetAuthorizationWithSig` and the `midnight-sdk`
  Vitest project / fork-test timeouts.

Deprecated-package removal re-applied against current `main`:

- Deleted `simulation-sdk`, `bundler-sdk-viem`, `blue-sdk-wagmi`,
  `migration-sdk-viem`, `simulation-sdk-wagmi`.
- Dropped their Biome ignores, Typedoc entry points, Vitest projects and
  CI filters, JSDoc coverage tiers, and the `--exclude-deprecated`
  checksum-lint flag.
- Removed the frozen-deprecated-package rules from `AGENTS.md` and the
  `code-quality` / `style-conventions` / `ci-release-security` personas.
- Dropped the two `morpho-sdk` devDependencies on the deleted packages and
  the parity suites that were their only consumers
  (`bundler-sdk-viem parity` in `bundler/actions.test.ts`,
  `ReallocationData SimulationState parity` in `reallocationData.test.ts`).
- Regenerated `pnpm-lock.yaml` (deletions only, no version drift).

Validation: `pnpm lint`, `pnpm build:ci`, `tsc --noEmit` per package, and
1395 + 510 + 96 non-fork tests pass. Fork suites need RPC secrets and were
not run locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants