From fc16640538700b0764aafa01223a26986b8f5c57 Mon Sep 17 00:00:00 2001 From: dimkouv Date: Fri, 8 Sep 2023 13:00:17 +0300 Subject: [PATCH] fix leafHasher tests --- .../plugins/ccip/internal/hashlib/leaf_hasher_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/services/ocr2/plugins/ccip/internal/hashlib/leaf_hasher_test.go b/core/services/ocr2/plugins/ccip/internal/hashlib/leaf_hasher_test.go index faddb1b673..8c6e2edf4f 100644 --- a/core/services/ocr2/plugins/ccip/internal/hashlib/leaf_hasher_test.go +++ b/core/services/ocr2/plugins/ccip/internal/hashlib/leaf_hasher_test.go @@ -1,4 +1,4 @@ -package hashlib_test +package hashlib import ( "encoding/hex" @@ -9,7 +9,6 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/evm_2_evm_onramp" - "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/hashlib" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/testhelpers" ) @@ -17,9 +16,9 @@ func TestHasher(t *testing.T) { sourceChainSelector, destChainSelector := uint64(1), uint64(4) onRampAddress := common.HexToAddress("0x5550000000000000000000000000000000000001") - hashingCtx := hashlib.NewKeccakCtx() + hashingCtx := NewKeccakCtx() - hasher := hashlib.NewLeafHasher(sourceChainSelector, destChainSelector, onRampAddress, hashingCtx) + hasher := NewLeafHasher(sourceChainSelector, destChainSelector, onRampAddress, hashingCtx) message := evm_2_evm_onramp.InternalEVM2EVMMessage{ SourceChainSelector: sourceChainSelector, @@ -72,7 +71,7 @@ func TestHasher(t *testing.T) { func TestMetaDataHash(t *testing.T) { sourceChainSelector, destChainSelector := uint64(1), uint64(4) onRampAddress := common.HexToAddress("0x5550000000000000000000000000000000000001") - ctx := hashlib.NewKeccakCtx() - hash := hashlib.GetMetaDataHash(ctx, ctx.Hash([]byte("EVM2EVMSubscriptionMessagePlus")), sourceChainSelector, onRampAddress, destChainSelector) + ctx := NewKeccakCtx() + hash := GetMetaDataHash(ctx, ctx.Hash([]byte("EVM2EVMSubscriptionMessagePlus")), sourceChainSelector, onRampAddress, destChainSelector) require.Equal(t, "e8b93c9d01a7a72ec6c7235e238701cf1511b267a31fdb78dd342649ee58c08d", hex.EncodeToString(hash[:])) }