Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

destexecdata decoder support + refactor #15978

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/large-mice-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

modify extradatacodec interface to support chain agnostic destExecdata map in ORC report message #added
16 changes: 0 additions & 16 deletions core/capabilities/ccip/ccipevm/extraargscodec.go

This file was deleted.

26 changes: 26 additions & 0 deletions core/capabilities/ccip/common/extradatacodec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package common

import (
cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3"
)

type ExtraDataCodec struct{}

func NewExtraDataCodec() ExtraDataCodec {
return ExtraDataCodec{}
}

func (c ExtraDataCodec) DecodeExtraData(extraArgs cciptypes.Bytes, sourceChainSelector cciptypes.ChainSelector) (map[string]any, error) {
// Not implemented and not return error
return nil, nil
}

func (c ExtraDataCodec) DecodeExtraArgs(extraArgs cciptypes.Bytes, sourceChainSelector cciptypes.ChainSelector) (map[string]any, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you're missing DecodeExtraData, I thought you were just adding DecodeTokenAmountDestExecData. You'll need to add the old value and deprecate/remove it in a future PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was renaming it from DecodeExtraData to DecodeExtraArgs since it wasn't accurate.

// Not implemented and not return error
return nil, nil
}

func (c ExtraDataCodec) DecodeTokenAmountDestExecData(destExecData cciptypes.Bytes, sourceChainSelector cciptypes.ChainSelector) (map[string]any, error) {
// Not implemented and not return error
return nil, nil
}
5 changes: 3 additions & 2 deletions core/capabilities/ccip/oraclecreator/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/google/uuid"
"github.com/prometheus/client_golang/prometheus"
ccipcommon "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/common"

chainsel "github.com/smartcontractkit/chain-selectors"
"github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3confighelper"
Expand Down Expand Up @@ -227,7 +228,7 @@ var plugins = map[string]plugin{
chainsel.FamilyEVM: {
CommitPluginCodec: ccipevm.NewCommitPluginCodecV1(),
ExecutePluginCodec: ccipevm.NewExecutePluginCodecV1(),
ExtraArgsCodec: ccipevm.ExtraArgsCodec{},
ExtraArgsCodec: ccipcommon.NewExtraDataCodec(),
MessageHasher: func(lggr logger.Logger) cciptypes.MessageHasher { return ccipevm.NewMessageHasherV1(lggr) },
TokenDataEncoder: ccipevm.NewEVMTokenDataEncoder(),
GasEstimateProvider: ccipevm.NewGasEstimateProvider(),
Expand All @@ -236,7 +237,7 @@ var plugins = map[string]plugin{
chainsel.FamilySolana: {
CommitPluginCodec: nil,
ExecutePluginCodec: nil,
ExtraArgsCodec: nil,
ExtraArgsCodec: ccipcommon.NewExtraDataCodec(),
MessageHasher: func(lggr logger.Logger) cciptypes.MessageHasher { return nil },
TokenDataEncoder: nil,
GasEstimateProvider: nil,
Expand Down
9 changes: 5 additions & 4 deletions integration-tests/smoke/ccip/ccip_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zapcore"

ccipcommon "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/common"

"github.com/smartcontractkit/chainlink/deployment/ccip/changeset"
"github.com/smartcontractkit/chainlink/deployment/ccip/changeset/testhelpers"
"github.com/smartcontractkit/chainlink/deployment/environment/memory"
Expand All @@ -33,7 +35,6 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"

"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm"
evmconfig "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/configs/evm"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/client"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker"
Expand Down Expand Up @@ -285,7 +286,7 @@ func TestCCIPReader_GetOffRampConfigDigest(t *testing.T) {
nil,
chainD,
addr.Bytes(),
ccipevm.NewExtraArgsCodec(),
ccipcommon.NewExtraDataCodec(),
)

ccipReaderCommitDigest, err := reader.GetOffRampConfigDigest(ctx, consts.PluginTypeCommit)
Expand Down Expand Up @@ -1405,7 +1406,7 @@ func testSetupRealContracts(
contractReaders[chain] = cr
}
contractWriters := make(map[cciptypes.ChainSelector]types.ContractWriter)
edc := ccipevm.NewExtraArgsCodec()
edc := ccipcommon.NewExtraDataCodec()
reader := ccipreaderpkg.NewCCIPReaderWithExtendedContractReaders(ctx, lggr, contractReaders, contractWriters, cciptypes.ChainSelector(destChain), nil, edc)

return reader
Expand Down Expand Up @@ -1521,7 +1522,7 @@ func testSetup(
contractReaders[chain] = cr
}
contractWriters := make(map[cciptypes.ChainSelector]types.ContractWriter)
edc := ccipevm.NewExtraArgsCodec()
edc := ccipcommon.NewExtraDataCodec()
reader := ccipreaderpkg.NewCCIPReaderWithExtendedContractReaders(ctx, lggr, contractReaders, contractWriters, params.DestChain, nil, edc)

t.Cleanup(func() {
Expand Down
Loading