Skip to content

Commit 2e3d061

Browse files
Caplin: Proper "Normalization" of length of ForkVersions to 8 hex characters (#10578)
Cherry pick PR #10512 into the release branch Co-authored-by: Giulio rebuffo <[email protected]>
1 parent c3fcd76 commit 2e3d061

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cl/clparams/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ package clparams
1515

1616
import (
1717
"crypto/rand"
18+
"encoding/binary"
1819
"fmt"
1920
"math"
2021
"math/big"
@@ -315,7 +316,9 @@ func (b ConfigByte) MarshalJSON() ([]byte, error) {
315316
type ConfigForkVersion uint32
316317

317318
func (v ConfigForkVersion) MarshalJSON() ([]byte, error) {
318-
return []byte(fmt.Sprintf("\"0x%x\"", v)), nil
319+
tmp := make([]byte, 4)
320+
binary.BigEndian.PutUint32(tmp, uint32(v))
321+
return []byte(fmt.Sprintf("\"0x%x\"", tmp)), nil
319322
}
320323

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

0 commit comments

Comments
 (0)