Repository navigation
Replenish the OUSD Vault idle buffer through Talos - #3069
naddison36 wants to merge 5 commits into
Conversation
|
The module sends the queue shortfall and the buffer top-up as one withdrawal, capped only by I'd fund the queue shortfall first, then try the buffer top-up as a separate best-effort withdrawal. Capping at the strategy's |
| // Step 2: Reserve all outstanding withdrawals, then target the idle buffer. | ||
| uint256 shortfall = liquidityShortfall(); | ||
|
|
||
| if (shortfall == 0) { |
There was a problem hiding this comment.
After a run, idle USDC sits exactly at targetBuffer(), so every rebase that grows totalSupply leaves a tiny shortfall. With a 1% buffer, about 1e14 wei of OUSD growth already creates a 1-wei USDC gap. Almost every run then calls withdrawFromStrategy for a few USDC, which costs extra strategy gas for no real benefit. Add a minimum buffer deficit, for example a percentage of the target, and only top up the buffer once the gap passes it. Keep funding the withdrawal queue shortfall in full, whatever its size.
There was a problem hiding this comment.
Addressed in d77faf5e3. The threshold is enforced in Talos through bufferThreshold, defaulting to 100 bps (1% of the target buffer), rounded up to the asset's smallest unit. Buffer-only runs skip both simulation and submission when the deficit, or the withdrawal after the strategy-balance cap, is below that minimum. Queue funding is exempt regardless of size and can include buffer replenishment in the same transaction. Fully funded targets also skip. Added coverage for threshold boundaries, rounding, configurable percentages, strategy caps, and tiny queue deficits.
| } | ||
|
|
||
| return await getContract("AutoWithdrawalModule"); | ||
| // Descriptors supply addresses; the curated ABI also includes buffer views. |
There was a problem hiding this comment.
The action calls liquidityShortfall() and targetBuffer() every run. The module in deployments/mainnet/AutoWithdrawalModule.json (0x90d588fc…2ae5) only has pendingShortfall(). So before deploy 016, the read reverts and no withdrawals get funded. After make deploy-mainnet updates the descriptor but before the Safe runs enableModule, fundWithdrawals() reverts with GS104 inside the Safe. That is a hard revert, so the soft-failure path is skipped, and the old module that is still enabled is never called. We should pause the Talos action and do the deployment, enable the module on the Safe and then unpause the action for a smoother transition
There was a problem hiding this comment.
Addressed in c72332fbf. Added an explicit rollout checklist to deploy 016 and ACTIONS.md: pause the action and drain any in-flight run before releasing the new code, deploy, enable the replacement/disable the old module and set the buffer on the Safe, ship the updated runner descriptor/ABI, verify simulation, then resume and run manually.
The action now checks isModuleEnabled(module) on module.safeContract() before reading the new buffer views, and throws an explicit activation error without simulating or sending if disabled. Tests cover disabled modules and activation-check failures. There is no legacy-module fallback; the coordinated rollout is still required because an enabled old module lacks the new API.
| function test_targetBuffer_matchesVaultAllocation() public view { | ||
| IVault vault = IVault(autoWithdrawalModule.vault()); | ||
| uint256 supply = IOToken(vault.oToken()).totalSupply(); | ||
| assertEq(vault.vaultBuffer(), 1e16); |
There was a problem hiding this comment.
assertEq(vault.vaultBuffer(), 1e16) only passes because _fork() pranks setVaultBuffer(1e16). After 016 is marked done, _fork() stops running, so any Strategist change to the buffer will fail mainnet smoke CI, even though the formula check right after it would still pass. Before execution, this assert also passes even if the Safe never enabled the module, so it proves nothing about the deployment. I'd drop the pin and keep the formula equality, or assert vaultBuffer() > 0 and check that the module is enabled on the Safe.
There was a problem hiding this comment.
Addressed in 7921314b3. Removed the fixed 1% assertion and retained the formula equality against the Vault's configured buffer, including zero. Added a separate test_moduleEnabled() check on the module's Safe. The exact 1% assertion remains in deploy 016's _fork() to verify the intended initial setup.
The smoke checks observe simulated activation while deploy 016 is pending, and live fork state once the deployment is marked complete. All 9 focused Ethereum fork smoke tests passed.
|
@shahthepro, addressed the queue-versus-buffer liquidity issue from this comment in e00ee5ae3. Talos now simulates Added the 50k queue / 560k buffer / 300k available-liquidity regression, plus action tests for reverted and soft-failed simulations, queue-only fallback, and no submission when both modes fail. |
|
This change has got way bigger than the original intention. Closing for now |
With a nonzero OUSD Vault buffer and no withdrawal queue shortfall, the current auto-withdrawal module does nothing and leaves the idle buffer depleted. The replacement funds all queued, unclaimed withdrawals plus the configured idle buffer, subtracting existing Vault USDC and capping the withdrawal at the strategy's reported balance. It uses the same supply percentage and decimal rounding as Vault allocation.
pendingShortfall()withtargetBuffer()andliquidityShortfall().otokenOusdAutoWithdrawallogging and load the module through a curated ABI.Deployment
016_AutoWithdrawalBufferdeploys only a replacementAutoWithdrawalModule, retaining the existing Safe and strategy and granting the Talos relayer the operator role. No core Vault/token upgrade or role reassignment is required. The Safe must enable the replacement, disable the old module, and callVault.setVaultBuffer(1e16)for 1%. These Safe transactions are simulated in_fork(), not broadcast by the deploy script.Talos impact:
make deploy-mainnetrefreshesdeployments/mainnet/AutoWithdrawalModule.json; ship that address descriptor and the newabi/AutoWithdrawalModule.jsonin the runner image after Safe activation, and update any explicit--moduleoverride. The pinned old-module address in the deploy script is intentionally retained for retirement; no action-local orutils/addresses.jsaddress update is needed. The existing twice-daily schedule remains unchanged, so withdrawals can consume the buffer between runs. Strategy withdrawals retain the existing soft-failure handling when immediately available liquidity is insufficient.Validation: