Skip to content

chore: review external / pure / view rule for cheatcodes that only operate on cheatcode stateΒ #10027

Open
@zerosnacks

Description

@zerosnacks

Component

Other (please describe)

Describe the feature you would like

For cheatcodes we follow these rules to determine what to tag the cheatcode as:

// Cheatcodes are marked as view/pure/none using the following rules:
// 0. A call's observable behaviour includes its return value, logs, reverts and state writes,
// 1. If you can influence a later call's observable behaviour, you're neither `view` nor `pure`
//    (you are modifying some state be it the EVM, interpreter, filesystem, etc),
// 2. Otherwise if you can be influenced by an earlier call, or if reading some state, you're `view`,
// 3. Otherwise you're `pure`.

There are some cases, like vm.createWallet or sign / signCompat with Wallet (and others) where we are writing to a local state only and the operations themselves have no side effects and could be marked as view. For end users it is preferred to have cheatcodes marked as view or pure for flexibility.

Additional context

From Telegram

Image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions