From 5bbd7fb390a539a7183bccc5f2b75b4e564ed398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 14 Sep 2017 10:07:31 +0300 Subject: consensus, core, params: rebrand Metro to Byzantium --- core/vm/contracts.go | 6 +++--- core/vm/contracts_test.go | 4 ++-- core/vm/evm.go | 8 ++++---- core/vm/gas_table.go | 2 +- core/vm/interpreter.go | 6 +++--- core/vm/jump_table.go | 12 ++++++------ 6 files changed, 19 insertions(+), 19 deletions(-) (limited to 'core/vm') diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 790d42bbe..7344b6043 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -46,9 +46,9 @@ var PrecompiledContractsHomestead = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{4}): &dataCopy{}, } -// PrecompiledContractsMetropolis contains the default set of pre-compiled Ethereum -// contracts used in the Metropolis release. -var PrecompiledContractsMetropolis = map[common.Address]PrecompiledContract{ +// PrecompiledContractsByzantium contains the default set of pre-compiled Ethereum +// contracts used in the Byzantium release. +var PrecompiledContractsByzantium = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{1}): &ecrecover{}, common.BytesToAddress([]byte{2}): &sha256hash{}, common.BytesToAddress([]byte{3}): &ripemd160hash{}, diff --git a/core/vm/contracts_test.go b/core/vm/contracts_test.go index 880d7324a..513651835 100644 --- a/core/vm/contracts_test.go +++ b/core/vm/contracts_test.go @@ -321,7 +321,7 @@ var bn256PairingTests = []precompiledTest{ } func testPrecompiled(addr string, test precompiledTest, t *testing.T) { - p := PrecompiledContractsMetropolis[common.HexToAddress(addr)] + p := PrecompiledContractsByzantium[common.HexToAddress(addr)] in := common.Hex2Bytes(test.input) contract := NewContract(AccountRef(common.HexToAddress("1337")), nil, new(big.Int), p.RequiredGas(in)) @@ -338,7 +338,7 @@ func benchmarkPrecompiled(addr string, test precompiledTest, bench *testing.B) { if test.noBenchmark { return } - p := PrecompiledContractsMetropolis[common.HexToAddress(addr)] + p := PrecompiledContractsByzantium[common.HexToAddress(addr)] in := common.Hex2Bytes(test.input) reqGas := p.RequiredGas(in) contract := NewContract(AccountRef(common.HexToAddress("1337")), diff --git a/core/vm/evm.go b/core/vm/evm.go index 495d9beea..b0a6f3d26 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -41,8 +41,8 @@ type ( func run(evm *EVM, snapshot int, contract *Contract, input []byte) ([]byte, error) { if contract.CodeAddr != nil { precompiles := PrecompiledContractsHomestead - if evm.ChainConfig().IsMetropolis(evm.BlockNumber) { - precompiles = PrecompiledContractsMetropolis + if evm.ChainConfig().IsByzantium(evm.BlockNumber) { + precompiles = PrecompiledContractsByzantium } if p := precompiles[*contract.CodeAddr]; p != nil { return RunPrecompiledContract(p, input, contract) @@ -151,8 +151,8 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas ) if !evm.StateDB.Exist(addr) { precompiles := PrecompiledContractsHomestead - if evm.ChainConfig().IsMetropolis(evm.BlockNumber) { - precompiles = PrecompiledContractsMetropolis + if evm.ChainConfig().IsByzantium(evm.BlockNumber) { + precompiles = PrecompiledContractsByzantium } if precompiles[addr] == nil && evm.ChainConfig().IsEIP158(evm.BlockNumber) && value.Sign() == 0 { return nil, gas, nil diff --git a/core/vm/gas_table.go b/core/vm/gas_table.go index 13712295c..0d8e295a5 100644 --- a/core/vm/gas_table.go +++ b/core/vm/gas_table.go @@ -324,7 +324,7 @@ func gasCall(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, mem eip158 = evm.ChainConfig().IsEIP158(evm.BlockNumber) ) if eip158 { - if transfersValue && evm.StateDB.Empty(address) { + if transfersValue && evm.StateDB.Empty(address) { gas += params.CallNewAccountGas } } else if !evm.StateDB.Exist(address) { diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index d3e24a7a4..b0d796a44 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -70,8 +70,8 @@ func NewInterpreter(evm *EVM, cfg Config) *Interpreter { // we'll set the default jump table. if !cfg.JumpTable[STOP].valid { switch { - case evm.ChainConfig().IsMetropolis(evm.BlockNumber): - cfg.JumpTable = metropolisInstructionSet + case evm.ChainConfig().IsByzantium(evm.BlockNumber): + cfg.JumpTable = byzantiumInstructionSet case evm.ChainConfig().IsHomestead(evm.BlockNumber): cfg.JumpTable = homesteadInstructionSet default: @@ -88,7 +88,7 @@ func NewInterpreter(evm *EVM, cfg Config) *Interpreter { } func (in *Interpreter) enforceRestrictions(op OpCode, operation operation, stack *Stack) error { - if in.evm.chainRules.IsMetropolis { + if in.evm.chainRules.IsByzantium { if in.readOnly { // If the interpreter is operating in readonly mode, make sure no // state-modifying operation is performed. The 3rd stack item diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index f0a922912..9ef192fdf 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -51,14 +51,14 @@ type operation struct { } var ( - frontierInstructionSet = NewFrontierInstructionSet() - homesteadInstructionSet = NewHomesteadInstructionSet() - metropolisInstructionSet = NewMetropolisInstructionSet() + frontierInstructionSet = NewFrontierInstructionSet() + homesteadInstructionSet = NewHomesteadInstructionSet() + byzantiumInstructionSet = NewByzantiumInstructionSet() ) -// NewMetropolisInstructionSet returns the frontier, homestead and -// metropolis instructions. -func NewMetropolisInstructionSet() [256]operation { +// NewByzantiumInstructionSet returns the frontier, homestead and +// byzantium instructions. +func NewByzantiumInstructionSet() [256]operation { // instructions that can be executed during the homestead phase. instructionSet := NewHomesteadInstructionSet() instructionSet[STATICCALL] = operation{ -- cgit v1.2.3