gas_table.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. // GasTable organizes gas prices for different ethereum phases.
  18. type GasTable struct {
  19. ExtcodeSize uint64
  20. ExtcodeCopy uint64
  21. ExtcodeHash uint64
  22. Balance uint64
  23. SLoad uint64
  24. Calls uint64
  25. Suicide uint64
  26. ExpByte uint64
  27. // CreateBySuicide occurs when the
  28. // refunded account is one that does
  29. // not exist. This logic is similar
  30. // to call. May be left nil. Nil means
  31. // not charged.
  32. CreateBySuicide uint64
  33. }
  34. // Variables containing gas prices for different ethereum phases.
  35. var (
  36. // GasTableHomestead contain the gas prices for
  37. // the homestead phase.
  38. GasTableHomestead = GasTable{
  39. ExtcodeSize: 20,
  40. ExtcodeCopy: 20,
  41. Balance: 20,
  42. SLoad: 50,
  43. Calls: 40,
  44. Suicide: 0,
  45. ExpByte: 10,
  46. }
  47. // GasTableEIP150 contain the gas re-prices for
  48. // the EIP150 phase.
  49. GasTableEIP150 = GasTable{
  50. ExtcodeSize: 700,
  51. ExtcodeCopy: 700,
  52. Balance: 400,
  53. SLoad: 200,
  54. Calls: 700,
  55. Suicide: 5000,
  56. ExpByte: 10,
  57. CreateBySuicide: 25000,
  58. }
  59. // GasTableEIP158 contain the gas re-prices for
  60. // the EIP155/EIP158 phase.
  61. GasTableEIP158 = GasTable{
  62. ExtcodeSize: 700,
  63. ExtcodeCopy: 700,
  64. Balance: 400,
  65. SLoad: 200,
  66. Calls: 700,
  67. Suicide: 5000,
  68. ExpByte: 50,
  69. CreateBySuicide: 25000,
  70. }
  71. // GasTableConstantinople contain the gas re-prices for
  72. // the constantinople phase.
  73. GasTableConstantinople = GasTable{
  74. ExtcodeSize: 700,
  75. ExtcodeCopy: 700,
  76. ExtcodeHash: 400,
  77. Balance: 400,
  78. SLoad: 200,
  79. Calls: 700,
  80. Suicide: 5000,
  81. ExpByte: 50,
  82. CreateBySuicide: 25000,
  83. }
  84. )