Add historical optimization allocations - #1330
Draft
rossgalloway wants to merge 1 commit into
Draft
Conversation
Strengthen optimizer records with explicit allocation coverage and freshness metadata while preserving the raw DOA payload. - Reconcile timestamp-aligned strategy debt and idle capital through Envio and archive RPC - Keep omitted strategies unknown unless scope is authoritative - Add bounded fallbacks, source provenance, contract documentation, and focused tests
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
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
Strengthen the optimization API's allocation-completeness contract without changing the raw DOA optimizer fields. Records now distinguish optimizer coverage residuals from authoritative idle capital, expose freshness metadata, and add timestamp-aligned historical allocation snapshots when Envio and archive RPC data are available.
Historical snapshots use Envio
StrategyChangedevents to establish the strategy universe, archive RPC multicalls for same-block debt and idle-capital values, and Kong only as a provenance-tagged strategy-name catalog. When those sources are incomplete or unavailable, the API returns an explicit incomplete fallback instead of copying current state or synthesizingUnallocated.How to review
allocationCoverage.tsandreconcile.tsfor the public semantics and unknown/outside-scope handling.historicalAllocation.ts,envio.ts, andrpc.tsfor source authority, batching, caching, retries, and bounded fallback behavior.change.tsfor requested-vault enrichment versus the no-fan-out unscoped response.manual-allocation-reallocation-data-spec.mdas the consumer contract and worked yvWETH example.Test plan
bun run test— 176 files, 929 tests passedbun run tslintbun run lintbun run build2026-07-25 00:15:29 UTCagainst Ethereum block25,606,129, including its full strategy composition and 2 bps of same-block idle capitalRisk / impact
This changes additive API metadata and historical enrichment only; raw optimizer fields remain intact. Historical enrichment depends on Envio lifecycle completeness and archive-capable RPC access, so failures intentionally degrade to
allocationSnapshot.complete: falsewith unknown true idle capital. A dedicated provider can be configured withOPTIMIZATION_ARCHIVE_RPC_URL_<chainId>to avoid public-provider rate limits.The downstream optimization visualizer must adopt the new fields separately and stop treating optimizer residuals as confirmed unallocated capital.