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

Multi-OffRamp - per-chain configs #761

Merged
merged 20 commits into from May 8, 2024

Conversation

elatoskinas
Copy link
Collaborator

@elatoskinas elatoskinas commented Apr 26, 2024

Motivation

Implements per-chain source configs in the MultiOffRamp, which allows an OffRamp to support more than one source configuration

Solution

Modifies the MultiOffRamp configs to be per-chain, along with getters and setters. Puts TODOs for execution and other functional parts

Focus: The focus of the PR are the source config state, event, set/get and constructor changes

Out of scope for this PR:

  • State changes to be per-chain
  • Per-chain ARL
  • Full test coverage for non-config setters / getters

Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset.

Copy link
Contributor

I see you updated files related to contracts. Please run pnpm changeset in the contracts directory to add a changeset.


import {IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";

contract EVM2EVMMultiOffRampSetup is TokenSetup, PriceRegistrySetup, OCR2BaseSetup {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

note: mostly a copy of EVM2EVMOffRampSetup

/// @param encodedSourceTokenData Array of token data returned by token pools on the source chain.
/// @param offchainTokenData Array of token data fetched offchain by the DON.
/// @dev This function wrappes the token pool call in a try catch block to gracefully handle
/// any non-rate limiting errors that may occur. If we encounter a rate limiting related error
/// we bubble it up. If we encounter a non-rate limiting error we wrap it in a TokenHandlingError.
function _releaseOrMintTokens(
Client.EVMTokenAmount[] memory sourceTokenAmounts,
bytes memory originalSender,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

note: hitting the stack depth limit - using struct instead

Copy link
Collaborator

Choose a reason for hiding this comment

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

add a todo for this here; Pool interface will likely chance, currently being worked on by Rens, that might impact stack depth again

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I pulled in the new changes. Stack depth issues are still present, so we will have to go with the struct

Copy link
Contributor

github-actions bot commented Apr 26, 2024

LCOV of commit 31e765b during Solidity Foundry #4148

Summary coverage rate:
  lines......: 98.7% (1119 of 1134 lines)
  functions..: 96.1% (244 of 254 functions)
  branches...: 91.8% (437 of 476 branches)

Files changed coverage rate: n/a

// already has roots committed.
// if (ICommitStore(staticConfig.commitStore).getExpectedNextSequenceNumber() != 1) revert CommitStoreAlreadyInUse();

// TODO: confirm if re-updating is allowed
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note: out-of-scope for this PR

@elatoskinas elatoskinas marked this pull request as ready for review April 26, 2024 11:39
@elatoskinas elatoskinas requested review from RensR, matYang, makramkd and a team as code owners April 26, 2024 11:39
@elatoskinas elatoskinas changed the title Multi-OffRamps - per-chain configs Multi-OffRamp - per-chain configs Apr 26, 2024
Copy link
Contributor

github-actions bot commented May 3, 2024

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

Copy link
Collaborator

@matYang matYang left a comment

Choose a reason for hiding this comment

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

overall LGTM, please address @RayXpub's lints above; can do a followup PR once the per-lane v.s per-chain convo resolves

address armProxy; // ARM proxy address
}

/// @notice Per-chain source config (defining a lane from a Source Chain -> Dest OffRamp)
struct SourceChainConfig {
bool isEnabled; // ─────────╮ Flag whether the source chain is enabled or not
Copy link
Collaborator

Choose a reason for hiding this comment

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

quick note, when it comes to it, isEnabled should be moved to same slot as onRamp, given prevOffRamp isnt always read

@elatoskinas elatoskinas merged commit 499bfa7 into ccip-develop May 8, 2024
85 of 86 checks passed
@elatoskinas elatoskinas deleted the feat/multi-offramp-source-config branch May 8, 2024 11:44
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.

None yet

4 participants