github.com/dim4egster/coreth@v0.10.2/tests/init.go (about) 1 // (c) 2019-2020, Ava Labs, Inc. 2 // 3 // This file is a derived work, based on the go-ethereum library whose original 4 // notices appear below. 5 // 6 // It is distributed under a license compatible with the licensing terms of the 7 // original code from which it is derived. 8 // 9 // Much love to the original authors for their work. 10 // ********** 11 // Copyright 2015 The go-ethereum Authors 12 // This file is part of the go-ethereum library. 13 // 14 // The go-ethereum library is free software: you can redistribute it and/or modify 15 // it under the terms of the GNU Lesser General Public License as published by 16 // the Free Software Foundation, either version 3 of the License, or 17 // (at your option) any later version. 18 // 19 // The go-ethereum library is distributed in the hope that it will be useful, 20 // but WITHOUT ANY WARRANTY; without even the implied warranty of 21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 // GNU Lesser General Public License for more details. 23 // 24 // You should have received a copy of the GNU Lesser General Public License 25 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. 26 27 package tests 28 29 import ( 30 "fmt" 31 "math/big" 32 "sort" 33 34 "github.com/dim4egster/coreth/params" 35 ) 36 37 // Forks table defines supported forks and their chain config. 38 var Forks = map[string]*params.ChainConfig{ 39 "Frontier": { 40 ChainID: big.NewInt(1), 41 }, 42 "Homestead": { 43 ChainID: big.NewInt(1), 44 HomesteadBlock: big.NewInt(0), 45 }, 46 "EIP150": { 47 ChainID: big.NewInt(1), 48 HomesteadBlock: big.NewInt(0), 49 EIP150Block: big.NewInt(0), 50 }, 51 "EIP158": { 52 ChainID: big.NewInt(1), 53 HomesteadBlock: big.NewInt(0), 54 EIP150Block: big.NewInt(0), 55 EIP155Block: big.NewInt(0), 56 EIP158Block: big.NewInt(0), 57 }, 58 "Byzantium": { 59 ChainID: big.NewInt(1), 60 HomesteadBlock: big.NewInt(0), 61 EIP150Block: big.NewInt(0), 62 EIP155Block: big.NewInt(0), 63 EIP158Block: big.NewInt(0), 64 DAOForkBlock: big.NewInt(0), 65 ByzantiumBlock: big.NewInt(0), 66 }, 67 "Constantinople": { 68 ChainID: big.NewInt(1), 69 HomesteadBlock: big.NewInt(0), 70 EIP150Block: big.NewInt(0), 71 EIP155Block: big.NewInt(0), 72 EIP158Block: big.NewInt(0), 73 DAOForkBlock: big.NewInt(0), 74 ByzantiumBlock: big.NewInt(0), 75 ConstantinopleBlock: big.NewInt(0), 76 PetersburgBlock: big.NewInt(10000000), 77 }, 78 "ConstantinopleFix": { 79 ChainID: big.NewInt(1), 80 HomesteadBlock: big.NewInt(0), 81 EIP150Block: big.NewInt(0), 82 EIP155Block: big.NewInt(0), 83 EIP158Block: big.NewInt(0), 84 DAOForkBlock: big.NewInt(0), 85 ByzantiumBlock: big.NewInt(0), 86 ConstantinopleBlock: big.NewInt(0), 87 PetersburgBlock: big.NewInt(0), 88 }, 89 "Istanbul": { 90 ChainID: big.NewInt(1), 91 HomesteadBlock: big.NewInt(0), 92 EIP150Block: big.NewInt(0), 93 EIP155Block: big.NewInt(0), 94 EIP158Block: big.NewInt(0), 95 DAOForkBlock: big.NewInt(0), 96 ByzantiumBlock: big.NewInt(0), 97 ConstantinopleBlock: big.NewInt(0), 98 PetersburgBlock: big.NewInt(0), 99 IstanbulBlock: big.NewInt(0), 100 }, 101 "FrontierToHomesteadAt5": { 102 ChainID: big.NewInt(1), 103 HomesteadBlock: big.NewInt(5), 104 }, 105 "HomesteadToEIP150At5": { 106 ChainID: big.NewInt(1), 107 HomesteadBlock: big.NewInt(0), 108 EIP150Block: big.NewInt(5), 109 }, 110 "HomesteadToDaoAt5": { 111 ChainID: big.NewInt(1), 112 HomesteadBlock: big.NewInt(0), 113 DAOForkBlock: big.NewInt(5), 114 DAOForkSupport: true, 115 }, 116 "EIP158ToByzantiumAt5": { 117 ChainID: big.NewInt(1), 118 HomesteadBlock: big.NewInt(0), 119 EIP150Block: big.NewInt(0), 120 EIP155Block: big.NewInt(0), 121 EIP158Block: big.NewInt(0), 122 ByzantiumBlock: big.NewInt(5), 123 }, 124 "ByzantiumToConstantinopleAt5": { 125 ChainID: big.NewInt(1), 126 HomesteadBlock: big.NewInt(0), 127 EIP150Block: big.NewInt(0), 128 EIP155Block: big.NewInt(0), 129 EIP158Block: big.NewInt(0), 130 ByzantiumBlock: big.NewInt(0), 131 ConstantinopleBlock: big.NewInt(5), 132 }, 133 "ByzantiumToConstantinopleFixAt5": { 134 ChainID: big.NewInt(1), 135 HomesteadBlock: big.NewInt(0), 136 EIP150Block: big.NewInt(0), 137 EIP155Block: big.NewInt(0), 138 EIP158Block: big.NewInt(0), 139 ByzantiumBlock: big.NewInt(0), 140 ConstantinopleBlock: big.NewInt(5), 141 PetersburgBlock: big.NewInt(5), 142 }, 143 "ConstantinopleFixToIstanbulAt5": { 144 ChainID: big.NewInt(1), 145 HomesteadBlock: big.NewInt(0), 146 EIP150Block: big.NewInt(0), 147 EIP155Block: big.NewInt(0), 148 EIP158Block: big.NewInt(0), 149 ByzantiumBlock: big.NewInt(0), 150 ConstantinopleBlock: big.NewInt(0), 151 PetersburgBlock: big.NewInt(0), 152 IstanbulBlock: big.NewInt(5), 153 }, 154 "ApricotPhase1": { 155 ChainID: big.NewInt(1), 156 HomesteadBlock: big.NewInt(0), 157 EIP150Block: big.NewInt(0), 158 EIP155Block: big.NewInt(0), 159 EIP158Block: big.NewInt(0), 160 ByzantiumBlock: big.NewInt(0), 161 ConstantinopleBlock: big.NewInt(0), 162 PetersburgBlock: big.NewInt(0), 163 IstanbulBlock: big.NewInt(0), 164 ApricotPhase1BlockTimestamp: big.NewInt(0), 165 }, 166 "ApricotPhase2": { 167 ChainID: big.NewInt(1), 168 HomesteadBlock: big.NewInt(0), 169 EIP150Block: big.NewInt(0), 170 EIP155Block: big.NewInt(0), 171 EIP158Block: big.NewInt(0), 172 ByzantiumBlock: big.NewInt(0), 173 ConstantinopleBlock: big.NewInt(0), 174 PetersburgBlock: big.NewInt(0), 175 IstanbulBlock: big.NewInt(0), 176 MuirGlacierBlock: big.NewInt(0), 177 ApricotPhase1BlockTimestamp: big.NewInt(0), 178 ApricotPhase2BlockTimestamp: big.NewInt(0), 179 }, 180 "ApricotPhase3": { 181 ChainID: big.NewInt(1), 182 HomesteadBlock: big.NewInt(0), 183 EIP150Block: big.NewInt(0), 184 EIP155Block: big.NewInt(0), 185 EIP158Block: big.NewInt(0), 186 ByzantiumBlock: big.NewInt(0), 187 ConstantinopleBlock: big.NewInt(0), 188 PetersburgBlock: big.NewInt(0), 189 IstanbulBlock: big.NewInt(0), 190 MuirGlacierBlock: big.NewInt(0), 191 ApricotPhase1BlockTimestamp: big.NewInt(0), 192 ApricotPhase2BlockTimestamp: big.NewInt(0), 193 ApricotPhase3BlockTimestamp: big.NewInt(0), 194 }, 195 "ApricotPhase4": { 196 ChainID: big.NewInt(1), 197 HomesteadBlock: big.NewInt(0), 198 EIP150Block: big.NewInt(0), 199 EIP155Block: big.NewInt(0), 200 EIP158Block: big.NewInt(0), 201 ByzantiumBlock: big.NewInt(0), 202 ConstantinopleBlock: big.NewInt(0), 203 PetersburgBlock: big.NewInt(0), 204 IstanbulBlock: big.NewInt(0), 205 MuirGlacierBlock: big.NewInt(0), 206 ApricotPhase1BlockTimestamp: big.NewInt(0), 207 ApricotPhase2BlockTimestamp: big.NewInt(0), 208 ApricotPhase3BlockTimestamp: big.NewInt(0), 209 ApricotPhase4BlockTimestamp: big.NewInt(0), 210 }, 211 "ApricotPhase5": { 212 ChainID: big.NewInt(1), 213 HomesteadBlock: big.NewInt(0), 214 EIP150Block: big.NewInt(0), 215 EIP155Block: big.NewInt(0), 216 EIP158Block: big.NewInt(0), 217 ByzantiumBlock: big.NewInt(0), 218 ConstantinopleBlock: big.NewInt(0), 219 PetersburgBlock: big.NewInt(0), 220 IstanbulBlock: big.NewInt(0), 221 ApricotPhase1BlockTimestamp: big.NewInt(0), 222 ApricotPhase2BlockTimestamp: big.NewInt(0), 223 ApricotPhase3BlockTimestamp: big.NewInt(0), 224 ApricotPhase4BlockTimestamp: big.NewInt(0), 225 ApricotPhase5BlockTimestamp: big.NewInt(0), 226 }, 227 "Banff": { 228 ChainID: big.NewInt(1), 229 HomesteadBlock: big.NewInt(0), 230 EIP150Block: big.NewInt(0), 231 EIP155Block: big.NewInt(0), 232 EIP158Block: big.NewInt(0), 233 ByzantiumBlock: big.NewInt(0), 234 ConstantinopleBlock: big.NewInt(0), 235 PetersburgBlock: big.NewInt(0), 236 IstanbulBlock: big.NewInt(0), 237 ApricotPhase1BlockTimestamp: big.NewInt(0), 238 ApricotPhase2BlockTimestamp: big.NewInt(0), 239 ApricotPhase3BlockTimestamp: big.NewInt(0), 240 ApricotPhase4BlockTimestamp: big.NewInt(0), 241 ApricotPhase5BlockTimestamp: big.NewInt(0), 242 BanffBlockTimestamp: big.NewInt(0), 243 }, 244 "Clementine": { 245 ChainID: big.NewInt(1), 246 HomesteadBlock: big.NewInt(0), 247 EIP150Block: big.NewInt(0), 248 EIP155Block: big.NewInt(0), 249 EIP158Block: big.NewInt(0), 250 ByzantiumBlock: big.NewInt(0), 251 ConstantinopleBlock: big.NewInt(0), 252 PetersburgBlock: big.NewInt(0), 253 IstanbulBlock: big.NewInt(0), 254 ApricotPhase1BlockTimestamp: big.NewInt(0), 255 ApricotPhase2BlockTimestamp: big.NewInt(0), 256 ApricotPhase3BlockTimestamp: big.NewInt(0), 257 ApricotPhase4BlockTimestamp: big.NewInt(0), 258 ApricotPhase5BlockTimestamp: big.NewInt(0), 259 BanffBlockTimestamp: big.NewInt(0), 260 ClementineBlockTimestamp: big.NewInt(0), 261 }, 262 } 263 264 // Returns the set of defined fork names 265 func AvailableForks() []string { 266 var availableForks []string 267 for k := range Forks { 268 availableForks = append(availableForks, k) 269 } 270 sort.Strings(availableForks) 271 return availableForks 272 } 273 274 // UnsupportedForkError is returned when a test requests a fork that isn't implemented. 275 type UnsupportedForkError struct { 276 Name string 277 } 278 279 func (e UnsupportedForkError) Error() string { 280 return fmt.Sprintf("unsupported fork %q", e.Name) 281 }