Skip to content

Commit

Permalink
Merge branch 'ccip-develop' into fix/backfilled-oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-sekara authored Jul 24, 2024
2 parents 17a02a4 + 054de17 commit a51b37a
Show file tree
Hide file tree
Showing 80 changed files with 9,793 additions and 4,645 deletions.
723 changes: 367 additions & 356 deletions contracts/gas-snapshots/ccip.gas-snapshot

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion contracts/scripts/native_solc_compile_all_ccip
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ compileContract () {
echo "MultiOffRamp uses $OPTIMIZE_RUNS_MULTI_OFFRAMP optimizer runs."
optimize_runs=$OPTIMIZE_RUNS_MULTI_OFFRAMP
;;
"ccip/onRamp/EVM2EVMMultiOnRamp.sol" | "ccip/onRamp/EVM2EVMOnRamp.sol")
"ccip/onRamp/EVM2EVMOnRamp.sol")
echo "OnRamp uses $OPTIMIZE_RUNS_ONRAMP optimizer runs."
optimize_runs=$OPTIMIZE_RUNS_ONRAMP
;;
Expand Down Expand Up @@ -85,6 +85,7 @@ compileContract ccip/test/helpers/CommitStoreHelper.sol
compileContract ccip/test/helpers/MessageHasher.sol
compileContract ccip/test/helpers/ReportCodec.sol
compileContract ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol
compileContract ccip/test/helpers/MultiOCR3Helper.sol
compileContract ccip/test/mocks/MockRMN1_0.sol
compileContract ccip/test/mocks/MockE2EUSDCTokenMessenger.sol
compileContract ccip/test/mocks/MockE2EUSDCTransmitter.sol
Expand Down
605 changes: 584 additions & 21 deletions contracts/src/v0.8/ccip/PriceRegistry.sol

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions contracts/src/v0.8/ccip/interfaces/IPriceRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Client} from "../libraries/Client.sol";
import {Internal} from "../libraries/Internal.sol";

interface IPriceRegistry {
Expand Down Expand Up @@ -71,4 +72,38 @@ interface IPriceRegistry {
/// @notice Get the list of fee tokens.
/// @return The tokens set as fee tokens.
function getFeeTokens() external view returns (address[] memory);

/// @notice Validates the ccip message & returns the fee
/// @param destChainSelector The destination chain selector.
/// @param message The message to get quote for.
/// @return feeTokenAmount The amount of fee token needed for the fee, in smallest denomination of the fee token.
function getValidatedFee(
uint64 destChainSelector,
Client.EVM2AnyMessage calldata message
) external view returns (uint256 feeTokenAmount);

/// @notice Converts the extraArgs to the latest version and returns the converted message fee in juels
/// @param destChainSelector destination chain selector to process
/// @param feeToken Fee token address used to pay for message fees
/// @param feeTokenAmount Fee token amount
/// @param extraArgs Message extra args that were passed in by the client
/// @return msgFeeJuels message fee in juels
/// @return isOutOfOrderExecution true if the message should be executed out of order
/// @return convertedExtraArgs extra args converted to the latest family-specific args version
function processMessageArgs(
uint64 destChainSelector,
address feeToken,
uint256 feeTokenAmount,
bytes memory extraArgs
) external view returns (uint256 msgFeeJuels, bool isOutOfOrderExecution, bytes memory convertedExtraArgs);

/// @notice Validates pool return data
/// @param destChainSelector Destination chain selector to which the token amounts are sent to
/// @param rampTokenAmounts Token amounts with populated pool return data
/// @param sourceTokenAmounts Token amounts originally sent in a Client.EVM2AnyMessage message
function validatePoolReturnData(
uint64 destChainSelector,
Internal.RampTokenAmount[] calldata rampTokenAmounts,
Client.EVMTokenAmount[] calldata sourceTokenAmounts
) external view;
}
19 changes: 4 additions & 15 deletions contracts/src/v0.8/ccip/offRamp/EVM2EVMMultiOffRamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ contract EVM2EVMMultiOffRamp is ITypeAndVersion, MultiOCR3Base {
}

_setExecutionState(sourceChainSelector, message.header.sequenceNumber, Internal.MessageExecutionState.IN_PROGRESS);

(Internal.MessageExecutionState newState, bytes memory returnData) = _trialExecute(message, offchainTokenData);
_setExecutionState(sourceChainSelector, message.header.sequenceNumber, newState);

Expand Down Expand Up @@ -479,21 +480,9 @@ contract EVM2EVMMultiOffRamp is ITypeAndVersion, MultiOCR3Base {
) internal returns (Internal.MessageExecutionState, bytes memory) {
try this.executeSingleMessage(message, offchainTokenData) {}
catch (bytes memory err) {
bytes4 errorSelector = bytes4(err);
if (
ReceiverError.selector == errorSelector || TokenHandlingError.selector == errorSelector
|| Internal.InvalidEVMAddress.selector == errorSelector || InvalidDataLength.selector == errorSelector
|| CallWithExactGas.NoContract.selector == errorSelector || NotACompatiblePool.selector == errorSelector
|| IMessageInterceptor.MessageValidationError.selector == errorSelector
) {
// If CCIP receiver execution is not successful, bubble up receiver revert data,
// prepended by the 4 bytes of ReceiverError.selector, TokenHandlingError.selector or InvalidPoolAddress.selector.
// Max length of revert data is Router.MAX_RET_BYTES, max length of err is 4 + Router.MAX_RET_BYTES
return (Internal.MessageExecutionState.FAILURE, err);
} else {
// If revert is not caused by CCIP receiver, it is unexpected, bubble up the revert.
revert ExecutionError(message.header.messageId, err);
}
// return the message execution state as FAILURE and the revert data
// Max length of revert data is Router.MAX_RET_BYTES, max length of err is 4 + Router.MAX_RET_BYTES
return (Internal.MessageExecutionState.FAILURE, err);
}
// If message execution succeeded, no CCIP receiver return data is expected, return with empty bytes.
return (Internal.MessageExecutionState.SUCCESS, "");
Expand Down
Loading

0 comments on commit a51b37a

Please sign in to comment.