Skip to content

Commit a3a6471

Browse files
committed
Use 8 bytes to hash UpgradeConfig
8 bytes is generally enough to fingerprint the UpgradeConfig changes, so nodes can exchange the hash as part of the handshake[1] [1] https://stackoverflow.com/questions/18134627/how-much-of-a-git-sha-is-generally-considered-necessary-to-uniquely-identify-a
1 parent be9f6b2 commit a3a6471

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

plugin/evm/message/handshake/upgrade_config.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ func (r *UpgradeConfig) Bytes() []byte {
111111
return r.bytes
112112
}
113113

114-
func (r *UpgradeConfig) Hash() [32]byte {
115-
return sha256.Sum256(r.bytes)
114+
func (r *UpgradeConfig) Hash() [8]byte {
115+
hash := sha256.Sum256(r.bytes)
116+
var firstBytes [8]byte
117+
copy(firstBytes[:], hash[:8])
118+
return firstBytes
116119
}

0 commit comments

Comments
 (0)