Skip to content

Conversation

@toblich
Copy link
Contributor

@toblich toblich commented Jun 13, 2025

Includes changes from #1004 and #982, and more. Main changes:

  • New CCTP Token Pool
  • Support for Router & Offramp to dynamically discover the accounts that the token pool requires, and allowing those to reach the pools

Other minor changes:

  • Introduction of the new "total nonce" counter, and slight change to the token pool's onramp interface for it to be sent along 👉 This means that the router has to be upgraded before any pool can be upgraded to the latest version.
  • Migration of the Nonce PDAs and TokenAdminRegistry PDAs to their respective new versions

devin-ai-integration bot and others added 30 commits June 11, 2025 14:46
…lizing CCTP (#1)

# Solana USDC Token Pool for CCIP utilizing CCTP

This PR adds a new Solana contract that acts as a USDC Token Pool for
CCIP, utilizing CCTP. The implementation follows the existing burnmint
token pool interface and integrates with CCTP for cross-chain USDC
transfers.

## Implementation Details

- Created a new Anchor program for the USDC Token Pool using Anchor 0.29
- Implemented the burnmint token pool interface for compatibility with
existing CCIP infrastructure
- Added CCTP integration for token burning and minting
- Utilized CCTP's `deposit_for_burn_with_caller` for token burning
during onramp
- Utilized CCTP's `receive_message` for token minting during offramp

## TODO

- Complete the implementation of the CCTP integration with actual
cross-program invocations
- Add unit tests for the USDC Token Pool
- Update the program ID with a proper ID when registered

## Link to Devin run
https://app.devin.ai/sessions/79017ec0e8f440208faf891fbf4eeef8

Requested by: tobias.lichtig@smartcontract.com

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: tobias.lichtig@smartcontract.com <toblich@gmail.com>
Co-authored-by: Tobías Lichtig <toblich@users.noreply.github.com>
…lana contract (#2)

# Mock CCTP Message Transmitter Contract for Solana

This PR adds a mock implementation of the CCTP message_transmitter
Solana contract for integration testing purposes. The mock adheres to
the same interface as the real contract but with minimal logic.

## Implementation Details

- Created a new Anchor program in
`chainlink-ccip/chains/solana/contracts/programs/cctp-message-transmitter-mock`
- Implemented all methods from the original contract with minimal logic
- Added proper account structures and instruction parameters to match
the original interface
- Used the same program ID as the real contract for easy substitution in
tests
- Added `/// CHECK:` comments for all unchecked accounts to satisfy
Anchor's safety requirements

## Testing

- Verified that the contract compiles successfully with `anchor build`

This will facilitate future integration tests where the CCTP contracts
are treated as external dependencies that require mocking.

Link to Devin run:
https://app.devin.ai/sessions/819f9620d87940b1968c0442e71881eb
Requested by: tobias.lichtig@smartcontract.com

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: tobias.lichtig@smartcontract.com <toblich@gmail.com>
Co-authored-by: Tobías Lichtig <toblich@users.noreply.github.com>
… Solana contract (#3)

# Mock CCTP Token Messenger Minter Contract for Solana

This PR adds a mock implementation of the CCTP token-messenger-minter
Solana contract for integration testing purposes. The mock adheres to
the same interface as the real contract but with minimal logic.

## Implementation Details

- Created a new Anchor program in
`chainlink-ccip/chains/solana/contracts/programs/cctp-token-messenger-minter-mock`
- Implemented all methods from the original contract with minimal logic
- Added proper account structures and instruction parameters to match
the original interface
- Used the same program ID as the real contract for easy substitution in
tests
- Added `/// CHECK:` comments for all unchecked accounts to satisfy
Anchor's safety requirements

## Testing

- Verified that the contract compiles successfully with `anchor build`

This will facilitate future integration tests where the CCTP contracts
are treated as external dependencies that require mocking.

Link to Devin run:
https://app.devin.ai/sessions/819f9620d87940b1968c0442e71881eb
Requested by: tobias.lichtig@smartcontract.com

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: tobias.lichtig@smartcontract.com <toblich@gmail.com>
Co-authored-by: Tobías Lichtig <toblich@users.noreply.github.com>
)

Removes the CCTP mocks. Instead, starts a tokenpool test suite that uses
the real CCTP contracts (deployed locally and initialized/configured),
so we can test the actual integration.
…e seed. Add new field in Nonce account (#8)

For CCTP, we need to derive the message-sent account address
deterministically so as to make discoverability for the offchain easy.
This adds a new full_nonce that is always incremented, and identifies
any message for a particular user to a particular destination chain.
This PR also includes (untested) code to migrate the Nonce account from
the single-counter schema to the new extended dual-counter one.
Because EVM does not have access to the token receiver's ATA, the CCTP
message cannot be sent from EVM with the right mint_recipient. Thus, the
workaround is to always send the CCTP funds to an intermediary TP-owned
ATA, and then have the TP transfer the funds to the actual token
receiver.
…of the cctp message event account (#10)

The offchain does not have easy access to the new `full_nonce` of the
message. So, emit a new event in the TP that allows it to get to CCTP's
message sent event
Working on devnet, until the point where it fails to serialize from router -> tp

Able to send a message

On the way to fixing nonce migration

Improved nonce account handling

Cleanup
Support messaging accounts

Integration tests for the message-only case

Refactor and cleanup
@toblich toblich requested a review from PabloMansanet July 4, 2025 21:55
@toblich toblich marked this pull request as ready for review July 4, 2025 21:56
@toblich toblich requested a review from a team as a code owner July 4, 2025 21:56
@toblich toblich changed the title [WIP] SVM CCTP Token Pool + SVM accounts auto-derivation SVM CCTP Token Pool + SVM accounts auto-derivation Jul 4, 2025
@toblich toblich enabled auto-merge July 4, 2025 22:01
/// again, including exactly these accounts as the `remaining_accounts`.
/// * `lookup_tables_to_save`: The caller must save those LUTs. They can be used for `ccip_execute`.
/// * `current_stage`: A string describing the current stage of the derivation process. When the stage
/// is "TokenTransferAccounts", it means the `accounts_to_save` block in this response contains
Copy link
Contributor

Choose a reason for hiding this comment

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

Follow up: Update this comment.

FinishMainAccountList,
RetrieveTokenLUTs,
RetrievePoolPrograms,
// N stages, one per token
Copy link
Contributor

Choose a reason for hiding this comment

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

Follow up: Remove this line

/// again, including exactly these accounts as the `remaining_accounts`.
/// * `lookup_tables_to_save`: The caller must save those LUTs. They can be used for `ccip_send`.
/// * `current_stage`: A string describing the current stage of the derivation process. When the stage
/// is "TokenTransferAccounts", it means the `accounts_to_save` block in this response contains
Copy link
Contributor

Choose a reason for hiding this comment

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

Update comment

@github-actions
Copy link

github-actions bot commented Jul 7, 2025

Metric feat/svm-cctp main
Coverage 70.1% 69.7%

@toblich toblich added this pull request to the merge queue Jul 7, 2025
Merged via the queue into main with commit d1f5f0b Jul 7, 2025
63 of 234 checks passed
@toblich toblich deleted the feat/svm-cctp branch July 8, 2025 18:28
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.

2 participants