fix: OptimizerV3Push3 as IOptimizer always returns bear defaults — integration risk (#1063)

- getLiquidityParams() now reverts with "OptimizerV3Push3: not for production use" instead
  of silently returning zeroed bear-mode defaults; LiquidityManager.recenter() already has
  a try/catch fallback so backtesting is unaffected
- Added @custom:experimental NatSpec annotation to the contract marking it as a transpiler
  harness / backtesting stub only
- DeployBase.sol now validates any pre-existing optimizer address by calling getLiquidityParams()
  and reverting if it fails, blocking accidental wiring of OptimizerV3Push3 as a live optimizer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
johba 2026-03-20 20:13:18 +00:00
parent 351d4813e6
commit 6f7b6c4254
2 changed files with 14 additions and 7 deletions

View file

@ -93,6 +93,10 @@ contract DeployBase is Script {
} else {
optimizerAddress = optimizer;
console.log("Using existing optimizer at:", optimizerAddress);
// Guard: ensure the pre-existing optimizer is not a stub (e.g. OptimizerV3Push3).
// OptimizerV3Push3.getLiquidityParams() always reverts; a live optimizer must not.
(bool ok,) = optimizerAddress.staticcall(abi.encodeWithSignature("getLiquidityParams()"));
require(ok, "DeployBase: optimizer getLiquidityParams() reverted - stub or misconfigured address");
}
// Deploy LiquidityManager