-
Notifications
You must be signed in to change notification settings - Fork 90
Add cheatcode documentation #191
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 cheatcode documentation #191
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive documentation for Solidity test cheatcodes, covering utilities, types, state snapshots, signing, RPC, fuzzer, forking, file operations, external interactions, and environment manipulation.
Key changes:
- Added documentation for 200+ cheatcode functions and types
- Includes function signatures, descriptions, and practical examples
- Content adapted from Foundry Book (MIT licensed) where applicable
Reviewed changes
Copilot reviewed 227 out of 228 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| utilities/*.mdx | Documentation for utility cheatcodes (string manipulation, random generation, parsing, etc.) |
| types/*.mdx | Type definitions for cheatcode structs and enums |
| state-snaptshots/*.mdx | State snapshot management cheatcodes |
| signing/*.mdx | Cryptographic signing operations |
| rpc/*.mdx | RPC endpoint configuration and usage |
| fuzzer/*.mdx | Fuzzing test configuration cheatcodes |
| forking/*.mdx | Blockchain forking and fork management |
| file/*.mdx | File system operations |
| external/*.mdx | External data handling (JSON, TOML, environment variables) |
| environment/*.mdx | EVM state manipulation cheatcodes |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function envBytes(bytes calldata key) external returns (bytes value); | ||
| ``` | ||
|
|
||
| ```solidity | ||
| function envBytes( | ||
| bytes calldata key, |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function signature shows bytes calldata key but environment variable names should be strings. This should be string calldata key to match the pattern used in other env* cheatcodes.
| function envBytes(bytes calldata key) external returns (bytes value); | |
| ``` | |
| ```solidity | |
| function envBytes( | |
| bytes calldata key, | |
| function envBytes(string calldata key) external returns (bytes value); |
function envBytes(
string calldata key,| function envBytes( | ||
| bytes calldata key, | ||
| bytes calldata delimiter | ||
| ) external returns (bytes[] memory values); |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function signature shows bytes calldata key but environment variable names should be strings. This should be string calldata key to match the pattern used in other env* cheatcodes.
|
|
||
| ### Description | ||
|
|
||
| Read an environment variable as `bytes32` or `address[]`. |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description incorrectly states the function returns address[] for arrays, but the signature shows it returns bytes32[] memory values. Should be "Read an environment variable as bytes32 or bytes32[]."
| Read an environment variable as `bytes32` or `address[]`. | |
| Read an environment variable as `bytes32` or `bytes32[]`. |
agostbiro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good, thank you!
I reviewed by browsing the preview website and noted the following things:
- A conceptual explanation of cheatcodes would be nice, but probably out of scope for this PR
- We shouldn't include private methods in the docs (_expectCheatcodeRevert, _expectInternalRevert)
- Possibly move types next to relevant methods instead of a separate section?
- Foundry spells cheatcodes in one word, so we should follow that consistently
|
Thanks for the feedback, @agostbiro! Added the changes to the PR (except for point 1, which will be done in a separate PR). |
|
@fvictorio, @alcuadrado I believe the content in now ready. Could you please review the PR? The part that I'm most interested in being reviewed is the integration with the website (navigation bar, categorization, etc.). Thanks! |
alcuadrado
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This PR adds documentation for Solidity test cheatcodes.
Notes: