From 83cb2b60402cfd4e8fed6afdd8c8b686c9ae26af Mon Sep 17 00:00:00 2001 From: Cesar Date: Sun, 13 Aug 2023 23:55:16 -0400 Subject: [PATCH] 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 --- plugin/evm/message/handshake/upgrade_config.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/evm/message/handshake/upgrade_config.go b/plugin/evm/message/handshake/upgrade_config.go index 39489b05cf..24971f2c83 100644 --- a/plugin/evm/message/handshake/upgrade_config.go +++ b/plugin/evm/message/handshake/upgrade_config.go @@ -111,6 +111,9 @@ func (r *UpgradeConfig) Bytes() []byte { return r.bytes } -func (r *UpgradeConfig) Hash() [32]byte { - return sha256.Sum256(r.bytes) +func (r *UpgradeConfig) Hash() [8]byte { + hash := sha256.Sum256(r.bytes) + var firstBytes [8]byte + copy(firstBytes[:], hash[:8]) + return firstBytes }