fix: address AI review findings for #706 recenterAccess removal
- DeployBase.sol: remove broken inline second recenter() (would always revert with 'recenter cooldown' in same Forge broadcast); replace with operator instructions to run the new BootstrapVWAPPhase2.s.sol script at least 60 s after deployment - BootstrapVWAPPhase2.s.sol: new script for the second VWAP bootstrap recenter on Base mainnet deployments - StrategyExecutor.sol: update stale docstring that still described the removed recenterAccess bypass; reflect permissionless model with vm.warp - TestBase.sol: remove vestigial recenterCaller parameter from all four setupEnvironment* functions (parameter was silently ignored after setRecenterAccess was removed); update all callers across six test files - bootstrap-common.sh: fix misleading retry recenter in seed_application_state() — add evm_increaseTime 61 before evm_mine so the recenter cooldown actually clears and the retry can succeed All 210 tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9b53f409b7
commit
0d3aee15b4
11 changed files with 71 additions and 42 deletions
45
onchain/script/BootstrapVWAPPhase2.s.sol
Normal file
45
onchain/script/BootstrapVWAPPhase2.s.sol
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
import { LiquidityManager } from "../src/LiquidityManager.sol";
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
/**
|
||||
* @title BootstrapVWAPPhase2
|
||||
* @notice Second phase of the VWAP bootstrap for Base mainnet deployments.
|
||||
*
|
||||
* Run this script >= 60 seconds after DeployBase (or DeployBaseMainnet/DeployBaseSepolia)
|
||||
* finishes. The first recenter() sets lastRecenterTime; the 60-second cooldown must
|
||||
* elapse before this second recenter() can succeed.
|
||||
*
|
||||
* What this does:
|
||||
* - Calls liquidityManager.recenter() a second time.
|
||||
* - At this point cumulativeVolume == 0 (bootstrap path) and the seed buy has
|
||||
* generated ethFee > 0, so recenter() records the VWAP anchor.
|
||||
* - Asserts cumulativeVolume > 0 to confirm bootstrap success.
|
||||
*
|
||||
* Usage:
|
||||
* export LM_ADDRESS=<deployed LiquidityManager address>
|
||||
* forge script script/BootstrapVWAPPhase2.s.sol --tc BootstrapVWAPPhase2 \
|
||||
* --fork-url $BASE_RPC --broadcast
|
||||
*/
|
||||
contract BootstrapVWAPPhase2 is Script {
|
||||
function run() public {
|
||||
address lmAddress = vm.envAddress("LM_ADDRESS");
|
||||
LiquidityManager lm = LiquidityManager(payable(lmAddress));
|
||||
|
||||
string memory seedPhrase = vm.readFile(".secret");
|
||||
uint256 privateKey = vm.deriveKey(seedPhrase, 0);
|
||||
vm.startBroadcast(privateKey);
|
||||
|
||||
console.log("Running VWAP bootstrap phase 2 on LiquidityManager:", lmAddress);
|
||||
|
||||
lm.recenter();
|
||||
|
||||
uint256 cumVol = lm.cumulativeVolume();
|
||||
require(cumVol > 0, "VWAP bootstrap failed: cumulativeVolume is still 0");
|
||||
console.log("VWAP bootstrapped successfully. cumulativeVolume:", cumVol);
|
||||
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue