Skip to content

Files

Latest commit

0daba1e · Mar 24, 2023

History

History
This branch is 12010 commits behind ethereum-optimism/optimism:develop.

invariant-docs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 9, 2023
Jan 9, 2023
Feb 22, 2023
Jan 9, 2023
Jan 9, 2023
Feb 22, 2023
Mar 24, 2023
Mar 1, 2023
Mar 24, 2023
Mar 1, 2023
Mar 24, 2023

Invariant Docs

This directory contains documentation for all defined invariant tests within contracts-bedrock.

Table of Contents

Usage

To auto-generate documentation for invariant tests, run yarn autogen:invariant-docs.

Documentation Standard

In order for an invariant test file to be picked up by the docgen script, it must adhere to the following conventions:

Forge Invariants

All forge invariant tests must exist within the contracts/test/invariants folder, and the file name should be <ContractName>.t.sol, where <ContractName> is the name of the contract that is being tested.

All tests within forge invariant files should follow the convention:

/**
 * @custom:invariant <title>
 *
 * <longDescription>
 */
function invariant_<shortDescription>() external {
    // ...
}

Echidna Invariants

All echidna invariant tests must exist within the contracts/echidna folder, and the file name should be Fuzz<ContractName>.sol, where <ContractName> is the name of the contract that is being tested.

All property tests within echidna invariant files should follow the convention:

/**
 * @custom:invariant <title>
 *
 * <longDescription>
 */
function echidna_<shortDescription>() external view returns (bool) {
    // ...
}