github.com/EgonCoin/EgonChain@v1.10.16/tests/init.go (about) 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 17 package tests 18 19 import ( 20 "fmt" 21 "math/big" 22 "sort" 23 24 "github.com/EgonCoin/EgonChain/params" 25 ) 26 27 // Forks table defines supported forks and their chain config. 28 var Forks = map[string]*params.ChainConfig{ 29 "Frontier": { 30 ChainID: big.NewInt(1), 31 }, 32 "Homestead": { 33 ChainID: big.NewInt(1), 34 HomesteadBlock: big.NewInt(0), 35 }, 36 "EIP150": { 37 ChainID: big.NewInt(1), 38 HomesteadBlock: big.NewInt(0), 39 EIP150Block: big.NewInt(0), 40 }, 41 "EIP158": { 42 ChainID: big.NewInt(1), 43 HomesteadBlock: big.NewInt(0), 44 EIP150Block: big.NewInt(0), 45 EIP155Block: big.NewInt(0), 46 EIP158Block: big.NewInt(0), 47 }, 48 "Byzantium": { 49 ChainID: big.NewInt(1), 50 HomesteadBlock: big.NewInt(0), 51 EIP150Block: big.NewInt(0), 52 EIP155Block: big.NewInt(0), 53 EIP158Block: big.NewInt(0), 54 DAOForkBlock: big.NewInt(0), 55 ByzantiumBlock: big.NewInt(0), 56 }, 57 "Constantinople": { 58 ChainID: big.NewInt(1), 59 HomesteadBlock: big.NewInt(0), 60 EIP150Block: big.NewInt(0), 61 EIP155Block: big.NewInt(0), 62 EIP158Block: big.NewInt(0), 63 DAOForkBlock: big.NewInt(0), 64 ByzantiumBlock: big.NewInt(0), 65 ConstantinopleBlock: big.NewInt(0), 66 PetersburgBlock: big.NewInt(10000000), 67 }, 68 "ConstantinopleFix": { 69 ChainID: big.NewInt(1), 70 HomesteadBlock: big.NewInt(0), 71 EIP150Block: big.NewInt(0), 72 EIP155Block: big.NewInt(0), 73 EIP158Block: big.NewInt(0), 74 DAOForkBlock: big.NewInt(0), 75 ByzantiumBlock: big.NewInt(0), 76 ConstantinopleBlock: big.NewInt(0), 77 PetersburgBlock: big.NewInt(0), 78 }, 79 "Istanbul": { 80 ChainID: big.NewInt(1), 81 HomesteadBlock: big.NewInt(0), 82 EIP150Block: big.NewInt(0), 83 EIP155Block: big.NewInt(0), 84 EIP158Block: big.NewInt(0), 85 DAOForkBlock: big.NewInt(0), 86 ByzantiumBlock: big.NewInt(0), 87 ConstantinopleBlock: big.NewInt(0), 88 PetersburgBlock: big.NewInt(0), 89 IstanbulBlock: big.NewInt(0), 90 }, 91 "FrontierToHomesteadAt5": { 92 ChainID: big.NewInt(1), 93 HomesteadBlock: big.NewInt(5), 94 }, 95 "HomesteadToEIP150At5": { 96 ChainID: big.NewInt(1), 97 HomesteadBlock: big.NewInt(0), 98 EIP150Block: big.NewInt(5), 99 }, 100 "HomesteadToDaoAt5": { 101 ChainID: big.NewInt(1), 102 HomesteadBlock: big.NewInt(0), 103 DAOForkBlock: big.NewInt(5), 104 DAOForkSupport: true, 105 }, 106 "EIP158ToByzantiumAt5": { 107 ChainID: big.NewInt(1), 108 HomesteadBlock: big.NewInt(0), 109 EIP150Block: big.NewInt(0), 110 EIP155Block: big.NewInt(0), 111 EIP158Block: big.NewInt(0), 112 ByzantiumBlock: big.NewInt(5), 113 }, 114 "ByzantiumToConstantinopleAt5": { 115 ChainID: big.NewInt(1), 116 HomesteadBlock: big.NewInt(0), 117 EIP150Block: big.NewInt(0), 118 EIP155Block: big.NewInt(0), 119 EIP158Block: big.NewInt(0), 120 ByzantiumBlock: big.NewInt(0), 121 ConstantinopleBlock: big.NewInt(5), 122 }, 123 "ByzantiumToConstantinopleFixAt5": { 124 ChainID: big.NewInt(1), 125 HomesteadBlock: big.NewInt(0), 126 EIP150Block: big.NewInt(0), 127 EIP155Block: big.NewInt(0), 128 EIP158Block: big.NewInt(0), 129 ByzantiumBlock: big.NewInt(0), 130 ConstantinopleBlock: big.NewInt(5), 131 PetersburgBlock: big.NewInt(5), 132 }, 133 "ConstantinopleFixToIstanbulAt5": { 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(0), 141 PetersburgBlock: big.NewInt(0), 142 IstanbulBlock: big.NewInt(5), 143 }, 144 "Berlin": { 145 ChainID: big.NewInt(1), 146 HomesteadBlock: big.NewInt(0), 147 EIP150Block: big.NewInt(0), 148 EIP155Block: big.NewInt(0), 149 EIP158Block: big.NewInt(0), 150 ByzantiumBlock: big.NewInt(0), 151 ConstantinopleBlock: big.NewInt(0), 152 PetersburgBlock: big.NewInt(0), 153 IstanbulBlock: big.NewInt(0), 154 MuirGlacierBlock: big.NewInt(0), 155 BerlinBlock: big.NewInt(0), 156 }, 157 "BerlinToLondonAt5": { 158 ChainID: big.NewInt(1), 159 HomesteadBlock: big.NewInt(0), 160 EIP150Block: big.NewInt(0), 161 EIP155Block: big.NewInt(0), 162 EIP158Block: big.NewInt(0), 163 ByzantiumBlock: big.NewInt(0), 164 ConstantinopleBlock: big.NewInt(0), 165 PetersburgBlock: big.NewInt(0), 166 IstanbulBlock: big.NewInt(0), 167 MuirGlacierBlock: big.NewInt(0), 168 BerlinBlock: big.NewInt(0), 169 LondonBlock: big.NewInt(5), 170 }, 171 "London": { 172 ChainID: big.NewInt(1), 173 HomesteadBlock: big.NewInt(0), 174 EIP150Block: big.NewInt(0), 175 EIP155Block: big.NewInt(0), 176 EIP158Block: big.NewInt(0), 177 ByzantiumBlock: big.NewInt(0), 178 ConstantinopleBlock: big.NewInt(0), 179 PetersburgBlock: big.NewInt(0), 180 IstanbulBlock: big.NewInt(0), 181 MuirGlacierBlock: big.NewInt(0), 182 BerlinBlock: big.NewInt(0), 183 LondonBlock: big.NewInt(0), 184 }, 185 "ArrowGlacier": { 186 ChainID: big.NewInt(1), 187 HomesteadBlock: big.NewInt(0), 188 EIP150Block: big.NewInt(0), 189 EIP155Block: big.NewInt(0), 190 EIP158Block: big.NewInt(0), 191 ByzantiumBlock: big.NewInt(0), 192 ConstantinopleBlock: big.NewInt(0), 193 PetersburgBlock: big.NewInt(0), 194 IstanbulBlock: big.NewInt(0), 195 MuirGlacierBlock: big.NewInt(0), 196 BerlinBlock: big.NewInt(0), 197 LondonBlock: big.NewInt(0), 198 ArrowGlacierBlock: big.NewInt(0), 199 }, 200 } 201 202 // Returns the set of defined fork names 203 func AvailableForks() []string { 204 var availableForks []string 205 for k := range Forks { 206 availableForks = append(availableForks, k) 207 } 208 sort.Strings(availableForks) 209 return availableForks 210 } 211 212 // UnsupportedForkError is returned when a test requests a fork that isn't implemented. 213 type UnsupportedForkError struct { 214 Name string 215 } 216 217 func (e UnsupportedForkError) Error() string { 218 return fmt.Sprintf("unsupported fork %q", e.Name) 219 }