Skip to content
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
6 changes: 3 additions & 3 deletions chains/evm/deployment/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/Masterminds/semver/v3 v3.4.0
github.com/ethereum/go-ethereum v1.16.2
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250320090719-315440f5b0a7
github.com/smartcontractkit/chainlink-common v0.9.5-0.20250910201107-cb4c31b624d3
github.com/smartcontractkit/chainlink-common v0.9.6-0.20250929154511-1f5fbda7ae76
github.com/smartcontractkit/chainlink-deployments-framework v0.37.1
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20250808121824-2c3544aab8f3
github.com/smartcontractkit/mcms v0.21.1
Expand Down Expand Up @@ -218,8 +218,8 @@ require (
github.com/smartcontractkit/chainlink-aptos v0.0.0-20250414155853-651b4e583ee9 // indirect
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250805210128-7f8a0f403c3a // indirect
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20250805210128-7f8a0f403c3a // indirect
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.1 // indirect
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250905211734-167560f092c1 // indirect
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.4 // indirect
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250911124514-5874cc6d62b2 // indirect
github.com/smartcontractkit/chainlink-protos/job-distributor v0.12.0 // indirect
github.com/smartcontractkit/chainlink-testing-framework/framework v0.10.15 // indirect
github.com/smartcontractkit/chainlink-testing-framework/seth v1.51.2 // indirect
Expand Down
12 changes: 6 additions & 6 deletions chains/evm/deployment/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -664,16 +664,16 @@ github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250805210128-7
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250805210128-7f8a0f403c3a/go.mod h1:Ve1xD71bl193YIZQEoJMmBqLGQJdNs29bwbuObwvbhQ=
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20250805210128-7f8a0f403c3a h1:38dAlTPRUQHZus5dCnBnQyf/V4oYn0p2svWlbPgHDQ4=
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20250805210128-7f8a0f403c3a/go.mod h1:xtZNi6pOKdC3sLvokDvXOhgHzT+cyBqH/gWwvxTxqrg=
github.com/smartcontractkit/chainlink-common v0.9.5-0.20250910201107-cb4c31b624d3 h1:dMvSvJ7nRAQViYSjdfj/vRGLULY7mJ3X4UgsPMmXgOI=
github.com/smartcontractkit/chainlink-common v0.9.5-0.20250910201107-cb4c31b624d3/go.mod h1:1diMLMwfIACeqJFt7ySGaBrJIeUwHTLhVVYlb41EyKk=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.1 h1:ca2z5OXgnbBPQRxpwXwBLJsUA1+cAp5ncfW4Ssvd6eY=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.1/go.mod h1:NZv/qKYGFRnkjOYBouajnDfFoZ+WDa6H2KNmSf1dnKc=
github.com/smartcontractkit/chainlink-common v0.9.6-0.20250929154511-1f5fbda7ae76 h1:Slnws8RoXRUYGgEMYK6X2yYzjZwNgVb93PxU45VEObQ=
github.com/smartcontractkit/chainlink-common v0.9.6-0.20250929154511-1f5fbda7ae76/go.mod h1:1r3aM96KHAESfnayJ3BTHCkP1qJS1BEG1r4czeoaXlA=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.4 h1:hvqATtrZ0iMRTI80cpBot/3JFbjz2j+2tvpfooVhRHw=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.4/go.mod h1:eKGyfTKzr0/PeR7qKN4l2FcW9p+HzyKUwAfGhm/5YZc=
github.com/smartcontractkit/chainlink-deployments-framework v0.37.1 h1:GqqcSz0egZGS6HGk9CnswvONwVAQsP3VWGpLGj8DR7M=
github.com/smartcontractkit/chainlink-deployments-framework v0.37.1/go.mod h1:nvsOomMe/u/T4vekY7sd10HEGDbvadEw6bUMEblPDP0=
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20250808121824-2c3544aab8f3 h1:SRMNzCdQnF2x6+QlL5YSzVeWyJb/BXqMrg+zSGaBPVg=
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20250808121824-2c3544aab8f3/go.mod h1:3Lsp38qxen9PABVF+O5eocveQev+hyo9HLAgRodBD4Q=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250905211734-167560f092c1 h1:HZt/80mhcNw6/MlYBIRracxfHWNqFF0iZ5nZEVZBUgo=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250905211734-167560f092c1/go.mod h1:jUC52kZzEnWF9tddHh85zolKybmLpbQ1oNA4FjOHt1Q=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250911124514-5874cc6d62b2 h1:1/KdO5AbUr3CmpLjMPuJXPo2wHMbfB8mldKLsg7D4M8=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250911124514-5874cc6d62b2/go.mod h1:jUC52kZzEnWF9tddHh85zolKybmLpbQ1oNA4FjOHt1Q=
github.com/smartcontractkit/chainlink-protos/job-distributor v0.12.0 h1:/bhoALRzNXZkdzxBkNM505pMofNy0K0eW1nCzXw+AUI=
github.com/smartcontractkit/chainlink-protos/job-distributor v0.12.0/go.mod h1:/dVVLXrsp+V0AbcYGJo3XMzKg3CkELsweA/TTopCsKE=
github.com/smartcontractkit/chainlink-testing-framework/framework v0.10.15 h1:OyX2Z68z6VDY4aadqMXjwSTE/0misA5fk8Iq710nxkk=
Expand Down
1 change: 1 addition & 0 deletions execute/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func (p PluginFactory) NewReportingPlugin(
p.ocrConfig.Config.ChainSelector,
offchainConfig.TokenDataObservers,
p.tokenDataEncoder,
p.chainAccessors,
p.extendedReaders,
p.addrCodec,
)
Expand Down
2 changes: 2 additions & 0 deletions execute/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ func (it *IntTest) Start() *testhelpers.OCR3Runner[[]byte] {
})
}

emptyChainAccessors := make(map[cciptypes.ChainSelector]cciptypes.ChainAccessor)
homeChain := setupHomeChainPoller(it.t, it.lggr, chainConfigInfos)
ctx := it.t.Context()
err := homeChain.Start(ctx)
Expand All @@ -277,6 +278,7 @@ func (it *IntTest) Start() *testhelpers.OCR3Runner[[]byte] {
it.dstSelector,
it.tokenObserverConfig,
testhelpers.TokenDataEncoderInstance,
emptyChainAccessors,
it.tokenChainReader,
mockAddrCodec,
)
Expand Down
6 changes: 4 additions & 2 deletions execute/tokendata/observer/observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func NewConfigBasedCompositeObservers(
destChainSelector cciptypes.ChainSelector,
config []pluginconfig.TokenDataObserverConfig,
encoder cciptypes.TokenDataEncoder,
chainAccessors map[cciptypes.ChainSelector]cciptypes.ChainAccessor,
readers map[cciptypes.ChainSelector]contractreader.Extended,
addrCodec cciptypes.AddressCodec,
) (TokenDataObserver, error) {
Expand All @@ -67,9 +68,10 @@ func NewConfigBasedCompositeObservers(
// e.g. observers[i] := config.CreateTokenDataObserver()
switch {
case c.USDCCCTPObserverConfig != nil:
observer, err := usdc.NewUSDCTokenDataObserver(ctx, lggr, destChainSelector,
observer, err := usdc.NewUSDCTokenDataObserver(
ctx, lggr, destChainSelector,
*c.USDCCCTPObserverConfig,
encoder.EncodeUSDC, readers, addrCodec)
encoder.EncodeUSDC, chainAccessors, readers, addrCodec)
if err != nil {
return nil, fmt.Errorf("create USDC/CCTP token observer: %w", err)
}
Expand Down
1 change: 1 addition & 0 deletions execute/tokendata/observer/observer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func Test_CompositeTokenDataObserver_EmptyObservers(t *testing.T) {
[]pluginconfig.TokenDataObserverConfig{},
nil,
nil,
nil,
mockAddrCodec,
)
require.NoError(t, err)
Expand Down
2 changes: 2 additions & 0 deletions execute/tokendata/usdc/usdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func NewUSDCTokenDataObserver(
destChainSelector cciptypes.ChainSelector,
usdcConfig pluginconfig.USDCCCTPObserverConfig,
attestationEncoder AttestationEncoder,
chainAccessors map[cciptypes.ChainSelector]cciptypes.ChainAccessor,
readers map[cciptypes.ChainSelector]contractreader.Extended,
addrCodec cciptypes.AddressCodec,
) (*USDCTokenDataObserver, error) {
Expand All @@ -43,6 +44,7 @@ func NewUSDCTokenDataObserver(
ctx,
lggr,
usdcConfig.Tokens,
chainAccessors,
readers,
addrCodec,
)
Expand Down
2 changes: 2 additions & 0 deletions execute/tokendata/usdc/usdc_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,15 @@ func Test_USDC_CCTP_Flow(t *testing.T) {
},
}

emptyChainAccessors := make(map[cciptypes.ChainSelector]cciptypes.ChainAccessor)
mockAddrCodec := internal.NewMockAddressCodecHex(t)
tkReader, err := usdc.NewUSDCTokenDataObserver(
t.Context(),
logger.Test(t),
baseChain,
config,
testhelpers.USDCEncoder,
emptyChainAccessors,
map[cciptypes.ChainSelector]contractreader.Extended{
fujiChain: mockReader(t, fuji),
sepoliaChain: mockReader(t, sepolia),
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/prometheus/client_golang v1.22.0
github.com/prometheus/client_model v0.6.2
github.com/smartcontractkit/chain-selectors v1.0.67
github.com/smartcontractkit/chainlink-common v0.9.5-0.20250910201107-cb4c31b624d3
github.com/smartcontractkit/chainlink-common v0.9.6-0.20250929154511-1f5fbda7ae76
github.com/smartcontractkit/chainlink-protos/rmn/v1.6/go v0.0.0-20250131130834-15e0d4cde2a6
github.com/smartcontractkit/libocr v0.0.0-20250707144819-babe0ec4e358
github.com/stretchr/testify v1.10.0
Expand Down Expand Up @@ -82,8 +82,8 @@ require (
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.1 // indirect
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250905211734-167560f092c1 // indirect
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.4 // indirect
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250911124514-5874cc6d62b2 // indirect
github.com/stephenlacy/go-ethereum-hdwallet v0.0.0-20230913225845-a4fa94429863 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/supranational/blst v0.3.14 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/smartcontractkit/chain-selectors v1.0.67 h1:gxTqP/JC40KDe3DE1SIsIKSTKTZEPyEU1YufO1admnw=
github.com/smartcontractkit/chain-selectors v1.0.67/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8=
github.com/smartcontractkit/chainlink-common v0.9.5-0.20250910201107-cb4c31b624d3 h1:dMvSvJ7nRAQViYSjdfj/vRGLULY7mJ3X4UgsPMmXgOI=
github.com/smartcontractkit/chainlink-common v0.9.5-0.20250910201107-cb4c31b624d3/go.mod h1:1diMLMwfIACeqJFt7ySGaBrJIeUwHTLhVVYlb41EyKk=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.1 h1:ca2z5OXgnbBPQRxpwXwBLJsUA1+cAp5ncfW4Ssvd6eY=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.1/go.mod h1:NZv/qKYGFRnkjOYBouajnDfFoZ+WDa6H2KNmSf1dnKc=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250905211734-167560f092c1 h1:HZt/80mhcNw6/MlYBIRracxfHWNqFF0iZ5nZEVZBUgo=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250905211734-167560f092c1/go.mod h1:jUC52kZzEnWF9tddHh85zolKybmLpbQ1oNA4FjOHt1Q=
github.com/smartcontractkit/chainlink-common v0.9.6-0.20250929154511-1f5fbda7ae76 h1:Slnws8RoXRUYGgEMYK6X2yYzjZwNgVb93PxU45VEObQ=
github.com/smartcontractkit/chainlink-common v0.9.6-0.20250929154511-1f5fbda7ae76/go.mod h1:1r3aM96KHAESfnayJ3BTHCkP1qJS1BEG1r4czeoaXlA=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.4 h1:hvqATtrZ0iMRTI80cpBot/3JFbjz2j+2tvpfooVhRHw=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.4/go.mod h1:eKGyfTKzr0/PeR7qKN4l2FcW9p+HzyKUwAfGhm/5YZc=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250911124514-5874cc6d62b2 h1:1/KdO5AbUr3CmpLjMPuJXPo2wHMbfB8mldKLsg7D4M8=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250911124514-5874cc6d62b2/go.mod h1:jUC52kZzEnWF9tddHh85zolKybmLpbQ1oNA4FjOHt1Q=
github.com/smartcontractkit/chainlink-protos/rmn/v1.6/go v0.0.0-20250131130834-15e0d4cde2a6 h1:L6KJ4kGv/yNNoCk8affk7Y1vAY0qglPMXC/hevV/IsA=
github.com/smartcontractkit/chainlink-protos/rmn/v1.6/go v0.0.0-20250131130834-15e0d4cde2a6/go.mod h1:FRwzI3hGj4CJclNS733gfcffmqQ62ONCkbGi49s658w=
github.com/smartcontractkit/libocr v0.0.0-20250707144819-babe0ec4e358 h1:+NVzR5LZVazRUunzVn34u+lwnpmn6NTVPCeZOVyQHLo=
Expand Down
31 changes: 15 additions & 16 deletions mocks/chainlink_common/ccipocr3/chain_accessor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 14 additions & 23 deletions pkg/chainaccessor/default_price_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,33 +107,21 @@ func normalizePrice(price *big.Int, decimals uint8) *big.Int {

func (l *DefaultAccessor) GetFeeQuoterTokenUpdates(
ctx context.Context,
tokens []ccipocr3.UnknownEncodedAddress,
chain ccipocr3.ChainSelector,
tokenBytes []ccipocr3.UnknownAddress,
) (map[ccipocr3.UnknownEncodedAddress]ccipocr3.TimestampedUnixBig, error) {
lggr := logutil.WithContextValues(ctx, l.lggr)
byteTokens := make([][]byte, 0, len(tokens))
for _, token := range tokens {
tokenAddressBytes, err := l.addrCodec.AddressStringToBytes(string(token), chain)
if err != nil {
lggr.Warnw("failed to convert token address to bytes", "token", token, "err", err)
continue
}

byteTokens = append(byteTokens, tokenAddressBytes)
}

feeQuoterAddress, err := l.GetContractAddress(consts.ContractNameFeeQuoter)
if err != nil {
return nil, fmt.Errorf("failed to get fee quoter address: %w", err)
}

feeQuoterAddressStr, err := l.addrCodec.AddressBytesToString(feeQuoterAddress[:], chain)
feeQuoterAddressStr, err := l.addrCodec.AddressBytesToString(feeQuoterAddress[:], l.chainSelector)
if err != nil {
lggr.Warnw("failed to convert fee quoter address to string", "chain", chain, "err", err)
lggr.Warnw("failed to convert fee quoter address to string", "chain", l.chainSelector, "err", err)
return make(map[ccipocr3.UnknownEncodedAddress]ccipocr3.TimestampedUnixBig), nil
}

updates := make([]ccipocr3.TimestampedUnixBig, len(tokens))
updates := make([]ccipocr3.TimestampedUnixBig, len(tokenBytes))
boundContract := types.BoundContract{
Address: feeQuoterAddressStr,
Name: consts.ContractNameFeeQuoter,
Expand All @@ -147,24 +135,27 @@ func (l *DefaultAccessor) GetFeeQuoterTokenUpdates(
boundContract.ReadIdentifier(consts.MethodNameFeeQuoterGetTokenPrices),
primitives.Unconfirmed,
map[string]any{
"tokens": byteTokens,
"tokens": tokenBytes,
},
&updates,
); err != nil {
return nil, fmt.Errorf("failed to get fee quoter token updates: %w", err)
}

updateMap := make(map[ccipocr3.UnknownEncodedAddress]ccipocr3.TimestampedUnixBig)
for i, token := range tokens {
for i, token := range tokenBytes {
tokenAddressStr, err := l.addrCodec.AddressBytesToString(token[:], l.chainSelector)
if err != nil {
lggr.Errorw("failed to convert token address to string", "token", token, "chain", l.chainSelector, "err", err)
continue
}

// token not available on fee quoter
if updates[i].Timestamp == 0 || updates[i].Value == nil || updates[i].Value.Cmp(big.NewInt(0)) == 0 {
lggr.Debugw("empty fee quoter update found",
"chain", chain,
"token", token,
)
lggr.Debugw("empty fee quoter update found", "chain", l.chainSelector, "token", tokenAddressStr)
continue
}
updateMap[token] = updates[i]
updateMap[ccipocr3.UnknownEncodedAddress(tokenAddressStr)] = updates[i]
}

return updateMap, nil
Expand Down
13 changes: 12 additions & 1 deletion pkg/reader/price_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,25 @@ func (pr *priceReader) GetFeeQuoterTokenUpdates(
) (map[ccipocr3.UnknownEncodedAddress]ccipocr3.TimestampedBig, error) {
lggr := logutil.WithContextValues(ctx, pr.lggr)

tokensBytes := make([]ccipocr3.UnknownAddress, 0, len(tokens))
for _, token := range tokens {
tokenAddressBytes, err := pr.addressCodec.AddressStringToBytes(string(token), chain)
if err != nil {
lggr.Warnw("failed to convert token address to bytes", "token", token, "err", err)
continue
}

tokensBytes = append(tokensBytes, tokenAddressBytes)
}

accessor, err := getChainAccessor(pr.chainAccessors, chain)
if err != nil {
// Don't return an error if the chain accessor is not found, just log warning and return nil
lggr.Warnw("chain accessor not found", "chain", chain, "err", err)
return nil, nil
}

updates, err := accessor.GetFeeQuoterTokenUpdates(ctx, tokens, chain)
updates, err := accessor.GetFeeQuoterTokenUpdates(ctx, tokensBytes)
if err != nil {
return nil, fmt.Errorf("failed to get fee quoter token updates: %w", err)
}
Expand Down
Loading
Loading