feat(api): add migrate_adapter rebalance keeper - #512
Merged
Conversation
|
Deployment failed for project meridian with the following error: Learn More: https://vercel.link/3Fpeeb1 |
collinsezedike
force-pushed
the
feat/469-migrate-adapter-keeper
branch
from
August 14, 2026 15:32
122e2c8 to
6eecb62
Compare
collinsezedike
force-pushed
the
feat/469-migrate-adapter-keeper
branch
from
August 15, 2026 14:08
c2d2b6e to
0d4cc58
Compare
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
MeridianRouterentirely: per-user delegated rebalancing is structurally impossible on Stellar, token transfers and burns always require the token holder's own signature and there is no allowance/delegation primitivepackages/stellar-sdk-helpers/src/migration-keeper.ts) that compares live rates across a vault's candidate protocol adapters and calls the existing, already-admin-gatedmigrate_adapterwhen a candidate clears a configured minimum improvement, with the same retry, deadline-budget, and structured-failure-reporting shape as the existing accrue keepermigrate_adapterbeing added tovault/src/lib.rsand doesn't have the function at all, confirmed directly against the live contract ([Bug] Live testnet vault predates migrate_adapter, needs redeployment #514). Seeapps/docs/operations/migration-keeper.mdMeridianDefindexAdapteron testnet (CAJVTA7EC3ZL3G4WSU4QIRB7RU7SUFUUJDEB7JE6CQQNPE7QC5OBSAM6) against the existing DeFindex testnet vault, so there's a genuine second candidate to evaluate once the gaps above close; it is not the vault's active adapter. Deliberately not wired intopackages/shared/src/constants.ts, that file gates a required CI check verifying the vault address's on-chain bytecode against source, and [Bug] Live testnet vault predates migrate_adapter, needs redeployment #514 already fails it independent of this address; setMERIDIAN_DEFINDEX_ADAPTER_IDdirectly insteadapi/v1/keepers/rebalanceendpoint.MERIDIAN_MIGRATION_KEEPER_SECRET_KEYis a separate, higher-trust key from the accrue keeper's sincemigrate_adapteris admin-gated andaccrue()is not. Itsvercel.jsoncron entry is known to be non-functional on the Hobby plan (same limitation the existing accrue keeper's cron already hits), tracked separately in [Chore] Move keeper scheduling off Vercel Cron #513keeper-retry.ts/keeper-tx.tsmodules so the new migration keeper reuses them instead of duplicating a third copy; closes out several items from [Chore] Deduplicate retry/error-handling logic in the accrual keeper #510 as a result (tracked there)Test plan
cargo build --workspacepasses with the router package removedpnpm typecheckpasses acrossstellar-sdk-helpers,api,sharedpnpm testpasses: 166 tests instellar-sdk-helpers(18 new for the migration keeper), 35 inapi(3 new for the rebalance endpoint)MeridianDefindexAdapteron testnet viastellar contract invoke:get_protocolreturnsdefindex,get_poolreturns the configured DeFindex vault,total_assetsreturns0stellar contract invoke -- --help: nomigrate_adapter, confirming [Bug] Live testnet vault predates migrate_adapter, needs redeployment #514Closes #469