Skip to content

Commit

Permalink
Remove all references to DAO fork
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning100 committed Apr 26, 2023
1 parent e1ea217 commit 7d676c5
Show file tree
Hide file tree
Showing 11 changed files with 3 additions and 365 deletions.
152 changes: 0 additions & 152 deletions cmd/go-quai/dao_test.go

This file was deleted.

2 changes: 0 additions & 2 deletions cmd/go-quai/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ var customGenesisTests = []struct {
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00",
"config" : {
"daoForkBlock" : 141,
"daoForkSupport" : true
}
}`,
query: "eth.getBlock(0).nonce",
Expand Down
2 changes: 0 additions & 2 deletions consensus/misc/eip1559_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import (
func copyConfig(original *params.ChainConfig) *params.ChainConfig {
return &params.ChainConfig{
ChainID: original.ChainID,
DAOForkBlock: original.DAOForkBlock,
DAOForkSupport: original.DAOForkSupport,
EIP155Block: original.EIP155Block,
ByzantiumBlock: original.ByzantiumBlock,
ConstantinopleBlock: original.ConstantinopleBlock,
Expand Down
9 changes: 0 additions & 9 deletions core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,6 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
b := &BlockGen{i: i, chain: blocks, parent: parent, statedb: statedb, config: config, engine: engine}
b.header = makeHeader(chainreader, parent, statedb, b.engine)

// Mutate the state and block according to any hard-fork specs
if daoBlock := config.DAOForkBlock; daoBlock != nil {
limit := new(big.Int).Add(daoBlock, params.DAOForkExtraRange)
if b.header.Number().Cmp(daoBlock) >= 0 && b.header.Number().Cmp(limit) < 0 {
if config.DAOForkSupport {
b.header.SetExtra(common.CopyBytes(params.DAOForkBlockExtra))
}
}
}
// Execute any user modifications to the block
if gen != nil {
gen(i, b)
Expand Down
2 changes: 0 additions & 2 deletions core/forkid/forkid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ func TestCreation(t *testing.T) {
[]testcase{
{0, ID{Hash: checksumToBytes(0xfc64ec04), Next: 1150000}}, // Unsynced
{1149999, ID{Hash: checksumToBytes(0xfc64ec04), Next: 1150000}}, // Last Frontier block
{1920000, ID{Hash: checksumToBytes(0x91d1f948), Next: 2463000}}, // First DAO block
{2462999, ID{Hash: checksumToBytes(0x91d1f948), Next: 2463000}}, // Last DAO block
{2675000, ID{Hash: checksumToBytes(0x3edd5b10), Next: 4370000}}, // First Spurious block
{4369999, ID{Hash: checksumToBytes(0x3edd5b10), Next: 4370000}}, // Last Spurious block
{4370000, ID{Hash: checksumToBytes(0xa00bc324), Next: 7280000}}, // First Byzantium block
Expand Down
2 changes: 0 additions & 2 deletions core/vm/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ func setDefaults(cfg *Config) {
if cfg.ChainConfig == nil {
cfg.ChainConfig = &params.ChainConfig{
ChainID: big.NewInt(1),
DAOForkBlock: new(big.Int),
DAOForkSupport: false,
EIP155Block: new(big.Int),
ByzantiumBlock: new(big.Int),
ConstantinopleBlock: new(big.Int),
Expand Down
2 changes: 0 additions & 2 deletions core/vm/runtime/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ func benchmarkEVM_Create(bench *testing.B, code string) {
ChainID: big.NewInt(1),
ByzantiumBlock: new(big.Int),
ConstantinopleBlock: new(big.Int),
DAOForkBlock: new(big.Int),
DAOForkSupport: false,
EIP155Block: new(big.Int),
},
EVMConfig: vm.Config{},
Expand Down
33 changes: 3 additions & 30 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ var (
// ColosseumChainConfig is the chain parameters to run a node on the Colosseum network.
ColosseumChainConfig = &ChainConfig{
ChainID: big.NewInt(9000),
DAOForkBlock: big.NewInt(0),
DAOForkSupport: false,
EIP155Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
Expand All @@ -53,8 +51,6 @@ var (
// GardenChainConfig contains the chain parameters to run a node on the Garden test network.
GardenChainConfig = &ChainConfig{
ChainID: big.NewInt(12000),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP155Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
Expand All @@ -70,8 +66,6 @@ var (
// OrchardChainConfig contains the chain parameters to run a node on the Orchard test network.
OrchardChainConfig = &ChainConfig{
ChainID: big.NewInt(15000),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP155Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
Expand All @@ -87,8 +81,6 @@ var (
// GalenaChainConfig contains the chain parameters to run a node on the Galena test network.
GalenaChainConfig = &ChainConfig{
ChainID: big.NewInt(17000),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP155Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
Expand All @@ -104,8 +96,6 @@ var (
// LocalChainConfig contains the chain parameters to run a node on the Local test network.
LocalChainConfig = &ChainConfig{
ChainID: big.NewInt(1337),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP155Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
Expand All @@ -123,9 +113,9 @@ var (
//
// This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields.
AllBlake3powProtocolChanges = &ChainConfig{big.NewInt(1337), nil, false, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), new(Blake3powConfig), common.Hash{}}
AllBlake3powProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), new(Blake3powConfig), common.Hash{}}

TestChainConfig = &ChainConfig{big.NewInt(1), nil, false, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), new(Blake3powConfig), common.Hash{}}
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), new(Blake3powConfig), common.Hash{}}
TestRules = TestChainConfig.Rules(new(big.Int))
)

Expand All @@ -137,9 +127,6 @@ var (
type ChainConfig struct {
ChainID *big.Int `json:"chainId"` // chainId identifies the current chain and is used for replay protection

DAOForkBlock *big.Int `json:"daoForkBlock,omitempty"` // TheDAO hard-fork switch block (nil = no fork)
DAOForkSupport bool `json:"daoForkSupport,omitempty"` // Whether the nodes supports or opposes the DAO hard-fork

EIP155Block *big.Int `json:"eip155Block,omitempty"` // EIP155 HF block

ByzantiumBlock *big.Int `json:"byzantiumBlock,omitempty"` // Byzantium switch block (nil = no fork, 0 = already on byzantium)
Expand Down Expand Up @@ -172,10 +159,8 @@ func (c *ChainConfig) String() string {
default:
engine = "unknown"
}
return fmt.Sprintf("{ChainID: %v DAO: %v DAOSupport: %v EIP155: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, London: %v, Engine: %v}",
return fmt.Sprintf("{ChainID: %v EIP155: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, London: %v, Engine: %v}",
c.ChainID,
c.DAOForkBlock,
c.DAOForkSupport,
c.EIP155Block,
c.ByzantiumBlock,
c.ConstantinopleBlock,
Expand All @@ -188,11 +173,6 @@ func (c *ChainConfig) String() string {
)
}

// IsDAOFork returns whether num is either equal to the DAO fork block or greater.
func (c *ChainConfig) IsDAOFork(num *big.Int) bool {
return isForked(c.DAOForkBlock, num)
}

// IsEIP155 returns whether num is either equal to the EIP155 fork block or greater.
func (c *ChainConfig) IsEIP155(num *big.Int) bool {
return isForked(c.EIP155Block, num)
Expand Down Expand Up @@ -263,7 +243,6 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
}
var lastFork fork
for _, cur := range []fork{
{name: "daoForkBlock", block: c.DAOForkBlock, optional: true},
{name: "eip155Block", block: c.EIP155Block},
{name: "byzantiumBlock", block: c.ByzantiumBlock},
{name: "constantinopleBlock", block: c.ConstantinopleBlock},
Expand Down Expand Up @@ -295,12 +274,6 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
}

func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *ConfigCompatError {
if isForkIncompatible(c.DAOForkBlock, newcfg.DAOForkBlock, head) {
return newCompatError("DAO fork block", c.DAOForkBlock, newcfg.DAOForkBlock)
}
if c.IsDAOFork(head) && c.DAOForkSupport != newcfg.DAOForkSupport {
return newCompatError("DAO fork support flag", c.DAOForkBlock, newcfg.DAOForkBlock)
}
if isForkIncompatible(c.EIP155Block, newcfg.EIP155Block, head) {
return newCompatError("EIP155 fork block", c.EIP155Block, newcfg.EIP155Block)
}
Expand Down
Loading

0 comments on commit 7d676c5

Please sign in to comment.