2022-12-23 17:39:44 +00:00
|
|
|
package clparams
|
|
|
|
|
|
|
|
type StateVersion uint8
|
|
|
|
|
|
|
|
const (
|
|
|
|
Phase0Version StateVersion = 0
|
|
|
|
AltairVersion StateVersion = 1
|
|
|
|
BellatrixVersion StateVersion = 2
|
2023-05-06 16:50:58 +00:00
|
|
|
CapellaVersion StateVersion = 3
|
|
|
|
DenebVersion StateVersion = 4
|
2022-12-23 17:39:44 +00:00
|
|
|
)
|
2023-05-02 14:19:22 +00:00
|
|
|
|
|
|
|
// stringToClVersion converts the string to the current state version.
|
|
|
|
func StringToClVersion(s string) StateVersion {
|
|
|
|
switch s {
|
|
|
|
case "phase0":
|
|
|
|
return Phase0Version
|
|
|
|
case "altair":
|
|
|
|
return AltairVersion
|
|
|
|
case "bellatrix":
|
|
|
|
return BellatrixVersion
|
|
|
|
case "capella":
|
|
|
|
return CapellaVersion
|
2023-05-06 16:50:58 +00:00
|
|
|
case "deneb":
|
|
|
|
return DenebVersion
|
2023-05-02 14:19:22 +00:00
|
|
|
default:
|
|
|
|
panic("unsupported fork version: " + s)
|
|
|
|
}
|
|
|
|
}
|
2023-08-30 23:18:12 +00:00
|
|
|
|
|
|
|
func ClVersionToString(s StateVersion) string {
|
|
|
|
switch s {
|
|
|
|
case Phase0Version:
|
|
|
|
return "phase0"
|
|
|
|
case AltairVersion:
|
|
|
|
return "altair"
|
|
|
|
case BellatrixVersion:
|
|
|
|
return "bellatrix"
|
|
|
|
case CapellaVersion:
|
|
|
|
return "capella"
|
|
|
|
case DenebVersion:
|
|
|
|
return "deneb"
|
|
|
|
default:
|
|
|
|
panic("unsupported fork version")
|
|
|
|
}
|
|
|
|
}
|