Skip to content

Commit

Permalink
add network list
Browse files Browse the repository at this point in the history
  • Loading branch information
y0sher committed Nov 1, 2023
1 parent 956d73c commit 516c5cd
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions core/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
// Network represents the network.
type Network string

var Networks = []Network{MainNetwork, HoleskyNetwork, PraterNetwork, PyrmontNetwork}

// NetworkFromString returns network from the given string value
func NetworkFromString(n string) Network {
switch n {
Expand Down Expand Up @@ -46,19 +48,19 @@ func (n Network) GenesisForkVersion() phase0.Version {

// NetworkFromGenesisForkVersion returns the network base on the 4 bytes of the genesis fork version
func NetworkFromGenesisForkVersion(f phase0.Version) Network {
switch f {
switch f {
case phase0.Version{0, 0, 32, 9}:
return PyrmontNetwork
case phase0.Version{0x00, 0x00, 0x10, 0x20}:
return PraterNetwork
case phase0.Version{0x01, 0x01, 0x70, 0x00}:
return HoleskyNetwork
case phase0.Version{0, 0, 0, 0}:
return MainNetwork
default:
logrus.WithField("fork version", f).Fatal("undefined fork version")
case phase0.Version{0x00, 0x00, 0x10, 0x20}:
return PraterNetwork
case phase0.Version{0x01, 0x01, 0x70, 0x00}:
return HoleskyNetwork
case phase0.Version{0, 0, 0, 0}:
return MainNetwork
default:
logrus.WithField("fork version", f).Fatal("undefined fork version")
return ""
}
}
}

// GenesisValidatorsRoot returns the genesis validators root of the network.
Expand Down

0 comments on commit 516c5cd

Please sign in to comment.