Skip to content

Conversation

@maoueh
Copy link
Contributor

@maoueh maoueh commented Dec 2, 2025

Add possibility to add more prefunded accounts to the L1 generated genesis by accepting a repeated []string flag --prefunded-account which accepts the same format (private key in hex) as the static prefunded accounts.

I debated about putting the prefunded-account flag on the L1 recipe directly, to scope it just to this. Maybe it would be preferable, let me know what do you think.

Add possibility to add more prefunded accounts to the L1 generated genesis by accepting a repeated `[]string` flag `--prefunded-account` which accepts the same format (private key in hex) as the static prefunded accounts.

I debated about putting the `prefunded-account` flag on the L1 recipe directly, to scope it just to this. Maybe it would be preferable, let me know what do you think.
Copilot AI review requested due to automatic review settings December 2, 2025 16:30
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 pull request adds the ability to specify additional prefunded accounts for L1 and L2 genesis configurations through a new --prefunded-account CLI flag. The flag accepts private keys in hexadecimal format and can be specified multiple times to add multiple accounts.

Key changes:

  • New --prefunded-account flag that accepts private keys and can be repeated
  • Refactored static prefunded accounts into a separate variable positioned closer to usage
  • Additional prefunded accounts are combined with the existing 10 static accounts in the genesis

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
playground/artifacts.go Added prefundedAccounts field to ArtifactsBuilder, new setter method PrefundedAccounts(), helper method getPrefundedAccounts() to combine static and user-provided accounts, and moved static accounts definition for better code organization
main.go Added prefundedAccounts global variable and --prefunded-account CLI flag, integrated the flag value with the artifacts builder

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ferranbt
Copy link
Collaborator

ferranbt commented Dec 5, 2025

LGTM!

@maoueh
Copy link
Contributor Author

maoueh commented Dec 5, 2025

@ferranbt Let me know how you want to proceed, will be happy to work any you like for this.

@ferranbt
Copy link
Collaborator

LGTM. Can you please resolve the conflicts?

@maoueh
Copy link
Contributor Author

maoueh commented Dec 10, 2025

@ferranbt Done

Copy link
Contributor

@canercidam canercidam left a comment

Choose a reason for hiding this comment

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

Thanks! I have a few very small requests.

gen.Config.DepositContractAddress = gethcommon.HexToAddress(config.DepositContractAddress)

// add pre-funded accounts
prefundedBalance, _ := new(big.Int).SetString("10000000000000000000000", 16)
Copy link
Contributor

Choose a reason for hiding this comment

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

This number is making it hard to track balance movements. Usually if something is 1000 by default, 999 is an easy visual signal about a balance movement. Let's change this to base 10 and adapt the documentation.

Copy link
Contributor Author

@maoueh maoueh Dec 16, 2025

Choose a reason for hiding this comment

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

This is done like this to align with the other prefunded balances:

Do you want me to fully change all of them?

Usually if something is 1000 by default

I saw all numbers over the years, overly big doesn't change that much I would personally go with something bigger than smaller, just for those that don't we tiny amount of wei to perform their testing and input really big eth value.

Something like 99999999999999999 ETH.

All in all, let me know and I'll make the necessary work.

main.go Outdated
recipeCmd.Flags().BoolVar(&contenderEnabled, "contender", false, "spam nodes with contender")
recipeCmd.Flags().StringArrayVar(&contenderArgs, "contender.arg", []string{}, "add/override contender CLI flags")
recipeCmd.Flags().StringVar(&contenderTarget, "contender.target", "", "override the node that contender spams -- accepts names like \"el\"")
recipeCmd.Flags().StringArrayVar(&prefundedAccounts, "prefunded-account", []string{}, "Fund this account in addition to static prefunded accounts, the input should the account's private key in hexadecimal format prefixed with 0x, the account is added to L1 and to L2 (if present)")
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we can provide multiple accounts here. So maybe the flag is add-prefunded-accounts or prefund-accounts and we can document that possibility ("fund these accounts").

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I aligned myself with the other array var &contenderArgs, "contender.arg" so no s.

- `--log-level` (string): Log level to use (debug, info, warn, error, fatal). Defaults to `info`.
- `--labels` (key=val): Custom labels to apply to your deployment.
- `--disable-logs` (bool): Disable the logs for the services. Defaults to `false`.
- `--prefunded-account` (string, repeated): Fund this account in addition to static prefunded accounts, the input should the account's private key in hexadecimal format prefixed with 0x, the account is added to L1 and to L2 (if present).
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's fix this depending on the flag if we adjust it based on the suggestion.

@julio4
Copy link
Collaborator

julio4 commented Dec 15, 2025

FYI it seems all default prefunded anvil accounts are also prefunded in builder-playground.
Like 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266

gen.Config.DepositContractAddress = gethcommon.HexToAddress(config.DepositContractAddress)

// add pre-funded accounts
prefundedBalance, _ := new(big.Int).SetString("10000000000000000000000", 16)
Copy link
Contributor Author

@maoueh maoueh Dec 16, 2025

Choose a reason for hiding this comment

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

This is done like this to align with the other prefunded balances:

Do you want me to fully change all of them?

Usually if something is 1000 by default

I saw all numbers over the years, overly big doesn't change that much I would personally go with something bigger than smaller, just for those that don't we tiny amount of wei to perform their testing and input really big eth value.

Something like 99999999999999999 ETH.

All in all, let me know and I'll make the necessary work.

main.go Outdated
recipeCmd.Flags().BoolVar(&contenderEnabled, "contender", false, "spam nodes with contender")
recipeCmd.Flags().StringArrayVar(&contenderArgs, "contender.arg", []string{}, "add/override contender CLI flags")
recipeCmd.Flags().StringVar(&contenderTarget, "contender.target", "", "override the node that contender spams -- accepts names like \"el\"")
recipeCmd.Flags().StringArrayVar(&prefundedAccounts, "prefunded-account", []string{}, "Fund this account in addition to static prefunded accounts, the input should the account's private key in hexadecimal format prefixed with 0x, the account is added to L1 and to L2 (if present)")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I aligned myself with the other array var &contenderArgs, "contender.arg" so no s.

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