Skip to content

Commit

Permalink
Caplin: Proper "Normalization" of length of ForkVersions to 8 hex cha…
Browse files Browse the repository at this point in the history
…racters (#10578)

Cherry pick PR #10512 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>
  • Loading branch information
yperbasis and Giulio2002 authored May 31, 2024
1 parent c3fcd76 commit 2e3d061
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cl/clparams/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package clparams

import (
"crypto/rand"
"encoding/binary"
"fmt"
"math"
"math/big"
Expand Down Expand Up @@ -315,7 +316,9 @@ func (b ConfigByte) MarshalJSON() ([]byte, error) {
type ConfigForkVersion uint32

func (v ConfigForkVersion) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("\"0x%x\"", v)), nil
tmp := make([]byte, 4)
binary.BigEndian.PutUint32(tmp, uint32(v))
return []byte(fmt.Sprintf("\"0x%x\"", tmp)), nil
}

// BeaconChainConfig contains constant configs for node to participate in beacon chain.
Expand Down

0 comments on commit 2e3d061

Please sign in to comment.