Skip to content

Commit

Permalink
add odyssey testnet (#33)
Browse files Browse the repository at this point in the history
Signed-off-by: lutty <lutty@lutty.me>
  • Loading branch information
LuttyYang authored Oct 17, 2024
1 parent da87b58 commit c4e1fef
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 1 deletion.
23 changes: 22 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,11 @@ var (
Usage: "iliad test network: pre-configured proof-of-stake test network",
Category: flags.MiscCategory,
}
OdysseyFlag = &cli.BoolFlag{
Name: "odyssey",
Usage: "odyssey test network: pre-configured proof-of-stake test network",
Category: flags.MiscCategory,
}
LocalFlag = &cli.BoolFlag{
Name: "local",
Usage: "local test network: pre-configured local proof-of-stake test network",
Expand Down Expand Up @@ -984,6 +989,7 @@ var (
SepoliaFlag,
HoleskyFlag,
IliadFlag,
OdysseyFlag,
LocalFlag,
}
// NetworkFlags is the flag group of all built-in supported networks.
Expand Down Expand Up @@ -1017,6 +1023,9 @@ func MakeDataDir(ctx *cli.Context) string {
if ctx.Bool(IliadFlag.Name) {
return filepath.Join(path, "iliad")
}
if ctx.Bool(OdysseyFlag.Name) {
return filepath.Join(path, "odyssey")
}
if ctx.Bool(LocalFlag.Name) {
return filepath.Join(path, "local")
}
Expand Down Expand Up @@ -1084,6 +1093,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
urls = params.GoerliBootnodes
case ctx.Bool(IliadFlag.Name):
urls = params.IliadBootnodes
case ctx.Bool(OdysseyFlag.Name):
urls = params.OdysseyBootnodes
case ctx.Bool(LocalFlag.Name):
urls = params.LocalBootnodes
}
Expand Down Expand Up @@ -1519,6 +1530,8 @@ func SetDataDir(ctx *cli.Context, cfg *node.Config) {
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "holesky")
case ctx.Bool(IliadFlag.Name) && cfg.DataDir == node.DefaultDataDir():
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "iliad")
case ctx.Bool(OdysseyFlag.Name) && cfg.DataDir == node.DefaultDataDir():
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "odyssey")
case ctx.Bool(LocalFlag.Name) && cfg.DataDir == node.DefaultDataDir():
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "local")
}
Expand Down Expand Up @@ -1676,7 +1689,7 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
// SetEthConfig applies eth-related command line flags to the config.
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
// Avoid conflicting network flags
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, GoerliFlag, SepoliaFlag, HoleskyFlag, IliadFlag, LocalFlag)
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, GoerliFlag, SepoliaFlag, HoleskyFlag, IliadFlag, OdysseyFlag, LocalFlag)
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer

// Set configurations from CLI flags
Expand Down Expand Up @@ -1857,6 +1870,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
}
cfg.Genesis = core.DefaultIliadGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.IliadGenesisHash)
case ctx.Bool(OdysseyFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1516
}
cfg.Genesis = core.DefaultOdysseyGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.OdysseyGenesisHash)
case ctx.Bool(LocalFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1511
Expand Down Expand Up @@ -2187,6 +2206,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
genesis = core.DefaultGoerliGenesisBlock()
case ctx.Bool(IliadFlag.Name):
genesis = core.DefaultIliadGenesisBlock()
case ctx.Bool(OdysseyFlag.Name):
genesis = core.DefaultOdysseyGenesisBlock()
case ctx.Bool(LocalFlag.Name):
genesis = core.DefaultLocalGenesisBlock()
case ctx.Bool(DeveloperFlag.Name):
Expand Down
12 changes: 12 additions & 0 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,18 @@ func DefaultIliadGenesisBlock() *Genesis {
}
}

// DefaultOdysseyGenesisBlock returns the odyssey network genesis block.
func DefaultOdysseyGenesisBlock() *Genesis {
return &Genesis{
Config: params.OdysseyChainConfig,
Difficulty: big.NewInt(0x20000),
GasLimit: 0x7A1200,
Nonce: 0x42,
Timestamp: 0,
Alloc: decodePrealloc(odysseyAllocData),
}
}

// DefaultLocalGenesisBlock returns the network genesis block for local testing.
func DefaultLocalGenesisBlock() *Genesis {
return &Genesis{
Expand Down
1 change: 1 addition & 0 deletions core/genesis_alloc.go

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions params/bootnodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ var IliadBootnodes = []string{
"enode://3bae9a46ddf39b805f678dd8ba8624c28285417d4bdbf5212234ee83a4cf94335bfd32b449a37bcf39b609208f8556ce42d6ee60c657f2a75b893350c1bd347f@b2.testnet.storyrpc.io:30303",
}

// OdysseyBootnodes are the enode URLs of the P2P bootstrap nodes running on the
// Odyssey test network.
var OdysseyBootnodes = []string{
// Upstream bootnodes
"enode://077aa94a5bf388adda35e0d5a7bd8cb5e9741ea5c18381fd14b16018e112497b7c0a400f50677deb4271af3bc0a1b74f093067a398257b76e3a0d7387a432110@b1.odyssey-testnet.storyrpc.io:30303",
"enode://298bc05889e120e50e7a344e31adb72901caaff9e747b3e8f57c5786e6167452857cbd0ff7d5e0f849a8dfd26efcc3da1795e28d7cb05d120e97a89e79ec4b18@b2.odyssey-testnet.storyrpc.io:30303",
}

// GoerliBootnodes are the enode URLs of the P2P bootstrap nodes running on the
// Görli test network.
var GoerliBootnodes = []string{
Expand Down
21 changes: 21 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var (
SepoliaGenesisHash = common.HexToHash("0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9")
GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
IliadGenesisHash = common.HexToHash("0xf5ebc6f0982e8bf7fd532b3f959f84d12b3dedd2827af8d31f5389447bedafc6")
OdysseyGenesisHash = common.HexToHash("0xf5ebc6f0982e8bf7fd532b3f959f84d12b3dedd2827af8d31f5389447bedafc6")
LocalGenesisHash = common.HexToHash("0x8f3fc56b0dc3a009e6771da99ff737900da84b9aeae15d1bae225cc8b4dbbdc3")
)

Expand Down Expand Up @@ -165,6 +166,26 @@ var (
Enable4844: false,
}

OdysseyChainConfig = &ChainConfig{
ChainID: big.NewInt(1516),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0),
TerminalTotalDifficultyPassed: true,
ShanghaiTime: newUint64(0),
CancunTime: newUint64(0),
}

LocalChainConfig = &ChainConfig{
ChainID: big.NewInt(1511),
HomesteadBlock: big.NewInt(0),
Expand Down

0 comments on commit c4e1fef

Please sign in to comment.