Skip to content

Add batch auto-balancer relaunch and supervisor admin tx on v0#249

Open
liobrasil wants to merge 5 commits intov0from
lionel/batch-relaunch-auto-balancers-v0
Open

Add batch auto-balancer relaunch and supervisor admin tx on v0#249
liobrasil wants to merge 5 commits intov0from
lionel/batch-relaunch-auto-balancers-v0

Conversation

@liobrasil
Copy link
Copy Markdown
Contributor

Summary

  • add a single admin transaction to batch relaunch multiple auto-balancers by id
  • make the relaunch logic stuck-aware so it only cancels live scheduled entries when needed
  • ensure the global supervisor is present and schedule a fresh recurring supervisor run in the same transaction

Why

The current admin flow requires multiple transactions:

  • relaunch each auto-balancer one by one
  • reason manually about whether cancellation is safe based on stuck state
  • separately schedule or reset the supervisor

This PR adds one v0 admin entrypoint that can do the full recovery pass atomically.

Behavior

For each requested auto-balancer id:

  • dedupe ids in the input array
  • borrow the auto-balancer from storage
  • if the vault is not stuck, cancel only Scheduled transactions so the new config takes effect immediately
  • if the vault is stuck, leave inactive scheduled records alone and seed the next rebalance directly
  • apply a new recurring config and immediately call scheduleNextRebalance(nil)

For the supervisor:

  • detect an invalid stored supervisor capability and reset that state before reconfiguring
  • call ensureSupervisorConfigured() so a missing supervisor is recreated
  • cancel any currently scheduled supervisor run
  • schedule a fresh recurring supervisor execution with the provided interval / effort / scan settings

Validation

  • flow cadence lint cadence/transactions/flow-yield-vaults/admin/batch_relaunch_auto_balancers_and_schedule_supervisor.cdc --warnings-as-errors
    • passed
  • flow cadence lint cadence/transactions/flow-yield-vaults/admin/relaunch_auto_balancer_by_id.cdc
    • passed in the same bootstrapped origin/v0 worktree

Notes

This is scoped to the v0 architecture and uses:

  • FlowYieldVaultsAutoBalancersV1
  • FlowYieldVaultsSchedulerV1
  • AutoBalancers.AutoBalancerRecurringConfig

@liobrasil liobrasil marked this pull request as ready for review April 3, 2026 11:03
@liobrasil liobrasil requested a review from a team as a code owner April 3, 2026 11:03
@liobrasil liobrasil requested a review from nialexsan April 3, 2026 11:59
@liobrasil liobrasil requested a review from a team April 7, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants