mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
Fix EIP160 gas mismatch
This commit is contained in:
parent
c04407b8e1
commit
e61a43dc9d
2 changed files with 27 additions and 4 deletions
|
|
@ -60,6 +60,7 @@ var (
|
||||||
DisposalBlock: big.NewInt(0),
|
DisposalBlock: big.NewInt(0),
|
||||||
ConstantinopleBlock: nil,
|
ConstantinopleBlock: nil,
|
||||||
ECIP1017EraRounds: big.NewInt(10000000),
|
ECIP1017EraRounds: big.NewInt(10000000),
|
||||||
|
EIP160Block: big.NewInt(0),
|
||||||
Ethash: new(EthashConfig),
|
Ethash: new(EthashConfig),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,16 +104,16 @@ var (
|
||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// 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), nil, 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), nil, nil, nil, nil, new(EthashConfig), nil}
|
||||||
|
|
||||||
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
||||||
// and accepted by the Ethereum core developers into the Clique consensus.
|
// and accepted by the Ethereum core developers into the Clique consensus.
|
||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// 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), nil, 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), nil, 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), nil, 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), nil, nil, nil, nil, new(EthashConfig), nil}
|
||||||
TestRules = TestChainConfig.Rules(new(big.Int))
|
TestRules = TestChainConfig.Rules(new(big.Int))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -141,6 +142,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)
|
||||||
|
|
||||||
ECIP1017EraRounds *big.Int `json:"ecip1017EraRounds,omitempty"` // ECIP1017 era rounds
|
ECIP1017EraRounds *big.Int `json:"ecip1017EraRounds,omitempty"` // ECIP1017 era rounds
|
||||||
|
EIP160Block *big.Int `json:"eip160Block,omitempty"` // EIP160 HF block
|
||||||
|
|
||||||
// Various consensus engines
|
// Various consensus engines
|
||||||
Ethash *EthashConfig `json:"ethash,omitempty"`
|
Ethash *EthashConfig `json:"ethash,omitempty"`
|
||||||
|
|
@ -177,7 +179,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, Disposal: %v, ECIP1017: %v, Constantinople: %v, Engine: %v}",
|
return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v, Disposal: %v, ECIP1017: %v, EIP160: %v, Constantinople: %v, Engine: %v}",
|
||||||
c.ChainId,
|
c.ChainId,
|
||||||
c.HomesteadBlock,
|
c.HomesteadBlock,
|
||||||
c.DAOForkBlock,
|
c.DAOForkBlock,
|
||||||
|
|
@ -207,6 +209,11 @@ func (c *ChainConfig) IsHomestead(num *big.Int) bool {
|
||||||
return isForked(c.HomesteadBlock, num)
|
return isForked(c.HomesteadBlock, num)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsEIP160 returns whether num is either equal to the EIP160 block or greater.
|
||||||
|
func (c *ChainConfig) IsEIP160(num *big.Int) bool {
|
||||||
|
return isForked(c.EIP160Block, num)
|
||||||
|
}
|
||||||
|
|
||||||
// IsDAO returns whether num is either equal to the DAO fork block or greater.
|
// IsDAO returns whether num is either equal to the DAO fork block or greater.
|
||||||
func (c *ChainConfig) IsDAOFork(num *big.Int) bool {
|
func (c *ChainConfig) IsDAOFork(num *big.Int) bool {
|
||||||
return isForked(c.DAOForkBlock, num)
|
return isForked(c.DAOForkBlock, num)
|
||||||
|
|
@ -244,6 +251,8 @@ func (c *ChainConfig) GasTable(num *big.Int) GasTable {
|
||||||
return GasTableHomestead
|
return GasTableHomestead
|
||||||
}
|
}
|
||||||
switch {
|
switch {
|
||||||
|
case c.IsEIP160(num):
|
||||||
|
return GasTableEIP160
|
||||||
case c.IsEIP158(num):
|
case c.IsEIP158(num):
|
||||||
return GasTableEIP158
|
return GasTableEIP158
|
||||||
case c.IsEIP150(num):
|
case c.IsEIP150(num):
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,20 @@ var (
|
||||||
CreateBySuicide: 25000,
|
CreateBySuicide: 25000,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GasTableEIP160 contains the gas re-prices for
|
||||||
|
// EIP160 hard fork.
|
||||||
|
GasTableEIP160 = GasTable{
|
||||||
|
ExtcodeSize: 700,
|
||||||
|
ExtcodeCopy: 700,
|
||||||
|
Balance: 400,
|
||||||
|
SLoad: 200,
|
||||||
|
Calls: 700,
|
||||||
|
Suicide: 5000,
|
||||||
|
ExpByte: 50,
|
||||||
|
|
||||||
|
CreateBySuicide: 25000,
|
||||||
|
}
|
||||||
|
|
||||||
GasTableEIP158 = GasTable{
|
GasTableEIP158 = GasTable{
|
||||||
ExtcodeSize: 700,
|
ExtcodeSize: 700,
|
||||||
ExtcodeCopy: 700,
|
ExtcodeCopy: 700,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue