Skip to content

Commit 96e5059

Browse files
committed
cmd/*, core, params: add ottoman testnet
1 parent d704571 commit 96e5059

File tree

7 files changed

+64
-2
lines changed

7 files changed

+64
-2
lines changed

cmd/geth/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ var (
108108
utils.DeveloperPeriodFlag,
109109
utils.TestnetFlag,
110110
utils.RinkebyFlag,
111+
utils.OttomanFlag,
111112
utils.VMEnableDebugFlag,
112113
utils.NetworkIdFlag,
113114
utils.RPCCORSDomainFlag,

cmd/geth/usage.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ var AppHelpFlagGroups = []flagGroup{
7373
utils.NetworkIdFlag,
7474
utils.TestnetFlag,
7575
utils.RinkebyFlag,
76+
utils.OttomanFlag,
7677
utils.SyncModeFlag,
7778
utils.EthStatsURLFlag,
7879
utils.IdentityFlag,

cmd/utils/flags.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ var (
128128
}
129129
NetworkIdFlag = cli.Uint64Flag{
130130
Name: "networkid",
131-
Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby)",
131+
Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby, 5=Ottoman)",
132132
Value: eth.DefaultConfig.NetworkId,
133133
}
134134
TestnetFlag = cli.BoolFlag{
@@ -143,6 +143,10 @@ var (
143143
Name: "dev",
144144
Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled",
145145
}
146+
OttomanFlag = cli.BoolFlag{
147+
Name: "ottoman",
148+
Usage: "Ottoman network: pre-configured istanbul bft test network",
149+
}
146150
DeveloperPeriodFlag = cli.IntFlag{
147151
Name: "dev.period",
148152
Usage: "Block period to use in developer mode (0 = mine only if transaction pending)",
@@ -548,6 +552,9 @@ func MakeDataDir(ctx *cli.Context) string {
548552
if ctx.GlobalBool(RinkebyFlag.Name) {
549553
return filepath.Join(path, "rinkeby")
550554
}
555+
if ctx.GlobalBool(OttomanFlag.Name) {
556+
return filepath.Join(path, "ottoman")
557+
}
551558
return path
552559
}
553560
Fatalf("Cannot determine default data directory, please set manually (--datadir)")
@@ -602,6 +609,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
602609
urls = params.TestnetBootnodes
603610
case ctx.GlobalBool(RinkebyFlag.Name):
604611
urls = params.RinkebyBootnodes
612+
case ctx.GlobalBool(OttomanFlag.Name):
613+
urls = params.OttomanBootnodes
605614
case cfg.BootstrapNodes != nil:
606615
return // already set, don't apply defaults.
607616
}
@@ -870,6 +879,8 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
870879
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
871880
case ctx.GlobalBool(RinkebyFlag.Name):
872881
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
882+
case ctx.GlobalBool(OttomanFlag.Name):
883+
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "ottoman")
873884
}
874885

875886
if ctx.GlobalIsSet(KeyStoreDirFlag.Name) {
@@ -1009,7 +1020,7 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
10091020
// SetEthConfig applies eth-related command line flags to the config.
10101021
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
10111022
// Avoid conflicting network flags
1012-
checkExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag)
1023+
checkExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag, OttomanFlag)
10131024
checkExclusive(ctx, FastSyncFlag, LightModeFlag, SyncModeFlag)
10141025
checkExclusive(ctx, LightServFlag, LightModeFlag)
10151026
checkExclusive(ctx, LightServFlag, SyncModeFlag, "light")
@@ -1096,6 +1107,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
10961107
if !ctx.GlobalIsSet(GasPriceFlag.Name) {
10971108
cfg.GasPrice = big.NewInt(1)
10981109
}
1110+
case ctx.GlobalBool(OttomanFlag.Name):
1111+
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
1112+
cfg.NetworkId = 5
1113+
}
1114+
cfg.Genesis = core.DefaultOttomanGenesisBlock()
10991115
}
11001116
// TODO(fjl): move trie cache generations into config
11011117
if gen := ctx.GlobalInt(TrieCacheGenFlag.Name); gen > 0 {
@@ -1198,6 +1214,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
11981214
genesis = core.DefaultRinkebyGenesisBlock()
11991215
case ctx.GlobalBool(DeveloperFlag.Name):
12001216
Fatalf("Developer chains are ephemeral")
1217+
case ctx.GlobalBool(OttomanFlag.Name):
1218+
genesis = core.DefaultOttomanGenesisBlock()
12011219
}
12021220
return genesis
12031221
}

core/genesis.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,19 @@ func DefaultRinkebyGenesisBlock() *Genesis {
342342
}
343343
}
344344

345+
// DefaultOttomanGenesisBlock returns the Ottoman network genesis block.
346+
func DefaultOttomanGenesisBlock() *Genesis {
347+
return &Genesis{
348+
Config: params.OttomanChainConfig,
349+
Timestamp: 1496993285,
350+
ExtraData: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000f89af85494475cc98b5521ab2a1335683e7567c8048bfe79ed9407d8299de61faed3686ba4c4e6c3b9083d7e2371944fe035ce99af680d89e2c4d73aca01dbfc1bd2fd94dc421209441a754f79c4a4ecd2b49c935aad0312b8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0"),
351+
GasLimit: 4700000,
352+
Difficulty: big.NewInt(1),
353+
Mixhash: common.HexToHash("0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365"),
354+
Alloc: decodePrealloc(ottomanAllocData),
355+
}
356+
}
357+
345358
// DeveloperGenesisBlock returns the 'geth --dev' genesis block. Note, this must
346359
// be seeded with the
347360
func DeveloperGenesisBlock(period uint64, faucet common.Address) *Genesis {

core/genesis_alloc.go

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

params/bootnodes.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ var RinkebyV5Bootnodes = []string{
5353
"enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303?discport=30304", // AKASHA
5454
}
5555

56+
// Ottoman are the enode URLs of the P2P bootstrap nodes running on the
57+
// Ottoman test network.
58+
var OttomanBootnodes = []string{
59+
"enode://851ceb576681cf1e0d46ee9f049d6c678f229d806d1b41afe5b6d3c99a43fbbb7271d60e4c43cc5535e125a61db4ea2424823a3ad2c5959e8125f546cd1a7969@13.76.136.158:30303", //SG
60+
"enode://e3b5624752b86b60aa492edd65bdc906f9861a5e9113abd8f908443d1f64395c0e2bdd2e1825154837fd72da9d2e55e4f231411d5ca99ba9c90e14ba2f5612f6@52.163.118.231:30303", //SG
61+
"enode://3a1c96fe1fe9da5d4ea3b1a65bfecb4571101b519595cab6deb2eb029209353cdbc91c8d3751d0c6c00e5440657b678508e99bd9e934d4a0c1ad553fc1cb9155@13.76.140.250:30303", //SG
62+
"enode://aebe74e4ab7db8074d1cb9634dab3fd8c5745f8cc4868da2007ff754721085b189ffaf44b8041219de90b55df3ac515bbd0e1df7fde8d7684df0ecfb12534a73@52.187.45.126:30303", //SG
63+
}
64+
5665
// DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the
5766
// experimental RLPx v5 topic-discovery network.
5867
var DiscoveryV5Bootnodes = []string{

params/config.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package params
1818

1919
import (
2020
"fmt"
21+
"math"
2122
"math/big"
2223

2324
"github.com/ethereum/go-ethereum/common"
@@ -77,6 +78,24 @@ var (
7778
},
7879
}
7980

81+
// OttomanChainConfig contains the chain parameters to run a node on the Ottoman test network.
82+
OttomanChainConfig = &ChainConfig{
83+
ChainId: big.NewInt(5),
84+
HomesteadBlock: big.NewInt(1),
85+
DAOForkBlock: nil,
86+
DAOForkSupport: true,
87+
EIP150Block: big.NewInt(2),
88+
EIP150Hash: common.HexToHash("0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9"),
89+
EIP155Block: big.NewInt(3),
90+
EIP158Block: big.NewInt(3),
91+
ByzantiumBlock: big.NewInt(math.MaxInt64), // Don't enable yet
92+
93+
Istanbul: &IstanbulConfig{
94+
Epoch: 30000,
95+
ProposerPolicy: 0,
96+
},
97+
}
98+
8099
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
81100
// and accepted by the Ethereum core developers into the Ethash consensus.
82101
//

0 commit comments

Comments
 (0)