Skip to content

Commit c754738

Browse files
committed
cmd/*, core, params: add ottoman testnet
1 parent 159fba7 commit c754738

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
@@ -110,6 +110,7 @@ var (
110110
utils.DeveloperPeriodFlag,
111111
utils.TestnetFlag,
112112
utils.RinkebyFlag,
113+
utils.OttomanFlag,
113114
utils.VMEnableDebugFlag,
114115
utils.NetworkIdFlag,
115116
utils.RPCCORSDomainFlag,

cmd/geth/usage.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ var AppHelpFlagGroups = []flagGroup{
7474
utils.NetworkIdFlag,
7575
utils.TestnetFlag,
7676
utils.RinkebyFlag,
77+
utils.OttomanFlag,
7778
utils.SyncModeFlag,
7879
utils.GCModeFlag,
7980
utils.EthStatsURLFlag,

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)",
@@ -557,6 +561,9 @@ func MakeDataDir(ctx *cli.Context) string {
557561
if ctx.GlobalBool(RinkebyFlag.Name) {
558562
return filepath.Join(path, "rinkeby")
559563
}
564+
if ctx.GlobalBool(OttomanFlag.Name) {
565+
return filepath.Join(path, "ottoman")
566+
}
560567
return path
561568
}
562569
Fatalf("Cannot determine default data directory, please set manually (--datadir)")
@@ -611,6 +618,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
611618
urls = params.TestnetBootnodes
612619
case ctx.GlobalBool(RinkebyFlag.Name):
613620
urls = params.RinkebyBootnodes
621+
case ctx.GlobalBool(OttomanFlag.Name):
622+
urls = params.OttomanBootnodes
614623
case cfg.BootstrapNodes != nil:
615624
return // already set, don't apply defaults.
616625
}
@@ -897,6 +906,8 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
897906
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
898907
case ctx.GlobalBool(RinkebyFlag.Name):
899908
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
909+
case ctx.GlobalBool(OttomanFlag.Name):
910+
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "ottoman")
900911
}
901912

902913
if ctx.GlobalIsSet(KeyStoreDirFlag.Name) {
@@ -1033,7 +1044,7 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
10331044
// SetEthConfig applies eth-related command line flags to the config.
10341045
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
10351046
// Avoid conflicting network flags
1036-
checkExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag)
1047+
checkExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag, OttomanFlag)
10371048
checkExclusive(ctx, FastSyncFlag, LightModeFlag, SyncModeFlag)
10381049
checkExclusive(ctx, LightServFlag, LightModeFlag)
10391050
checkExclusive(ctx, LightServFlag, SyncModeFlag, "light")
@@ -1128,6 +1139,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
11281139
if !ctx.GlobalIsSet(GasPriceFlag.Name) {
11291140
cfg.GasPrice = big.NewInt(1)
11301141
}
1142+
case ctx.GlobalBool(OttomanFlag.Name):
1143+
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
1144+
cfg.NetworkId = 5
1145+
}
1146+
cfg.Genesis = core.DefaultOttomanGenesisBlock()
11311147
}
11321148
// TODO(fjl): move trie cache generations into config
11331149
if gen := ctx.GlobalInt(TrieCacheGenFlag.Name); gen > 0 {
@@ -1229,6 +1245,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
12291245
genesis = core.DefaultRinkebyGenesisBlock()
12301246
case ctx.GlobalBool(DeveloperFlag.Name):
12311247
Fatalf("Developer chains are ephemeral")
1248+
case ctx.GlobalBool(OttomanFlag.Name):
1249+
genesis = core.DefaultOttomanGenesisBlock()
12321250
}
12331251
return genesis
12341252
}

core/genesis.go

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

347+
// DefaultOttomanGenesisBlock returns the Ottoman network genesis block.
348+
func DefaultOttomanGenesisBlock() *Genesis {
349+
return &Genesis{
350+
Config: params.OttomanChainConfig,
351+
Timestamp: 1496993285,
352+
ExtraData: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000f89af85494475cc98b5521ab2a1335683e7567c8048bfe79ed9407d8299de61faed3686ba4c4e6c3b9083d7e2371944fe035ce99af680d89e2c4d73aca01dbfc1bd2fd94dc421209441a754f79c4a4ecd2b49c935aad0312b8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0"),
353+
GasLimit: 4700000,
354+
Difficulty: big.NewInt(1),
355+
Mixhash: common.HexToHash("0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365"),
356+
Alloc: decodePrealloc(ottomanAllocData),
357+
}
358+
}
359+
347360
// DeveloperGenesisBlock returns the 'geth --dev' genesis block. Note, this must
348361
// be seeded with the
349362
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
@@ -47,6 +47,15 @@ var RinkebyBootnodes = []string{
4747
"enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303", // AKASHA
4848
}
4949

50+
// Ottoman are the enode URLs of the P2P bootstrap nodes running on the
51+
// Ottoman test network.
52+
var OttomanBootnodes = []string{
53+
"enode://851ceb576681cf1e0d46ee9f049d6c678f229d806d1b41afe5b6d3c99a43fbbb7271d60e4c43cc5535e125a61db4ea2424823a3ad2c5959e8125f546cd1a7969@13.76.136.158:30303", //SG
54+
"enode://e3b5624752b86b60aa492edd65bdc906f9861a5e9113abd8f908443d1f64395c0e2bdd2e1825154837fd72da9d2e55e4f231411d5ca99ba9c90e14ba2f5612f6@52.163.118.231:30303", //SG
55+
"enode://3a1c96fe1fe9da5d4ea3b1a65bfecb4571101b519595cab6deb2eb029209353cdbc91c8d3751d0c6c00e5440657b678508e99bd9e934d4a0c1ad553fc1cb9155@13.76.140.250:30303", //SG
56+
"enode://aebe74e4ab7db8074d1cb9634dab3fd8c5745f8cc4868da2007ff754721085b189ffaf44b8041219de90b55df3ac515bbd0e1df7fde8d7684df0ecfb12534a73@52.187.45.126:30303", //SG
57+
}
58+
5059
// DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the
5160
// experimental RLPx v5 topic-discovery network.
5261
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)