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
|
|
@ -41,7 +41,7 @@ contract EthScarcityAbundance is Test {
|
|||
// Default params: CI=50%, AS=50%, AW=50, DD=50%
|
||||
optimizer = new ConfigurableOptimizer(5e17, 5e17, 50, 5e17);
|
||||
|
||||
(factory, pool, weth, kraiken,, lm,, token0isWeth) = testEnv.setupEnvironmentWithExistingFactory(factory, true, fees, address(optimizer));
|
||||
(factory, pool, weth, kraiken,, lm,, token0isWeth) = testEnv.setupEnvironmentWithExistingFactory(factory, true, address(optimizer));
|
||||
|
||||
swapExecutor = new SwapExecutor(pool, weth, kraiken, token0isWeth, lm, true);
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ contract EthScarcityAbundance is Test {
|
|||
// Bull optimizer: high anchorShare, wide anchor, deep discovery
|
||||
ConfigurableOptimizer bullOpt = new ConfigurableOptimizer(3e17, 8e17, 80, 8e17);
|
||||
|
||||
(,,,,, LiquidityManager bullLm,,) = testEnv.setupEnvironmentWithExistingFactory(factory, true, fees, address(bullOpt));
|
||||
(,,,,, LiquidityManager bullLm,,) = testEnv.setupEnvironmentWithExistingFactory(factory, true, address(bullOpt));
|
||||
|
||||
vm.deal(address(bullLm), 200 ether);
|
||||
vm.prank(address(bullLm));
|
||||
|
|
@ -252,7 +252,7 @@ contract EthScarcityAbundance is Test {
|
|||
// Bear optimizer: low anchorShare, moderate anchor, thin discovery
|
||||
ConfigurableOptimizer bearOpt = new ConfigurableOptimizer(8e17, 1e17, 40, 2e17);
|
||||
|
||||
(,,,,, LiquidityManager bearLm,,) = testEnv.setupEnvironmentWithExistingFactory(factory, true, fees, address(bearOpt));
|
||||
(,,,,, LiquidityManager bearLm,,) = testEnv.setupEnvironmentWithExistingFactory(factory, true, address(bearOpt));
|
||||
|
||||
vm.deal(address(bearLm), 200 ether);
|
||||
vm.prank(address(bearLm));
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ contract FuzzingAnalyzerBugs is Test {
|
|||
// Bear market params: CI=0.8e18, AS=0.1e18, AW=40, DD=0.2e18
|
||||
optimizer = new ConfigurableOptimizer(8e17, 1e17, 40, 2e17);
|
||||
|
||||
(factory, pool, weth, kraiken,, lm,, token0isWeth) = testEnv.setupEnvironmentWithExistingFactory(factory, true, fees, address(optimizer));
|
||||
(factory, pool, weth, kraiken,, lm,, token0isWeth) = testEnv.setupEnvironmentWithExistingFactory(factory, true, address(optimizer));
|
||||
|
||||
swapExecutor = new SwapExecutor(pool, weth, kraiken, token0isWeth, lm, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ contract LiquidityManagerTest is UniSwapHelper {
|
|||
LiquidityManager _lm,
|
||||
Optimizer _optimizer,
|
||||
bool _token0isWeth
|
||||
) = testEnv.setupEnvironment(token0shouldBeWeth, RECENTER_CALLER);
|
||||
) = testEnv.setupEnvironment(token0shouldBeWeth);
|
||||
|
||||
// Assign to state variables
|
||||
factory = _factory;
|
||||
|
|
@ -1029,7 +1029,7 @@ contract LiquidityManagerTest is UniSwapHelper {
|
|||
function testOptimizerFallback() public {
|
||||
RevertingOptimizer revertingOpt = new RevertingOptimizer();
|
||||
TestEnvironment env = new TestEnvironment(feeDestination);
|
||||
(,,,,, LiquidityManager _lm,,) = env.setupEnvironmentWithOptimizer(DEFAULT_TOKEN0_IS_WETH, RECENTER_CALLER, address(revertingOpt));
|
||||
(,,,,, LiquidityManager _lm,,) = env.setupEnvironmentWithOptimizer(DEFAULT_TOKEN0_IS_WETH, address(revertingOpt));
|
||||
|
||||
// Recenter uses the fallback params from the catch block
|
||||
vm.prank(RECENTER_CALLER);
|
||||
|
|
@ -1065,7 +1065,7 @@ contract LiquidityManagerTest is UniSwapHelper {
|
|||
LiquidityManager _lm,
|
||||
Optimizer _optimizer,
|
||||
bool _token0isWeth
|
||||
) = selfFeeEnv.setupEnvironmentWithSelfFeeDestination(DEFAULT_TOKEN0_IS_WETH, RECENTER_CALLER);
|
||||
) = selfFeeEnv.setupEnvironmentWithSelfFeeDestination(DEFAULT_TOKEN0_IS_WETH);
|
||||
|
||||
// Wire state variables used by buy/sell/recenter helpers
|
||||
factory = _factory;
|
||||
|
|
@ -1143,7 +1143,6 @@ contract LiquidityManagerTest is UniSwapHelper {
|
|||
,
|
||||
) = clampTestEnv.setupEnvironmentWithOptimizer(
|
||||
DEFAULT_TOKEN0_IS_WETH,
|
||||
RECENTER_CALLER,
|
||||
address(highWidthOptimizer)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ contract ReplayProfitableScenario is Test {
|
|||
BullMarketOptimizer optimizer = new BullMarketOptimizer();
|
||||
|
||||
// Use seed 1 setup (odd seed = false for first param)
|
||||
(, pool, weth, kraiken, stake, lm,, token0isWeth) = testEnv.setupEnvironmentWithOptimizer(false, feeDestination, address(optimizer));
|
||||
(, pool, weth, kraiken, stake, lm,, token0isWeth) = testEnv.setupEnvironmentWithOptimizer(false, address(optimizer));
|
||||
|
||||
// Fund exactly as in the recorded scenario
|
||||
vm.deal(address(lm), 200 ether);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ contract SupplyCorruptionTest is UniSwapHelper {
|
|||
LiquidityManager _lm,
|
||||
Optimizer _optimizer,
|
||||
bool _token0isWeth
|
||||
) = testEnv.setupEnvironment(false, RECENTER_CALLER);
|
||||
) = testEnv.setupEnvironment(false);
|
||||
|
||||
factory = _factory;
|
||||
pool = _pool;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ contract VWAPFloorProtectionTest is UniSwapHelper {
|
|||
function setUp() public {
|
||||
testEnv = new TestEnvironment(feeDestination);
|
||||
(,pool, weth, harberg, , lm, , token0isWeth) =
|
||||
testEnv.setupEnvironment(false, RECENTER_CALLER);
|
||||
testEnv.setupEnvironment(false);
|
||||
|
||||
vm.deal(address(lm), LM_ETH);
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ contract TestEnvironment is TestConstants {
|
|||
/**
|
||||
* @notice Deploy all contracts and set up the environment
|
||||
* @param token0shouldBeWeth Whether WETH should be token0
|
||||
* @param recenterCaller Address that will be granted recenter access
|
||||
* @return _factory The deployed Uniswap factory
|
||||
* @return _pool The created Uniswap pool
|
||||
* @return _weth The WETH token contract
|
||||
|
|
@ -101,10 +100,7 @@ contract TestEnvironment is TestConstants {
|
|||
* @return _optimizer The optimizer contract
|
||||
* @return _token0isWeth Whether token0 is WETH
|
||||
*/
|
||||
function setupEnvironment(
|
||||
bool token0shouldBeWeth,
|
||||
address recenterCaller
|
||||
)
|
||||
function setupEnvironment(bool token0shouldBeWeth)
|
||||
external
|
||||
returns (
|
||||
IUniswapV3Factory _factory,
|
||||
|
|
@ -201,7 +197,6 @@ contract TestEnvironment is TestConstants {
|
|||
/**
|
||||
* @notice Setup environment with specific optimizer
|
||||
* @param token0shouldBeWeth Whether WETH should be token0
|
||||
* @param recenterCaller Address that will be granted recenter access
|
||||
* @param optimizerAddress Address of the optimizer to use
|
||||
* @return _factory The deployed Uniswap factory
|
||||
* @return _pool The created Uniswap pool
|
||||
|
|
@ -212,11 +207,7 @@ contract TestEnvironment is TestConstants {
|
|||
* @return _optimizer The optimizer contract
|
||||
* @return _token0isWeth Whether token0 is WETH
|
||||
*/
|
||||
function setupEnvironmentWithOptimizer(
|
||||
bool token0shouldBeWeth,
|
||||
address recenterCaller,
|
||||
address optimizerAddress
|
||||
)
|
||||
function setupEnvironmentWithOptimizer(bool token0shouldBeWeth, address optimizerAddress)
|
||||
external
|
||||
returns (
|
||||
IUniswapV3Factory _factory,
|
||||
|
|
@ -257,12 +248,8 @@ contract TestEnvironment is TestConstants {
|
|||
* _getOutstandingSupply skips the feeDestination KRK subtraction (already excluded
|
||||
* by outstandingSupply()).
|
||||
* @param token0shouldBeWeth Whether WETH should be token0
|
||||
* @param recenterCaller Address that will be granted recenter access
|
||||
*/
|
||||
function setupEnvironmentWithSelfFeeDestination(
|
||||
bool token0shouldBeWeth,
|
||||
address recenterCaller
|
||||
)
|
||||
function setupEnvironmentWithSelfFeeDestination(bool token0shouldBeWeth)
|
||||
external
|
||||
returns (
|
||||
IUniswapV3Factory _factory,
|
||||
|
|
@ -301,7 +288,6 @@ contract TestEnvironment is TestConstants {
|
|||
* @notice Setup environment with existing factory and specific optimizer
|
||||
* @param existingFactory The existing Uniswap factory to use
|
||||
* @param token0shouldBeWeth Whether WETH should be token0
|
||||
* @param recenterCaller Address that will be granted recenter access
|
||||
* @param optimizerAddress Address of the optimizer to use
|
||||
* @return _factory The existing Uniswap factory
|
||||
* @return _pool The created Uniswap pool
|
||||
|
|
@ -315,7 +301,6 @@ contract TestEnvironment is TestConstants {
|
|||
function setupEnvironmentWithExistingFactory(
|
||||
IUniswapV3Factory existingFactory,
|
||||
bool token0shouldBeWeth,
|
||||
address recenterCaller,
|
||||
address optimizerAddress
|
||||
)
|
||||
external
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue