Skip to content

chore: fund accounts in L2 genesis #103

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

Merged
merged 1 commit into from
Apr 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions internal/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@ func (b *ArtifactsBuilder) Build() (*Artifacts, error) {
}
}

// Update the allocs to include the same prefunded accounts as the L1 genesis.
allocs := make(map[string]interface{})
input["alloc"] = allocs
for _, privStr := range prefundedAccounts {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could hardcode these into the genesis.json if you prefer. Felt a bit neater to duplicate it here so the addresses we fund don't get out of sync.

priv, err := getPrivKey(privStr)
if err != nil {
return nil, err
}
addr := ecrypto.PubkeyToAddress(priv.PublicKey)
allocs[addr.String()] = map[string]interface{}{
"balance": "0x10000000000000000000000",
"nonce": "0x1",
}
}

newOpGenesis, err := overrideJSON(opGenesis, input)
if err != nil {
return nil, err
Expand Down