-
Notifications
You must be signed in to change notification settings - Fork 3
/
constants.go
43 lines (36 loc) · 1.19 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package ethcl
import (
"fmt"
beaconcommon "github.com/protolambda/zrnt/eth2/beacon/common"
)
var (
MainnetForkVersion = beaconcommon.Version{0x00, 0x00, 0x00, 0x00}
PraterForkVersion = beaconcommon.Version{0x00, 0x00, 0x10, 0x20}
SepoliaForkVersion = beaconcommon.Version{0x90, 0x00, 0x00, 0x69}
RopstenForkVersion = beaconcommon.Version{0x80, 0x00, 0x00, 0x69}
)
var forkVersions = map[string]beaconcommon.Version{
"mainnet": MainnetForkVersion,
"prater": PraterForkVersion,
"goerli": PraterForkVersion, // we add goerli to facilitate correspondance with exec layer
"sepolia": SepoliaForkVersion,
"ropsten": RopstenForkVersion,
}
var networks = map[string]string{
MainnetForkVersion.String(): "mainnet",
PraterForkVersion.String(): "prater",
SepoliaForkVersion.String(): "sepolia",
RopstenForkVersion.String(): "ropsten",
}
func ForkVersion(network string) (beaconcommon.Version, error) {
if v, ok := forkVersions[network]; ok {
return v, nil
}
return beaconcommon.Version{}, fmt.Errorf("unknown network %v", network)
}
func Network(v beaconcommon.Version) (string, error) {
if v, ok := networks[v.String()]; ok {
return v, nil
}
return "", fmt.Errorf("unknown fork version %v", v)
}