init.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. // Copyright 2015 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 tests
  17. import (
  18. "fmt"
  19. "math/big"
  20. "github.com/ethereum/go-ethereum/params"
  21. )
  22. // Forks table defines supported forks and their chain config.
  23. var Forks = map[string]*params.ChainConfig{
  24. "Frontier": {
  25. ChainID: big.NewInt(1),
  26. },
  27. "Homestead": {
  28. ChainID: big.NewInt(1),
  29. HomesteadBlock: big.NewInt(0),
  30. },
  31. "EIP150": {
  32. ChainID: big.NewInt(1),
  33. HomesteadBlock: big.NewInt(0),
  34. EIP150Block: big.NewInt(0),
  35. },
  36. "EIP158": {
  37. ChainID: big.NewInt(1),
  38. HomesteadBlock: big.NewInt(0),
  39. EIP150Block: big.NewInt(0),
  40. EIP155Block: big.NewInt(0),
  41. EIP158Block: big.NewInt(0),
  42. },
  43. "Byzantium": {
  44. ChainID: big.NewInt(1),
  45. HomesteadBlock: big.NewInt(0),
  46. EIP150Block: big.NewInt(0),
  47. EIP155Block: big.NewInt(0),
  48. EIP158Block: big.NewInt(0),
  49. DAOForkBlock: big.NewInt(0),
  50. ByzantiumBlock: big.NewInt(0),
  51. },
  52. "Constantinople": {
  53. ChainID: big.NewInt(1),
  54. HomesteadBlock: big.NewInt(0),
  55. EIP150Block: big.NewInt(0),
  56. EIP155Block: big.NewInt(0),
  57. EIP158Block: big.NewInt(0),
  58. DAOForkBlock: big.NewInt(0),
  59. ByzantiumBlock: big.NewInt(0),
  60. ConstantinopleBlock: big.NewInt(0),
  61. PetersburgBlock: big.NewInt(10000000),
  62. },
  63. "ConstantinopleFix": {
  64. ChainID: big.NewInt(1),
  65. HomesteadBlock: big.NewInt(0),
  66. EIP150Block: big.NewInt(0),
  67. EIP155Block: big.NewInt(0),
  68. EIP158Block: big.NewInt(0),
  69. DAOForkBlock: big.NewInt(0),
  70. ByzantiumBlock: big.NewInt(0),
  71. ConstantinopleBlock: big.NewInt(0),
  72. PetersburgBlock: big.NewInt(0),
  73. },
  74. "Istanbul": {
  75. ChainID: big.NewInt(1),
  76. HomesteadBlock: big.NewInt(0),
  77. EIP150Block: big.NewInt(0),
  78. EIP155Block: big.NewInt(0),
  79. EIP158Block: big.NewInt(0),
  80. DAOForkBlock: big.NewInt(0),
  81. ByzantiumBlock: big.NewInt(0),
  82. ConstantinopleBlock: big.NewInt(0),
  83. PetersburgBlock: big.NewInt(0),
  84. IstanbulBlock: big.NewInt(0),
  85. },
  86. "FrontierToHomesteadAt5": {
  87. ChainID: big.NewInt(1),
  88. HomesteadBlock: big.NewInt(5),
  89. },
  90. "HomesteadToEIP150At5": {
  91. ChainID: big.NewInt(1),
  92. HomesteadBlock: big.NewInt(0),
  93. EIP150Block: big.NewInt(5),
  94. },
  95. "HomesteadToDaoAt5": {
  96. ChainID: big.NewInt(1),
  97. HomesteadBlock: big.NewInt(0),
  98. DAOForkBlock: big.NewInt(5),
  99. DAOForkSupport: true,
  100. },
  101. "EIP158ToByzantiumAt5": {
  102. ChainID: big.NewInt(1),
  103. HomesteadBlock: big.NewInt(0),
  104. EIP150Block: big.NewInt(0),
  105. EIP155Block: big.NewInt(0),
  106. EIP158Block: big.NewInt(0),
  107. ByzantiumBlock: big.NewInt(5),
  108. },
  109. "ByzantiumToConstantinopleAt5": {
  110. ChainID: big.NewInt(1),
  111. HomesteadBlock: big.NewInt(0),
  112. EIP150Block: big.NewInt(0),
  113. EIP155Block: big.NewInt(0),
  114. EIP158Block: big.NewInt(0),
  115. ByzantiumBlock: big.NewInt(0),
  116. ConstantinopleBlock: big.NewInt(5),
  117. },
  118. "ByzantiumToConstantinopleFixAt5": {
  119. ChainID: big.NewInt(1),
  120. HomesteadBlock: big.NewInt(0),
  121. EIP150Block: big.NewInt(0),
  122. EIP155Block: big.NewInt(0),
  123. EIP158Block: big.NewInt(0),
  124. ByzantiumBlock: big.NewInt(0),
  125. ConstantinopleBlock: big.NewInt(5),
  126. PetersburgBlock: big.NewInt(5),
  127. },
  128. "ConstantinopleFixToIstanbulAt5": {
  129. ChainID: big.NewInt(1),
  130. HomesteadBlock: big.NewInt(0),
  131. EIP150Block: big.NewInt(0),
  132. EIP155Block: big.NewInt(0),
  133. EIP158Block: big.NewInt(0),
  134. ByzantiumBlock: big.NewInt(0),
  135. ConstantinopleBlock: big.NewInt(0),
  136. PetersburgBlock: big.NewInt(0),
  137. IstanbulBlock: big.NewInt(5),
  138. },
  139. }
  140. // UnsupportedForkError is returned when a test requests a fork that isn't implemented.
  141. type UnsupportedForkError struct {
  142. Name string
  143. }
  144. func (e UnsupportedForkError) Error() string {
  145. return fmt.Sprintf("unsupported fork %q", e.Name)
  146. }