Skip to content

feat(tokenverifier)!: CCTPCodec via the chain accessor - #1450

Open
jadepark-dev wants to merge 10 commits into
mainfrom
jade/cctp-selectors
Open

jadepark-dev wants to merge 10 commits into
mainfrom
jade/cctp-selectors

Conversation

@jadepark-dev

@jadepark-dev jadepark-dev commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Description

The CCTP token verifier held its chain knowledge in verifier/pkg/token/cctp: a static Domains map, plus encodeTxHash and decodeAddress branching on the chain family. A source chain with no Domains entry failed at Fetch with unsupported source chain selector, before the attestation API call, so the local devenv Solana chain never attested and the indexer returned 404.

This change moves that knowledge to the chain accessor. chainaccess.CCTPCodec is a new interface in pkg/chainaccess with three methods: Domain, EncodeTxHash, and DecodeAddress. Accessor exposes it through CCTPCodec(), the same way it exposes SourceReader(). cmd/verifier/tokenfactory.go builds a map[protocol.ChainSelector]chainaccess.CCTPCodec from the accessors it already resolves, and Fetch reads that map. cctp.Domains keeps only the EVM entries; each chain repository owns its own table, and the Solana table lives in the paired chainlink-ccip-solana PR.

Breaking: cctp.NewAttestationService takes the codec map as a new required argument; a source chain whose accessor does not implement CCTPCodec now fails at Fetch with no CCTP chain codec for source chain selector instead of failing at startup; an EVM-only verifier is unchanged. See changelog/2026-09-15_injectable_cctp_chain_codecs.md.

Testing

go test ./pkg/chainaccess/... ./integration/pkg/accessors/evm/... ./verifier/pkg/token/cctp/... ./cmd/verifier/... passes. integration/pkg/accessors/evm/codec_test.go covers the EVM codec, and attestation_test.go covers the codec path. go build ./... and golangci-lint are clean. The paired chainlink-ccip-solana case TestSolana2EVM/TokenTransfer/CCTP passes on a local devenv with this change.

Checklist

huangzhen1997
huangzhen1997 previously approved these changes Sep 15, 2026

@huangzhen1997 huangzhen1997 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can probably also add the Solana localnets to verifier/pkg/token/cctp/consts.go

@jadepark-dev
jadepark-dev marked this pull request as ready for review September 16, 2026 14:25
@jadepark-dev
jadepark-dev requested review from a team as code owners September 16, 2026 14:25
Copilot AI lite review requested due to automatic review settings September 16, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

An adapter-registration test gap and documentation inconsistency remain unresolved, warranting final human review.

Pull request overview

Refactors CCTP chain-specific behavior into injectable family adapters, enabling external Solana support while preserving EVM behavior.

Changes:

  • Adds adapter registration and an EVM implementation.
  • Routes attestation and message matching through adapters.
  • Documents the breaking integration change.
File summaries
File Summary
verifier/pkg/token/cctp/consts.go Restricts the domain catalog to EVM chains.
verifier/pkg/token/cctp/attestation.go Uses adapters for attestation processing.
verifier/pkg/token/cctp/attestation_solana_test.go Removes tests for externally provided Solana codecs.
verifier/pkg/token/cctp/adapter.go Defines the adapter interface and registry.
verifier/pkg/token/cctp/adapter_evm.go Implements and registers the EVM adapter.
verifier/pkg/token/cctp/adapter_evm_test.go Tests adapter resolution and EVM codecs.
go.mod Updates base58 dependency classification.
changelog/2026-09-15_injectable_cctp_chain_adapters.md Documents migration and breaking behavior.
Review details

Suppressed comments (2)

verifier/pkg/token/cctp/adapter_evm_test.go:23

  • This test does not exercise the missing-registration branch it claims to cover: selector 1 fails inside GetSelectorFamily, so AdapterFor never reaches the !ok lookup at adapter.go:49-52. Use a known family without an adapter in this package (for example chainsel.SOLANA_DEVNET) so regressions in the unregistered-family path are caught.
func TestAdapterForUnregisteredFamily(t *testing.T) {
	// Selector 1 is in no chain-selectors family map, so no adapter can be resolved.
	_, err := AdapterFor(protocol.ChainSelector(1))
	require.Error(t, err)

verifier/pkg/token/cctp/consts.go:21

  • verifier/docs/token_verifier.md:150 still says the full domain table is defined in consts.go, but this change makes Domains EVM-only and moves Solana domains into the family adapter. Update that documentation so non-EVM consumers are not directed to an incomplete catalog.
// Solana selectors are absent: the Solana adapter owns that table.
  • Files reviewed: 8/8 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jadepark-dev jadepark-dev changed the title feat(tokenverifier)!: injectable CCTP chain adapters feat(tokenverifier)!: injectable CCTP chain codecs Sep 16, 2026
Comment thread verifier/pkg/token/cctp/codec.go Outdated
Comment on lines +10 to +17
// ChainCodec holds the chain-family-specific CCTP knowledge the verifier needs: the
// Circle domain of a source chain, and the codecs for that chain's native transaction
// hash and address encodings.
//
// One codec exists per chain family. The EVM codec lives in this package; other families
// register theirs from their own module. The verifier resolves the codec from the source
// chain's family, so the core path holds no chain-specific branch.
type ChainCodec interface {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I feel like this should be defined in pkg/chainaccess and added to the Accessor interface, since that is the standard registration pattern already defined in the protocol module for chain-specific deps.

type Accessor interface {
// already defined things ...
  CCTPCodec() CCTPCodec
}

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.

Hmm I thought about this, felt like mixing layers into Accessor.. but yeah probably it's better than scattering them out


## Migration Guide

Do nothing for an EVM-only token verifier.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ideally we dogfood it for EVM as well - lets not have it be a special case. I believe if you go the accessor path, it'll be a standard case like Solana.

@jadepark-dev jadepark-dev changed the title feat(tokenverifier)!: injectable CCTP chain codecs feat(tokenverifier)!: CCTPCodec via the chain accessor Sep 17, 2026
@github-actions

Copy link
Copy Markdown

Code coverage report:

Package main jade/cctp-selectors Diff
github.com/smartcontractkit/chainlink-ccv/aggregator 50.88% 50.87% -0.01%
github.com/smartcontractkit/chainlink-ccv/bootstrap 72.00% 72.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/cli 50.62% 50.62% +0.00%
github.com/smartcontractkit/chainlink-ccv/cmd 40.02% 39.10% -0.92%
github.com/smartcontractkit/chainlink-ccv/common 48.13% 48.13% +0.00%
github.com/smartcontractkit/chainlink-ccv/executor 42.80% 42.80% +0.00%
github.com/smartcontractkit/chainlink-ccv/indexer 37.27% 37.23% -0.04%
github.com/smartcontractkit/chainlink-ccv/integration 61.39% 61.77% +0.38%
github.com/smartcontractkit/chainlink-ccv/internal 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/migration 78.70% 78.70% +0.00%
github.com/smartcontractkit/chainlink-ccv/pkg 100.00% 100.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/pricer 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/protocol 67.04% 67.04% +0.00%
github.com/smartcontractkit/chainlink-ccv/tools 43.61% 43.61% +0.00%
github.com/smartcontractkit/chainlink-ccv/verifier 36.61% 36.95% +0.34%
Total 51.10% 51.10% +0.00%

Files added (in jade/cctp-selectors):

  • github.com/smartcontractkit/chainlink-ccv/integration/pkg/accessors/evm/cctp_codec.go
  • github.com/smartcontractkit/chainlink-ccv/integration/pkg/accessors/evm/cctp_domains.go

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