Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhen1997 committed Jan 29, 2025
1 parent 55b33e3 commit 8d4d702
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 10 additions & 0 deletions core/capabilities/ccip/common/extradatacodec.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ func NewExtraDataCodec() ExtraDataCodec {
}

func (c ExtraDataCodec) DecodeExtraArgs(extraArgs cciptypes.Bytes, sourceChainSelector cciptypes.ChainSelector) (map[string]any, error) {
if len(extraArgs) == 0 {
// return empty map if extraArgs is empty
return nil, nil
}

family, err := chainsel.GetSelectorFamily(uint64(sourceChainSelector))
if err != nil {
return nil, fmt.Errorf("failed to get chain family for selector %d: %w", sourceChainSelector, err)
Expand All @@ -35,6 +40,11 @@ func (c ExtraDataCodec) DecodeExtraArgs(extraArgs cciptypes.Bytes, sourceChainSe
}

func (c ExtraDataCodec) DecodeTokenAmountDestExecData(destExecData cciptypes.Bytes, sourceChainSelector cciptypes.ChainSelector) (map[string]any, error) {
if len(destExecData) == 0 {
// return empty map if destExecData is empty
return nil, nil
}

family, err := chainsel.GetSelectorFamily(uint64(sourceChainSelector))
if err != nil {
return nil, fmt.Errorf("failed to get chain family for selector %d: %w", sourceChainSelector, err)
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/smoke/ccip/ccip_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ func setupExecutedMessageRangesTest(ctx context.Context, t testing.TB, useHeavyD
})
}

func setupMsgsBetweenSeqNumsTest(ctx context.Context, t testing.TB, useHeavyDB bool) *testSetupData {
func setupMsgsBetweenSeqNumsTest(ctx context.Context, t testing.TB, useHeavyDB bool, sourceChainSel cciptypes.ChainSelector) *testSetupData {
sb, auth := setupSimulatedBackendAndAuth(t)
return testSetup(ctx, t, testSetupParams{
ReaderChain: chainS1,
ReaderChain: sourceChainSel,
DestChain: chainD,
OnChainSeqNums: nil,
Cfg: evmconfig.SourceReaderConfig,
Expand Down Expand Up @@ -463,7 +463,7 @@ func TestCCIPReader_MsgsBetweenSeqNums(t *testing.T) {
t.Parallel()
ctx := tests.Context(t)

s := setupMsgsBetweenSeqNumsTest(ctx, t, false)
s := setupMsgsBetweenSeqNumsTest(ctx, t, false, chainSEVM)
_, err := s.contract.EmitCCIPMessageSent(s.auth, uint64(chainD), ccip_reader_tester.InternalEVM2AnyRampMessage{
Header: ccip_reader_tester.InternalRampMessageHeader{
MessageId: [32]byte{1, 0, 0, 0, 0},
Expand Down Expand Up @@ -1169,7 +1169,7 @@ func Benchmark_CCIPReader_MessageSentRanges(b *testing.B) {
func benchmarkMessageSentRanges(b *testing.B, logsInserted int, startSeqNum, endSeqNum cciptypes.SeqNum) {
// Initialize test setup
ctx := tests.Context(b)
s := setupMsgsBetweenSeqNumsTest(ctx, b, true)
s := setupMsgsBetweenSeqNumsTest(ctx, b, true, chainS1)
expectedRangeLen := calculateExpectedRangeLen(logsInserted, startSeqNum, endSeqNum)

err := s.extendedCR.Bind(ctx, []types.BoundContract{
Expand Down

0 comments on commit 8d4d702

Please sign in to comment.