Skip to content

Write fuzz tests #184

Description

@PaulRBerg

Context

#183 split the tests into two categories, "unit" and "fuzz", but it didn't add any new fuzz tests.

This is a task developing in stages.

1. Porting Over

The idea is to replicate the existing tests that can be fuzzed, e.g. all tests in div and mul that produce an output of zero can be fuzzed because there is no need to test against another mathematical implementation.

  • abs
  • convertFrom
  • convertTo
  • div
  • gm
  • mul

2. Differential Fuzzing

Here, the goal is to verify that the outputs of all Solidity functions in PRBMath closely match those of an alternative implementation written in Rust.

See the Foundry Book tutorial on differential fuzzing, and my related tweet about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: highLarge or difficult task.priority: 1This is important. It should be dealt with shortly.type: testAdding, updating, or removing tests.work: complicatedSense-analyze-respond. The relationship between cause and effect requires analysis or expertise.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions