Skip to content

Commit 0c852ee

Browse files
authored
Caplin: Proper "Normalization" of length of ForkVersions to 8 hex characters (#10512)
1 parent f7ebfb2 commit 0c852ee

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"
@@ -319,7 +320,9 @@ func (b ConfigByte) MarshalJSON() ([]byte, error) {
319320
type ConfigForkVersion uint32
320321

321322
func (v ConfigForkVersion) MarshalJSON() ([]byte, error) {
322-
return []byte(fmt.Sprintf("\"0x%x\"", v)), nil
323+
tmp := make([]byte, 4)
324+
binary.BigEndian.PutUint32(tmp, uint32(v))
325+
return []byte(fmt.Sprintf("\"0x%x\"", tmp)), nil
323326
}
324327

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

0 commit comments

Comments
 (0)