aboutsummaryrefslogtreecommitdiff
path: root/params
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-09-15 23:55:34 -0400
committerDeterminant <[email protected]>2020-09-15 23:55:34 -0400
commit78745551c077bf54151202138c2629f288769561 (patch)
tree2b628e99fd110617089778fa91235ecd2888f4ef /params
parent7d1388c743b4ec8f4a86bea95bfada785dee83f7 (diff)
WIP: geth-tavum
Diffstat (limited to 'params')
-rw-r--r--params/config.go164
-rw-r--r--params/dao.go2
-rw-r--r--params/network_params.go12
-rw-r--r--params/version.go2
4 files changed, 139 insertions, 41 deletions
diff --git a/params/config.go b/params/config.go
index 23286cc..e5ec64b 100644
--- a/params/config.go
+++ b/params/config.go
@@ -21,23 +21,24 @@ import (
"fmt"
"math/big"
- "github.com/ava-labs/go-ethereum/common"
- "github.com/ava-labs/go-ethereum/crypto"
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/crypto"
)
// Genesis hashes to enforce below configs on.
var (
MainnetGenesisHash = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3")
- TestnetGenesisHash = common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d")
+ RopstenGenesisHash = common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d")
RinkebyGenesisHash = common.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177")
GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
+ YoloV1GenesisHash = common.HexToHash("0xc3fd235071f24f93865b0850bd2a2119b30f7224d18a0e34c7bbf549ad7e3d36")
)
// TrustedCheckpoints associates each known checkpoint with the genesis hash of
// the chain it belongs to.
var TrustedCheckpoints = map[common.Hash]*TrustedCheckpoint{
MainnetGenesisHash: MainnetTrustedCheckpoint,
- TestnetGenesisHash: TestnetTrustedCheckpoint,
+ RopstenGenesisHash: RopstenTrustedCheckpoint,
RinkebyGenesisHash: RinkebyTrustedCheckpoint,
GoerliGenesisHash: GoerliTrustedCheckpoint,
}
@@ -46,7 +47,7 @@ var TrustedCheckpoints = map[common.Hash]*TrustedCheckpoint{
// the chain it belongs to.
var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{
MainnetGenesisHash: MainnetCheckpointOracle,
- TestnetGenesisHash: TestnetCheckpointOracle,
+ RopstenGenesisHash: RopstenCheckpointOracle,
RinkebyGenesisHash: RinkebyCheckpointOracle,
GoerliGenesisHash: GoerliCheckpointOracle,
}
@@ -65,16 +66,17 @@ var (
ByzantiumBlock: big.NewInt(4370000),
ConstantinopleBlock: big.NewInt(7280000),
PetersburgBlock: big.NewInt(7280000),
- IstanbulBlock: nil,
+ IstanbulBlock: big.NewInt(9069000),
+ MuirGlacierBlock: big.NewInt(9200000),
Ethash: new(EthashConfig),
}
// MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network.
MainnetTrustedCheckpoint = &TrustedCheckpoint{
- SectionIndex: 253,
- SectionHead: common.HexToHash("0xf35fabd036e2030196183bb70ae194f6ce1ea7b58559e3825c168f1df9c0a258"),
- CHTRoot: common.HexToHash("0x8992849e2be3390696eaf66312626e484045501cd3ec207922c27a6a80a7bb07"),
- BloomRoot: common.HexToHash("0xcc510b51ca4d73fb3fdf43208d73286f8f23817cdc31b8ea9f4de8d645f07df4"),
+ SectionIndex: 329,
+ SectionHead: common.HexToHash("0x96bb6d286ded20a18480dd98d537ab503bd81110c6b9c3f8ad1f9338f3b9852d"),
+ CHTRoot: common.HexToHash("0x10627ff648077adeaab9dbd4e5bbed8671c86005b2aef5f5d4857acca19a49d8"),
+ BloomRoot: common.HexToHash("0xf499b0cfaf426a490b7b5ddca58d3031b008f0c15338f8f25c20f3df050bf785"),
}
// MainnetCheckpointOracle contains a set of configs for the main network oracle.
@@ -90,8 +92,8 @@ var (
Threshold: 2,
}
- // TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network.
- TestnetChainConfig = &ChainConfig{
+ // RopstenChainConfig contains the chain parameters to run a node on the Ropsten test network.
+ RopstenChainConfig = &ChainConfig{
ChainID: big.NewInt(3),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
@@ -103,20 +105,21 @@ var (
ByzantiumBlock: big.NewInt(1700000),
ConstantinopleBlock: big.NewInt(4230000),
PetersburgBlock: big.NewInt(4939394),
- IstanbulBlock: nil,
+ IstanbulBlock: big.NewInt(6485846),
+ MuirGlacierBlock: big.NewInt(7117117),
Ethash: new(EthashConfig),
}
- // TestnetTrustedCheckpoint contains the light client trusted checkpoint for the Ropsten test network.
- TestnetTrustedCheckpoint = &TrustedCheckpoint{
- SectionIndex: 187,
- SectionHead: common.HexToHash("0x7d6db64d8ec43303e4392fb726d2346f7231b246decca3d8140dd7e2c0d0b07d"),
- CHTRoot: common.HexToHash("0xa5095e1a004a8642fb93ca682eb91e8f20ef5bce151e47404fbb68772d17705b"),
- BloomRoot: common.HexToHash("0x90b28050f948ec6fb35b23a91d9aed38ce0c92d3cdd6e1d383c1bddf8b4071cf"),
+ // RopstenTrustedCheckpoint contains the light client trusted checkpoint for the Ropsten test network.
+ RopstenTrustedCheckpoint = &TrustedCheckpoint{
+ SectionIndex: 262,
+ SectionHead: common.HexToHash("0x12b068f285789b966a983b632266484f1bc93803df6c78773538a5777f57a236"),
+ CHTRoot: common.HexToHash("0x14000a1407e866f174f3a20fe9f271acd704bcf929b5205d83b70a1bba8c82c2"),
+ BloomRoot: common.HexToHash("0x2f4f4a34a55e35d0691c79a79e39b6f661259345080fb880da5195c11c2413be"),
}
- // TestnetCheckpointOracle contains a set of configs for the Ropsten test network oracle.
- TestnetCheckpointOracle = &CheckpointOracleConfig{
+ // RopstenCheckpointOracle contains a set of configs for the Ropsten test network oracle.
+ RopstenCheckpointOracle = &CheckpointOracleConfig{
Address: common.HexToAddress("0xEF79475013f154E6A65b54cB2742867791bf0B84"),
Signers: []common.Address{
common.HexToAddress("0x32162F3581E88a5f62e8A61892B42C46E2c18f7b"), // Peter
@@ -141,7 +144,8 @@ var (
ByzantiumBlock: big.NewInt(1035301),
ConstantinopleBlock: big.NewInt(3660663),
PetersburgBlock: big.NewInt(4321234),
- IstanbulBlock: nil,
+ IstanbulBlock: big.NewInt(5435345),
+ MuirGlacierBlock: nil,
Clique: &CliqueConfig{
Period: 15,
Epoch: 30000,
@@ -150,10 +154,10 @@ var (
// RinkebyTrustedCheckpoint contains the light client trusted checkpoint for the Rinkeby test network.
RinkebyTrustedCheckpoint = &TrustedCheckpoint{
- SectionIndex: 148,
- SectionHead: common.HexToHash("0x45918f4686732c2a3e80827e1bc39cdb6a27fa362ddfe1fdfb61c69a7f1df1a9"),
- CHTRoot: common.HexToHash("0x8ac7046391fec14834a2a0183513937c0b5f696666545991477d24b067008961"),
- BloomRoot: common.HexToHash("0xfe4b852517612d7da54bf7e9fc18861a83171a93c72583bb6a61893b74422168"),
+ SectionIndex: 217,
+ SectionHead: common.HexToHash("0x9afa4900a60cb44b102eb2eb5e5ef1d7f4cc1911c1c0588518995fb778ffe894"),
+ CHTRoot: common.HexToHash("0xcc963e5085622c7cb6b3bf747fbfdfe71887e0d5bc9e4b3fb0474d44fc97942a"),
+ BloomRoot: common.HexToHash("0x1064ca3a36b6f129783cff51bb18fb038bade47d2b776d1cccb9c74925106703"),
}
// RinkebyCheckpointOracle contains a set of configs for the Rinkeby test network oracle.
@@ -180,7 +184,8 @@ var (
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
- IstanbulBlock: nil,
+ IstanbulBlock: big.NewInt(1561651),
+ MuirGlacierBlock: nil,
Clique: &CliqueConfig{
Period: 15,
Epoch: 30000,
@@ -189,10 +194,10 @@ var (
// GoerliTrustedCheckpoint contains the light client trusted checkpoint for the Görli test network.
GoerliTrustedCheckpoint = &TrustedCheckpoint{
- SectionIndex: 32,
- SectionHead: common.HexToHash("0x50eaedd8361fa9edd0ac2dec410310b9bdf67b963b60f3b1dce47f84b30670f9"),
- CHTRoot: common.HexToHash("0x6504db73139f75ffa9102ae980e41b361cf3d5b66cea06c79cde9f457368820c"),
- BloomRoot: common.HexToHash("0x7551ae027bb776252a20ded51ee2ff0cbfbd1d8d57261b9161cc1f2f80237001"),
+ SectionIndex: 101,
+ SectionHead: common.HexToHash("0x396f5dd8e526edfb550873bcfe0e93dc00d70be4b881ab256980833b97a18c3e"),
+ CHTRoot: common.HexToHash("0x0d145657a6595508ef878c9bbf8eca045631986f664bfab0d898fc64804a4e64"),
+ BloomRoot: common.HexToHash("0x12df34d07cf1268abe22d40ee6deb199b8918e3d57d52f9e70f9b2883f57d74f"),
}
// GoerliCheckpointOracle contains a set of configs for the Goerli test network oracle.
@@ -208,21 +213,42 @@ var (
Threshold: 2,
}
+ // YoloV1ChainConfig contains the chain parameters to run a node on the YOLOv1 test network.
+ YoloV1ChainConfig = &ChainConfig{
+ ChainID: big.NewInt(133519467574833),
+ HomesteadBlock: big.NewInt(0),
+ DAOForkBlock: nil,
+ DAOForkSupport: true,
+ EIP150Block: big.NewInt(0),
+ EIP155Block: big.NewInt(0),
+ EIP158Block: big.NewInt(0),
+ ByzantiumBlock: big.NewInt(0),
+ ConstantinopleBlock: big.NewInt(0),
+ PetersburgBlock: big.NewInt(0),
+ IstanbulBlock: big.NewInt(0),
+ MuirGlacierBlock: nil,
+ YoloV1Block: big.NewInt(0),
+ Clique: &CliqueConfig{
+ Period: 15,
+ Epoch: 30000,
+ },
+ }
+
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Ethash consensus.
//
// This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields.
- AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil}
+ AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, new(EthashConfig), nil}
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Clique consensus.
//
// This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields.
- AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}}
+ AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}}
- TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil}
+ TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, new(EthashConfig), nil}
TestRules = TestChainConfig.Rules(new(big.Int))
)
@@ -292,7 +318,10 @@ type ChainConfig struct {
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)
IstanbulBlock *big.Int `json:"istanbulBlock,omitempty"` // Istanbul switch block (nil = no fork, 0 = already on istanbul)
- EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM 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)
+
+ YoloV1Block *big.Int `json:"yoloV1Block,omitempty"` // YOLO v1: https://github.com/ethereum/EIPs/pull/2657 (Ephemeral testnet)
+ EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM switch block (nil = no fork, 0 = already activated)
// Various consensus engines
Ethash *EthashConfig `json:"ethash,omitempty"`
@@ -329,7 +358,7 @@ func (c *ChainConfig) String() string {
default:
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 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, YOLO v1: %v, Engine: %v}",
c.ChainID,
c.HomesteadBlock,
c.DAOForkBlock,
@@ -341,6 +370,8 @@ func (c *ChainConfig) String() string {
c.ConstantinopleBlock,
c.PetersburgBlock,
c.IstanbulBlock,
+ c.MuirGlacierBlock,
+ c.YoloV1Block,
engine,
)
}
@@ -380,6 +411,11 @@ func (c *ChainConfig) IsConstantinople(num *big.Int) bool {
return isForked(c.ConstantinopleBlock, num)
}
+// 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 {
+ return isForked(c.MuirGlacierBlock, num)
+}
+
// IsPetersburg returns whether num is either
// - equal to or greater than the PetersburgBlock fork block,
// - OR is nil, and Constantinople is active
@@ -392,6 +428,11 @@ func (c *ChainConfig) IsIstanbul(num *big.Int) bool {
return isForked(c.IstanbulBlock, num)
}
+// IsYoloV1 returns whether num is either equal to the YoloV1 fork block or greater.
+func (c *ChainConfig) IsYoloV1(num *big.Int) bool {
+ return isForked(c.YoloV1Block, num)
+}
+
// IsEWASM returns whether num represents a block number after the EWASM fork
func (c *ChainConfig) IsEWASM(num *big.Int) bool {
return isForked(c.EWASMBlock, num)
@@ -415,6 +456,49 @@ func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *Confi
return lasterr
}
+// CheckConfigForkOrder checks that we don't "skip" any forks, geth isn't pluggable enough
+// to guarantee that forks can be implemented in a different order than on official networks
+func (c *ChainConfig) CheckConfigForkOrder() error {
+ type fork struct {
+ name string
+ block *big.Int
+ optional bool // if true, the fork may be nil and next fork is still allowed
+ }
+ var lastFork fork
+ for _, cur := range []fork{
+ {name: "homesteadBlock", block: c.HomesteadBlock},
+ {name: "daoForkBlock", block: c.DAOForkBlock, optional: true},
+ {name: "eip150Block", block: c.EIP150Block},
+ {name: "eip155Block", block: c.EIP155Block},
+ {name: "eip158Block", block: c.EIP158Block},
+ {name: "byzantiumBlock", block: c.ByzantiumBlock},
+ {name: "constantinopleBlock", block: c.ConstantinopleBlock},
+ {name: "petersburgBlock", block: c.PetersburgBlock},
+ {name: "istanbulBlock", block: c.IstanbulBlock},
+ {name: "muirGlacierBlock", block: c.MuirGlacierBlock, optional: true},
+ {name: "yoloV1Block", block: c.YoloV1Block},
+ } {
+ if lastFork.name != "" {
+ // Next one must be higher number
+ if lastFork.block == nil && cur.block != nil {
+ return fmt.Errorf("unsupported fork ordering: %v not enabled, but %v enabled at %v",
+ lastFork.name, cur.name, cur.block)
+ }
+ if lastFork.block != nil && cur.block != nil {
+ if lastFork.block.Cmp(cur.block) > 0 {
+ return fmt.Errorf("unsupported fork ordering: %v enabled at %v, but %v enabled at %v",
+ lastFork.name, lastFork.block, cur.name, cur.block)
+ }
+ }
+ }
+ // If it was optional and not set, then ignore it
+ if !cur.optional || cur.block != nil {
+ lastFork = cur
+ }
+ }
+ return nil
+}
+
func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *ConfigCompatError {
if isForkIncompatible(c.HomesteadBlock, newcfg.HomesteadBlock, head) {
return newCompatError("Homestead fork block", c.HomesteadBlock, newcfg.HomesteadBlock)
@@ -449,6 +533,12 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
if isForkIncompatible(c.IstanbulBlock, newcfg.IstanbulBlock, head) {
return newCompatError("Istanbul fork block", c.IstanbulBlock, newcfg.IstanbulBlock)
}
+ if isForkIncompatible(c.MuirGlacierBlock, newcfg.MuirGlacierBlock, head) {
+ return newCompatError("Muir Glacier fork block", c.MuirGlacierBlock, newcfg.MuirGlacierBlock)
+ }
+ if isForkIncompatible(c.YoloV1Block, newcfg.YoloV1Block, head) {
+ return newCompatError("YOLOv1 fork block", c.YoloV1Block, newcfg.YoloV1Block)
+ }
if isForkIncompatible(c.EWASMBlock, newcfg.EWASMBlock, head) {
return newCompatError("ewasm fork block", c.EWASMBlock, newcfg.EWASMBlock)
}
@@ -519,6 +609,7 @@ type Rules struct {
ChainID *big.Int
IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
+ IsYoloV1 bool
}
// Rules ensures c's ChainID is not nil.
@@ -537,5 +628,6 @@ func (c *ChainConfig) Rules(num *big.Int) Rules {
IsConstantinople: c.IsConstantinople(num),
IsPetersburg: c.IsPetersburg(num),
IsIstanbul: c.IsIstanbul(num),
+ IsYoloV1: c.IsYoloV1(num),
}
}
diff --git a/params/dao.go b/params/dao.go
index 2d75845..da3c8df 100644
--- a/params/dao.go
+++ b/params/dao.go
@@ -19,7 +19,7 @@ package params
import (
"math/big"
- "github.com/ava-labs/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/common"
)
// DAOForkBlockExtra is the block header extra-data field to set for the DAO fork
diff --git a/params/network_params.go b/params/network_params.go
index bba2472..9311b5e 100644
--- a/params/network_params.go
+++ b/params/network_params.go
@@ -53,9 +53,15 @@ const (
// CheckpointProcessConfirmations is the number before a checkpoint is generated
CheckpointProcessConfirmations = 256
- // ImmutabilityThreshold is the number of blocks after which a chain segment is
+ // FullImmutabilityThreshold is the number of blocks after which a chain segment is
// considered immutable (i.e. soft finality). It is used by the downloader as a
// hard limit against deep ancestors, by the blockchain against deep reorgs, by
- // the freezer as the cutoff treshold and by clique as the snapshot trust limit.
- ImmutabilityThreshold = 90000
+ // the freezer as the cutoff threshold and by clique as the snapshot trust limit.
+ FullImmutabilityThreshold = 90000
+
+ // LightImmutabilityThreshold is the number of blocks after which a header chain
+ // segment is considered immutable for light client(i.e. soft finality). It is used by
+ // the downloader as a hard limit against deep ancestors, by the blockchain against deep
+ // reorgs, by the light pruner as the pruning validity guarantee.
+ LightImmutabilityThreshold = 30000
)
diff --git a/params/version.go b/params/version.go
index 94386f5..521efe1 100644
--- a/params/version.go
+++ b/params/version.go
@@ -23,7 +23,7 @@ import (
const (
VersionMajor = 1 // Major version component of the current release
VersionMinor = 9 // Minor version component of the current release
- VersionPatch = 3 // Patch version component of the current release
+ VersionPatch = 22 // Patch version component of the current release
VersionMeta = "unstable" // Version metadata to append to the version string
)