Skip to content

CCIP - add price reader interfaces to ChainAccessor and move some generic types, clean others up#1487

Merged
archseer merged 10 commits intomainfrom
ogt/chain-accessor-add-price-reader-interfaces
Sep 10, 2025
Merged

CCIP - add price reader interfaces to ChainAccessor and move some generic types, clean others up#1487
archseer merged 10 commits intomainfrom
ogt/chain-accessor-add-price-reader-interfaces

Conversation

@ogtownsend
Copy link
Copy Markdown
Contributor

@ogtownsend ogtownsend commented Aug 19, 2025

The last remaining components to be migrated off of ChainReader and to ChainAccessor that will be required by Solana and TON are PriceReader and USDCReader.

Note: these are not required for the TON2EVM E2E test, but will be needed for future TON milestones and for LOOPPed Solana.

This PR:

  • Adds the USDCMessageReader and PriceReader interfaces to the ChainAccessor interface
  • Adds their protobuf definitions
  • Adds their gRPC wrapper conversion logic
  • Moves a few types from pkg/types/ccipocr3/chainaccessor.go to a better home
  • GetLatestPriceSeqNr(ctx context.Context) (uint64, error) uses uint64 as the return value but other code paths use ccipocr3.SeqNum, update to ccipocr3.SeqNum
  • Updates GetChainFeePriceUpdate to return an error
  • GetTokenPriceUSD returns a ccipocr3.TimestampedUnixBig, but GetChainFeePriceUpdate returns a map[ccipocr3.ChainSelector]ccipocr3.TimestampedBig, prefer to use TimestampedUnixBig
  • Adds persistence for chain accessor Sync() calls inside the grpc client and server impls

Corresponding cl-ccip PR: smartcontractkit/chainlink-ccip#1175

resp[contract][chain] = address
return resp
}
type PriceReader interface {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

// USDCMessageReader retrieves each of the CCTPv1 MessageSent event created
// when a ccipSend is made with USDC token transfer. The events are created
// when the USDC Token pool calls the 3rd party MessageTransmitter contract.
type USDCMessageReader interface {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This will replace chainlink-ccip/pkg/reader/usdc_reader.go for solana and EVM

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Sep 4, 2025

apidiff results - backwards-incompatible changes detected ❌

Module: github-com-smartcontractkit-chainlink-common

Status: ❌ 10 incompatible, 5 compatible

Incompatible Changes (10)

Element Change
./pkg/types/ccipocr3.DestinationAccessor.GetChainFeePriceUpdate changed from func(context.Context, []ChainSelector) map[ChainSelector]TimestampedBig to func(context.Context, []ChainSelector) (map[ChainSelector]TimestampedUnixBig, error)
./pkg/types/ccipocr3.DestinationAccessor.GetLatestPriceSeqNr changed from func(context.Context) (uint64, error) to func(context.Context) (SeqNum, error)
./pkg/types/ccipocr3.NewTimestampedBig changed from func(int64, time.Time) TimestampedBig to func(int64, time.Time) TimestampedBig
./pkg/types/ccipocr3.PriceReader.GetFeedPricesUSD added
./pkg/types/ccipocr3.PriceReader.GetFeeQuoterTokenUpdates added
./pkg/types/ccipocr3.TimestampedBig changed from TimestampedBig to TimestampedBig
./pkg/types/ccipocr3.TimestampedBig.Timestamp changed from time.Time to uint32
./pkg/types/ccipocr3.TimestampedBig.Value changed from BigInt to *math/big.Int
./pkg/types/ccipocr3.TimeStampedBigFromUnix changed from func(TimestampedUnixBig) TimestampedBig to func(TimestampedUnixBig) TimestampedBig
./pkg/types/ccipocr3.USDCMessageReader.MessagesByTokenID added

(Full summary: https://github.com/smartcontractkit/chainlink-common/actions/runs/17624183574/#summary-50076828284)

@ogtownsend ogtownsend changed the title CCIP - add price reader interfaces to ChainAccessor and move some generic types CCIP - add price reader interfaces to ChainAccessor and move some generic types, clean others up Sep 4, 2025
@ogtownsend ogtownsend force-pushed the ogt/chain-accessor-add-price-reader-interfaces branch from 52d976b to dedf05b Compare September 4, 2025 18:28
@ogtownsend ogtownsend marked this pull request as ready for review September 4, 2025 18:28
@ogtownsend ogtownsend requested review from a team as code owners September 4, 2025 18:28
Comment thread pkg/loop/internal/relayer/relayer.go Outdated
Comment on lines +295 to +298
var pbSyncs []*pb.SyncRequest
for _, s := range persistedSyncs {
pbSyncs = append(pbSyncs, &pb.SyncRequest{
ContractName: s.ContractName,
ContractAddress: s.ContractAddress,
})
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I ran into protoc gen madness trying to reuse the chain accessor pb.SyncRequest, the import "models.proto"; in chainlink-common/pkg/loop/internal/pb/ccipocr3/chainaccessor.proto caused several build issues when trying to import SyncRequest into relayer.proto

// If grpc call succeeded, store the sync request contents so we can re-populate them if the relayer restarts.
if err != nil {
c.mu.Lock()
c.syncs = append(c.syncs, req) // TODO: maybe dedupe these if needed
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sync() is called many times, this will grow very quickly, should likely change to a map

@ogtownsend
Copy link
Copy Markdown
Contributor Author

👋 @archseer @winder @jmank88 , can I get some eyes on this PR please?

Comment thread pkg/loop/internal/relayer/pluginprovider/ext/ccipocr3/chainaccessor.go Outdated
Comment thread pkg/loop/internal/relayer/pluginprovider/ext/ccipocr3/chainaccessor.go Outdated
archseer
archseer previously approved these changes Sep 10, 2025
archseer
archseer previously approved these changes Sep 10, 2025
Comment thread pkg/loop/internal/relayer/relayer.go Outdated
jmank88
jmank88 previously approved these changes Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants