harb/onchain/src/OptimizerV3.sol
johba 636ba989ee fix: Optimizer and OptimizerV3 lack _disableInitializers() in constructor (#1055) (#1080)
Fixes #1055

## Changes
That notification is for the earlier background task which already completed — I retrieved its output and used it to diagnose and fix the failing test. The work is done.

Reviewed-on: https://codeberg.org/johba/harb/pulls/1080
Reviewed-by: Disinto_bot <disinto_bot@noreply.codeberg.org>
2026-03-21 13:42:54 +01:00

33 lines
1.2 KiB
Solidity

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.19;
import { IOptimizer, OptimizerInput } from "./IOptimizer.sol";
import { Optimizer } from "./Optimizer.sol";
import { OptimizerV3Push3Lib } from "./OptimizerV3Push3Lib.sol";
/**
* @title OptimizerV3
* @notice UUPS-upgradeable Optimizer whose calculateParams is overridden by
* the Push3 transpiler output. Delegates to OptimizerV3Push3Lib —
* the single canonical copy of the transpiler logic — so that future
* transpiler changes require only one edit.
*
* @dev No new storage slots. Only overrides the pure calculateParams function.
* Register-to-output mapping must match OptimizerV3Push3 exactly:
* r40 -> ci, r39 -> anchorShare, r38 -> anchorWidth, r37 -> discoveryDepth
*/
contract OptimizerV3 is Optimizer {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
function calculateParams(OptimizerInput[8] memory inputs)
public
pure
override
returns (uint256 ci, uint256 anchorShare, uint24 anchorWidth, uint256 discoveryDepth)
{
return OptimizerV3Push3Lib.calculateParams(inputs);
}
}