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

Multiple offramps support according to CCIP minor version [NONEVM-1200] #501

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

toblich
Copy link
Contributor

@toblich toblich commented Jan 24, 2025

This PR differentiates the offramp between CCIP minor versions, so that a message must be executed invoking the same offramp that it was committed in.

⚠️ Interface changes:

  • Split add_chain_selector into two methods, one for the source chain (versioned) and one for the dest chain (unversioned, as we can't change PDAs in the onramp transparently to the end user).
  • Offramp methods require passing in a ccip_version parameter
  • Seeds for some PDAs now include the ccip_version in them

TODOs (may be separate PRs to not make this one grow even more)

  • Add support to reset the onramp seq nr when versions are bumped
  • Add support to rollback the onramp version state

Comment on lines -320 to -332
#[derive(Accounts)]
pub struct UpdateSupportedChainsConfigCCIPRouter<'info> {
#[account(
mut,
seeds = [CONFIG_SEED],
bump,
constraint = valid_version(config.load()?.version, MAX_CONFIG_V) @ CcipRouterError::InvalidInputs, // validate state version
)]
pub config: AccountLoader<'info, Config>,
#[account(address = config.load()?.owner @ CcipRouterError::Unauthorized)]
pub authority: Signer<'info>,
pub system_program: Program<'info, System>,
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seemed to be dead code

Comment on lines +32 to +33
pub const DEST_CHAIN_SEED: &[u8] = b"dest_chain_state";
pub const SOURCE_CHAIN_SEED: &[u8] = b"source_chain_state";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm removing the state bit of the names here as they hold config & state. I left the seeds untouched to no affect offchain code that may already be using those values though. If you think it's ok to change the seed values and just notify people, I'll happily do it.

@toblich toblich force-pushed the refactor/versioned-state branch from d15f05f to 63fb48a Compare January 24, 2025 20:04
Copy link

Metric refactor/versioned-state main
Coverage 76.5% 76.4%

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.

1 participant