mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/puppeth: integrate istanbul into puppeth
This commit is contained in:
parent
a28093ced4
commit
f7a540ff6a
2 changed files with 44 additions and 33 deletions
|
|
@ -36,25 +36,27 @@ import (
|
||||||
type alethGenesisSpec struct {
|
type alethGenesisSpec struct {
|
||||||
SealEngine string `json:"sealEngine"`
|
SealEngine string `json:"sealEngine"`
|
||||||
Params struct {
|
Params struct {
|
||||||
AccountStartNonce math2.HexOrDecimal64 `json:"accountStartNonce"`
|
AccountStartNonce math2.HexOrDecimal64 `json:"accountStartNonce"`
|
||||||
MaximumExtraDataSize hexutil.Uint64 `json:"maximumExtraDataSize"`
|
MaximumExtraDataSize hexutil.Uint64 `json:"maximumExtraDataSize"`
|
||||||
HomesteadForkBlock hexutil.Uint64 `json:"homesteadForkBlock"`
|
HomesteadForkBlock hexutil.Uint64 `json:"homesteadForkBlock"`
|
||||||
DaoHardforkBlock math2.HexOrDecimal64 `json:"daoHardforkBlock"`
|
DaoHardforkBlock math2.HexOrDecimal64 `json:"daoHardforkBlock"`
|
||||||
EIP150ForkBlock hexutil.Uint64 `json:"EIP150ForkBlock"`
|
EIP150ForkBlock hexutil.Uint64 `json:"EIP150ForkBlock"`
|
||||||
EIP158ForkBlock hexutil.Uint64 `json:"EIP158ForkBlock"`
|
EIP158ForkBlock hexutil.Uint64 `json:"EIP158ForkBlock"`
|
||||||
ByzantiumForkBlock hexutil.Uint64 `json:"byzantiumForkBlock"`
|
ByzantiumForkBlock hexutil.Uint64 `json:"byzantiumForkBlock"`
|
||||||
ConstantinopleForkBlock hexutil.Uint64 `json:"constantinopleForkBlock"`
|
ConstantinopleForkBlock hexutil.Uint64 `json:"constantinopleForkBlock"`
|
||||||
MinGasLimit hexutil.Uint64 `json:"minGasLimit"`
|
ConstantinopleFixForkBlock hexutil.Uint64 `json:"constantinopleFixForkBlock"`
|
||||||
MaxGasLimit hexutil.Uint64 `json:"maxGasLimit"`
|
IstanbulForkBlock hexutil.Uint64 `json:"IstanbulForkBlock"`
|
||||||
TieBreakingGas bool `json:"tieBreakingGas"`
|
MinGasLimit hexutil.Uint64 `json:"minGasLimit"`
|
||||||
GasLimitBoundDivisor math2.HexOrDecimal64 `json:"gasLimitBoundDivisor"`
|
MaxGasLimit hexutil.Uint64 `json:"maxGasLimit"`
|
||||||
MinimumDifficulty *hexutil.Big `json:"minimumDifficulty"`
|
TieBreakingGas bool `json:"tieBreakingGas"`
|
||||||
DifficultyBoundDivisor *math2.HexOrDecimal256 `json:"difficultyBoundDivisor"`
|
GasLimitBoundDivisor math2.HexOrDecimal64 `json:"gasLimitBoundDivisor"`
|
||||||
DurationLimit *math2.HexOrDecimal256 `json:"durationLimit"`
|
MinimumDifficulty *hexutil.Big `json:"minimumDifficulty"`
|
||||||
BlockReward *hexutil.Big `json:"blockReward"`
|
DifficultyBoundDivisor *math2.HexOrDecimal256 `json:"difficultyBoundDivisor"`
|
||||||
NetworkID hexutil.Uint64 `json:"networkID"`
|
DurationLimit *math2.HexOrDecimal256 `json:"durationLimit"`
|
||||||
ChainID hexutil.Uint64 `json:"chainID"`
|
BlockReward *hexutil.Big `json:"blockReward"`
|
||||||
AllowFutureBlocks bool `json:"allowFutureBlocks"`
|
NetworkID hexutil.Uint64 `json:"networkID"`
|
||||||
|
ChainID hexutil.Uint64 `json:"chainID"`
|
||||||
|
AllowFutureBlocks bool `json:"allowFutureBlocks"`
|
||||||
} `json:"params"`
|
} `json:"params"`
|
||||||
|
|
||||||
Genesis struct {
|
Genesis struct {
|
||||||
|
|
@ -112,15 +114,27 @@ func newAlethGenesisSpec(network string, genesis *core.Genesis) (*alethGenesisSp
|
||||||
spec.Params.EIP150ForkBlock = (hexutil.Uint64)(genesis.Config.EIP150Block.Uint64())
|
spec.Params.EIP150ForkBlock = (hexutil.Uint64)(genesis.Config.EIP150Block.Uint64())
|
||||||
spec.Params.EIP158ForkBlock = (hexutil.Uint64)(genesis.Config.EIP158Block.Uint64())
|
spec.Params.EIP158ForkBlock = (hexutil.Uint64)(genesis.Config.EIP158Block.Uint64())
|
||||||
|
|
||||||
// Byzantium
|
if num := genesis.Config.HomesteadBlock; num != nil {
|
||||||
|
spec.Params.HomesteadForkBlock = hexutil.Uint64(num.Uint64())
|
||||||
|
}
|
||||||
|
if num := genesis.Config.EIP150Block; num != nil {
|
||||||
|
spec.Params.EIP150ForkBlock = hexutil.Uint64(num.Uint64())
|
||||||
|
}
|
||||||
|
if num := genesis.Config.EIP158Block; num != nil {
|
||||||
|
spec.Params.EIP158ForkBlock = hexutil.Uint64(num.Uint64())
|
||||||
|
}
|
||||||
if num := genesis.Config.ByzantiumBlock; num != nil {
|
if num := genesis.Config.ByzantiumBlock; num != nil {
|
||||||
spec.setByzantium(num)
|
spec.Params.ByzantiumForkBlock = hexutil.Uint64(num.Uint64())
|
||||||
}
|
}
|
||||||
// Constantinople
|
|
||||||
if num := genesis.Config.ConstantinopleBlock; num != nil {
|
if num := genesis.Config.ConstantinopleBlock; num != nil {
|
||||||
spec.setConstantinople(num)
|
spec.Params.ConstantinopleForkBlock = hexutil.Uint64(num.Uint64())
|
||||||
|
}
|
||||||
|
if num := genesis.Config.PetersburgBlock; num != nil {
|
||||||
|
spec.Params.ConstantinopleFixForkBlock = hexutil.Uint64(num.Uint64())
|
||||||
|
}
|
||||||
|
if num := genesis.Config.IstanbulBlock; num != nil {
|
||||||
|
spec.Params.IstanbulForkBlock = hexutil.Uint64(num.Uint64())
|
||||||
}
|
}
|
||||||
|
|
||||||
spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64())
|
spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64())
|
||||||
spec.Params.ChainID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64())
|
spec.Params.ChainID = (hexutil.Uint64)(genesis.Config.ChainID.Uint64())
|
||||||
spec.Params.MaximumExtraDataSize = (hexutil.Uint64)(params.MaximumExtraDataSize)
|
spec.Params.MaximumExtraDataSize = (hexutil.Uint64)(params.MaximumExtraDataSize)
|
||||||
|
|
@ -196,14 +210,6 @@ func (spec *alethGenesisSpec) setAccount(address common.Address, account core.Ge
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (spec *alethGenesisSpec) setByzantium(num *big.Int) {
|
|
||||||
spec.Params.ByzantiumForkBlock = hexutil.Uint64(num.Uint64())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (spec *alethGenesisSpec) setConstantinople(num *big.Int) {
|
|
||||||
spec.Params.ConstantinopleForkBlock = hexutil.Uint64(num.Uint64())
|
|
||||||
}
|
|
||||||
|
|
||||||
// parityChainSpec is the chain specification format used by Parity.
|
// parityChainSpec is the chain specification format used by Parity.
|
||||||
type parityChainSpec struct {
|
type parityChainSpec struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
|
||||||
|
|
@ -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() {
|
||||||
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() {
|
||||||
} 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":
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue