Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCIP-4748 CCTP Upgradeability Fix #16140

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

0xsuryansh
Copy link
Member

@0xsuryansh 0xsuryansh commented Jan 30, 2025

Problem

When upgrading the pool contract on the destination chain, any CCTP messages created on the source chain during the transition still reference the old destination pool address in their allowedCaller. Since the CCTPMessageTransmitter enforces a match with the allowedCaller in the message, these messages fail verification and revert when processed on the destination chain.

Solution

To prevent this issue, we introduce a permanent forwarding contract (CCTPMessageTransmitterProxy) that acts as the stable allowedCaller. Instead of setting the pool contract directly as the allowedCaller, we register this proxy, ensuring that:

  • The destinationCaller in all CCTP messages always points to the proxy, which does not change.
  • The proxy forwards messages to the active token pool, enabling seamless upgrades without breaking message verification.

Changes

  • New Contract: CCTPMessageTransmitterProxy
    • Serves as a fixed allowedCaller, preventing mismatches during upgrades.
    • Forwards messages to the latest token pool.
  • Updated USDCTokenPool Contract
    • Accepts the proxy address in its constructor.
    • Ensures only messages forwarded through the proxy are processed.

Deployment & Upgrade Steps

  1. Deploy CCTPMessageTransmitterProxy.
  2. Register this proxy's address as Domain.allowedCaller on the source chain pool.
  3. Deploy the new USDCTokenPool, passing the proxy address.
  4. Call updatePool in CCTPMessageTransmitterProxy to register the new pool contract.

@0xsuryansh 0xsuryansh requested a review from a team as a code owner January 30, 2025 10:22
Copy link
Contributor

github-actions bot commented Jan 30, 2025

Static analysis results are available

Hey @0xsuryansh, you can view Slither reports in the job summary here or download them as artifact here.
Please check them before merging and make sure you have addressed all issues.

@0xsuryansh 0xsuryansh changed the title CCCIP-4748 CCTP Upgradeability Fix CCIP-4748 CCTP Upgradeability Fix Jan 30, 2025
Copy link
Contributor

github-actions bot commented Jan 30, 2025

AER Report: CI Core

aer_workflow , commit , Clean Go Tidy & Generate , Detect Changes , Scheduled Run Frequency , Core Tests (go_core_tests) , Core Tests (go_core_tests_integration) , Core Tests (go_core_ccip_deployment_tests) , Core Tests (go_core_fuzz) , GolangCI Lint (.) , Core Tests (go_core_race_tests) , GolangCI Lint (integration-tests) , GolangCI Lint (deployment) , test-scripts , lint , SonarQube Scan

1. Test failure in github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/executable:[Run tests]

Source of Error:
Run tests	2025-02-05T18:48:22.0673398Z FAIL
Run tests	2025-02-05T18:48:22.0673931Z FAIL	github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/executable	632.971s

Why: The test suite for github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/executable failed. The exact reason for the failure is not provided in the logs, but it indicates that the tests did not pass within the allotted time or encountered an error.

Suggested fix: Investigate the specific test cases within the github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/executable package to identify the root cause of the failure. Check for any timeouts, unhandled exceptions, or logic errors in the tests.

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

# Conflicts:
#	core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt
#	deployment/ccip/changeset/cs_prerequisites.go
#	integration-tests/ccip-tests/contracts/contract_deployer.go
Copy link
Contributor

github-actions bot commented Feb 3, 2025

Solidity Review Jira issue

Hey! We have taken the liberty to link this PR to a Jira issue for Solidity Review.

This is a new feature, that's currently in the pilot phase, so please make sure that the linkage is correct. In a contrary case, please update it manually in JIRA and replace Solidity Review issue key in the changeset file with the correct one.
Please reach out to the Test Tooling team and notify them about any issues you encounter.

Any changes to the Solidity Review Jira issue should be reflected in the changeset file. If you need to update the issue key, please do so manually in the following changeset file: contracts/.changeset/brave-keys-enjoy.md

This PR has been linked to Solidity Review Jira issue: CCIP-3966

@@ -0,0 +1,46 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not: missing natspec on contact and functions

Copy link
Member Author

Choose a reason for hiding this comment

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

Added

@@ -146,7 +151,7 @@ contract USDCTokenPool is TokenPool, ITypeAndVersion {

_validateMessage(msgAndAttestation.message, sourceTokenDataPayload);

if (!i_messageTransmitter.receiveMessage(msgAndAttestation.message, msgAndAttestation.attestation)) {
if (!i_messageTransmitterProxy.receiveMessage(msgAndAttestation.message, msgAndAttestation.attestation)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you include a comment about why changes don't need to be made for outgoing messages and if the domain config needs to be modified to support incoming messages being received by the proxy and not the token pool?

Copy link
Member Author

Choose a reason for hiding this comment

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

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