Skip to content

Detect use of block.timestamp when running forge coverage with --ir-minimum enabled #11598

@PaulRBerg

Description

@PaulRBerg

Component

Forge

Describe the feature you would like

Problem

block.timestamp is assumed to be constant when --ir-minimum (via IR) is enabled, and this leads to false negative failed tests when the tests use the warp cheat.

This can easily create hard-to-debug circumstances - tests that normally pass start failing, and debugging via IR-enabled code is not easy.

For instance, I spent an hour debugging one of our tests.

Solution

Detect the use of block.timestamp in the users' tests, and throw a bespoke warning (or error, if the user specifies so via a config field) about it. Recommend using vm.getBlockTimestamp() instead.

Additional context

Related

Metadata

Metadata

Assignees

Labels

Projects

Status

Todo

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions