Skip to content

test(ActivationRegistry): add activate and deactivate revertOrder tests - #110

Merged
eric-ships merged 2 commits into
mainfrom
ericliu/bop-221-coverage-activation-registry
Jun 1, 2026
Merged

eric-ships merged 2 commits into
mainfrom
ericliu/bop-221-coverage-activation-registry

Conversation

@eric-ships

Copy link
Copy Markdown
Collaborator

BOP-221

Motivation

check-coverage.py flagged two missing test files for ActivationRegistry:

  • test/unit/ActivationRegistry/activate_revertOrder.t.sol
  • test/unit/ActivationRegistry/deactivate_revertOrder.t.sol

RevertOrder files document and enforce the priority ordering of reverts when multiple error conditions hold simultaneously. For activate, the only multi-revert scenario is an unauthorized caller attempting to activate an already-activated feature; access control must fire before the state check. The deactivate file is a forward stub matching the same pattern for when a deactivate function is added.

What changed

  • Added activate_revertOrder.t.sol with test_activate_revertOrder_unauthorized_beats_alreadyActivated stub documenting that Unauthorized fires before AlreadyActivated.
  • Added deactivate_revertOrder.t.sol with test_deactivate_revertOrder_unauthorized_beats_featureNotActivated stub matching the same access-control-first ordering convention.
  • Both files inherit from ActivationRegistryTest, follow the // unimplemented stub convention used across this test suite, and pass forge fmt.

type=routine
risk=low
impact=sev5

@eric-ships
eric-ships force-pushed the ericliu/bop-221-coverage-activation-registry branch from 9e85ba8 to 2d9d51f Compare June 1, 2026 22:54
@eric-ships
eric-ships changed the base branch from master to main June 1, 2026 22:54
@linear

linear Bot commented Jun 1, 2026 •

Copy link
Copy Markdown
BOP-221 feat(base-std): automated interface coverage check in CI

Context

base-std tests are the behavioral spec for the base/base Rust precompile implementations. If a function exists in an interface but has no test file, the Rust implementation can diverge silently. There is currently no automated enforcement that every interface function has corresponding test coverage.

What to build

A script (scripts/check-coverage.sh or similar) that:

  1. Parses src/interfaces/IB20*.sol for all external function signatures
  2. For each function on each contract, checks for test files by category:
    • test/unit/<Contract>/<function>.t.sol (happy path, mandatory for all non-view functions)
    • test/unit/<Contract>/<function>_revertOrder.t.sol (mandatory for functions with revert conditions)
    • test/unit/<Contract>/<function>_rollback.t.sol (mandatory for functions that mutate multiple storage slots)
  3. Outputs a gap report and exits non-zero if required files are missing
  4. Runs in CI on every PR as a step before forge test

Success criteria

  • Adding a new external function to an interface without a corresponding test file fails CI
  • The script is fast (pure shell/Python, no compilation)
  • Gap report is human-readable and actionable

Review in Linear

@eric-ships
eric-ships marked this pull request as ready for review June 1, 2026 23:14

@ilikesymmetry ilikesymmetry left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR is small enough to do test implementation in one go vs leaving as unimplemented

…er assertions

Fill in real fuzz assertions for the two revertOrder stubs: activate confirms
Unauthorized fires before AlreadyActivated; deactivate confirms Unauthorized
fires before FeatureNotActivated. Both tests run 256 fuzz rounds and pass.
@eric-ships

Copy link
Copy Markdown
Collaborator Author

this PR is small enough to do test implementation in one go vs leaving as unimplemented

@ilikesymmetry Fixed 59968a6

@eric-ships
eric-ships merged commit 793d78b into main Jun 1, 2026
5 checks passed
@eric-ships
eric-ships deleted the ericliu/bop-221-coverage-activation-registry branch June 1, 2026 23:31
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

⚠️ Fork tests: 2 failed, 604 passed

These failures indicate divergences where base/base needs to catch up to the base-std spec. This check is advisory and does not block merging.

Failing tests
  • test_createB20_revert_emptyCurrency(address,bytes32): Error != expected error: MissingRequiredField("currency") != InvalidCurrency(""); counterexample: calldata=0xa8dd497d0000000000000000000000000000000000000000000000000000000000006df20000000000000000000000000000000000000000000000000000000000005739 args=[0x0000000000000000000000000000000000006Df2, 0x0000000000000000000000000000000000000000000000000000000000005739]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants