foundry-mainnet-fork-etch-testing

Uses Fleet.sh and Git to manage and automate fleet-wide tasks and configurations.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/phpmac/skills --skill foundry-mainnet-fork-etch-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: foundry-mainnet-fork-etch-testing
Source: https://github.com/phpmac/skills/tree/main/plugins/my-agents/skills/foundry-mainnet-fork-etch-testing
Command: npx skills add https://github.com/phpmac/skills --skill foundry-mainnet-fork-etch-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enable end-to-end mainnet-like testing by forking mainnet and selectively etching runtime code while preserving on-chain state.

Core Features & Use Cases

  • Fork mainnet to create a live-like testing environment without altering the original chain.
  • Use vm.etch to replace runtime code while keeping storage intact to validate new logic and migrations.
  • Replay real interactions and verify contract behavior under realistic conditions.

Quick Start

Fork the mainnet and etch runtime code to validate contract behavior in a live-like environment.

Frequently Asked Questions about foundry-mainnet-fork-etch-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test new smart contract logic against live mainnet state without redeploying?

You can test new logic against live mainnet state by forking mainnet and using vm.etch to replace runtime code while preserving on-chain storage. This allows you to validate deployed contract behavior without redeploying.

Can I preserve storage layout when replacing runtime code in a Foundry mainnet fork?

Yes, vm.etch replaces runtime code while keeping storage intact in a Foundry mainnet fork. You must ensure storage layout compatibility before applying etches to successfully validate new logic and migrations.

What's the best way to replay real interactions on a mainnet mirror for testing?

The best way to replay real interactions is by forking mainnet to create a live-like testing environment. This approach lets you verify contract behavior under realistic conditions without altering the original chain.

When should I use vm.etch for smart contract testing instead of a standard deployment?

Use vm.etch when you need to validate deployed contract behavior against live data, replay real interactions, or test new logic against a mainnet mirror. It is essential for migrations where preserving on-chain state is required.

Does Foundry forking support replacing runtime code to validate contract migrations?

Yes, Foundry forking supports replacing runtime code via vm.etch. This combination enables end-to-end mainnet-like testing by selectively etching new logic while preserving the existing on-chain state for migration validation.

Why do I need to verify storage layout compatibility before etching runtime code?

Verifying storage layout compatibility before etching runtime code is required because vm.etch replaces runtime code while preserving storage. Incompatible layouts will corrupt state interpretation and cause migration validation failures.