Skip to content

Commit

Permalink
Fix config unmarshal
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Feb 13, 2024
1 parent 0a568c9 commit 208240e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions networkconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@ func (n *NetworkConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
return fmt.Errorf("decode domain: %w", err)
}

contractAddr, err := hex.DecodeString(strings.TrimPrefix(aux.RegistryContractAddr, "0x"))
if err != nil {
return fmt.Errorf("decode registry contract address: %w", err)
var domainArr spectypes.DomainType
if len(domain) != 0 {
domainArr = spectypes.DomainType(domain)
}

*n = NetworkConfig{
Name: aux.Name,
Beacon: aux.Beacon,
Domain: spectypes.DomainType(domain),
Domain: domainArr,
GenesisEpoch: aux.GenesisEpoch,
RegistrySyncOffset: aux.RegistrySyncOffset,
RegistryContractAddr: ethcommon.Address(contractAddr),
RegistryContractAddr: ethcommon.HexToAddress(aux.RegistryContractAddr),
Bootnodes: aux.Bootnodes,
WhitelistedOperatorKeys: aux.WhitelistedOperatorKeys,
PermissionlessActivationEpoch: aux.PermissionlessActivationEpoch,
Expand Down
7 changes: 6 additions & 1 deletion protocol/v2/blockchain/beacon/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,15 @@ func (n *Network) UnmarshalYAML(unmarshal func(interface{}) error) error {
return fmt.Errorf("decode fork version: %w", err)
}

var forkVersionArr [4]byte
if len(forkVersion) != 0 {
forkVersionArr = [4]byte(forkVersion)
}

*n = Network{
Parent: aux.Parent,
Name: aux.Name,
ForkVersionVal: [4]byte(forkVersion),
ForkVersionVal: forkVersionArr,
MinGenesisTimeVal: aux.MinGenesisTimeVal,
SlotDurationVal: aux.SlotDurationVal,
SlotsPerEpochVal: aux.SlotsPerEpochVal,
Expand Down

0 comments on commit 208240e

Please sign in to comment.