Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhen1997 committed Jan 22, 2025
1 parent 36a5ad1 commit 3fa671b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
9 changes: 5 additions & 4 deletions core/capabilities/ccip/ccipevm/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ func DecodeExtraArgsToMap(extraArgs []byte) (map[string]any, error) {
}

var method string
if bytes.Equal(extraArgs[:4], evmExtraArgsV1Tag) {
switch string(extraArgs[:4]) {
case string(evmExtraArgsV1Tag):
method = evmV1DecodeName
} else if bytes.Equal(extraArgs[:4], evmExtraArgsV2Tag) {
case string(evmExtraArgsV2Tag):
method = evmV2DecodeName
} else if bytes.Equal(extraArgs[:4], svmExtraArgsV1Tag) {
case string(svmExtraArgsV1Tag):
method = svmV1DecodeName
} else {
default:
return nil, fmt.Errorf("unknown extra args tag: %x", extraArgs)
}

Expand Down
4 changes: 2 additions & 2 deletions core/capabilities/ccip/ccipevm/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func Test_decodeExtraArgs(t *testing.T) {

m, err := DecodeExtraArgsToMap(encoded)
require.NoError(t, err)
require.Equal(t, 1, len(m))
require.Len(t, m, 1)
})

t.Run("decode extra args into map evm v2", func(t *testing.T) {
Expand All @@ -60,7 +60,7 @@ func Test_decodeExtraArgs(t *testing.T) {

m, err := DecodeExtraArgsToMap(encoded)
require.NoError(t, err)
require.Equal(t, 2, len(m))
require.Len(t, m, 2)
})

t.Run("decode extra args into map svm", func(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions core/capabilities/ccip/ccipsolana/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"reflect"

agbinary "github.com/gagliardetto/binary"

"github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/ccip_router"
)

Expand Down
5 changes: 3 additions & 2 deletions core/capabilities/ccip/ccipsolana/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (

agbinary "github.com/gagliardetto/binary"
"github.com/gagliardetto/solana-go"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-ccip/chains/solana/contracts/tests/config"
"github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/ccip_router"
"github.com/stretchr/testify/require"
)

func Test_decodeExtraArgs(t *testing.T) {
Expand All @@ -29,6 +30,6 @@ func Test_decodeExtraArgs(t *testing.T) {
require.NoError(t, err)
output, err := DecodeExtraArgsToMap(buf.Bytes())
require.NoError(t, err)
require.Equal(t, 3, len(output))
require.Len(t, output, 3)
})
}
1 change: 1 addition & 0 deletions core/capabilities/ccip/common/extraargscodec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipsolana"

Expand Down

0 comments on commit 3fa671b

Please sign in to comment.