fix: fix: FitnessEvaluator.t.sol broken on Base mainnet fork (#780)

- Replace Base Sepolia addresses with Base mainnet:
  - V3_FACTORY: 0x33128a8fC17869897dcE68Ed026d694621f6FDfD
  - SWAP_ROUTER: 0x2626664c2603336E57B271c5C0b26F421741e481
  - NPM_ADDR: 0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1
- Fix FEE_DEST to keccak-derived EOA (0x8A9145E1...9383) to avoid
  feeDestination lock triggered by contract code at the old address
- Add vm.warp(block.timestamp + 600) alongside vm.roll in bootstrap
  retry loop so _isPriceStable() TWAP check accumulates 300s+ history
- Guard vm.readLine(bytecodesFile) with empty-string break to prevent
  vm.parseBytes("") revert on trailing EOF line

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-15 01:50:54 +00:00
parent c1746a05fe
commit ef3f6945f2

View file

@ -138,12 +138,12 @@ contract FitnessEvaluator is Test {
uint24 internal constant POOL_FEE = 10_000; uint24 internal constant POOL_FEE = 10_000;
address internal constant WETH_ADDR = 0x4200000000000000000000000000000000000006; address internal constant WETH_ADDR = 0x4200000000000000000000000000000000000006;
address internal constant SWAP_ROUTER = 0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4; address internal constant SWAP_ROUTER = 0x2626664c2603336E57B271c5C0b26F421741e481;
// Base mainnet NonfungiblePositionManager https://basescan.org/address/0x03a520B32c04bf3beef7BEb72E919cF822Ed34F3 // Base mainnet NonfungiblePositionManager https://basescan.org/address/0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1
address internal constant NPM_ADDR = 0x03a520B32c04bf3beef7BEb72E919cF822Ed34F3; address internal constant NPM_ADDR = 0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1;
// Base mainnet Uniswap V3 Factory https://basescan.org/address/0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24 // Base mainnet Uniswap V3 Factory https://basescan.org/address/0x33128a8fC17869897dcE68Ed026d694621f6FDfD
address internal constant V3_FACTORY = 0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24; address internal constant V3_FACTORY = 0x33128a8fC17869897dcE68Ed026d694621f6FDfD;
address internal constant FEE_DEST = 0xf6a3eef9088A255c32b6aD2025f83E57291D9011; address internal constant FEE_DEST = 0x8A9145E1Ea4C4d7FB08cF1011c8ac1F0e10F9383;
/// @dev Fixed address used with vm.etch to inject candidate bytecode. /// @dev Fixed address used with vm.etch to inject candidate bytecode.
/// Chosen to be deterministic and not collide with real Base addresses. /// Chosen to be deterministic and not collide with real Base addresses.
@ -230,6 +230,7 @@ contract FitnessEvaluator is Test {
string memory candidateId = vm.readLine(idsFile); string memory candidateId = vm.readLine(idsFile);
string memory bytecodeHex = vm.readLine(bytecodesFile); string memory bytecodeHex = vm.readLine(bytecodesFile);
if (bytes(candidateId).length == 0) break; if (bytes(candidateId).length == 0) break;
if (bytes(bytecodeHex).length == 0) break;
// Revert to clean post-deploy state for each candidate. // Revert to clean post-deploy state for each candidate.
vm.revertTo(baseSnap); vm.revertTo(baseSnap);
@ -401,7 +402,10 @@ contract FitnessEvaluator is Test {
// candidate score identically (all lm_eth_total = free WETH only, no positions). // candidate score identically (all lm_eth_total = free WETH only, no positions).
bool recentered = false; bool recentered = false;
for (uint256 _attempt = 0; _attempt < 5; _attempt++) { for (uint256 _attempt = 0; _attempt < 5; _attempt++) {
if (_attempt > 0) vm.roll(block.number + 50); if (_attempt > 0) {
vm.roll(block.number + 50);
vm.warp(block.timestamp + 600);
}
vm.prank(recenterAddr); vm.prank(recenterAddr);
try ILM(lmAddr).recenter() returns (bool) { try ILM(lmAddr).recenter() returns (bool) {
recentered = true; recentered = true;