Skip to content

Commit

Permalink
cmd/geth: add support for sepolia testnet (ethereum#23730)
Browse files Browse the repository at this point in the history
* cmd/geth: add support for sepolia testnet

* core: last details on sepolia genesis

* params: fix sepolia hash + reduce testing code

* Update params/bootnodes.go

* cmd/geth: fix attach path for sepolia

* params: update bootnodes

* params: fix

* core: fix docstring

* params: add sepolia CHT
  • Loading branch information
holiman authored and zzyalbert committed Nov 26, 2021
1 parent 51bdd2d commit 7bcc275
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
6 changes: 0 additions & 6 deletions cmd/geth/dbcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ WARNING: This is a low-level operation which may cause database corruption!`,
utils.DataDirFlag,
utils.SyncModeFlag,
utils.MainnetFlag,
utils.RopstenFlag,
utils.RinkebyFlag,
utils.GoerliFlag,
},
Description: "The import command imports the specific chain data from an RLP encoded stream.",
}
Expand All @@ -202,9 +199,6 @@ WARNING: This is a low-level operation which may cause database corruption!`,
utils.DataDirFlag,
utils.SyncModeFlag,
utils.MainnetFlag,
utils.RopstenFlag,
utils.RinkebyFlag,
utils.GoerliFlag,
},
Description: "Exports the specified chain data to an RLP encoded stream, optionally gzip-compressed.",
}
Expand Down
7 changes: 7 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ var (
Name: "testnet",
Usage: "Testnet network: pre-configured proof-of-authority shortlived test network.",
}
SepoliaFlag = cli.BoolFlag{
Name: "sepolia",
Usage: "Sepolia network: pre-configured proof-of-work test network",
}
DeveloperFlag = cli.BoolFlag{
Name: "dev",
Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled",
Expand Down Expand Up @@ -782,6 +786,9 @@ func MakeDataDir(ctx *cli.Context) string {
if ctx.GlobalBool(TestnetFlag.Name) {
return filepath.Join(path, "testnet")
}
if ctx.GlobalBool(SepoliaFlag.Name) {
return filepath.Join(path, "sepolia")
}
return path
}
Fatalf("Cannot determine default data directory, please set manually (--datadir)")
Expand Down
25 changes: 13 additions & 12 deletions core/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,22 @@ func TestSetupGenesis(t *testing.T) {
}
}

// TestGenesisHashes checks the congruity of default genesis data to corresponding hardcoded genesis hash values.
// TestGenesisHashes checks the congruity of default genesis data to
// corresponding hardcoded genesis hash values.
func TestGenesisHashes(t *testing.T) {
cases := []struct {
for i, c := range []struct {
genesis *Genesis
hash common.Hash
want common.Hash
}{
{
genesis: DefaultGenesisBlock(),
hash: params.MainnetGenesisHash,
},
}
for i, c := range cases {
b := c.genesis.MustCommit(rawdb.NewMemoryDatabase())
if got := b.Hash(); got != c.hash {
t.Errorf("case: %d, want: %s, got: %s", i, c.hash.Hex(), got.Hex())
{DefaultGenesisBlock(), params.MainnetGenesisHash},
} {
// Test via MustCommit
if have := c.genesis.MustCommit(rawdb.NewMemoryDatabase()).Hash(); have != c.want {
t.Errorf("case: %d a), want: %s, got: %s", i, c.want.Hex(), have.Hex())
}
// Test via ToBlock
if have := c.genesis.ToBlock(nil).Hash(); have != c.want {
t.Errorf("case: %d a), want: %s, got: %s", i, c.want.Hex(), have.Hex())
}
}
}
Expand Down

0 comments on commit 7bcc275

Please sign in to comment.