fix: No recovery path if VWAP bootstrap fails mid-sequence (#644)

Add recovery procedure documentation and automated recovery script for
when the VWAP bootstrap fails partway through (e.g. second recenter
reverts due to insufficient price movement).

- Add "Recovery from failed mid-sequence bootstrap" section to
  docs/mainnet-bootstrap.md with diagnosis steps and manual recovery
- Create scripts/recover-bootstrap.sh to automate diagnosis and retry
- Add warning comments in BootstrapVWAPPhase2.s.sol, DeployBase.sol,
  and bootstrap-common.sh referencing the recovery procedure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-19 22:24:05 +00:00
parent 9cfffa5cea
commit fbe8384342
5 changed files with 291 additions and 0 deletions

View file

@ -18,6 +18,13 @@ import "forge-std/Script.sol";
* generated ethFee > 0, so recenter() records the VWAP anchor.
* - Asserts cumulativeVolume > 0 to confirm bootstrap success.
*
* WARNING: If this script reverts (e.g. "amplitude not reached" due to
* insufficient price movement from the seed buy), the LiquidityManager is
* left in a partially bootstrapped state with positions deployed but
* cumulativeVolume == 0. See docs/mainnet-bootstrap.md "Recovery from
* failed mid-sequence bootstrap" for the recovery procedure, or run
* scripts/recover-bootstrap.sh to diagnose and retry automatically.
*
* Usage:
* export LM_ADDRESS=<deployed LiquidityManager address>
*

View file

@ -118,6 +118,11 @@ contract DeployBase is Script {
// Phase 2 wait >= 300 s, fund LM, first recenter(), seed buy
// Phase 3 wait >= 60 s, run BootstrapVWAPPhase2.s.sol
//
// RECOVERY: If Phase 3 reverts mid-sequence, the LM is left with
// positions deployed but cumulativeVolume == 0. See
// docs/mainnet-bootstrap.md "Recovery from failed mid-sequence
// bootstrap" or run scripts/recover-bootstrap.sh.
//
// The cumulativeVolume==0 path in recenter() records VWAP from whatever
// price exists at the time of the first fee event. An attacker who
// front-runs deployment with a whale buy inflates that anchor; executing