Skip to content

Conversation

@popescuoctavian
Copy link
Contributor

@popescuoctavian popescuoctavian commented Nov 27, 2025

This PR adds documentation for Solidity test cheatcodes.

Notes:

  • The Foundry book was used for cheatcodes that are already documented there and are supported by HH/EDR. This was updated to remove unsupported references and adapted to match our implementation.
  • Documentation was generated for the others using the documentation comments in vm.rs.

@vercel
Copy link

vercel bot commented Nov 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
hardhat-website Ready Ready Preview, Comment Jan 14, 2026 1:27pm

Copilot AI review requested due to automatic review settings November 28, 2025 14:13
Copy link
Contributor

Copilot AI left a 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.

Comment on lines 11 to 16
function envBytes(bytes calldata key) external returns (bytes value);
```

```solidity
function envBytes(
bytes calldata key,
Copy link

Copilot AI Nov 28, 2025

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.

Suggested change
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,

Copilot uses AI. Check for mistakes.
Comment on lines 15 to 18
function envBytes(
bytes calldata key,
bytes calldata delimiter
) external returns (bytes[] memory values);
Copy link

Copilot AI Nov 28, 2025

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.

Copilot uses AI. Check for mistakes.

### Description

Read an environment variable as `bytes32` or `address[]`.
Copy link

Copilot AI Nov 28, 2025

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[]."

Suggested change
Read an environment variable as `bytes32` or `address[]`.
Read an environment variable as `bytes32` or `bytes32[]`.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@agostbiro agostbiro left a 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

@popescuoctavian
Copy link
Contributor Author

Thanks for the feedback, @agostbiro! Added the changes to the PR (except for point 1, which will be done in a separate PR).

@popescuoctavian
Copy link
Contributor Author

@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!

Copy link
Member

@alcuadrado alcuadrado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@popescuoctavian popescuoctavian added this pull request to the merge queue Jan 14, 2026
Merged via the queue into main with commit 0e9d574 Jan 14, 2026
3 checks passed
@popescuoctavian popescuoctavian deleted the popescuoctavian/cheatcode-documentation branch January 14, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants