gas_table.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. package params
  17. import "math/big"
  18. type GasTable struct {
  19. ExtcodeSize *big.Int
  20. ExtcodeCopy *big.Int
  21. Balance *big.Int
  22. SLoad *big.Int
  23. Calls *big.Int
  24. Suicide *big.Int
  25. ExpByte *big.Int
  26. // CreateBySuicide occurs when the
  27. // refunded account is one that does
  28. // not exist. This logic is similar
  29. // to call. May be left nil. Nil means
  30. // not charged.
  31. CreateBySuicide *big.Int
  32. }
  33. var (
  34. // GasTableHomestead contain the gas prices for
  35. // the homestead phase.
  36. GasTableHomestead = GasTable{
  37. ExtcodeSize: big.NewInt(20),
  38. ExtcodeCopy: big.NewInt(20),
  39. Balance: big.NewInt(20),
  40. SLoad: big.NewInt(50),
  41. Calls: big.NewInt(40),
  42. Suicide: big.NewInt(0),
  43. ExpByte: big.NewInt(10),
  44. // explicitly set to nil to indicate
  45. // this rule does not apply to homestead.
  46. CreateBySuicide: nil,
  47. }
  48. // GasTableHomestead contain the gas re-prices for
  49. // the homestead phase.
  50. //
  51. // TODO rename to GasTableEIP150
  52. GasTableHomesteadGasRepriceFork = GasTable{
  53. ExtcodeSize: big.NewInt(700),
  54. ExtcodeCopy: big.NewInt(700),
  55. Balance: big.NewInt(400),
  56. SLoad: big.NewInt(200),
  57. Calls: big.NewInt(700),
  58. Suicide: big.NewInt(5000),
  59. ExpByte: big.NewInt(10),
  60. CreateBySuicide: big.NewInt(25000),
  61. }
  62. GasTableEIP158 = GasTable{
  63. ExtcodeSize: big.NewInt(700),
  64. ExtcodeCopy: big.NewInt(700),
  65. Balance: big.NewInt(400),
  66. SLoad: big.NewInt(200),
  67. Calls: big.NewInt(700),
  68. Suicide: big.NewInt(5000),
  69. ExpByte: big.NewInt(50),
  70. CreateBySuicide: big.NewInt(25000),
  71. }
  72. )