From c1c230706e65bb0a01e8c4ddb0b0354264093431 Mon Sep 17 00:00:00 2001 From: Jun Kimura Date: Tue, 18 Jun 2024 09:41:55 +0900 Subject: [PATCH] fix eip712 salt Signed-off-by: Jun Kimura --- light-clients/lcp/types/lcp.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/light-clients/lcp/types/lcp.go b/light-clients/lcp/types/lcp.go index 2fdeee8..5cdf0af 100644 --- a/light-clients/lcp/types/lcp.go +++ b/light-clients/lcp/types/lcp.go @@ -77,11 +77,11 @@ func (t ChainType) Uint16() uint16 { } func ComputeChainSalt(chainID string, prefix []byte) common.Hash { + // salt = Hash(| ChainType | Hash(ChainID) | Hash(Prefix) |) msg := make([]byte, 2) binary.BigEndian.PutUint16(msg, ChainTypeCosmos.Uint16()) - // TODO abi encode? - msg = append(msg, []byte(chainID)...) - msg = append(msg, prefix...) + msg = append(msg, crypto.Keccak256Hash([]byte(chainID)).Bytes()...) + msg = append(msg, crypto.Keccak256Hash(prefix).Bytes()...) return crypto.Keccak256Hash(msg) }