mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
make DeveloperGenesisBlock faucet prefund optional
This commit is contained in:
parent
f681475a3d
commit
8e260aa0a2
5 changed files with 10 additions and 7 deletions
|
|
@ -235,7 +235,7 @@ func dumpGenesis(ctx *cli.Context) error {
|
|||
|
||||
// if a datadir isn't specified, dump a generic dev-mode compatible genesis configuration
|
||||
if ctx.IsSet(utils.DeveloperFlag.Name) && !ctx.IsSet(utils.DataDirFlag.Name) {
|
||||
genesis := core.DeveloperGenesisBlock(10_000_000, common.Address{})
|
||||
genesis := core.DeveloperGenesisBlock(10_000_000, nil)
|
||||
if err := json.NewEncoder(os.Stdout).Encode(genesis); err != nil {
|
||||
utils.Fatalf("could not encode genesis: %s", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1865,7 +1865,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||
log.Info("Using developer account", "address", developer.Address)
|
||||
|
||||
// Create a new developer genesis block or reuse existing one
|
||||
cfg.Genesis = core.DeveloperGenesisBlock(ctx.Uint64(DeveloperGasLimitFlag.Name), developer.Address)
|
||||
cfg.Genesis = core.DeveloperGenesisBlock(ctx.Uint64(DeveloperGasLimitFlag.Name), &developer.Address)
|
||||
if ctx.IsSet(DataDirFlag.Name) {
|
||||
chaindb := tryMakeReadOnlyDatabase(ctx, stack)
|
||||
if rawdb.ReadCanonicalHash(chaindb, 0) != (common.Hash{}) {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ func newTester(t *testing.T, confOverride func(*ethconfig.Config)) *tester {
|
|||
t.Fatalf("failed to create node: %v", err)
|
||||
}
|
||||
ethConf := ðconfig.Config{
|
||||
Genesis: core.DeveloperGenesisBlock(11_500_000, common.Address{}),
|
||||
Genesis: core.DeveloperGenesisBlock(11_500_000, nil),
|
||||
Miner: miner.Config{
|
||||
Etherbase: common.HexToAddress(testAddress),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -563,12 +563,12 @@ func DefaultHoleskyGenesisBlock() *Genesis {
|
|||
}
|
||||
|
||||
// DeveloperGenesisBlock returns the 'geth --dev' genesis block.
|
||||
func DeveloperGenesisBlock(gasLimit uint64, faucet common.Address) *Genesis {
|
||||
func DeveloperGenesisBlock(gasLimit uint64, faucet *common.Address) *Genesis {
|
||||
// Override the default period to the user requested one
|
||||
config := *params.AllDevChainProtocolChanges
|
||||
|
||||
// Assemble and return the genesis with the precompiles and faucet pre-funded
|
||||
return &Genesis{
|
||||
genesis := &Genesis{
|
||||
Config: &config,
|
||||
GasLimit: gasLimit,
|
||||
BaseFee: big.NewInt(params.InitialBaseFee),
|
||||
|
|
@ -583,9 +583,12 @@ func DeveloperGenesisBlock(gasLimit uint64, faucet common.Address) *Genesis {
|
|||
common.BytesToAddress([]byte{7}): {Balance: big.NewInt(1)}, // ECScalarMul
|
||||
common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing
|
||||
common.BytesToAddress([]byte{9}): {Balance: big.NewInt(1)}, // BLAKE2b
|
||||
faucet: {Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))},
|
||||
},
|
||||
}
|
||||
if faucet != nil {
|
||||
genesis.Alloc[*faucet] = GenesisAccount{Balance: new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(9))}
|
||||
}
|
||||
return genesis
|
||||
}
|
||||
|
||||
func decodePrealloc(data string) GenesisAlloc {
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ func TestSimulatedBeaconSendWithdrawals(t *testing.T) {
|
|||
|
||||
// short period (1 second) for testing purposes
|
||||
var gasLimit uint64 = 10_000_000
|
||||
genesis := core.DeveloperGenesisBlock(gasLimit, testAddr)
|
||||
genesis := core.DeveloperGenesisBlock(gasLimit, &testAddr)
|
||||
node, ethService, mock := startSimulatedBeaconEthService(t, genesis)
|
||||
_ = mock
|
||||
defer node.Close()
|
||||
|
|
|
|||
Loading…
Reference in a new issue