github.com/annchain/OG@v0.0.9/vm/eth/params/gas_table.go (about)

     1  // Copyright 2016 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package params
    18  
    19  // GasTable organizes gas prices for different ethereum phases.
    20  type GasTable struct {
    21  	ExtcodeSize uint64
    22  	ExtcodeCopy uint64
    23  	ExtcodeHash uint64
    24  	Balance     uint64
    25  	SLoad       uint64
    26  	Calls       uint64
    27  	Suicide     uint64
    28  
    29  	ExpByte uint64
    30  
    31  	// CreateBySuicide occurs when the
    32  	// refunded account is one that does
    33  	// not exist. This logic is similar
    34  	// to call. May be left nil. Nil means
    35  	// not charged.
    36  	CreateBySuicide uint64
    37  }
    38  
    39  // Variables containing gas prices for different ethereum phases.
    40  var (
    41  	// GasTableConstantinople contain the gas re-prices for
    42  	// the constantinople phase.
    43  	GasTableConstantinople = GasTable{
    44  		ExtcodeSize: 700,
    45  		ExtcodeCopy: 700,
    46  		ExtcodeHash: 400,
    47  		Balance:     400,
    48  		SLoad:       200,
    49  		Calls:       700,
    50  		Suicide:     5000,
    51  		ExpByte:     50,
    52  
    53  		CreateBySuicide: 25000,
    54  	}
    55  )
    56  
    57  var (
    58  // AllEthashProtocolChanges contains every protocol change (EIPs) introduced
    59  // and accepted by the Ethereum core developers into the Ethash consensus.
    60  //
    61  // This configuration is intentionally not using keyed fields to force anyone
    62  // adding flags to the config to also have to set these fields.
    63  //AllEthashProtocolChanges = &ChainConfig{ChainID: 0}
    64  )
    65  
    66  // GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice).
    67  //
    68  // The returned GasTable's fields shouldn't, under any circumstances, be changed.
    69  func GetGasTable(num uint64) GasTable {
    70  	return GasTableConstantinople
    71  }