mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 14:33:52 +00:00
Merge 364c7b3246 into 80f7c6c299
This commit is contained in:
commit
311d7b21dd
4 changed files with 43 additions and 0 deletions
16
core/dao.go
16
core/dao.go
|
|
@ -73,3 +73,19 @@ func ApplyDAOHardFork(statedb *state.StateDB) {
|
||||||
statedb.SetBalance(addr, new(big.Int))
|
statedb.SetBalance(addr, new(big.Int))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ApplyQuadHardFork modifies the state database according to the Quad hard-fork
|
||||||
|
// rules, transferring all balances of a set of DAO accounts to a single refund
|
||||||
|
// contract.
|
||||||
|
func ApplyQuadHardFork(statedb *state.StateDB) {
|
||||||
|
// Retrieve the contract to refund balances into
|
||||||
|
if !statedb.Exist(params.QuadRefundContract) {
|
||||||
|
statedb.CreateAccount(params.QuadRefundContract)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move every DAO account and extra-balance account funds into the refund contract
|
||||||
|
for _, addr := range params.QuadDrainList() {
|
||||||
|
statedb.AddBalance(params.QuadRefundContract, statedb.GetBalance(addr))
|
||||||
|
statedb.SetBalance(addr, new(big.Int))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,10 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
|
||||||
if p.config.DAOForkSupport && p.config.DAOForkBlock != nil && p.config.DAOForkBlock.Cmp(block.Number()) == 0 {
|
if p.config.DAOForkSupport && p.config.DAOForkBlock != nil && p.config.DAOForkBlock.Cmp(block.Number()) == 0 {
|
||||||
misc.ApplyDAOHardFork(statedb)
|
misc.ApplyDAOHardFork(statedb)
|
||||||
}
|
}
|
||||||
|
// Mutate the the block and state according to any hard-fork specs
|
||||||
|
if p.config.QuadForkSupport && p.config.QuadForkBlock != nil && p.config.QuadForkBlock.Cmp(block.Number()) == 0 {
|
||||||
|
misc.ApplyQuadHardFork(statedb)
|
||||||
|
}
|
||||||
// Iterate over and process the individual transactions
|
// Iterate over and process the individual transactions
|
||||||
for i, tx := range block.Transactions() {
|
for i, tx := range block.Transactions() {
|
||||||
statedb.Prepare(tx.Hash(), block.Hash(), i)
|
statedb.Prepare(tx.Hash(), block.Hash(), i)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,9 @@ var (
|
||||||
ChainId: MainNetChainID,
|
ChainId: MainNetChainID,
|
||||||
HomesteadBlock: MainNetHomesteadBlock,
|
HomesteadBlock: MainNetHomesteadBlock,
|
||||||
DAOForkBlock: MainNetDAOForkBlock,
|
DAOForkBlock: MainNetDAOForkBlock,
|
||||||
|
QuadForkBlock: MainNetQuadForkBlock,
|
||||||
DAOForkSupport: true,
|
DAOForkSupport: true,
|
||||||
|
QuadForkSupport: true,
|
||||||
EIP150Block: MainNetHomesteadGasRepriceBlock,
|
EIP150Block: MainNetHomesteadGasRepriceBlock,
|
||||||
EIP150Hash: MainNetHomesteadGasRepriceHash,
|
EIP150Hash: MainNetHomesteadGasRepriceHash,
|
||||||
EIP155Block: MainNetSpuriousDragon,
|
EIP155Block: MainNetSpuriousDragon,
|
||||||
|
|
@ -44,7 +46,9 @@ var (
|
||||||
ChainId: big.NewInt(3),
|
ChainId: big.NewInt(3),
|
||||||
HomesteadBlock: big.NewInt(0),
|
HomesteadBlock: big.NewInt(0),
|
||||||
DAOForkBlock: nil,
|
DAOForkBlock: nil,
|
||||||
|
QuadForkBlock: nil,
|
||||||
DAOForkSupport: true,
|
DAOForkSupport: true,
|
||||||
|
QuadForkSupport: true,
|
||||||
EIP150Block: big.NewInt(0),
|
EIP150Block: big.NewInt(0),
|
||||||
EIP150Hash: common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"),
|
EIP150Hash: common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"),
|
||||||
EIP155Block: big.NewInt(10),
|
EIP155Block: big.NewInt(10),
|
||||||
|
|
@ -59,7 +63,9 @@ var (
|
||||||
ChainId: big.NewInt(4),
|
ChainId: big.NewInt(4),
|
||||||
HomesteadBlock: big.NewInt(1),
|
HomesteadBlock: big.NewInt(1),
|
||||||
DAOForkBlock: nil,
|
DAOForkBlock: nil,
|
||||||
|
QuadForkBlock: nil,
|
||||||
DAOForkSupport: true,
|
DAOForkSupport: true,
|
||||||
|
QuadForkSupport: true,
|
||||||
EIP150Block: big.NewInt(2),
|
EIP150Block: big.NewInt(2),
|
||||||
EIP150Hash: common.HexToHash("0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9"),
|
EIP150Hash: common.HexToHash("0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9"),
|
||||||
EIP155Block: big.NewInt(3),
|
EIP155Block: big.NewInt(3),
|
||||||
|
|
@ -95,7 +101,9 @@ type ChainConfig struct {
|
||||||
|
|
||||||
HomesteadBlock *big.Int `json:"homesteadBlock,omitempty"` // Homestead switch block (nil = no fork, 0 = already homestead)
|
HomesteadBlock *big.Int `json:"homesteadBlock,omitempty"` // Homestead switch block (nil = no fork, 0 = already homestead)
|
||||||
DAOForkBlock *big.Int `json:"daoForkBlock,omitempty"` // TheDAO hard-fork switch block (nil = no fork)
|
DAOForkBlock *big.Int `json:"daoForkBlock,omitempty"` // TheDAO hard-fork switch block (nil = no fork)
|
||||||
|
QuadForkBlock *big.Int `json:"quadForkBlock,omitempty"` // TheQuad hard-fork switch block (nil = no fork)
|
||||||
DAOForkSupport bool `json:"daoForkSupport,omitempty"` // Whether the nodes supports or opposes the DAO hard-fork
|
DAOForkSupport bool `json:"daoForkSupport,omitempty"` // Whether the nodes supports or opposes the DAO hard-fork
|
||||||
|
QuadForkSupport bool `json:"quadForkSupport,omitempty"` // Whether the nodes supports or opposes the Quad hard-fork
|
||||||
|
|
||||||
// EIP150 implements the Gas price changes (https://github.com/ethereum/EIPs/issues/150)
|
// EIP150 implements the Gas price changes (https://github.com/ethereum/EIPs/issues/150)
|
||||||
EIP150Block *big.Int `json:"eip150Block,omitempty"` // EIP150 HF block (nil = no fork)
|
EIP150Block *big.Int `json:"eip150Block,omitempty"` // EIP150 HF block (nil = no fork)
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,10 @@ var TestNetDAOForkBlock *big.Int
|
||||||
// the Ethereum main network.
|
// the Ethereum main network.
|
||||||
var MainNetDAOForkBlock = big.NewInt(1920000)
|
var MainNetDAOForkBlock = big.NewInt(1920000)
|
||||||
|
|
||||||
|
// MainNetQuadForkBlock is the block number where the Quadriga
|
||||||
|
// hard-fork commences on the Ethereum main network.
|
||||||
|
var MainNetQuadForkBlock = big.NewInt(4000000)
|
||||||
|
|
||||||
// DAOForkBlockExtra is the block header extra-data field to set for the DAO fork
|
// DAOForkBlockExtra is the block header extra-data field to set for the DAO fork
|
||||||
// point and a number of consecutive blocks to allow fast/light syncers to correctly
|
// point and a number of consecutive blocks to allow fast/light syncers to correctly
|
||||||
// pick the side they want ("dao-hard-fork").
|
// pick the side they want ("dao-hard-fork").
|
||||||
|
|
@ -43,6 +47,17 @@ var DAOForkExtraRange = big.NewInt(10)
|
||||||
// DAORefundContract is the address of the refund contract to send DAO balances to.
|
// DAORefundContract is the address of the refund contract to send DAO balances to.
|
||||||
var DAORefundContract = common.HexToAddress("0xbf4ed7b27f1d666546e30d74d50d173d20bca754")
|
var DAORefundContract = common.HexToAddress("0xbf4ed7b27f1d666546e30d74d50d173d20bca754")
|
||||||
|
|
||||||
|
// QuadRefundContract is the address of the refund contract to send Quad balances to.
|
||||||
|
var QuadRefundContract = common.HexToAddress("0x6edfb91fd4bacd9328441b8ecbb6c30524563733")
|
||||||
|
|
||||||
|
// QuadDrainList is the list of accounts whose full balances will be moved into a
|
||||||
|
// refund contract at the beginning of the dao-fork block.
|
||||||
|
var QuadDrainList() []common.Address {
|
||||||
|
return []common.Address{
|
||||||
|
common.HexToAddres("0x027BEEFcBaD782faF69FAD12DeE97Ed894c68549"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// DAODrainList is the list of accounts whose full balances will be moved into a
|
// DAODrainList is the list of accounts whose full balances will be moved into a
|
||||||
// refund contract at the beginning of the dao-fork block.
|
// refund contract at the beginning of the dao-fork block.
|
||||||
func DAODrainList() []common.Address {
|
func DAODrainList() []common.Address {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue