fix: address review — add negative-mantissa guard to OptimizerV3, add OptimizerV3 test file
- Add require(mantissa >= 0) to OptimizerV3.calculateParams validation loop (was missing unlike Optimizer and OptimizerV3Push3) - Create onchain/test/OptimizerV3.t.sol with shift, negative-mantissa, and basic bear/bull output tests - Fix stale comment in Optimizer.sol: "shift=0 assumed" → "shift=0 enforced" - Use implementation-neutral NatSpec phrasing in IOptimizer.sol Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
42b4bf4149
commit
abbf14854d
4 changed files with 92 additions and 6 deletions
|
|
@ -3,10 +3,9 @@ pragma solidity ^0.8.19;
|
|||
|
||||
/**
|
||||
* @notice Dyadic rational input: mantissa × 2^(-shift).
|
||||
* shift is reserved for future use and MUST be 0. All current
|
||||
* Optimizer implementations (Optimizer, OptimizerV3, OptimizerV3Push3)
|
||||
* require shift == 0 and revert otherwise. When shift == 0 (as
|
||||
* produced by _toDyadic), value == mantissa.
|
||||
* shift is reserved for future use and MUST be 0. All production
|
||||
* Optimizer implementations require shift == 0 and revert otherwise.
|
||||
* When shift == 0 (as produced by _toDyadic), value == mantissa.
|
||||
*/
|
||||
struct OptimizerInput {
|
||||
int256 mantissa;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue