Closed dpaiton closed 4 months ago
my testing shows a problem occurring with fixed rates above 300%:
Total tests: 17720 Both pass: 8496 Both fail: 8873 Mismatched: 351 Failure rate: 0.019808126410835215
Fuzzed over fixed rate from Some(FixedPoint(0.000385747703397417)) to Some(FixedPoint(399.625149689078101990))
Mismatched fixed rate from Some(FixedPoint(3.131040290023483491)) to Some(FixedPoint(133.805637502892130607))
that's from wip draft pr #19
testing with
RUST_BACKTRACE=full HYPERDRIVE_FAST_FUZZ_RUNS=100000 HYPERDRIVE_ETHEREUM_URL=http://127.0.0.1:8547 LOCAL_DEVELOPMENT=true cargo test -vvv --package hyperdrive-math --release -- short::max::tests::fuzz_calculate_max_short_no_budget --exact --show-output --nocapture
still get a 2% mismatch rate after #122 allows the test to run to the end
Total tests: 100,000 Both pass: 48,054 Both fail: 49,871 Mismatched: 2,075 Failure rate: 0.02075
looks like Rust succeeds when Solidity doesn't:
Fixed rate: 9.258702584950471355
MISMATCHED: actual: Ok(Ok(FixedPoint(44767131.875921600404760400))) expected: Revert(Bytes(0x4e487b710000000000000000000000000000000000000000000000000000000000000011))
Rust: FixedPoint(44767131.875921600404760400) Solidity: Revert(Bytes(0x4e487b710000000000000000000000000000000000000000000000000000000000000011))
Fixed rate: 5.460357484762586677
MISMATCHED: actual: Ok(Ok(FixedPoint(835897164.703558754582240549))) expected: Revert(Bytes(0x4e487b710000000000000000000000000000000000000000000000000000000000000011))
this result is on 989ad42c89e4b9179331f8b879e376a356433bca
I posted about a similar error here but closed that issue in favor of this dedicated one.