gas_table.go 2.4 KB

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