Skip to content

Add Vault Rebalancer Automation Spec - #1

Merged
jribbink merged 6 commits into
mainfrom
jribbink/automation-spec
Jun 3, 2026
Merged

Add Vault Rebalancer Automation Spec#1
jribbink merged 6 commits into
mainfrom
jribbink/automation-spec

Conversation

@jribbink

@jribbink jribbink commented May 18, 2026

Copy link
Copy Markdown
Contributor

This PR adds a markdown spec for the Cadence automation that triggers the EVM vault rebalance operation.

@jribbink
jribbink marked this pull request as ready for review May 18, 2026 21:37
Comment thread docs/vault-rebalancer.md Outdated
- **`rebalance()` is idempotent and self-guarding** — it inspects vault state and either acts or no-ops.
- **Internal errors revert the EVM transaction cleanly.** `coa.call` surfaces them as `EVM.Result`, not a Cadence panic.
- **The COA's EVM-side authority is narrow** — restricted to invoking `rebalance()` only (no admin or fund-movement entrypoints). This bounds the blast radius of an admin-compromised Config rewrite to liveness impact.
- **Solvency does not depend on the rebalancer firing.** Insolvency-critical actions take permissionless paths: emergency deleverage triggers above a hard-LTV ceiling, and liquidations are Morpho-driven and external. If a future change makes solvency depend on tick liveness, the Medium-priority choice must be revisited.

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.

I don't really understand what this line means.

emergency deleverage triggers above a hard-LTV ceiling

I don't think there is a separate "emergency deleverage" mechanism, separate from automated rebalancing, that we expect to be more reliable than automated rebalancing.

Morpho will allow anyone to liquidate our position if it exceeds LTV limit. We want to structure our vault such that that is unlikely to happen. The main purpose of the automated rebalancing is to prevent our position from being liquidated, as best we can. But ultimately we can't guarantee solvency without making assumptions about the price movements of the assets we're exposed to.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agree!
Since the config contains the scheduler priority we don't need to concern ourselves here with the specific things the EVM code is doing or isn't doing.
We can just focus on calling a function on a schedule with the provided parameters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah good catch, I think that this came from trying to callout the fact that there are permissionless escape hatches (i.e. permissionless rebalance/user escape hatch) which can be leveraged in the case of rebalancing failure, but this statement doesn't frame it properly adds more confusion than its worth IMO, removed in 4e852dd

Comment thread docs/vault-rebalancer.md Outdated
| COA FLOW depletion (EVM-side gas) | Per-tick COA balance in event; EVM calls fail with insufficient-balance error | Admin tops up the COA |
| Cadence-side OOE (effort margin too tight) | Absence of expected events for the scheduled tx; rebalancer stops ticking | Admin re-invokes self-reschedule; retune effort margin if recurring |

All failures are liveness-only (no solvency impact). Off-chain monitoring of tick freshness, per-tick EVM result status, fee-vault balance, and COA balance is required for reliable operation.

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.

no solvency impact

Again, in my view, one of the main purposes of this component (automated rebalancing) is to avoid liquidations. If the auto-balancer fails to run for an extended period of time, that will impact our LTV. Depending on the direction and magnitude of that impact, it will also impact our solvency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reframed in 4e852dd

Comment thread docs/vault-rebalancer.md Outdated
## What we require from the EVM contract

- **`rebalance()` is idempotent and self-guarding** — it inspects vault state and either acts or no-ops.
- **Internal errors revert the EVM transaction cleanly.** `coa.call` surfaces them as `EVM.Result`, not a Cadence panic.

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.

Internal errors revert the EVM transaction cleanly

I agree that we require that the EVM contract we're calling does not cause the transaction to panic. But also, it's impossible as far as I know for an EVM contract to directly induce a Cadence panic. I would frame this requirement as an assumption that is satisfied based on the structure where we are invoking an EVM function. There is no additional requirement to "revert the EVM transaction cleanly".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah makes sense, changed to an assumption in 4e852dd. The idea was to make it explicit that we were protected from panics because:

  1. None of the Cadence code paths would panic
  2. Any panics that do occur during rebalnacing are within EVM, which can be caught by Cadence

@jribbink
jribbink merged commit b26907d into main Jun 3, 2026
2 checks passed
@jribbink
jribbink deleted the jribbink/automation-spec branch June 3, 2026 18:43
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.

3 participants