params, core/forkid: review nitpicks

This commit is contained in:
Martin Holst Swende 2019-12-05 19:31:58 +01:00
parent de424f357e
commit 51172f0a88
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
2 changed files with 13 additions and 13 deletions

View file

@ -57,10 +57,10 @@ func TestCreation(t *testing.T) {
{7279999, ID{Hash: checksumToBytes(0xa00bc324), Next: 7280000}}, // Last Byzantium block {7279999, ID{Hash: checksumToBytes(0xa00bc324), Next: 7280000}}, // Last Byzantium block
{7280000, ID{Hash: checksumToBytes(0x668db0af), Next: 9069000}}, // First and last Constantinople, first Petersburg block {7280000, ID{Hash: checksumToBytes(0x668db0af), Next: 9069000}}, // First and last Constantinople, first Petersburg block
{9068999, ID{Hash: checksumToBytes(0x668db0af), Next: 9069000}}, // Last Petersburg block {9068999, ID{Hash: checksumToBytes(0x668db0af), Next: 9069000}}, // Last Petersburg block
{9069000, ID{Hash: checksumToBytes(0x879d6e30), Next: 9200000}}, // Muir Glacier block {9069000, ID{Hash: checksumToBytes(0x879d6e30), Next: 9200000}}, // First Istanbul and first Muir Glacier block
{9199999, ID{Hash: checksumToBytes(0x879d6e30), Next: 9200000}}, // Muir Glacier block {9199999, ID{Hash: checksumToBytes(0x879d6e30), Next: 9200000}}, // Last Istanbul and first Muir Glacier block
{9200000, ID{Hash: checksumToBytes(0xe029e991), Next: 0}}, // Future Istanbul block {9200000, ID{Hash: checksumToBytes(0xe029e991), Next: 0}}, // First Muir Glacier block
{10000000, ID{Hash: checksumToBytes(0xe029e991), Next: 0}}, // Future Istanbul block {10000000, ID{Hash: checksumToBytes(0xe029e991), Next: 0}}, // Future Muir Glacier block
}, },
}, },
// Ropsten test cases // Ropsten test cases

View file

@ -66,7 +66,7 @@ var (
ConstantinopleBlock: big.NewInt(7280000), ConstantinopleBlock: big.NewInt(7280000),
PetersburgBlock: big.NewInt(7280000), PetersburgBlock: big.NewInt(7280000),
IstanbulBlock: big.NewInt(9069000), IstanbulBlock: big.NewInt(9069000),
EIP2384Block: big.NewInt(9200000), MuirGlacierBlock: big.NewInt(9200000),
Ethash: new(EthashConfig), Ethash: new(EthashConfig),
} }
@ -105,7 +105,7 @@ var (
ConstantinopleBlock: big.NewInt(4230000), ConstantinopleBlock: big.NewInt(4230000),
PetersburgBlock: big.NewInt(4939394), PetersburgBlock: big.NewInt(4939394),
IstanbulBlock: big.NewInt(6485846), IstanbulBlock: big.NewInt(6485846),
EIP2384Block: big.NewInt(7117117), MuirGlacierBlock: big.NewInt(7117117),
Ethash: new(EthashConfig), Ethash: new(EthashConfig),
} }
@ -294,7 +294,7 @@ type ChainConfig struct {
ConstantinopleBlock *big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated) ConstantinopleBlock *big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated)
PetersburgBlock *big.Int `json:"petersburgBlock,omitempty"` // Petersburg switch block (nil = same as Constantinople) PetersburgBlock *big.Int `json:"petersburgBlock,omitempty"` // Petersburg switch block (nil = same as Constantinople)
IstanbulBlock *big.Int `json:"istanbulBlock,omitempty"` // Istanbul switch block (nil = no fork, 0 = already on istanbul) IstanbulBlock *big.Int `json:"istanbulBlock,omitempty"` // Istanbul switch block (nil = no fork, 0 = already on istanbul)
EIP2384Block *big.Int `json:"muirGlacierBlock,omitempty"` // Eip-2384 (bomb delay) switch block (nil = no fork, 0 = already activated) MuirGlacierBlock *big.Int `json:"muirGlacierBlock,omitempty"` // Eip-2384 (bomb delay) switch block (nil = no fork, 0 = already activated)
EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM switch block (nil = no fork, 0 = already activated) EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM switch block (nil = no fork, 0 = already activated)
// Various consensus engines // Various consensus engines
@ -332,7 +332,7 @@ func (c *ChainConfig) String() string {
default: default:
engine = "unknown" engine = "unknown"
} }
return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, EIP-2384: %v, Engine: %v}", return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Engine: %v}",
c.ChainID, c.ChainID,
c.HomesteadBlock, c.HomesteadBlock,
c.DAOForkBlock, c.DAOForkBlock,
@ -344,7 +344,7 @@ func (c *ChainConfig) String() string {
c.ConstantinopleBlock, c.ConstantinopleBlock,
c.PetersburgBlock, c.PetersburgBlock,
c.IstanbulBlock, c.IstanbulBlock,
c.EIP2384Block, c.MuirGlacierBlock,
engine, engine,
) )
} }
@ -386,7 +386,7 @@ func (c *ChainConfig) IsConstantinople(num *big.Int) bool {
// IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater. // IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater.
func (c *ChainConfig) IsMuirGlacier(num *big.Int) bool { func (c *ChainConfig) IsMuirGlacier(num *big.Int) bool {
return isForked(c.EIP2384Block, num) return isForked(c.MuirGlacierBlock, num)
} }
// IsPetersburg returns whether num is either // IsPetersburg returns whether num is either
@ -441,7 +441,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
{"constantinopleBlock", c.ConstantinopleBlock}, {"constantinopleBlock", c.ConstantinopleBlock},
{"petersburgBlock", c.PetersburgBlock}, {"petersburgBlock", c.PetersburgBlock},
{"istanbulBlock", c.IstanbulBlock}, {"istanbulBlock", c.IstanbulBlock},
{"eip2384Block", c.EIP2384Block}, {"muirGlacierBlock", c.MuirGlacierBlock},
} { } {
if lastFork.name != "" { if lastFork.name != "" {
// Next one must be higher number // Next one must be higher number
@ -495,8 +495,8 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
if isForkIncompatible(c.IstanbulBlock, newcfg.IstanbulBlock, head) { if isForkIncompatible(c.IstanbulBlock, newcfg.IstanbulBlock, head) {
return newCompatError("Istanbul fork block", c.IstanbulBlock, newcfg.IstanbulBlock) return newCompatError("Istanbul fork block", c.IstanbulBlock, newcfg.IstanbulBlock)
} }
if isForkIncompatible(c.EIP2384Block, newcfg.EIP2384Block, head) { if isForkIncompatible(c.MuirGlacierBlock, newcfg.MuirGlacierBlock, head) {
return newCompatError("EIP-2348 fork block", c.EIP2384Block, newcfg.EIP2384Block) return newCompatError("EIP-2348 fork block", c.MuirGlacierBlock, newcfg.MuirGlacierBlock)
} }
if isForkIncompatible(c.EWASMBlock, newcfg.EWASMBlock, head) { if isForkIncompatible(c.EWASMBlock, newcfg.EWASMBlock, head) {
return newCompatError("ewasm fork block", c.EWASMBlock, newcfg.EWASMBlock) return newCompatError("ewasm fork block", c.EWASMBlock, newcfg.EWASMBlock)