Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a vm.isSimulation() cheatcode #3928

Closed
Skelectric opened this issue Dec 21, 2022 · 5 comments
Closed

Add a vm.isSimulation() cheatcode #3928

Skelectric opened this issue Dec 21, 2022 · 5 comments
Labels
A-cheatcodes Area: cheatcodes Cmd-forge-script Command: forge script D-easy Difficulty: easy good first issue Good for newcomers T-feature Type: feature

Comments

@Skelectric
Copy link

Component

Forge

Describe the feature you would like

I would like for my scripts to skip certain operations in the pre-broadcast simulations.

if (vm.isSimulation() == false) {
    stdJson.write(json, filepath);   
}

Without the ability to differentiate whether the script is executing in a simulation at runtime, I can't perform certain operations that require persistent storage because the simulation gets in the way.

Additional context

No response

@Skelectric Skelectric added the T-feature Type: feature label Dec 21, 2022
@mattsse
Copy link
Member

mattsse commented Dec 22, 2022

this is useful to have imo.

supportive of this.

I think we can add this via bool field that is set before and unset after simulation.

@mattsse mattsse added good first issue Good for newcomers D-easy Difficulty: easy labels Dec 22, 2022
@mds1
Copy link
Collaborator

mds1 commented Dec 22, 2022

One note is we don't have any script-only cheats yet, so what should this return during tests? Perhaps a better way to implement is as part of #2900, and make the "Script" context more granular

@mattsse
Copy link
Member

mattsse commented Dec 22, 2022

right, forgot about this. #2900 is the right way to do this

@0x0elliot
Copy link

so, would you rather even have this implemented? @mattsse

@zerosnacks zerosnacks added A-cheatcodes Area: cheatcodes Cmd-forge-script Command: forge script labels Jun 28, 2024
@zerosnacks
Copy link
Member

Marking as completed by #7377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cheatcodes Area: cheatcodes Cmd-forge-script Command: forge script D-easy Difficulty: easy good first issue Good for newcomers T-feature Type: feature
Projects
None yet
Development

No branches or pull requests

5 participants