github.com/MetalBlockchain/subnet-evm@v0.4.9/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/MetalBlockchain/subnet-evm/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 ByzantiumBlock: big.NewInt(0), 65 }, 66 "Constantinople": { 67 ChainID: big.NewInt(1), 68 HomesteadBlock: big.NewInt(0), 69 EIP150Block: big.NewInt(0), 70 EIP155Block: big.NewInt(0), 71 EIP158Block: big.NewInt(0), 72 ByzantiumBlock: big.NewInt(0), 73 ConstantinopleBlock: big.NewInt(0), 74 PetersburgBlock: big.NewInt(10000000), 75 }, 76 "ConstantinopleFix": { 77 ChainID: big.NewInt(1), 78 HomesteadBlock: big.NewInt(0), 79 EIP150Block: big.NewInt(0), 80 EIP155Block: big.NewInt(0), 81 EIP158Block: big.NewInt(0), 82 ByzantiumBlock: big.NewInt(0), 83 ConstantinopleBlock: big.NewInt(0), 84 PetersburgBlock: big.NewInt(0), 85 }, 86 "Istanbul": { 87 ChainID: big.NewInt(1), 88 HomesteadBlock: big.NewInt(0), 89 EIP150Block: big.NewInt(0), 90 EIP155Block: big.NewInt(0), 91 EIP158Block: big.NewInt(0), 92 ByzantiumBlock: big.NewInt(0), 93 ConstantinopleBlock: big.NewInt(0), 94 PetersburgBlock: big.NewInt(0), 95 IstanbulBlock: big.NewInt(0), 96 }, 97 "FrontierToHomesteadAt5": { 98 ChainID: big.NewInt(1), 99 HomesteadBlock: big.NewInt(5), 100 }, 101 "HomesteadToEIP150At5": { 102 ChainID: big.NewInt(1), 103 HomesteadBlock: big.NewInt(0), 104 EIP150Block: big.NewInt(5), 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 "SubnetEVM": { 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 NetworkUpgrades: params.NetworkUpgrades{ 155 SubnetEVMTimestamp: big.NewInt(0), 156 }, 157 }, 158 } 159 160 // Returns the set of defined fork names 161 func AvailableForks() []string { 162 var availableForks []string 163 for k := range Forks { 164 availableForks = append(availableForks, k) 165 } 166 sort.Strings(availableForks) 167 return availableForks 168 } 169 170 // UnsupportedForkError is returned when a test requests a fork that isn't implemented. 171 type UnsupportedForkError struct { 172 Name string 173 } 174 175 func (e UnsupportedForkError) Error() string { 176 return fmt.Sprintf("unsupported fork %q", e.Name) 177 }