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

Genesis Account Allocations cheatcode #6126

Closed
clabby opened this issue Oct 26, 2023 · 1 comment
Closed

Genesis Account Allocations cheatcode #6126

clabby opened this issue Oct 26, 2023 · 1 comment
Labels
T-feature Type: feature

Comments

@clabby
Copy link
Contributor

clabby commented Oct 26, 2023

Component

Forge

Describe the feature you would like

Several Layer 2s, including Optimism, allocate many proxies etc. in the genesis file. For example, take Base Mainnet's 8.76MB genesis file.

While it is possible to deploy all of these contracts manually in a test file's setUp function, it is slow, cumbersome, and rather easy to accidentally break parity. A solution to make this process easier for authors of test suites that would like to locally allocate the same accounts that are in the L2 genesis file is to add a simple cheatcode which loads a JSON file with account allocations inside of it into the in-memory revm journal.

This cheatcode can re-use the type defined in ethers-rs for the GenesisAccount when deserializing the allocs JSON, and the basic structure of the file would be HashMap<Address, GenesisAccount>.

Desired Usage

contract MyTest is Test {
    function setUp() public {
        vm.loadAllocs("./path/to/allocs.json");

        // After the cheatcode is invoked, the accounts will have been committed to the revm journal and accessible
        // within the environment.
    }
}

Additional context

n/a

@clabby clabby added the T-feature Type: feature label Oct 26, 2023
@Evalir
Copy link
Member

Evalir commented Dec 14, 2023

Closed by #6101 / #6207

@Evalir Evalir closed this as completed Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants