From 428f005362832904248e56b9a4a3b7c13f930e81 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Fri, 20 Dec 2024 10:01:54 -0500 Subject: [PATCH] Encode sender address according to source chain. (#396) --- commit/report.go | 2 +- execute/report/report.go | 2 +- pkg/reader/ccip.go | 2 +- pkg/reader/ccip_interface.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commit/report.go b/commit/report.go index 00d51d8d..c6e0885e 100644 --- a/commit/report.go +++ b/commit/report.go @@ -8,9 +8,9 @@ import ( "fmt" "time" - "github.com/smartcontractkit/chainlink-common/pkg/logger" "golang.org/x/exp/maps" + "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" "github.com/smartcontractkit/chainlink-ccip/commit/committypes" diff --git a/execute/report/report.go b/execute/report/report.go index 287cba79..55182af8 100644 --- a/execute/report/report.go +++ b/execute/report/report.go @@ -236,7 +236,7 @@ func (b *execReportBuilder) checkMessageNonce( } chainNonces := b.sendersNonce[execReport.SourceChain] - sender := typeconv.AddressBytesToString(msg.Sender[:], uint64(b.destChainSelector)) + sender := typeconv.AddressBytesToString(msg.Sender[:], uint64(msg.Header.SourceChainSelector)) if _, ok := chainNonces[sender]; !ok { b.lggr.Errorw("Skipping message - missing nonce", "messageID", msg.Header.MessageID, diff --git a/pkg/reader/ccip.go b/pkg/reader/ccip.go index 5197adc1..d036f9b1 100644 --- a/pkg/reader/ccip.go +++ b/pkg/reader/ccip.go @@ -435,7 +435,7 @@ func (r *ccipChainReader) Nonces( responses := make([]uint64, len(addresses)) for i, address := range addresses { - sender, err := typeconv.AddressStringToBytes(address, uint64(destChainSelector)) + sender, err := typeconv.AddressStringToBytes(address, uint64(sourceChainSelector)) if err != nil { return nil, fmt.Errorf("failed to convert address %s to bytes: %w", address, err) } diff --git a/pkg/reader/ccip_interface.go b/pkg/reader/ccip_interface.go index 9ec64b3c..e652b6e6 100644 --- a/pkg/reader/ccip_interface.go +++ b/pkg/reader/ccip_interface.go @@ -114,7 +114,7 @@ type CCIPReader interface { GetContractAddress(contractName string, chain cciptypes.ChainSelector) ([]byte, error) // Nonces fetches all nonces for the provided selector/address pairs. Addresses are a string encoded raw address, - // it must be encoding according to the destination chain requirements with typeconv.AddressBytesToString. + // it must be encoding according to the source chain requirements with typeconv.AddressBytesToString. Nonces( ctx context.Context, source, dest cciptypes.ChainSelector,