Commit 7a6d5d0c authored by gary rong's avatar gary rong Committed by Péter Szilágyi

cmd/puppeth: integrate istanbul into puppeth (#19926)

* cmd/puppeth: integrate istanbul into puppeth

* cmd/puppeth: address comment

* cmd/puppeth: use hexutil.Big for fork indicator

* cmd/puppeth: finalize istanbul fork

* cmd/puppeth: fix 2200 for parity, rename is to eip1283ReenableTransition

* cmd/puppeth: fix eip1108

* cmd/puppeth: add blake2f for parity

* cmd/puppeth: add aleth istanbul precompiled

* cmd/puppeth: use hexutil.Big

* cmd/puppeth: fix unit tests

* cmd/puppeth: update testdata
parent 0ff73804
This diff is collapsed.
...@@ -76,7 +76,7 @@ func TestParitySturebyConverter(t *testing.T) { ...@@ -76,7 +76,7 @@ func TestParitySturebyConverter(t *testing.T) {
if err := json.Unmarshal(blob, &genesis); err != nil { if err := json.Unmarshal(blob, &genesis); err != nil {
t.Fatalf("failed parsing genesis: %v", err) t.Fatalf("failed parsing genesis: %v", err)
} }
spec, err := newParityChainSpec("Stureby", &genesis, []string{}) spec, err := newParityChainSpec("stureby", &genesis, []string{})
if err != nil { if err != nil {
t.Fatalf("failed creating chainspec: %v", err) t.Fatalf("failed creating chainspec: %v", err)
} }
......
{ {
"sealEngine":"Ethash", "sealEngine": "Ethash",
"params":{ "params": {
"accountStartNonce":"0x00", "accountStartNonce": "0x0",
"maximumExtraDataSize":"0x20", "maximumExtraDataSize": "0x20",
"homesteadForkBlock":"0x2710", "homesteadForkBlock": "0x2710",
"daoHardforkBlock":"0x00", "daoHardforkBlock": "0x0",
"EIP150ForkBlock":"0x3a98", "EIP150ForkBlock": "0x3a98",
"EIP158ForkBlock":"0x59d8", "EIP158ForkBlock": "0x59d8",
"byzantiumForkBlock":"0x7530", "byzantiumForkBlock": "0x7530",
"constantinopleForkBlock":"0x9c40", "constantinopleForkBlock": "0x9c40",
"minGasLimit":"0x1388", "constantinopleFixForkBlock": "0x9c40",
"maxGasLimit":"0x7fffffffffffffff", "istanbulForkBlock": "0xc350",
"tieBreakingGas":false, "minGasLimit": "0x1388",
"gasLimitBoundDivisor":"0x0400", "maxGasLimit": "0x7fffffffffffffff",
"minimumDifficulty":"0x20000", "tieBreakingGas": false,
"difficultyBoundDivisor":"0x0800", "gasLimitBoundDivisor": "0x400",
"durationLimit":"0x0d", "minimumDifficulty": "0x20000",
"blockReward":"0x4563918244F40000", "difficultyBoundDivisor": "0x800",
"networkID":"0x4cb2e", "durationLimit": "0xd",
"chainID":"0x4cb2e", "blockReward": "0x4563918244f40000",
"allowFutureBlocks":false "networkID": "0x4cb2e",
"chainID": "0x4cb2e",
"allowFutureBlocks": false
}, },
"genesis":{ "genesis": {
"nonce":"0x0000000000000000", "nonce": "0x0000000000000000",
"difficulty":"0x20000", "difficulty": "0x20000",
"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000", "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"author":"0x0000000000000000000000000000000000000000", "author": "0x0000000000000000000000000000000000000000",
"timestamp":"0x59a4e76d", "timestamp": "0x59a4e76d",
"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData":"0x0000000000000000000000000000000000000000000000000000000b4dc0ffee", "extraData": "0x0000000000000000000000000000000000000000000000000000000b4dc0ffee",
"gasLimit":"0x47b760" "gasLimit": "0x47b760"
}, },
"accounts":{ "accounts": {
"0000000000000000000000000000000000000001":{ "0000000000000000000000000000000000000001": {
"balance":"1", "balance": "0x1",
"precompiled":{ "precompiled": {
"name":"ecrecover", "name": "ecrecover",
"linear":{ "linear": {
"base":3000, "base": 3000,
"word":0 "word": 0
} }
} }
}, },
"0000000000000000000000000000000000000002":{ "0000000000000000000000000000000000000002": {
"balance":"1", "balance": "0x1",
"precompiled":{ "precompiled": {
"name":"sha256", "name": "sha256",
"linear":{ "linear": {
"base":60, "base": 60,
"word":12 "word": 12
} }
} }
}, },
"0000000000000000000000000000000000000003":{ "0000000000000000000000000000000000000003": {
"balance":"1", "balance": "0x1",
"precompiled":{ "precompiled": {
"name":"ripemd160", "name": "ripemd160",
"linear":{ "linear": {
"base":600, "base": 600,
"word":120 "word": 120
} }
} }
}, },
"0000000000000000000000000000000000000004":{ "0000000000000000000000000000000000000004": {
"balance":"1", "balance": "0x1",
"precompiled":{ "precompiled": {
"name":"identity", "name": "identity",
"linear":{ "linear": {
"base":15, "base": 15,
"word":3 "word": 3
} }
} }
}, },
"0000000000000000000000000000000000000005":{ "0000000000000000000000000000000000000005": {
"balance":"1", "balance": "0x1",
"precompiled":{ "precompiled": {
"name":"modexp", "name": "modexp",
"startingBlock":"0x7530" "startingBlock": "0x7530"
} }
}, },
"0000000000000000000000000000000000000006":{ "0000000000000000000000000000000000000006": {
"balance":"1", "balance": "0x1",
"precompiled":{ "precompiled": {
"name":"alt_bn128_G1_add", "name": "alt_bn128_G1_add",
"startingBlock":"0x7530", "startingBlock": "0x7530"
"linear":{
"base":500,
"word":0
}
} }
}, },
"0000000000000000000000000000000000000007":{ "0000000000000000000000000000000000000007": {
"balance":"1", "balance": "0x1",
"precompiled":{ "precompiled": {
"name":"alt_bn128_G1_mul", "name": "alt_bn128_G1_mul",
"startingBlock":"0x7530", "startingBlock": "0x7530"
"linear":{
"base":40000,
"word":0
} }
},
"0000000000000000000000000000000000000008": {
"balance": "0x1",
"precompiled": {
"name": "alt_bn128_pairing_product",
"startingBlock": "0x7530"
} }
}, },
"0000000000000000000000000000000000000008":{ "0000000000000000000000000000000000000009": {
"balance":"1", "balance": "0x1",
"precompiled":{ "precompiled": {
"name":"alt_bn128_pairing_product", "name": "blake2_compression",
"startingBlock":"0x7530" "startingBlock": "0xc350"
} }
} }
} }
......
{ {
"config": { "config": {
"ethash":{},
"chainId": 314158, "chainId": 314158,
"homesteadBlock": 10000, "homesteadBlock": 10000,
"eip150Block": 15000, "eip150Block": 15000,
...@@ -8,11 +7,13 @@ ...@@ -8,11 +7,13 @@
"eip155Block": 23000, "eip155Block": 23000,
"eip158Block": 23000, "eip158Block": 23000,
"byzantiumBlock": 30000, "byzantiumBlock": 30000,
"constantinopleBlock": 40000 "constantinopleBlock": 40000,
"petersburgBlock": 40000,
"istanbulBlock": 50000,
"ethash": {}
}, },
"nonce": "0x0", "nonce": "0x0",
"timestamp": "0x59a4e76d", "timestamp": "0x59a4e76d",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x0000000000000000000000000000000000000000000000000000000b4dc0ffee", "extraData": "0x0000000000000000000000000000000000000000000000000000000b4dc0ffee",
"gasLimit": "0x47b760", "gasLimit": "0x47b760",
"difficulty": "0x20000", "difficulty": "0x20000",
...@@ -20,28 +21,34 @@ ...@@ -20,28 +21,34 @@
"coinbase": "0x0000000000000000000000000000000000000000", "coinbase": "0x0000000000000000000000000000000000000000",
"alloc": { "alloc": {
"0000000000000000000000000000000000000001": { "0000000000000000000000000000000000000001": {
"balance": "0x01" "balance": "0x1"
}, },
"0000000000000000000000000000000000000002": { "0000000000000000000000000000000000000002": {
"balance": "0x01" "balance": "0x1"
}, },
"0000000000000000000000000000000000000003": { "0000000000000000000000000000000000000003": {
"balance": "0x01" "balance": "0x1"
}, },
"0000000000000000000000000000000000000004": { "0000000000000000000000000000000000000004": {
"balance": "0x01" "balance": "0x1"
}, },
"0000000000000000000000000000000000000005": { "0000000000000000000000000000000000000005": {
"balance": "0x01" "balance": "0x1"
}, },
"0000000000000000000000000000000000000006": { "0000000000000000000000000000000000000006": {
"balance": "0x01" "balance": "0x1"
}, },
"0000000000000000000000000000000000000007": { "0000000000000000000000000000000000000007": {
"balance": "0x01" "balance": "0x1"
}, },
"0000000000000000000000000000000000000008": { "0000000000000000000000000000000000000008": {
"balance": "0x01" "balance": "0x1"
} },
"0000000000000000000000000000000000000009": {
"balance": "0x1"
} }
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
} }
\ No newline at end of file
This diff is collapsed.
...@@ -51,6 +51,7 @@ func (w *wizard) makeGenesis() { ...@@ -51,6 +51,7 @@ func (w *wizard) makeGenesis() {
ByzantiumBlock: big.NewInt(0), ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
}, },
} }
// Figure out which consensus engine to choose // Figure out which consensus engine to choose
...@@ -230,6 +231,10 @@ func (w *wizard) manageGenesis() { ...@@ -230,6 +231,10 @@ func (w *wizard) manageGenesis() {
fmt.Printf("Which block should Petersburg come into effect? (default = %v)\n", w.conf.Genesis.Config.PetersburgBlock) fmt.Printf("Which block should Petersburg come into effect? (default = %v)\n", w.conf.Genesis.Config.PetersburgBlock)
w.conf.Genesis.Config.PetersburgBlock = w.readDefaultBigInt(w.conf.Genesis.Config.PetersburgBlock) w.conf.Genesis.Config.PetersburgBlock = w.readDefaultBigInt(w.conf.Genesis.Config.PetersburgBlock)
fmt.Println()
fmt.Printf("Which block should Istanbul come into effect? (default = %v)\n", w.conf.Genesis.Config.IstanbulBlock)
w.conf.Genesis.Config.IstanbulBlock = w.readDefaultBigInt(w.conf.Genesis.Config.IstanbulBlock)
out, _ := json.MarshalIndent(w.conf.Genesis.Config, "", " ") out, _ := json.MarshalIndent(w.conf.Genesis.Config, "", " ")
fmt.Printf("Chain configuration updated:\n\n%s\n", out) fmt.Printf("Chain configuration updated:\n\n%s\n", out)
...@@ -268,7 +273,7 @@ func (w *wizard) manageGenesis() { ...@@ -268,7 +273,7 @@ func (w *wizard) manageGenesis() {
} else { } else {
saveGenesis(folder, w.network, "parity", spec) saveGenesis(folder, w.network, "parity", spec)
} }
// Export the genesis spec used by Harmony (formerly EthereumJ // Export the genesis spec used by Harmony (formerly EthereumJ)
saveGenesis(folder, w.network, "harmony", w.conf.Genesis) saveGenesis(folder, w.network, "harmony", w.conf.Genesis)
case "3": case "3":
...@@ -291,7 +296,7 @@ func (w *wizard) manageGenesis() { ...@@ -291,7 +296,7 @@ func (w *wizard) manageGenesis() {
func saveGenesis(folder, network, client string, spec interface{}) { func saveGenesis(folder, network, client string, spec interface{}) {
path := filepath.Join(folder, fmt.Sprintf("%s-%s.json", network, client)) path := filepath.Join(folder, fmt.Sprintf("%s-%s.json", network, client))
out, _ := json.Marshal(spec) out, _ := json.MarshalIndent(spec, "", " ")
if err := ioutil.WriteFile(path, out, 0644); err != nil { if err := ioutil.WriteFile(path, out, 0644); err != nil {
log.Error("Failed to save genesis file", "client", client, "err", err) log.Error("Failed to save genesis file", "client", client, "err", err)
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment