Skip to content

Plans to support more cheatcodes in chisel? #4811

New issue

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

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

Already on GitHub? # to your account

Closed
jat9292 opened this issue Apr 23, 2023 · 8 comments
Closed

Plans to support more cheatcodes in chisel? #4811

jat9292 opened this issue Apr 23, 2023 · 8 comments
Labels
A-cheatcodes Area: cheatcodes C-chisel Command: chisel T-feature Type: feature

Comments

@jat9292
Copy link

jat9292 commented Apr 23, 2023

Component

Chisel

Describe the feature you would like

Support all the cheatocdes in chisel

Additional context

Today only a few cheatcodes are supported in chisel, like prank and deal. But many are still missing : assertLt , envUnit, envAddress, assertEq , etc.
Furthermore it is not clear which ones are already supported and which are not.

@jat9292 jat9292 added the T-feature Type: feature label Apr 23, 2023
@gakonst gakonst added this to Foundry Apr 23, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Apr 23, 2023
@mattsse
Copy link
Member

mattsse commented Apr 23, 2023

Supportive,
What do you think ahould be prioritized?

@jat9292
Copy link
Author

jat9292 commented Apr 25, 2023

For quick testing purposes I think most important ones are assertions related ones like, especially assertEq.

@mds1
Copy link
Collaborator

mds1 commented Apr 25, 2023

Not sure what you are doing, but you can probably just use require instead of assertEq for that use case.

But the distinction here seems to be that the vm interface/cheats are available, but the stdCheats/etc from forge-std are not present. Maybe we just need a way to pull in forge-std into chisel (if that's not currently present)? cc @clabby

@mds1 mds1 added the C-chisel Command: chisel label Apr 25, 2023
@jat9292
Copy link
Author

jat9292 commented Apr 25, 2023

This feature is useful to be able to debug tests faster inside chisel for example.

@jat9292
Copy link
Author

jat9292 commented Apr 29, 2023

Another annoying inconsistency I noticed is that vm.deal cheatcode in Chisel is only available for native ETH, but not for ERC20 tokens. I.e only the 2 arguments version of deal cheatcode is available. It would be nice if we can re-use same cheatcodes in Test and in Chisel.

@clabby
Copy link
Contributor

clabby commented May 3, 2023

Not sure what you are doing, but you can probably just use require instead of assertEq for that use case.

But the distinction here seems to be that the vm interface/cheats are available, but the stdCheats/etc from forge-std are not present. Maybe we just need a way to pull in forge-std into chisel (if that's not currently present)? cc @clabby

We can definitely pull in forge-std, but when I did that for the first iteration to get it working, it slowed down compilation time and made the repl feel a good bit less snappy. We'd also have to add forge-std as a submodule - will defer to @mattsse and you on whether or not this is worth it!

As for the inconsistency of some of the cheatcodes (i.e. the lack of the version of vm.deal that is for ERC20 tokens), it's looking like that cheatcode is not present in testdata/cheats/Cheats.sol. Should probably go through and make sure Cheats.sol has parity w/ forge-std's Vm.sol and write tests for the ones that aren't there at the moment.

@zerosnacks zerosnacks added the A-cheatcodes Area: cheatcodes label Jul 2, 2024
@zerosnacks
Copy link
Member

@clabby I think this issue may have been resolved by work that has happened on the foundry-cheatcodes crate

If so, we can mark this as resolved

cc @DaniPopes

@DaniPopes
Copy link
Member

All cheatcodes are available through Vm, what OP is referring to is forge-std utilities, a lot of which have been moved to cheatcodes, including assetions. The rest is tracked here #3782

@jenpaff jenpaff moved this from Todo to Completed in Foundry Sep 30, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-cheatcodes Area: cheatcodes C-chisel Command: chisel T-feature Type: feature
Projects
Archived in project
Development

No branches or pull requests

6 participants