Repository navigation
Description
The FastLZ and Fjord L1-cost fuzzers have not run in CI since #21639, not even their seeds. Proposal: replace them with fixtures that run in the normal Go test job, so every branch of the two functions is covered on each PR.
Current state
The fuzzers compare op-core/fees with the Solidity and C implementations:
FuzzFjordCostFunction:L1CostFjordagainst theGasPriceOraclepredeployFuzzFastLzSolidity:FlzCompressLenagainst Solady's LibZipFuzzFastLzCgo:FlzCompressLenagainst the C FastLZ library
All are in op-core/fees/fuzz/fuzz_test.go since #23864, behind the cgo_test build tag.
#21639 retired the Go fuzz jobs because the seed cases "run in the normal unit-test jobs". That does not hold here: the Go test jobs build with -tags="ci", so nothing compiles a cgo_test file. Today the fuzzers run only through a manual just fuzz-op-core-fees.
Their seeds are also weak. All are real Base transactions between roughly 100 bytes and 1.2 KB, and a coverage run shows they never reach:
- the 100-byte floor of the Fjord size estimate (
fees.go) - inputs under 13 bytes, including the empty input (
fastlz.go) - a hash-table hit further back than 8191 bytes, which must not count as a match (
fastlz.go); no seed is long enough
What already runs in CI
- Go:
TestFlzCompressLenpins compressed lengths;TestFjordL1CostFuncMinimumBoundsandTestFjordL1CostSolidityParitypin the cost function, including the floor. - Rust:
op-revm/src/fast_lz.rspins compressed lengths and compares its implementation with LibZip executed in revm, on the same Base transactions.
Neither FlzCompressLen table has a fixture for a far hash-table hit, and the Go table has none for a non-empty input under 13 bytes.
Proposal
- Add fixtures for the uncovered branches to
TestFlzCompressLen:- a few inputs under 13 bytes
- an incompressible block longer than 32 bytes (literal-run encoding)
- a match longer than 262 bytes with a remainder on each side of the 2-byte/3-byte boundary
- a sequence that repeats more than 8191 bytes apart
- a hash collision that is not a match
- Take the expected values from the references once: add the fixtures as fuzz seeds, run the three targets locally, then pin the results.
- Assert the same new vectors in
op-revm'stest_flz_compress_len, as the cross-implementation parity rule asks. - Add an end-to-end Fjord fee vector from transaction bytes to fee, below and above the floor.
- Keep the vendored C FastLZ as an oracle: turn
FuzzFastLzCgointo a table test that comparesFlzCompressLenwith the C library over the same fixtures, without thecgo_testtag, so the normal Go test job runs it. C FastLZ is the original implementation; LibZip and the Go and Rust code are ports of it. Confirm first that the CI Go test jobs build with cgo enabled. - Delete the two Solidity fuzzers, the
cgo_testtag and thejust fuzz-op-core-feesrecipe.
Both functions are small and frozen, so exploration adds little once each branch has a pinned vector, and the question of a scheduled fuzz job goes away.
🤖 Co-created with Claude Fable 5.2
Activity
[-]ci: run the FastLZ and Fjord L1-cost fuzzers again[/-][+]op-core: replace the FastLZ and Fjord L1-cost fuzzers with pinned fixtures[/+]