Skip to content

Commit

Permalink
remove extra data codec and encoded maps (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhen1997 authored Feb 19, 2025
1 parent 2532663 commit 751d873
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 28 deletions.
4 changes: 0 additions & 4 deletions commit/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ type PluginFactory struct {
ocrConfig reader.OCR3ConfigWithMeta
commitCodec cciptypes.CommitPluginCodec
msgHasher cciptypes.MessageHasher
extraDataCodec cciptypes.ExtraDataCodec
homeChainReader reader.HomeChain
homeChainSelector cciptypes.ChainSelector
contractReaders map[cciptypes.ChainSelector]types.ContractReader
Expand All @@ -84,7 +83,6 @@ type CommitPluginFactoryParams struct {
OcrConfig reader.OCR3ConfigWithMeta
CommitCodec cciptypes.CommitPluginCodec
MsgHasher cciptypes.MessageHasher
ExtraDataCodec cciptypes.ExtraDataCodec
HomeChainReader reader.HomeChain
HomeChainSelector cciptypes.ChainSelector
ContractReaders map[cciptypes.ChainSelector]types.ContractReader
Expand All @@ -102,7 +100,6 @@ func NewCommitPluginFactory(params CommitPluginFactoryParams) *PluginFactory {
ocrConfig: params.OcrConfig,
commitCodec: params.CommitCodec,
msgHasher: params.MsgHasher,
extraDataCodec: params.ExtraDataCodec,
homeChainReader: params.HomeChainReader,
homeChainSelector: params.HomeChainSelector,
contractReaders: params.ContractReaders,
Expand Down Expand Up @@ -183,7 +180,6 @@ func (p *PluginFactory) NewReportingPlugin(ctx context.Context, config ocr3types
p.chainWriters,
p.ocrConfig.Config.ChainSelector,
p.ocrConfig.Config.OfframpAddress,
p.extraDataCodec,
)

// The node supports the chain that the token prices are on.
Expand Down
3 changes: 0 additions & 3 deletions execute/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ type PluginFactory struct {
ocrConfig reader.OCR3ConfigWithMeta
execCodec cciptypes.ExecutePluginCodec
msgHasher cciptypes.MessageHasher
extraDataCodec cciptypes.ExtraDataCodec
homeChainReader reader.HomeChain
estimateProvider cciptypes.EstimateProvider
tokenDataEncoder cciptypes.TokenDataEncoder
Expand Down Expand Up @@ -99,7 +98,6 @@ func NewExecutePluginFactory(params PluginFactoryParams) *PluginFactory {
ocrConfig: params.OcrConfig,
execCodec: params.ExecCodec,
msgHasher: params.MsgHasher,
extraDataCodec: params.ExtraDataCodec,
homeChainReader: params.HomeChainReader,
estimateProvider: params.EstimateProvider,
tokenDataEncoder: params.TokenDataEncoder,
Expand Down Expand Up @@ -147,7 +145,6 @@ func (p PluginFactory) NewReportingPlugin(
p.chainWriters,
p.ocrConfig.Config.ChainSelector,
p.ocrConfig.Config.OfframpAddress,
p.extraDataCodec,
)

tokenDataObserver, err := tokendata.NewConfigBasedCompositeObservers(
Expand Down
3 changes: 0 additions & 3 deletions pkg/reader/ccip.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ type ccipChainReader struct {
contractWriters map[cciptypes.ChainSelector]types.ContractWriter
destChain cciptypes.ChainSelector
offrampAddress string
extraDataCodec cciptypes.ExtraDataCodec
configPoller ConfigPoller
}

Expand All @@ -55,7 +54,6 @@ func newCCIPChainReaderInternal(
contractWriters map[cciptypes.ChainSelector]types.ContractWriter,
destChain cciptypes.ChainSelector,
offrampAddress []byte,
extraDataCodec cciptypes.ExtraDataCodec,
) *ccipChainReader {
var crs = make(map[cciptypes.ChainSelector]contractreader.Extended)
for chainSelector, cr := range contractReaders {
Expand All @@ -68,7 +66,6 @@ func newCCIPChainReaderInternal(
contractWriters: contractWriters,
destChain: destChain,
offrampAddress: typeconv.AddressBytesToString(offrampAddress, uint64(destChain)),
extraDataCodec: extraDataCodec,
}

// Initialize cache with readers
Expand Down
5 changes: 1 addition & 4 deletions pkg/reader/ccip_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ func NewCCIPChainReader(
contractWriters map[cciptypes.ChainSelector]types.ContractWriter,
destChain cciptypes.ChainSelector,
offrampAddress []byte,
extraDataCodec cciptypes.ExtraDataCodec,
) CCIPReader {
return NewObservedCCIPReader(
newCCIPChainReaderInternal(
Expand All @@ -93,7 +92,6 @@ func NewCCIPChainReader(
contractWriters,
destChain,
offrampAddress,
extraDataCodec,
),
destChain,
)
Expand All @@ -107,9 +105,8 @@ func NewCCIPReaderWithExtendedContractReaders(
contractWriters map[cciptypes.ChainSelector]types.ContractWriter,
destChain cciptypes.ChainSelector,
offrampAddress []byte,
extraDataCodec cciptypes.ExtraDataCodec,
) CCIPReader {
cr := newCCIPChainReaderInternal(ctx, lggr, nil, contractWriters, destChain, offrampAddress, extraDataCodec)
cr := newCCIPChainReaderInternal(ctx, lggr, nil, contractWriters, destChain, offrampAddress)
for ch, extendedCr := range contractReaders {
cr.WithExtendedContractReader(ch, extendedCr)
}
Expand Down
6 changes: 0 additions & 6 deletions pkg/reader/ccip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
"go.uber.org/zap/zapcore"
"golang.org/x/exp/maps"

"github.com/smartcontractkit/chainlink-ccip/mocks/pkg/types/ccipocr3"

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives"
Expand Down Expand Up @@ -88,7 +86,6 @@ func TestCCIPChainReader_getSourceChainsConfig(t *testing.T) {
chainB: sourceCRs[chainB],
chainC: destCR,
}, nil, chainC, offrampAddress,
ccipocr3.NewMockExtraDataCodec(t),
)

require.NoError(t, ccipReader.contractReaders[chainA].Bind(
Expand Down Expand Up @@ -826,7 +823,6 @@ func TestCCIPChainReader_getFeeQuoterTokenPriceUSD(t *testing.T) {
map[cciptypes.ChainSelector]contractreader.ContractReaderFacade{
chainC: destCR,
}, nil, chainC, offrampAddress,
ccipocr3.NewMockExtraDataCodec(t),
)

require.NoError(t, ccipReader.contractReaders[chainC].Bind(
Expand Down Expand Up @@ -859,7 +855,6 @@ func TestCCIPFeeComponents_HappyPath(t *testing.T) {
contractWriters,
chainC,
[]byte{0x3},
ccipocr3.NewMockExtraDataCodec(t),
)

ctx := context.Background()
Expand Down Expand Up @@ -888,7 +883,6 @@ func TestCCIPFeeComponents_NotFoundErrors(t *testing.T) {
contractWriters,
chainC,
[]byte{0x3},
ccipocr3.NewMockExtraDataCodec(t),
)

ctx := context.Background()
Expand Down
8 changes: 0 additions & 8 deletions pkg/types/ccipocr3/generic_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ type Message struct {
// such as the gasLimit for EVM chains.
// This field is encoded in the source chain encoding scheme.
ExtraArgs Bytes `json:"extraArgs"`
// ExtraArgsDecoded is same as ExtraArgs,
// just decoded into a named collection of arguments in a generic format,
// which can be read by any destination chain family.
ExtraArgsDecoded map[string]any `json:"extraArgsDecoded,omitempty"`
// FeeToken is the fee token address.
// i.e if the source chain is EVM, len(FeeToken) == 20 (i.e, is not abi-encoded).
FeeToken UnknownAddress `json:"feeToken"`
Expand Down Expand Up @@ -240,8 +236,4 @@ type RampTokenAmount struct {
// NOTE: this must be decoded before providing it as an execution input to the destination chain
// or hashing it. See Internal._hash(Any2EVMRampMessage) for more details as an example.
DestExecData Bytes `json:"destExecData"`
// DestExecDataDecoded is the same as DestExecData
// just decoded into a named collection of arguments in a generic format,
// which can be read by any destination chain family.
DestExecDataDecoded map[string]any `json:"destExecDataDecoded,omitempty"`
}

0 comments on commit 751d873

Please sign in to comment.