diff --git a/contracts/src/v0.8/ccip/ARMProxy.sol b/contracts/src/v0.8/ccip/ARMProxy.sol index e9ccde8680..c37899c83c 100644 --- a/contracts/src/v0.8/ccip/ARMProxy.sol +++ b/contracts/src/v0.8/ccip/ARMProxy.sol @@ -22,13 +22,17 @@ contract ARMProxy is OwnerIsCreator, ITypeAndVersion { // DYNAMIC CONFIG address private s_arm; - constructor(address arm) { + constructor( + address arm + ) { setARM(arm); } /// @notice SetARM sets the ARM implementation contract address. /// @param arm The address of the arm implementation contract. - function setARM(address arm) public onlyOwner { + function setARM( + address arm + ) public onlyOwner { if (arm == address(0)) revert ZeroAddressNotAllowed(); s_arm = arm; emit ARMSet(arm); diff --git a/contracts/src/v0.8/ccip/AggregateRateLimiter.sol b/contracts/src/v0.8/ccip/AggregateRateLimiter.sol index 7401df2ed4..7a210e7c20 100644 --- a/contracts/src/v0.8/ccip/AggregateRateLimiter.sol +++ b/contracts/src/v0.8/ccip/AggregateRateLimiter.sol @@ -26,7 +26,9 @@ contract AggregateRateLimiter is OwnerIsCreator { RateLimiter.TokenBucket private s_rateLimiter; /// @param config The RateLimiter.Config - constructor(RateLimiter.Config memory config) { + constructor( + RateLimiter.Config memory config + ) { s_rateLimiter = RateLimiter.TokenBucket({ rate: config.rate, capacity: config.capacity, @@ -37,7 +39,9 @@ contract AggregateRateLimiter is OwnerIsCreator { } /// @notice Consumes value from the rate limiter bucket based on the token value given. - function _rateLimitValue(uint256 value) internal { + function _rateLimitValue( + uint256 value + ) internal { s_rateLimiter._consume(value, address(0)); } @@ -61,7 +65,9 @@ contract AggregateRateLimiter is OwnerIsCreator { /// @notice Sets the rate limited config. /// @param config The new rate limiter config. /// @dev should only be callable by the owner or token limit admin. - function setRateLimiterConfig(RateLimiter.Config memory config) external onlyAdminOrOwner { + function setRateLimiterConfig( + RateLimiter.Config memory config + ) external onlyAdminOrOwner { s_rateLimiter._setTokenBucketConfig(config); } @@ -78,7 +84,9 @@ contract AggregateRateLimiter is OwnerIsCreator { /// @notice Sets the token limit admin address. /// @param newAdmin the address of the new admin. /// @dev setting this to address(0) indicates there is no active admin. - function setAdmin(address newAdmin) external onlyAdminOrOwner { + function setAdmin( + address newAdmin + ) external onlyAdminOrOwner { s_admin = newAdmin; emit AdminSet(newAdmin); } diff --git a/contracts/src/v0.8/ccip/CommitStore.sol b/contracts/src/v0.8/ccip/CommitStore.sol index 77c2864d4f..4df251f63a 100644 --- a/contracts/src/v0.8/ccip/CommitStore.sol +++ b/contracts/src/v0.8/ccip/CommitStore.sol @@ -89,7 +89,9 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { /// only if one must strictly ensure that for a given round there is only one valid report ever generated by /// the DON. In our case additional valid reports (i.e. approved by >= f+1 oracles) are not a problem, as they will /// will either be ignored (reverted as an invalid interval) or will be accepted as an additional valid price update. - constructor(StaticConfig memory staticConfig) OCR2Base(false) { + constructor( + StaticConfig memory staticConfig + ) OCR2Base(false) { if ( staticConfig.onRamp == address(0) || staticConfig.chainSelector == 0 || staticConfig.sourceChainSelector == 0 || staticConfig.rmnProxy == address(0) @@ -113,7 +115,9 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { /// @notice Sets the minimum sequence number. /// @param minSeqNr The new minimum sequence number. - function setMinSeqNr(uint64 minSeqNr) external onlyOwner { + function setMinSeqNr( + uint64 minSeqNr + ) external onlyOwner { uint64 oldSeqNum = s_minSeqNr; s_minSeqNr = minSeqNr; @@ -129,7 +133,9 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { /// @notice Sets the latest epoch and round for price update. /// @param latestPriceEpochAndRound The new epoch and round for prices. - function setLatestPriceEpochAndRound(uint40 latestPriceEpochAndRound) external onlyOwner { + function setLatestPriceEpochAndRound( + uint40 latestPriceEpochAndRound + ) external onlyOwner { uint40 oldEpochAndRound = s_latestPriceEpochAndRound; s_latestPriceEpochAndRound = latestPriceEpochAndRound; @@ -142,14 +148,18 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { /// @param root The merkle root to check the commit status for. /// @return the timestamp of the committed root or zero in the case that it was never /// committed. - function getMerkleRoot(bytes32 root) external view returns (uint256) { + function getMerkleRoot( + bytes32 root + ) external view returns (uint256) { return s_roots[root]; } /// @notice Returns if a root is blessed or not. /// @param root The merkle root to check the blessing status for. /// @return whether the root is blessed or not. - function isBlessed(bytes32 root) public view returns (bool) { + function isBlessed( + bytes32 root + ) public view returns (bool) { return IRMN(i_rmnProxy).isBlessed(IRMN.TaggedRoot({commitStore: address(this), root: root})); } @@ -157,7 +167,9 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { /// posted and needs to be removed. The interval in the report is trusted. /// @param rootToReset The roots that will be reset. This function will only /// reset roots that are not blessed. - function resetUnblessedRoots(bytes32[] calldata rootToReset) external onlyOwner { + function resetUnblessedRoots( + bytes32[] calldata rootToReset + ) external onlyOwner { for (uint256 i = 0; i < rootToReset.length; ++i) { bytes32 root = rootToReset[i]; if (!isBlessed(root)) { @@ -255,7 +267,9 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base { } /// @notice Sets the dynamic config. This function is called during `setOCR2Config` flow - function _beforeSetConfig(bytes memory onchainConfig) internal override { + function _beforeSetConfig( + bytes memory onchainConfig + ) internal override { DynamicConfig memory dynamicConfig = abi.decode(onchainConfig, (DynamicConfig)); if (dynamicConfig.priceRegistry == address(0)) revert InvalidCommitStoreConfig(); diff --git a/contracts/src/v0.8/ccip/FeeQuoter.sol b/contracts/src/v0.8/ccip/FeeQuoter.sol index 9c6d6a5331..efb0a420f2 100644 --- a/contracts/src/v0.8/ccip/FeeQuoter.sol +++ b/contracts/src/v0.8/ccip/FeeQuoter.sol @@ -238,7 +238,9 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, // ================================================================ /// @inheritdoc IPriceRegistry - function getTokenPrice(address token) public view override returns (Internal.TimestampedPackedUint224 memory) { + function getTokenPrice( + address token + ) public view override returns (Internal.TimestampedPackedUint224 memory) { Internal.TimestampedPackedUint224 memory tokenPrice = s_usdPerToken[token]; // If the token price is not stale, return it @@ -261,14 +263,18 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Get the `tokenPrice` for a given token, checks if the price is valid. /// @param token The token to get the price for. /// @return tokenPrice The tokenPrice for the given token if it exists and is valid. - function getValidatedTokenPrice(address token) external view returns (uint224) { + function getValidatedTokenPrice( + address token + ) external view returns (uint224) { return _getValidatedTokenPrice(token); } /// @notice Get the `tokenPrice` for an array of tokens. /// @param tokens The tokens to get prices for. /// @return tokenPrices The tokenPrices for the given tokens. - function getTokenPrices(address[] calldata tokens) external view returns (Internal.TimestampedPackedUint224[] memory) { + function getTokenPrices( + address[] calldata tokens + ) external view returns (Internal.TimestampedPackedUint224[] memory) { uint256 length = tokens.length; Internal.TimestampedPackedUint224[] memory tokenPrices = new Internal.TimestampedPackedUint224[](length); for (uint256 i = 0; i < length; ++i) { @@ -280,7 +286,9 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Returns the token price data feed configuration /// @param token The token to retrieve the feed config for /// @return tokenPriceFeedConfig The token price data feed config (if feed address is 0, the feed config is disabled) - function getTokenPriceFeedConfig(address token) external view returns (TokenPriceFeedConfig memory) { + function getTokenPriceFeedConfig( + address token + ) external view returns (TokenPriceFeedConfig memory) { return s_usdPriceFeedsPerToken[token]; } @@ -338,7 +346,9 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Gets the token price for a given token and reverts if the token is not supported /// @param token The address of the token to get the price for /// @return tokenPriceValue The token price - function _getValidatedTokenPrice(address token) internal view returns (uint224) { + function _getValidatedTokenPrice( + address token + ) internal view returns (uint224) { Internal.TimestampedPackedUint224 memory tokenPrice = getTokenPrice(token); // Token price must be set at least once if (tokenPrice.timestamp == 0 || tokenPrice.value == 0) revert TokenNotSupported(token); @@ -436,7 +446,9 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, // ================================================================ /// @inheritdoc IPriceRegistry - function updatePrices(Internal.PriceUpdates calldata priceUpdates) external override { + function updatePrices( + Internal.PriceUpdates calldata priceUpdates + ) external override { // The caller must be the fee updater _validateCaller(); @@ -461,13 +473,17 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Updates the USD token price feeds for given tokens /// @param tokenPriceFeedUpdates Token price feed updates to apply - function updateTokenPriceFeeds(TokenPriceFeedUpdate[] memory tokenPriceFeedUpdates) external onlyOwner { + function updateTokenPriceFeeds( + TokenPriceFeedUpdate[] memory tokenPriceFeedUpdates + ) external onlyOwner { _updateTokenPriceFeeds(tokenPriceFeedUpdates); } /// @notice Updates the USD token price feeds for given tokens /// @param tokenPriceFeedUpdates Token price feed updates to apply - function _updateTokenPriceFeeds(TokenPriceFeedUpdate[] memory tokenPriceFeedUpdates) private { + function _updateTokenPriceFeeds( + TokenPriceFeedUpdate[] memory tokenPriceFeedUpdates + ) private { for (uint256 i; i < tokenPriceFeedUpdates.length; ++i) { TokenPriceFeedUpdate memory update = tokenPriceFeedUpdates[i]; address sourceToken = update.sourceToken; @@ -607,7 +623,9 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Gets the fee configuration for a token. /// @param token The token to get the fee configuration for. /// @return premiumMultiplierWeiPerEth The multiplier for destination chain specific premiums. - function getPremiumMultiplierWeiPerEth(address token) external view returns (uint64 premiumMultiplierWeiPerEth) { + function getPremiumMultiplierWeiPerEth( + address token + ) external view returns (uint64 premiumMultiplierWeiPerEth) { return s_premiumMultiplierWeiPerEth[token]; } @@ -967,18 +985,24 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @notice Returns the configured config for the dest chain selector. /// @param destChainSelector Destination chain selector to fetch config for. /// @return destChainConfig Config for the destination chain. - function getDestChainConfig(uint64 destChainSelector) external view returns (DestChainConfig memory) { + function getDestChainConfig( + uint64 destChainSelector + ) external view returns (DestChainConfig memory) { return s_destChainConfigs[destChainSelector]; } /// @notice Updates the destination chain specific config. /// @param destChainConfigArgs Array of source chain specific configs. - function applyDestChainConfigUpdates(DestChainConfigArgs[] memory destChainConfigArgs) external onlyOwner { + function applyDestChainConfigUpdates( + DestChainConfigArgs[] memory destChainConfigArgs + ) external onlyOwner { _applyDestChainConfigUpdates(destChainConfigArgs); } /// @notice Internal version of applyDestChainConfigUpdates. - function _applyDestChainConfigUpdates(DestChainConfigArgs[] memory destChainConfigArgs) internal { + function _applyDestChainConfigUpdates( + DestChainConfigArgs[] memory destChainConfigArgs + ) internal { for (uint256 i = 0; i < destChainConfigArgs.length; ++i) { DestChainConfigArgs memory destChainConfigArg = destChainConfigArgs[i]; uint64 destChainSelector = destChainConfigArgs[i].destChainSelector; diff --git a/contracts/src/v0.8/ccip/MultiAggregateRateLimiter.sol b/contracts/src/v0.8/ccip/MultiAggregateRateLimiter.sol index 3935d6fab9..7dfcc0ef60 100644 --- a/contracts/src/v0.8/ccip/MultiAggregateRateLimiter.sol +++ b/contracts/src/v0.8/ccip/MultiAggregateRateLimiter.sol @@ -75,7 +75,9 @@ contract MultiAggregateRateLimiter is IMessageInterceptor, AuthorizedCallers, IT } /// @inheritdoc IMessageInterceptor - function onInboundMessage(Client.Any2EVMMessage memory message) external onlyAuthorizedCallers { + function onInboundMessage( + Client.Any2EVMMessage memory message + ) external onlyAuthorizedCallers { _applyRateLimit(message.sourceChainSelector, message.destTokenAmounts, false); } @@ -130,7 +132,9 @@ contract MultiAggregateRateLimiter is IMessageInterceptor, AuthorizedCallers, IT /// @notice Retrieves the token value for a token using the FeeQuoter. /// @param tokenAmount The token and amount to get the value for. /// @return tokenValue USD value in 18 decimals. - function _getTokenValue(Client.EVMTokenAmount memory tokenAmount) internal view returns (uint256) { + function _getTokenValue( + Client.EVMTokenAmount memory tokenAmount + ) internal view returns (uint256) { // not fetching validated price, as price staleness is not important for value-based rate limiting // we only need to verify the price is not 0 uint224 pricePerToken = IFeeQuoter(s_feeQuoter).getTokenPrice(tokenAmount.token).value; @@ -154,7 +158,9 @@ contract MultiAggregateRateLimiter is IMessageInterceptor, AuthorizedCallers, IT /// @notice Applies the provided rate limiter config updates. /// @param rateLimiterUpdates Rate limiter updates. /// @dev Only callable by the owner. - function applyRateLimiterConfigUpdates(RateLimiterConfigArgs[] memory rateLimiterUpdates) external onlyOwner { + function applyRateLimiterConfigUpdates( + RateLimiterConfigArgs[] memory rateLimiterUpdates + ) external onlyOwner { for (uint256 i = 0; i < rateLimiterUpdates.length; ++i) { RateLimiterConfigArgs memory updateArgs = rateLimiterUpdates[i]; RateLimiter.Config memory configUpdate = updateArgs.rateLimiterConfig; @@ -253,14 +259,18 @@ contract MultiAggregateRateLimiter is IMessageInterceptor, AuthorizedCallers, IT /// @notice Sets the FeeQuoter address. /// @param newFeeQuoter the address of the new FeeQuoter. /// @dev precondition The address must be a non-zero address. - function setFeeQuoter(address newFeeQuoter) external onlyOwner { + function setFeeQuoter( + address newFeeQuoter + ) external onlyOwner { _setFeeQuoter(newFeeQuoter); } /// @notice Sets the FeeQuoter address. /// @param newFeeQuoter the address of the new FeeQuoter. /// @dev precondition The address must be a non-zero address. - function _setFeeQuoter(address newFeeQuoter) internal { + function _setFeeQuoter( + address newFeeQuoter + ) internal { if (newFeeQuoter == address(0)) { revert ZeroAddressNotAllowed(); } diff --git a/contracts/src/v0.8/ccip/NonceManager.sol b/contracts/src/v0.8/ccip/NonceManager.sol index 5932e88b9c..a1db80aa7c 100644 --- a/contracts/src/v0.8/ccip/NonceManager.sol +++ b/contracts/src/v0.8/ccip/NonceManager.sol @@ -39,7 +39,9 @@ contract NonceManager is INonceManager, AuthorizedCallers, ITypeAndVersion { /// executed in the same order they are sent (assuming they are DON) mapping(uint64 sourceChainSelector => mapping(bytes sender => uint64 inboundNonce)) private s_inboundNonces; - constructor(address[] memory authorizedCallers) AuthorizedCallers(authorizedCallers) {} + constructor( + address[] memory authorizedCallers + ) AuthorizedCallers(authorizedCallers) {} /// @inheritdoc INonceManager function getIncrementedOutboundNonce( @@ -123,7 +125,9 @@ contract NonceManager is INonceManager, AuthorizedCallers, ITypeAndVersion { /// @notice Updates the previous ramps addresses. /// @param previousRampsArgs The previous on/off ramps addresses. - function applyPreviousRampsUpdates(PreviousRampsArgs[] calldata previousRampsArgs) external onlyOwner { + function applyPreviousRampsUpdates( + PreviousRampsArgs[] calldata previousRampsArgs + ) external onlyOwner { for (uint256 i = 0; i < previousRampsArgs.length; ++i) { PreviousRampsArgs calldata previousRampsArg = previousRampsArgs[i]; @@ -146,7 +150,9 @@ contract NonceManager is INonceManager, AuthorizedCallers, ITypeAndVersion { /// @notice Gets the previous onRamp address for the given chain selector /// @param chainSelector The chain selector /// @return previousRamps The previous on/offRamp addresses - function getPreviousRamps(uint64 chainSelector) external view returns (PreviousRamps memory) { + function getPreviousRamps( + uint64 chainSelector + ) external view returns (PreviousRamps memory) { return s_previousRamps[chainSelector]; } } diff --git a/contracts/src/v0.8/ccip/RMN.sol b/contracts/src/v0.8/ccip/RMN.sol index 3b9af7e0ce..fd1746f3fd 100644 --- a/contracts/src/v0.8/ccip/RMN.sol +++ b/contracts/src/v0.8/ccip/RMN.sol @@ -190,7 +190,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { /// 1. Cursedness is retained from a prior config. /// 2. The curse weight threshold was met at some point, which activated a curse, and enough voters unvoted to curse /// such that the curse weight threshold is no longer met. - function _shouldCurseBeActive(CurseVoteProgress storage sptr_upToDateCurseVoteProgress) internal view returns (bool) { + function _shouldCurseBeActive( + CurseVoteProgress storage sptr_upToDateCurseVoteProgress + ) internal view returns (bool) { return sptr_upToDateCurseVoteProgress.latestVoteToCurseByCurseVoteAddr[OWNER_CURSE_VOTE_ADDR].cursesHash != NO_VOTES_CURSES_HASH || sptr_upToDateCurseVoteProgress.accumulatedWeight >= sptr_upToDateCurseVoteProgress.curseWeightThreshold; @@ -291,7 +293,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { // Prevents a subject from receiving multiple votes to curse with the same curse id. error SubjectsMustBeStrictlyIncreasing(); - constructor(Config memory config) { + constructor( + Config memory config + ) { { // Ensure that the bitmap is large enough to hold MAX_NUM_VOTERS. // We do this in the constructor because MAX_NUM_VOTERS is constant. @@ -316,7 +320,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { return bitmap | (uint200(1) << index); } - function _bitmapCount(uint200 bitmap) internal pure returns (uint8 oneBits) { + function _bitmapCount( + uint200 bitmap + ) internal pure returns (uint8 oneBits) { assert(bitmap < 1 << MAX_NUM_VOTERS); // https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan for (; bitmap != 0; ++oneBits) { @@ -324,7 +330,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { } } - function _taggedRootHash(IRMN.TaggedRoot memory taggedRoot) internal pure returns (bytes32) { + function _taggedRootHash( + IRMN.TaggedRoot memory taggedRoot + ) internal pure returns (bytes32) { return keccak256(abi.encode(taggedRoot.commitStore, taggedRoot.root)); } @@ -340,7 +348,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { /// /* address */, taggedRoot.root /* bytes32 */))`. /// @notice Tagged roots which are already (voted to be) blessed are skipped and emit corresponding events. In case /// the call has no effect, i.e., all passed tagged roots are skipped, the function reverts with a `VoteToBlessNoop`. - function voteToBless(IRMN.TaggedRoot[] calldata taggedRoots) external { + function voteToBless( + IRMN.TaggedRoot[] calldata taggedRoots + ) external { // If we have an active global curse, something is really wrong. Let's err on the // side of caution and not accept further blessings during this time of // uncertainty. @@ -402,7 +412,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { /// scenario. The owner must ensure that there are no in-flight transactions by RMN nodes voting for any of the /// taggedRoots before calling this function, as such in-flight transactions could lead to the roots becoming /// re-blessed shortly after the call to this function, contrary to the original intention. - function ownerResetBlessVotes(IRMN.TaggedRoot[] calldata taggedRoots) external onlyOwner { + function ownerResetBlessVotes( + IRMN.TaggedRoot[] calldata taggedRoots + ) external onlyOwner { uint32 configVersion = s_versionedConfig.configVersion; for (uint256 i = 0; i < taggedRoots.length; ++i) { IRMN.TaggedRoot memory taggedRoot = taggedRoots[i]; @@ -510,7 +522,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { /// We expect this to be called very rarely, e.g. in case of a bug in the /// offchain code causing false voteToCurse calls. /// @notice Should be called from curser's corresponding curseVoteAddr. - function unvoteToCurse(UnvoteToCurseRequest[] memory unvoteToCurseRequests) external { + function unvoteToCurse( + UnvoteToCurseRequest[] memory unvoteToCurseRequests + ) external { address curseVoteAddr = msg.sender; CurserRecord storage sptr_curserRecord = s_curserRecords[curseVoteAddr]; @@ -635,7 +649,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { /// @notice Enables the owner to remove curse votes. After the curse votes are removed, /// this function will check whether the curse is still valid and restore the uncursed state if possible. /// This function also enables the owner to lift a curse created through ownerCurse. - function ownerUnvoteToCurse(OwnerUnvoteToCurseRequest[] memory ownerUnvoteToCurseRequests) external onlyOwner { + function ownerUnvoteToCurse( + OwnerUnvoteToCurseRequest[] memory ownerUnvoteToCurseRequests + ) external onlyOwner { bool anyCurseWasLifted = false; bool anyVoteWasUnvoted = false; uint32 configVersion = s_versionedConfig.configVersion; @@ -667,7 +683,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { } } - function setConfig(Config memory config) external onlyOwner { + function setConfig( + Config memory config + ) external onlyOwner { _setConfig(config); } @@ -695,7 +713,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { } /// @inheritdoc IRMN - function isBlessed(IRMN.TaggedRoot calldata taggedRoot) external view returns (bool) { + function isBlessed( + IRMN.TaggedRoot calldata taggedRoot + ) external view returns (bool) { return s_blessVoteProgressByTaggedRootHash[_taggedRootHash(taggedRoot)].weightThresholdMet || s_permaBlessedCommitStores.contains(taggedRoot.commitStore); } @@ -711,7 +731,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { } /// @inheritdoc IRMN - function isCursed(bytes16 subject) public view returns (bool) { + function isCursed( + bytes16 subject + ) public view returns (bool) { if (s_curseHotVars.numSubjectsCursed == 0) { return false; // happy path costs a single SLOAD } else { @@ -864,7 +886,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { return page; } - function _validateConfig(Config memory config) internal pure returns (bool) { + function _validateConfig( + Config memory config + ) internal pure returns (bool) { if ( config.voters.length == 0 || config.voters.length > MAX_NUM_VOTERS || config.blessWeightThreshold == 0 || config.curseWeightThreshold == 0 @@ -905,7 +929,9 @@ contract RMN is IRMN, OwnerIsCreator, ITypeAndVersion { return totalBlessWeight >= config.blessWeightThreshold && totalCurseWeight >= config.curseWeightThreshold; } - function _setConfig(Config memory config) private { + function _setConfig( + Config memory config + ) private { if (!_validateConfig(config)) revert InvalidConfig(); // We can't directly assign s_versionedConfig.config to config diff --git a/contracts/src/v0.8/ccip/Router.sol b/contracts/src/v0.8/ccip/Router.sol index a5474fdd04..d83216fb6f 100644 --- a/contracts/src/v0.8/ccip/Router.sol +++ b/contracts/src/v0.8/ccip/Router.sol @@ -89,7 +89,9 @@ contract Router is IRouter, IRouterClient, ITypeAndVersion, OwnerIsCreator { } /// @notice This functionality has been removed and will revert when called. - function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory) { + function getSupportedTokens( + uint64 chainSelector + ) external view returns (address[] memory) { if (!isChainSupported(chainSelector)) { return new address[](0); } @@ -97,7 +99,9 @@ contract Router is IRouter, IRouterClient, ITypeAndVersion, OwnerIsCreator { } /// @inheritdoc IRouterClient - function isChainSupported(uint64 chainSelector) public view returns (bool) { + function isChainSupported( + uint64 chainSelector + ) public view returns (bool) { return s_onRamps[chainSelector] != address(0); } @@ -192,7 +196,9 @@ contract Router is IRouter, IRouterClient, ITypeAndVersion, OwnerIsCreator { /// @notice Sets a new wrapped native token. /// @param wrappedNative The address of the new wrapped native ERC20 token. - function setWrappedNative(address wrappedNative) external onlyOwner { + function setWrappedNative( + address wrappedNative + ) external onlyOwner { s_wrappedNative = wrappedNative; } @@ -203,7 +209,9 @@ contract Router is IRouter, IRouterClient, ITypeAndVersion, OwnerIsCreator { } /// @inheritdoc IRouter - function getOnRamp(uint64 destChainSelector) external view returns (address) { + function getOnRamp( + uint64 destChainSelector + ) external view returns (address) { return s_onRamps[destChainSelector]; } diff --git a/contracts/src/v0.8/ccip/applications/CCIPClientExample.sol b/contracts/src/v0.8/ccip/applications/CCIPClientExample.sol index 82de08ea64..56f3cd1fe8 100644 --- a/contracts/src/v0.8/ccip/applications/CCIPClientExample.sol +++ b/contracts/src/v0.8/ccip/applications/CCIPClientExample.sol @@ -53,7 +53,9 @@ contract CCIPClientExample is CCIPReceiver, OwnerIsCreator { s_chains[chainSelector] = extraArgs; } - function disableChain(uint64 chainSelector) external onlyOwner { + function disableChain( + uint64 chainSelector + ) external onlyOwner { delete s_chains[chainSelector]; } @@ -66,7 +68,9 @@ contract CCIPClientExample is CCIPReceiver, OwnerIsCreator { _ccipReceive(message); } - function _ccipReceive(Client.Any2EVMMessage memory message) internal override { + function _ccipReceive( + Client.Any2EVMMessage memory message + ) internal override { emit MessageReceived(message.messageId); } @@ -162,7 +166,9 @@ contract CCIPClientExample is CCIPReceiver, OwnerIsCreator { emit MessageSent(messageId); } - modifier validChain(uint64 chainSelector) { + modifier validChain( + uint64 chainSelector + ) { if (s_chains[chainSelector].length == 0) revert InvalidChain(chainSelector); _; } diff --git a/contracts/src/v0.8/ccip/applications/CCIPReceiver.sol b/contracts/src/v0.8/ccip/applications/CCIPReceiver.sol index 208c4e47ce..8caeb3fcca 100644 --- a/contracts/src/v0.8/ccip/applications/CCIPReceiver.sol +++ b/contracts/src/v0.8/ccip/applications/CCIPReceiver.sol @@ -11,7 +11,9 @@ import {IERC165} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils abstract contract CCIPReceiver is IAny2EVMMessageReceiver, IERC165 { address internal immutable i_ccipRouter; - constructor(address router) { + constructor( + address router + ) { if (router == address(0)) revert InvalidRouter(address(0)); i_ccipRouter = router; } @@ -26,18 +28,24 @@ abstract contract CCIPReceiver is IAny2EVMMessageReceiver, IERC165 { /// If this returns true, tokens are transferred and ccipReceive is called atomically. /// Additionally, if the receiver address does not have code associated with /// it at the time of execution (EXTCODESIZE returns 0), only tokens will be transferred. - function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public view virtual override returns (bool) { return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; } /// @inheritdoc IAny2EVMMessageReceiver - function ccipReceive(Client.Any2EVMMessage calldata message) external virtual override onlyRouter { + function ccipReceive( + Client.Any2EVMMessage calldata message + ) external virtual override onlyRouter { _ccipReceive(message); } /// @notice Override this function in your implementation. /// @param message Any2EVMMessage - function _ccipReceive(Client.Any2EVMMessage memory message) internal virtual; + function _ccipReceive( + Client.Any2EVMMessage memory message + ) internal virtual; ///////////////////////////////////////////////////////////////////// // Plumbing diff --git a/contracts/src/v0.8/ccip/applications/DefensiveExample.sol b/contracts/src/v0.8/ccip/applications/DefensiveExample.sol index f0501b5d90..dbe8550933 100644 --- a/contracts/src/v0.8/ccip/applications/DefensiveExample.sol +++ b/contracts/src/v0.8/ccip/applications/DefensiveExample.sol @@ -101,7 +101,9 @@ contract DefensiveExample is CCIPClientExample { } // An example function to demonstrate recovery - function setSimRevert(bool simRevert) external onlyOwner { + function setSimRevert( + bool simRevert + ) external onlyOwner { s_simRevert = simRevert; } diff --git a/contracts/src/v0.8/ccip/applications/EtherSenderReceiver.sol b/contracts/src/v0.8/ccip/applications/EtherSenderReceiver.sol index 05d604d9c1..5bb0193c33 100644 --- a/contracts/src/v0.8/ccip/applications/EtherSenderReceiver.sol +++ b/contracts/src/v0.8/ccip/applications/EtherSenderReceiver.sol @@ -43,7 +43,9 @@ contract EtherSenderReceiver is CCIPReceiver, ITypeAndVersion { IWrappedNative public immutable i_weth; /// @param router The CCIP router address. - constructor(address router) CCIPReceiver(router) { + constructor( + address router + ) CCIPReceiver(router) { i_weth = IWrappedNative(CCIPRouter(router).getWrappedNative()); i_weth.approve(router, type(uint256).max); } @@ -130,7 +132,9 @@ contract EtherSenderReceiver is CCIPReceiver, ITypeAndVersion { return validatedMessage; } - function _validateFeeToken(Client.EVM2AnyMessage calldata message) internal view { + function _validateFeeToken( + Client.EVM2AnyMessage calldata message + ) internal view { uint256 tokenAmount = message.tokenAmounts[0].amount; if (message.feeToken != address(0)) { @@ -146,7 +150,9 @@ contract EtherSenderReceiver is CCIPReceiver, ITypeAndVersion { /// @param message The CCIP message containing the wrapped ether amount and the final receiver. /// @dev The code below should never revert if the message being is valid according /// to the above _validatedMessage and _validateFeeToken functions. - function _ccipReceive(Client.Any2EVMMessage memory message) internal override { + function _ccipReceive( + Client.Any2EVMMessage memory message + ) internal override { address receiver = abi.decode(message.data, (address)); if (message.destTokenAmounts.length != 1) { diff --git a/contracts/src/v0.8/ccip/applications/PingPongDemo.sol b/contracts/src/v0.8/ccip/applications/PingPongDemo.sol index 567ad3c27d..3fd3eec6ee 100644 --- a/contracts/src/v0.8/ccip/applications/PingPongDemo.sol +++ b/contracts/src/v0.8/ccip/applications/PingPongDemo.sol @@ -50,7 +50,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { _respond(1); } - function _respond(uint256 pingPongCount) internal virtual { + function _respond( + uint256 pingPongCount + ) internal virtual { if (pingPongCount & 1 == 1) { emit Ping(pingPongCount); } else { @@ -68,7 +70,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { IRouterClient(getRouter()).ccipSend(s_counterpartChainSelector, message); } - function _ccipReceive(Client.Any2EVMMessage memory message) internal override { + function _ccipReceive( + Client.Any2EVMMessage memory message + ) internal override { uint256 pingPongCount = abi.decode(message.data, (uint256)); if (!s_isPaused) { _respond(pingPongCount + 1); @@ -83,7 +87,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { return s_counterpartChainSelector; } - function setCounterpartChainSelector(uint64 chainSelector) external onlyOwner { + function setCounterpartChainSelector( + uint64 chainSelector + ) external onlyOwner { s_counterpartChainSelector = chainSelector; } @@ -95,7 +101,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { return s_feeToken; } - function setCounterpartAddress(address addr) external onlyOwner { + function setCounterpartAddress( + address addr + ) external onlyOwner { s_counterpartAddress = addr; } @@ -103,7 +111,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { return s_isPaused; } - function setPaused(bool pause) external onlyOwner { + function setPaused( + bool pause + ) external onlyOwner { s_isPaused = pause; } @@ -111,7 +121,9 @@ contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion { return s_outOfOrderExecution; } - function setOutOfOrderExecution(bool outOfOrderExecution) external onlyOwner { + function setOutOfOrderExecution( + bool outOfOrderExecution + ) external onlyOwner { s_outOfOrderExecution = outOfOrderExecution; emit OutOfOrderExecutionChange(outOfOrderExecution); } diff --git a/contracts/src/v0.8/ccip/applications/SelfFundedPingPong.sol b/contracts/src/v0.8/ccip/applications/SelfFundedPingPong.sol index 09c81ad5de..fe807a7cfa 100644 --- a/contracts/src/v0.8/ccip/applications/SelfFundedPingPong.sol +++ b/contracts/src/v0.8/ccip/applications/SelfFundedPingPong.sol @@ -23,7 +23,9 @@ contract SelfFundedPingPong is PingPongDemo { s_countIncrBeforeFunding = roundTripsBeforeFunding * 2; } - function _respond(uint256 pingPongCount) internal override { + function _respond( + uint256 pingPongCount + ) internal override { if (pingPongCount & 1 == 1) { emit Ping(pingPongCount); } else { @@ -45,7 +47,9 @@ contract SelfFundedPingPong is PingPongDemo { /// @notice A function that is responsible for funding this contract. /// The contract can only be funded if it is set as a nop in the target onRamp. /// In case your contract is not a nop you can prevent this function from being called by setting s_countIncrBeforeFunding=0. - function fundPingPong(uint256 pingPongCount) public { + function fundPingPong( + uint256 pingPongCount + ) public { // If selfFunding is disabled, or ping pong count has not reached s_countIncrPerFunding, do not attempt funding. if (s_countIncrBeforeFunding == 0 || pingPongCount < s_countIncrBeforeFunding) return; @@ -60,7 +64,9 @@ contract SelfFundedPingPong is PingPongDemo { return s_countIncrBeforeFunding; } - function setCountIncrBeforeFunding(uint8 countIncrBeforeFunding) external onlyOwner { + function setCountIncrBeforeFunding( + uint8 countIncrBeforeFunding + ) external onlyOwner { s_countIncrBeforeFunding = countIncrBeforeFunding; emit CountIncrBeforeFundingSet(countIncrBeforeFunding); } diff --git a/contracts/src/v0.8/ccip/applications/TokenProxy.sol b/contracts/src/v0.8/ccip/applications/TokenProxy.sol index 6fd26c076b..01d5b31430 100644 --- a/contracts/src/v0.8/ccip/applications/TokenProxy.sol +++ b/contracts/src/v0.8/ccip/applications/TokenProxy.sol @@ -64,7 +64,9 @@ contract TokenProxy is OwnerIsCreator { /// @notice Validates the message content. /// @dev Only allows a single token to be sent, and no data. - function _validateMessage(Client.EVM2AnyMessage calldata message) internal view { + function _validateMessage( + Client.EVM2AnyMessage calldata message + ) internal view { if (message.tokenAmounts.length != 1 || message.tokenAmounts[0].token != i_token) revert InvalidToken(); if (message.data.length > 0) revert NoDataAllowed(); diff --git a/contracts/src/v0.8/ccip/capability/CCIPHome.sol b/contracts/src/v0.8/ccip/capability/CCIPHome.sol index e387558946..e66e2f56ec 100644 --- a/contracts/src/v0.8/ccip/capability/CCIPHome.sol +++ b/contracts/src/v0.8/ccip/capability/CCIPHome.sol @@ -181,7 +181,9 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, /// @notice Constructor for the CCIPHome contract takes in the address of the capabilities registry. This address /// is the only allowed caller to mutate the configuration through beforeCapabilityConfigSet. - constructor(address capabilitiesRegistry) { + constructor( + address capabilitiesRegistry + ) { if (capabilitiesRegistry == address(0)) { revert ZeroAddressNotAllowed(); } @@ -200,7 +202,9 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, /// @inheritdoc IERC165 /// @dev Required for the capabilities registry to recognize this contract. - function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { return interfaceId == type(ICapabilityConfiguration).interfaceId || interfaceId == type(IERC165).interfaceId; } @@ -246,7 +250,9 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, /// @inheritdoc ICapabilityConfiguration /// @dev The CCIP capability will fetch the configuration needed directly from this contract. /// The offchain syncer will call this function, so its important that it doesn't revert. - function getCapabilityConfiguration(uint32 /* donId */ ) external pure override returns (bytes memory configuration) { + function getCapabilityConfiguration( + uint32 /* donId */ + ) external pure override returns (bytes memory configuration) { return bytes(""); } @@ -457,7 +463,9 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, // │ Validation │ // ================================================================ - function _validateConfig(OCR3Config memory cfg) internal view { + function _validateConfig( + OCR3Config memory cfg + ) internal view { if (cfg.chainSelector == 0) revert ChainSelectorNotSet(); if (cfg.pluginType != Internal.OCRPluginType.Commit && cfg.pluginType != Internal.OCRPluginType.Execution) { revert InvalidPluginType(); @@ -603,7 +611,9 @@ contract CCIPHome is OwnerIsCreator, ITypeAndVersion, ICapabilityConfiguration, /// @notice Helper function to ensure that a node is in the capabilities registry. /// @param p2pIds The P2P IDs of the node to check. - function _ensureInRegistry(bytes32[] memory p2pIds) internal view { + function _ensureInRegistry( + bytes32[] memory p2pIds + ) internal view { for (uint256 i = 0; i < p2pIds.length; ++i) { // TODO add a method that does the validation in the ICapabilitiesRegistry contract if (ICapabilitiesRegistry(i_capabilitiesRegistry).getNode(p2pIds[i]).p2pId == bytes32("")) { diff --git a/contracts/src/v0.8/ccip/interfaces/IAny2EVMMessageReceiver.sol b/contracts/src/v0.8/ccip/interfaces/IAny2EVMMessageReceiver.sol index 6305311050..2a38d82739 100644 --- a/contracts/src/v0.8/ccip/interfaces/IAny2EVMMessageReceiver.sol +++ b/contracts/src/v0.8/ccip/interfaces/IAny2EVMMessageReceiver.sol @@ -11,5 +11,7 @@ interface IAny2EVMMessageReceiver { /// will move to a FAILED state and become available for manual execution. /// @param message CCIP Message /// @dev Note ensure you check the msg.sender is the OffRampRouter - function ccipReceive(Client.Any2EVMMessage calldata message) external; + function ccipReceive( + Client.Any2EVMMessage calldata message + ) external; } diff --git a/contracts/src/v0.8/ccip/interfaces/IAny2EVMOffRamp.sol b/contracts/src/v0.8/ccip/interfaces/IAny2EVMOffRamp.sol index 1881dede2e..f18c6a73f5 100644 --- a/contracts/src/v0.8/ccip/interfaces/IAny2EVMOffRamp.sol +++ b/contracts/src/v0.8/ccip/interfaces/IAny2EVMOffRamp.sol @@ -5,5 +5,7 @@ interface IAny2EVMOffRamp { /// @notice Returns the the current nonce for a receiver. /// @param sender The sender address /// @return nonce The nonce value belonging to the sender address. - function getSenderNonce(address sender) external view returns (uint64 nonce); + function getSenderNonce( + address sender + ) external view returns (uint64 nonce); } diff --git a/contracts/src/v0.8/ccip/interfaces/ICapabilitiesRegistry.sol b/contracts/src/v0.8/ccip/interfaces/ICapabilitiesRegistry.sol index dac7317e41..e8bba76d42 100644 --- a/contracts/src/v0.8/ccip/interfaces/ICapabilitiesRegistry.sol +++ b/contracts/src/v0.8/ccip/interfaces/ICapabilitiesRegistry.sol @@ -27,5 +27,7 @@ interface ICapabilitiesRegistry { /// @notice Gets a node's data /// @param p2pId The P2P ID of the node to query for /// @return NodeInfo The node data - function getNode(bytes32 p2pId) external view returns (NodeInfo memory); + function getNode( + bytes32 p2pId + ) external view returns (NodeInfo memory); } diff --git a/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRamp.sol b/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRamp.sol index d657e148cb..c2d0d6cdb2 100644 --- a/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRamp.sol +++ b/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRamp.sol @@ -11,5 +11,7 @@ interface IEVM2AnyOnRamp is IEVM2AnyOnRampClient { /// @notice Get the next nonce for a given sender /// @param sender The sender to get the nonce for /// @return nonce The next nonce for the sender - function getSenderNonce(address sender) external view returns (uint64 nonce); + function getSenderNonce( + address sender + ) external view returns (uint64 nonce); } diff --git a/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRampClient.sol b/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRampClient.sol index 1dfae1abbc..d2fe34721b 100644 --- a/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRampClient.sol +++ b/contracts/src/v0.8/ccip/interfaces/IEVM2AnyOnRampClient.sol @@ -23,7 +23,9 @@ interface IEVM2AnyOnRampClient { /// @notice Gets a list of all supported source chain tokens. /// @param destChainSelector The destination chain selector /// @return tokens The addresses of all tokens that this onRamp supports the given destination chain - function getSupportedTokens(uint64 destChainSelector) external view returns (address[] memory tokens); + function getSupportedTokens( + uint64 destChainSelector + ) external view returns (address[] memory tokens); /// @notice Send a message to the remote chain /// @dev only callable by the Router diff --git a/contracts/src/v0.8/ccip/interfaces/IMessageInterceptor.sol b/contracts/src/v0.8/ccip/interfaces/IMessageInterceptor.sol index c2b432426b..0432a222df 100644 --- a/contracts/src/v0.8/ccip/interfaces/IMessageInterceptor.sol +++ b/contracts/src/v0.8/ccip/interfaces/IMessageInterceptor.sol @@ -13,7 +13,9 @@ interface IMessageInterceptor { /// @notice Intercepts & validates the given OffRamp message. Reverts on validation failure /// @param message to validate - function onInboundMessage(Client.Any2EVMMessage memory message) external; + function onInboundMessage( + Client.Any2EVMMessage memory message + ) external; /// @notice Intercepts & validates the given OnRamp message. Reverts on validation failure /// @param destChainSelector remote destination chain selector where the message is being sent to diff --git a/contracts/src/v0.8/ccip/interfaces/IPool.sol b/contracts/src/v0.8/ccip/interfaces/IPool.sol index a2b9281228..3545e57fa4 100644 --- a/contracts/src/v0.8/ccip/interfaces/IPool.sol +++ b/contracts/src/v0.8/ccip/interfaces/IPool.sol @@ -28,10 +28,14 @@ interface IPoolV1 is IERC165 { /// @notice Checks whether a remote chain is supported in the token pool. /// @param remoteChainSelector The selector of the remote chain. /// @return true if the given chain is a permissioned remote chain. - function isSupportedChain(uint64 remoteChainSelector) external view returns (bool); + function isSupportedChain( + uint64 remoteChainSelector + ) external view returns (bool); /// @notice Returns if the token pool supports the given token. /// @param token The address of the token. /// @return true if the token is supported by the pool. - function isSupportedToken(address token) external view returns (bool); + function isSupportedToken( + address token + ) external view returns (bool); } diff --git a/contracts/src/v0.8/ccip/interfaces/IPriceRegistry.sol b/contracts/src/v0.8/ccip/interfaces/IPriceRegistry.sol index 583a2e890b..b20c1b7229 100644 --- a/contracts/src/v0.8/ccip/interfaces/IPriceRegistry.sol +++ b/contracts/src/v0.8/ccip/interfaces/IPriceRegistry.sol @@ -6,22 +6,30 @@ import {Internal} from "../libraries/Internal.sol"; interface IPriceRegistry { /// @notice Update the price for given tokens and gas prices for given chains. /// @param priceUpdates The price updates to apply. - function updatePrices(Internal.PriceUpdates memory priceUpdates) external; + function updatePrices( + Internal.PriceUpdates memory priceUpdates + ) external; /// @notice Get the `tokenPrice` for a given token. /// @param token The token to get the price for. /// @return tokenPrice The tokenPrice for the given token. - function getTokenPrice(address token) external view returns (Internal.TimestampedPackedUint224 memory); + function getTokenPrice( + address token + ) external view returns (Internal.TimestampedPackedUint224 memory); /// @notice Get the `tokenPrice` for a given token, checks if the price is valid. /// @param token The token to get the price for. /// @return tokenPrice The tokenPrice for the given token if it exists and is valid. - function getValidatedTokenPrice(address token) external view returns (uint224); + function getValidatedTokenPrice( + address token + ) external view returns (uint224); /// @notice Get the `tokenPrice` for an array of tokens. /// @param tokens The tokens to get prices for. /// @return tokenPrices The tokenPrices for the given tokens. - function getTokenPrices(address[] calldata tokens) external view returns (Internal.TimestampedPackedUint224[] memory); + function getTokenPrices( + address[] calldata tokens + ) external view returns (Internal.TimestampedPackedUint224[] memory); /// @notice Get an encoded `gasPrice` for a given destination chain ID. /// The 224-bit result encodes necessary gas price components. diff --git a/contracts/src/v0.8/ccip/interfaces/IRMN.sol b/contracts/src/v0.8/ccip/interfaces/IRMN.sol index a409731549..4bd8f8348f 100644 --- a/contracts/src/v0.8/ccip/interfaces/IRMN.sol +++ b/contracts/src/v0.8/ccip/interfaces/IRMN.sol @@ -10,12 +10,16 @@ interface IRMN { } /// @notice Callers MUST NOT cache the return value as a blessed tagged root could become unblessed. - function isBlessed(TaggedRoot calldata taggedRoot) external view returns (bool); + function isBlessed( + TaggedRoot calldata taggedRoot + ) external view returns (bool); /// @notice Iff there is an active global or legacy curse, this function returns true. function isCursed() external view returns (bool); /// @notice Iff there is an active global curse, or an active curse for `subject`, this function returns true. /// @param subject To check whether a particular chain is cursed, set to bytes16(uint128(chainSelector)). - function isCursed(bytes16 subject) external view returns (bool); + function isCursed( + bytes16 subject + ) external view returns (bool); } diff --git a/contracts/src/v0.8/ccip/interfaces/IRMNRemote.sol b/contracts/src/v0.8/ccip/interfaces/IRMNRemote.sol index 536a823720..3754a2fe91 100644 --- a/contracts/src/v0.8/ccip/interfaces/IRMNRemote.sol +++ b/contracts/src/v0.8/ccip/interfaces/IRMNRemote.sol @@ -35,5 +35,7 @@ interface IRMNRemote { /// @notice If there is an active global curse, or an active curse for `subject`, this function returns true. /// @param subject To check whether a particular chain is cursed, set to bytes16(uint128(chainSelector)). /// @return bool true if the provided subject is cured *or* if there is an active global curse - function isCursed(bytes16 subject) external view returns (bool); + function isCursed( + bytes16 subject + ) external view returns (bool); } diff --git a/contracts/src/v0.8/ccip/interfaces/IRouter.sol b/contracts/src/v0.8/ccip/interfaces/IRouter.sol index 7f4544fd0f..d8f19bf5df 100644 --- a/contracts/src/v0.8/ccip/interfaces/IRouter.sol +++ b/contracts/src/v0.8/ccip/interfaces/IRouter.sol @@ -26,7 +26,9 @@ interface IRouter { /// @notice Returns the configured onramp for a specific destination chain. /// @param destChainSelector The destination chain Id to get the onRamp for. /// @return onRampAddress The address of the onRamp. - function getOnRamp(uint64 destChainSelector) external view returns (address onRampAddress); + function getOnRamp( + uint64 destChainSelector + ) external view returns (address onRampAddress); /// @notice Return true if the given offRamp is a configured offRamp for the given source chain. /// @param sourceChainSelector The source chain selector to check. diff --git a/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol b/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol index 27913b597d..36218b36b3 100644 --- a/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol +++ b/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol @@ -11,7 +11,9 @@ interface IRouterClient { /// @notice Checks if the given chain ID is supported for sending/receiving. /// @param destChainSelector The chain to check. /// @return supported is true if it is supported, false if not. - function isChainSupported(uint64 destChainSelector) external view returns (bool supported); + function isChainSupported( + uint64 destChainSelector + ) external view returns (bool supported); /// @param destinationChainSelector The destination chainSelector /// @param message The cross-chain CCIP message including data and/or tokens diff --git a/contracts/src/v0.8/ccip/interfaces/ITokenAdminRegistry.sol b/contracts/src/v0.8/ccip/interfaces/ITokenAdminRegistry.sol index 0e44122901..04bacbac5a 100644 --- a/contracts/src/v0.8/ccip/interfaces/ITokenAdminRegistry.sol +++ b/contracts/src/v0.8/ccip/interfaces/ITokenAdminRegistry.sol @@ -3,7 +3,9 @@ pragma solidity ^0.8.0; interface ITokenAdminRegistry { /// @notice Returns the pool for the given token. - function getPool(address token) external view returns (address); + function getPool( + address token + ) external view returns (address); /// @notice Proposes an administrator for the given token as pending administrator. /// @param localToken The token to register the administrator for. diff --git a/contracts/src/v0.8/ccip/interfaces/IWrappedNative.sol b/contracts/src/v0.8/ccip/interfaces/IWrappedNative.sol index 4225827a61..f4f824361e 100644 --- a/contracts/src/v0.8/ccip/interfaces/IWrappedNative.sol +++ b/contracts/src/v0.8/ccip/interfaces/IWrappedNative.sol @@ -6,5 +6,7 @@ import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ interface IWrappedNative is IERC20 { function deposit() external payable; - function withdraw(uint256 wad) external; + function withdraw( + uint256 wad + ) external; } diff --git a/contracts/src/v0.8/ccip/interfaces/encodingutils/ICCIPEncodingUtils.sol b/contracts/src/v0.8/ccip/interfaces/encodingutils/ICCIPEncodingUtils.sol index 026c5fa50b..5cba49bc7f 100644 --- a/contracts/src/v0.8/ccip/interfaces/encodingutils/ICCIPEncodingUtils.sol +++ b/contracts/src/v0.8/ccip/interfaces/encodingutils/ICCIPEncodingUtils.sol @@ -12,5 +12,7 @@ interface ICCIPEncodingUtils { function exposeRmnReport(bytes32 rmnReportVersion, RMNRemote.Report memory rmnReport) external; /// @dev the OCR3Config Config struct is used in integration / E2E tests - function exposeOCR3Config(CCIPHome.OCR3Config[] calldata config) external view returns (bytes memory); + function exposeOCR3Config( + CCIPHome.OCR3Config[] calldata config + ) external view returns (bytes memory); } diff --git a/contracts/src/v0.8/ccip/libraries/Client.sol b/contracts/src/v0.8/ccip/libraries/Client.sol index a985371bef..de1f6f1580 100644 --- a/contracts/src/v0.8/ccip/libraries/Client.sol +++ b/contracts/src/v0.8/ccip/libraries/Client.sol @@ -33,7 +33,9 @@ library Client { uint256 gasLimit; } - function _argsToBytes(EVMExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) { + function _argsToBytes( + EVMExtraArgsV1 memory extraArgs + ) internal pure returns (bytes memory bts) { return abi.encodeWithSelector(EVM_EXTRA_ARGS_V1_TAG, extraArgs); } @@ -49,7 +51,9 @@ library Client { bool allowOutOfOrderExecution; } - function _argsToBytes(EVMExtraArgsV2 memory extraArgs) internal pure returns (bytes memory bts) { + function _argsToBytes( + EVMExtraArgsV2 memory extraArgs + ) internal pure returns (bytes memory bts) { return abi.encodeWithSelector(EVM_EXTRA_ARGS_V2_TAG, extraArgs); } } diff --git a/contracts/src/v0.8/ccip/libraries/Internal.sol b/contracts/src/v0.8/ccip/libraries/Internal.sol index 90b36adb7b..31f107592e 100644 --- a/contracts/src/v0.8/ccip/libraries/Internal.sol +++ b/contracts/src/v0.8/ccip/libraries/Internal.sol @@ -249,7 +249,9 @@ library Internal { /// address is within the EVM address space. If it isn't it will revert with an InvalidEVMAddress error, which /// we can catch and handle more gracefully than a revert from abi.decode. /// @return The address if it is valid, the function will revert otherwise. - function _validateEVMAddress(bytes memory encodedAddress) internal pure returns (address) { + function _validateEVMAddress( + bytes memory encodedAddress + ) internal pure returns (address) { if (encodedAddress.length != 32) revert InvalidEVMAddress(encodedAddress); uint256 encodedAddressUint = abi.decode(encodedAddress, (uint256)); if (encodedAddressUint > type(uint160).max || encodedAddressUint < PRECOMPILE_SPACE) { diff --git a/contracts/src/v0.8/ccip/libraries/RateLimiter.sol b/contracts/src/v0.8/ccip/libraries/RateLimiter.sol index 84914749e0..431b772816 100644 --- a/contracts/src/v0.8/ccip/libraries/RateLimiter.sol +++ b/contracts/src/v0.8/ccip/libraries/RateLimiter.sol @@ -85,7 +85,9 @@ library RateLimiter { /// @notice Gets the token bucket with its values for the block it was requested at. /// @return The token bucket. - function _currentTokenBucketState(TokenBucket memory bucket) internal view returns (TokenBucket memory) { + function _currentTokenBucketState( + TokenBucket memory bucket + ) internal view returns (TokenBucket memory) { // We update the bucket to reflect the status at the exact time of the // call. This means we might need to refill a part of the bucket based // on the time that has passed since the last update. diff --git a/contracts/src/v0.8/ccip/ocr/MultiOCR3Base.sol b/contracts/src/v0.8/ccip/ocr/MultiOCR3Base.sol index 2e698cd230..ba1dc1e32c 100644 --- a/contracts/src/v0.8/ccip/ocr/MultiOCR3Base.sol +++ b/contracts/src/v0.8/ccip/ocr/MultiOCR3Base.sol @@ -128,7 +128,9 @@ abstract contract MultiOCR3Base is ITypeAndVersion, OwnerIsCreator { /// @dev precondition number of transmitters should match the expected F/fChain relationship. /// For transmitters, the function only validates that len(transmitters) > 0 && len(transmitters) <= MAX_NUM_ORACLES /// && len(transmitters) <= len(signers) [if sig verification is enabled] - function setOCR3Configs(OCRConfigArgs[] memory ocrConfigArgs) external onlyOwner { + function setOCR3Configs( + OCRConfigArgs[] memory ocrConfigArgs + ) external onlyOwner { for (uint256 i; i < ocrConfigArgs.length; ++i) { _setOCR3Config(ocrConfigArgs[i]); } @@ -136,7 +138,9 @@ abstract contract MultiOCR3Base is ITypeAndVersion, OwnerIsCreator { /// @notice Sets offchain reporting protocol configuration incl. participating oracles for a single OCR plugin type. /// @param ocrConfigArgs OCR config update args. - function _setOCR3Config(OCRConfigArgs memory ocrConfigArgs) internal { + function _setOCR3Config( + OCRConfigArgs memory ocrConfigArgs + ) internal { if (ocrConfigArgs.F == 0) revert InvalidConfig(InvalidConfigErrorType.F_MUST_BE_POSITIVE); uint8 ocrPluginType = ocrConfigArgs.ocrPluginType; @@ -187,7 +191,9 @@ abstract contract MultiOCR3Base is ITypeAndVersion, OwnerIsCreator { /// @notice Hook that is called after a plugin's OCR3 config changes. /// @param ocrPluginType Plugin type for which the config changed. - function _afterOCR3ConfigSet(uint8 ocrPluginType) internal virtual; + function _afterOCR3ConfigSet( + uint8 ocrPluginType + ) internal virtual; /// @notice Clears oracle roles for the provided oracle addresses. /// @param ocrPluginType OCR plugin type to clear roles for. @@ -321,7 +327,9 @@ abstract contract MultiOCR3Base is ITypeAndVersion, OwnerIsCreator { /// @notice Information about current offchain reporting protocol configuration. /// @param ocrPluginType OCR plugin type to return config details for. /// @return ocrConfig OCR config for the plugin type. - function latestConfigDetails(uint8 ocrPluginType) external view returns (OCRConfig memory ocrConfig) { + function latestConfigDetails( + uint8 ocrPluginType + ) external view returns (OCRConfig memory ocrConfig) { return s_ocrConfigs[ocrPluginType]; } } diff --git a/contracts/src/v0.8/ccip/ocr/OCR2Base.sol b/contracts/src/v0.8/ccip/ocr/OCR2Base.sol index 74c8e47917..3cd10f2c55 100644 --- a/contracts/src/v0.8/ccip/ocr/OCR2Base.sol +++ b/contracts/src/v0.8/ccip/ocr/OCR2Base.sol @@ -89,7 +89,9 @@ abstract contract OCR2Base is OwnerIsCreator, OCR2Abstract { bool internal immutable i_uniqueReports; uint256 internal immutable i_chainID; - constructor(bool uniqueReports) { + constructor( + bool uniqueReports + ) { i_uniqueReports = uniqueReports; i_chainID = block.chainid; } @@ -176,7 +178,9 @@ abstract contract OCR2Base is OwnerIsCreator, OCR2Abstract { /// @dev Hook that is run from setOCR2Config() right after validating configuration. /// Empty by default, please provide an implementation in a child contract if you need additional configuration processing - function _beforeSetConfig(bytes memory _onchainConfig) internal virtual; + function _beforeSetConfig( + bytes memory _onchainConfig + ) internal virtual; /// @return list of addresses permitted to transmit reports to this contract /// @dev The list will match the order used to specify the transmitter during setConfig diff --git a/contracts/src/v0.8/ccip/ocr/OCR2BaseNoChecks.sol b/contracts/src/v0.8/ccip/ocr/OCR2BaseNoChecks.sol index 8bada2c378..b9a2b31ef2 100644 --- a/contracts/src/v0.8/ccip/ocr/OCR2BaseNoChecks.sol +++ b/contracts/src/v0.8/ccip/ocr/OCR2BaseNoChecks.sol @@ -158,7 +158,9 @@ abstract contract OCR2BaseNoChecks is OwnerIsCreator, OCR2Abstract { /// @dev Hook that is run from setOCR2Config() right after validating configuration. /// Empty by default, please provide an implementation in a child contract if you need additional configuration processing - function _beforeSetConfig(bytes memory _onchainConfig) internal virtual; + function _beforeSetConfig( + bytes memory _onchainConfig + ) internal virtual; /// @return list of addresses permitted to transmit reports to this contract /// @dev The list will match the order used to specify the transmitter during setConfig @@ -238,5 +240,7 @@ abstract contract OCR2BaseNoChecks is OwnerIsCreator, OCR2Abstract { return (true, bytes32(0), uint32(0)); } - function _report(bytes calldata report) internal virtual; + function _report( + bytes calldata report + ) internal virtual; } diff --git a/contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol b/contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol index 0be7fe7511..c1fd117de6 100644 --- a/contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol +++ b/contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol @@ -187,7 +187,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio /// @param sequenceNumber The sequence number of the message to get the execution state for. /// @return The current execution state of the message. /// @dev we use the literal number 128 because using a constant increased gas usage. - function getExecutionState(uint64 sequenceNumber) public view returns (Internal.MessageExecutionState) { + function getExecutionState( + uint64 sequenceNumber + ) public view returns (Internal.MessageExecutionState) { return Internal.MessageExecutionState( (s_executionStates[sequenceNumber / 128] >> ((sequenceNumber % 128) * MESSAGE_EXECUTION_STATE_BIT_WIDTH)) & MESSAGE_EXECUTION_STATE_MASK @@ -211,7 +213,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio } /// @inheritdoc IAny2EVMOffRamp - function getSenderNonce(address sender) external view returns (uint64 nonce) { + function getSenderNonce( + address sender + ) external view returns (uint64 nonce) { uint256 senderNonce = s_senderNonce[sender]; if (senderNonce == 0) { @@ -276,7 +280,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio /// @notice Entrypoint for execution, called by the OCR network /// @dev Expects an encoded ExecutionReport /// @dev Supplies no GasLimitOverrides as the DON will only execute with the original gas limits. - function _report(bytes calldata report) internal override { + function _report( + bytes calldata report + ) internal override { _execute(abi.decode(report, (Internal.ExecutionReport)), new GasLimitOverride[](0)); } @@ -540,7 +546,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio } /// @notice creates a unique hash to be used in message hashing. - function _metadataHash(bytes32 prefix) internal view returns (bytes32) { + function _metadataHash( + bytes32 prefix + ) internal view returns (bytes32) { return keccak256(abi.encode(prefix, i_sourceChainSelector, i_chainSelector, i_onRamp)); } @@ -570,7 +578,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio } /// @notice Sets the dynamic config. This function is called during `setOCR2Config` flow - function _beforeSetConfig(bytes memory onchainConfig) internal override { + function _beforeSetConfig( + bytes memory onchainConfig + ) internal override { DynamicConfig memory dynamicConfig = abi.decode(onchainConfig, (DynamicConfig)); if (dynamicConfig.router == address(0)) revert ZeroAddressNotAllowed(); @@ -789,7 +799,9 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio // ================================================================ /// @notice Reverts as this contract should not access CCIP messages - function ccipReceive(Client.Any2EVMMessage calldata) external pure { + function ccipReceive( + Client.Any2EVMMessage calldata + ) external pure { // solhint-disable-next-line revert(); } diff --git a/contracts/src/v0.8/ccip/offRamp/OffRamp.sol b/contracts/src/v0.8/ccip/offRamp/OffRamp.sol index 14d5ae5c75..63232c038e 100644 --- a/contracts/src/v0.8/ccip/offRamp/OffRamp.sol +++ b/contracts/src/v0.8/ccip/offRamp/OffRamp.sol @@ -880,7 +880,9 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { } /// @inheritdoc MultiOCR3Base - function _afterOCR3ConfigSet(uint8 ocrPluginType) internal override { + function _afterOCR3ConfigSet( + uint8 ocrPluginType + ) internal override { if (ocrPluginType == uint8(Internal.OCRPluginType.Commit)) { // Signature verification must be enabled for commit plugin if (!s_ocrConfigs[ocrPluginType].configInfo.isSignatureVerificationEnabled) { @@ -920,7 +922,9 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { /// @notice Returns the source chain config for the provided source chain selector /// @param sourceChainSelector chain to retrieve configuration for /// @return sourceChainConfig The config for the source chain - function getSourceChainConfig(uint64 sourceChainSelector) external view returns (SourceChainConfig memory) { + function getSourceChainConfig( + uint64 sourceChainSelector + ) external view returns (SourceChainConfig memory) { return s_sourceChainConfigs[sourceChainSelector]; } @@ -938,13 +942,17 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { /// @notice Updates source configs /// @param sourceChainConfigUpdates Source chain configs - function applySourceChainConfigUpdates(SourceChainConfigArgs[] memory sourceChainConfigUpdates) external onlyOwner { + function applySourceChainConfigUpdates( + SourceChainConfigArgs[] memory sourceChainConfigUpdates + ) external onlyOwner { _applySourceChainConfigUpdates(sourceChainConfigUpdates); } /// @notice Updates source configs /// @param sourceChainConfigUpdates Source chain configs - function _applySourceChainConfigUpdates(SourceChainConfigArgs[] memory sourceChainConfigUpdates) internal { + function _applySourceChainConfigUpdates( + SourceChainConfigArgs[] memory sourceChainConfigUpdates + ) internal { for (uint256 i = 0; i < sourceChainConfigUpdates.length; ++i) { SourceChainConfigArgs memory sourceConfigUpdate = sourceChainConfigUpdates[i]; uint64 sourceChainSelector = sourceConfigUpdate.sourceChainSelector; @@ -988,13 +996,17 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { /// @notice Sets the dynamic config. /// @param dynamicConfig The new dynamic config. - function setDynamicConfig(DynamicConfig memory dynamicConfig) external onlyOwner { + function setDynamicConfig( + DynamicConfig memory dynamicConfig + ) external onlyOwner { _setDynamicConfig(dynamicConfig); } /// @notice Sets the dynamic config. /// @param dynamicConfig The dynamic config. - function _setDynamicConfig(DynamicConfig memory dynamicConfig) internal { + function _setDynamicConfig( + DynamicConfig memory dynamicConfig + ) internal { if (dynamicConfig.feeQuoter == address(0)) { revert ZeroAddressNotAllowed(); } @@ -1007,7 +1019,9 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { /// @notice Returns a source chain config with a check that the config is enabled /// @param sourceChainSelector Source chain selector to check for cursing /// @return sourceChainConfig The source chain config storage pointer - function _getEnabledSourceChainConfig(uint64 sourceChainSelector) internal view returns (SourceChainConfig storage) { + function _getEnabledSourceChainConfig( + uint64 sourceChainSelector + ) internal view returns (SourceChainConfig storage) { SourceChainConfig storage sourceChainConfig = s_sourceChainConfigs[sourceChainSelector]; if (!sourceChainConfig.isEnabled) { revert SourceChainNotEnabled(sourceChainSelector); @@ -1021,7 +1035,9 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { // ================================================================ /// @notice Reverts as this contract should not be able to receive CCIP messages - function ccipReceive(Client.Any2EVMMessage calldata) external pure { + function ccipReceive( + Client.Any2EVMMessage calldata + ) external pure { // solhint-disable-next-line revert(); } diff --git a/contracts/src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol b/contracts/src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol index 0c48b10e64..99bc27e80a 100644 --- a/contracts/src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol +++ b/contracts/src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol @@ -246,7 +246,9 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, } /// @inheritdoc IEVM2AnyOnRamp - function getSenderNonce(address sender) external view returns (uint64) { + function getSenderNonce( + address sender + ) external view returns (uint64) { uint256 senderNonce = s_senderNonce[sender]; if (i_prevOnRamp != address(0)) { @@ -399,7 +401,9 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, /// @dev Convert the extra args bytes into a struct /// @param extraArgs The extra args bytes /// @return The extra args struct - function _fromBytes(bytes calldata extraArgs) internal view returns (Client.EVMExtraArgsV2 memory) { + function _fromBytes( + bytes calldata extraArgs + ) internal view returns (Client.EVMExtraArgsV2 memory) { if (extraArgs.length == 0) { return Client.EVMExtraArgsV2({gasLimit: i_defaultTxGasLimit, allowOutOfOrderExecution: false}); } @@ -467,12 +471,16 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, /// @notice Sets the dynamic configuration. /// @param dynamicConfig The configuration. - function setDynamicConfig(DynamicConfig memory dynamicConfig) external onlyOwner { + function setDynamicConfig( + DynamicConfig memory dynamicConfig + ) external onlyOwner { _setDynamicConfig(dynamicConfig); } /// @notice Internal version of setDynamicConfig to allow for reuse in the constructor. - function _setDynamicConfig(DynamicConfig memory dynamicConfig) internal { + function _setDynamicConfig( + DynamicConfig memory dynamicConfig + ) internal { // We permit router to be set to zero as a way to pause the contract. if (dynamicConfig.priceRegistry == address(0)) revert InvalidConfig(); s_dynamicConfig = dynamicConfig; @@ -502,7 +510,9 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, } /// @inheritdoc IEVM2AnyOnRampClient - function getSupportedTokens(uint64) external pure returns (address[] memory) { + function getSupportedTokens( + uint64 + ) external pure returns (address[] memory) { revert GetSupportedTokensFunctionalityRemovedCheckAdminRegistry(); } @@ -688,20 +698,26 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, /// @notice Gets the fee configuration for a token /// @param token The token to get the fee configuration for /// @return feeTokenConfig FeeTokenConfig struct - function getFeeTokenConfig(address token) external view returns (FeeTokenConfig memory feeTokenConfig) { + function getFeeTokenConfig( + address token + ) external view returns (FeeTokenConfig memory feeTokenConfig) { return s_feeTokenConfig[token]; } /// @notice Sets the fee configuration for a token /// @param feeTokenConfigArgs Array of FeeTokenConfigArgs structs. - function setFeeTokenConfig(FeeTokenConfigArgs[] memory feeTokenConfigArgs) external { + function setFeeTokenConfig( + FeeTokenConfigArgs[] memory feeTokenConfigArgs + ) external { _onlyOwnerOrAdmin(); _setFeeTokenConfig(feeTokenConfigArgs); } /// @dev Set the fee config /// @param feeTokenConfigArgs The fee token configs. - function _setFeeTokenConfig(FeeTokenConfigArgs[] memory feeTokenConfigArgs) internal { + function _setFeeTokenConfig( + FeeTokenConfigArgs[] memory feeTokenConfigArgs + ) internal { for (uint256 i = 0; i < feeTokenConfigArgs.length; ++i) { FeeTokenConfigArgs memory configArg = feeTokenConfigArgs[i]; @@ -791,7 +807,9 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, /// @notice Sets the Nops and their weights /// @param nopsAndWeights Array of NopAndWeight structs - function setNops(NopAndWeight[] calldata nopsAndWeights) external { + function setNops( + NopAndWeight[] calldata nopsAndWeights + ) external { _onlyOwnerOrAdmin(); _setNops(nopsAndWeights); } @@ -800,7 +818,9 @@ contract EVM2EVMOnRamp is IEVM2AnyOnRamp, ILinkAvailable, AggregateRateLimiter, /// @dev Clears existing nops, sets new nops and weights /// @dev We permit fees to accrue before nops are configured, in which case /// they will go to the first set of configured nops. - function _setNops(NopAndWeight[] memory nopsAndWeights) internal { + function _setNops( + NopAndWeight[] memory nopsAndWeights + ) internal { uint256 numberOfNops = nopsAndWeights.length; if (numberOfNops > MAX_NUMBER_OF_NOPS) revert TooManyNops(); diff --git a/contracts/src/v0.8/ccip/onRamp/OnRamp.sol b/contracts/src/v0.8/ccip/onRamp/OnRamp.sol index e053baf507..d7af0d9eb2 100644 --- a/contracts/src/v0.8/ccip/onRamp/OnRamp.sol +++ b/contracts/src/v0.8/ccip/onRamp/OnRamp.sol @@ -155,7 +155,9 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { /// @notice Gets the next sequence number to be used in the onRamp /// @param destChainSelector The destination chain selector /// @return nextSequenceNumber The next sequence number to be used - function getExpectedNextSequenceNumber(uint64 destChainSelector) external view returns (uint64) { + function getExpectedNextSequenceNumber( + uint64 destChainSelector + ) external view returns (uint64) { return s_destChainConfigs[destChainSelector].sequenceNumber + 1; } @@ -329,19 +331,25 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { /// @notice Sets the dynamic configuration. /// @param dynamicConfig The configuration. - function setDynamicConfig(DynamicConfig memory dynamicConfig) external onlyOwner { + function setDynamicConfig( + DynamicConfig memory dynamicConfig + ) external onlyOwner { _setDynamicConfig(dynamicConfig); } /// @notice Gets the source router for a destination chain /// @param destChainSelector The destination chain selector /// @return router the router for the provided destination chain - function getRouter(uint64 destChainSelector) external view returns (IRouter) { + function getRouter( + uint64 destChainSelector + ) external view returns (IRouter) { return s_destChainConfigs[destChainSelector].router; } /// @notice Internal version of setDynamicConfig to allow for reuse in the constructor. - function _setDynamicConfig(DynamicConfig memory dynamicConfig) internal { + function _setDynamicConfig( + DynamicConfig memory dynamicConfig + ) internal { if ( dynamicConfig.feeQuoter == address(0) || dynamicConfig.feeAggregator == address(0) || dynamicConfig.reentrancyGuardEntered @@ -362,12 +370,16 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { /// @notice Updates destination chains specific configs. /// @param destChainConfigArgs Array of destination chain specific configs. - function applyDestChainConfigUpdates(DestChainConfigArgs[] memory destChainConfigArgs) external onlyOwner { + function applyDestChainConfigUpdates( + DestChainConfigArgs[] memory destChainConfigArgs + ) external onlyOwner { _applyDestChainConfigUpdates(destChainConfigArgs); } /// @notice Internal version of applyDestChainConfigUpdates. - function _applyDestChainConfigUpdates(DestChainConfigArgs[] memory destChainConfigArgs) internal { + function _applyDestChainConfigUpdates( + DestChainConfigArgs[] memory destChainConfigArgs + ) internal { for (uint256 i = 0; i < destChainConfigArgs.length; ++i) { DestChainConfigArgs memory destChainConfigArg = destChainConfigArgs[i]; uint64 destChainSelector = destChainConfigArgs[i].destChainSelector; @@ -404,7 +416,9 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { /// @notice get allowedSenders List configured for the DestinationChainSelector /// @param destChainSelector The destination chain selector /// @return array of allowedList of Senders - function getAllowedSendersList(uint64 destChainSelector) public view returns (address[] memory) { + function getAllowedSendersList( + uint64 destChainSelector + ) public view returns (address[] memory) { return s_destChainConfigs[destChainSelector].allowedSendersList.values(); } @@ -415,7 +429,9 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { /// @notice Updates allowListConfig for Senders /// @dev configuration used to set the list of senders who are authorized to send messages /// @param allowListConfigArgsItems Array of AllowListConfigArguments where each item is for a destChainSelector - function applyAllowListUpdates(AllowListConfigArgs[] calldata allowListConfigArgsItems) external { + function applyAllowListUpdates( + AllowListConfigArgs[] calldata allowListConfigArgsItems + ) external { if (msg.sender != owner()) { if (msg.sender != s_dynamicConfig.allowListAdmin) { revert OnlyCallableByOwnerOrAllowlistAdmin(); @@ -466,7 +482,9 @@ contract OnRamp is IEVM2AnyOnRampClient, ITypeAndVersion, OwnerIsCreator { } /// @inheritdoc IEVM2AnyOnRampClient - function getSupportedTokens(uint64 /*destChainSelector*/ ) external pure returns (address[] memory) { + function getSupportedTokens( + uint64 /*destChainSelector*/ + ) external pure returns (address[] memory) { revert GetSupportedTokensFunctionalityRemovedCheckAdminRegistry(); } diff --git a/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol b/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol index 4ea6664a5c..1ba13a4974 100644 --- a/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol @@ -32,7 +32,9 @@ contract BurnFromMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion { } /// @inheritdoc BurnMintTokenPoolAbstract - function _burn(uint256 amount) internal virtual override { + function _burn( + uint256 amount + ) internal virtual override { IBurnMintERC20(address(i_token)).burnFrom(address(this), amount); } } diff --git a/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol b/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol index c48c8e51fb..33026cf005 100644 --- a/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol @@ -24,7 +24,9 @@ contract BurnMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion { ) TokenPool(token, allowlist, rmnProxy, router) {} /// @inheritdoc BurnMintTokenPoolAbstract - function _burn(uint256 amount) internal virtual override { + function _burn( + uint256 amount + ) internal virtual override { IBurnMintERC20(address(i_token)).burn(amount); } } diff --git a/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol b/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol index 99908c91d0..6d743ed4a9 100644 --- a/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol +++ b/contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAbstract.sol @@ -10,7 +10,9 @@ abstract contract BurnMintTokenPoolAbstract is TokenPool { /// @notice Contains the specific burn call for a pool. /// @dev overriding this method allows us to create pools with different burn signatures /// without duplicating the underlying logic. - function _burn(uint256 amount) internal virtual; + function _burn( + uint256 amount + ) internal virtual; /// @notice Burn the token in the pool /// @dev The _validateLockOrBurn check is an essential security check diff --git a/contracts/src/v0.8/ccip/pools/BurnWithFromMintTokenPool.sol b/contracts/src/v0.8/ccip/pools/BurnWithFromMintTokenPool.sol index b999be6981..37541bb827 100644 --- a/contracts/src/v0.8/ccip/pools/BurnWithFromMintTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/BurnWithFromMintTokenPool.sol @@ -30,7 +30,9 @@ contract BurnWithFromMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion } /// @inheritdoc BurnMintTokenPoolAbstract - function _burn(uint256 amount) internal virtual override { + function _burn( + uint256 amount + ) internal virtual override { IBurnMintERC20(address(i_token)).burn(address(this), amount); } diff --git a/contracts/src/v0.8/ccip/pools/LegacyPoolWrapper.sol b/contracts/src/v0.8/ccip/pools/LegacyPoolWrapper.sol index 43326681e5..90c90369d8 100644 --- a/contracts/src/v0.8/ccip/pools/LegacyPoolWrapper.sol +++ b/contracts/src/v0.8/ccip/pools/LegacyPoolWrapper.sol @@ -36,7 +36,9 @@ abstract contract LegacyPoolWrapper is TokenPool { // Legacy fallbacks for older token pools that do not implement the new interface. /// @notice Legacy fallback for the 1.4 token pools. - function getOnRamp(uint64) external view returns (address onRampAddress) { + function getOnRamp( + uint64 + ) external view returns (address onRampAddress) { return address(this); } @@ -48,7 +50,9 @@ abstract contract LegacyPoolWrapper is TokenPool { /// @notice Configures the legacy fallback option. If the previous pool is set, this pool will act as a proxy for /// the legacy pool. /// @param prevPool The address of the previous pool. - function setPreviousPool(IPoolPriorTo1_5 prevPool) external onlyOwner { + function setPreviousPool( + IPoolPriorTo1_5 prevPool + ) external onlyOwner { IPoolPriorTo1_5 oldPrevPool = s_previousPool; s_previousPool = prevPool; @@ -64,7 +68,9 @@ abstract contract LegacyPoolWrapper is TokenPool { return address(s_previousPool) != address(0); } - function _lockOrBurnLegacy(Pool.LockOrBurnInV1 memory lockOrBurnIn) internal { + function _lockOrBurnLegacy( + Pool.LockOrBurnInV1 memory lockOrBurnIn + ) internal { i_token.safeTransfer(address(s_previousPool), lockOrBurnIn.amount); s_previousPool.lockOrBurn( lockOrBurnIn.originalSender, lockOrBurnIn.receiver, lockOrBurnIn.amount, lockOrBurnIn.remoteChainSelector, "" @@ -78,7 +84,9 @@ abstract contract LegacyPoolWrapper is TokenPool { /// offRamp. This is due to the older pools sending funds directly to the receiver, while the new pools do a hop /// through the offRamp to ensure the correct tokens are sent. /// @dev Since extraData has never been used in LockRelease or MintBurn token pools, we can safely ignore it. - function _releaseOrMintLegacy(Pool.ReleaseOrMintInV1 memory releaseOrMintIn) internal { + function _releaseOrMintLegacy( + Pool.ReleaseOrMintInV1 memory releaseOrMintIn + ) internal { s_previousPool.releaseOrMint( releaseOrMintIn.originalSender, releaseOrMintIn.receiver, diff --git a/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol b/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol index 3a4a4aef6d..0f77304b18 100644 --- a/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol @@ -70,7 +70,9 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion } // @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == type(ILiquidityContainer).interfaceId || super.supportsInterface(interfaceId); } @@ -82,7 +84,9 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion /// @notice Sets the LiquidityManager address. /// @dev Only callable by the owner. - function setRebalancer(address rebalancer) external onlyOwner { + function setRebalancer( + address rebalancer + ) external onlyOwner { s_rebalancer = rebalancer; } @@ -94,7 +98,9 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion /// @notice Adds liquidity to the pool. The tokens should be approved first. /// @param amount The amount of liquidity to provide. - function provideLiquidity(uint256 amount) external { + function provideLiquidity( + uint256 amount + ) external { if (!i_acceptLiquidity) revert LiquidityNotAccepted(); if (s_rebalancer != msg.sender) revert Unauthorized(msg.sender); @@ -104,7 +110,9 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion /// @notice Removed liquidity to the pool. The tokens will be sent to msg.sender. /// @param amount The amount of liquidity to remove. - function withdrawLiquidity(uint256 amount) external { + function withdrawLiquidity( + uint256 amount + ) external { if (s_rebalancer != msg.sender) revert Unauthorized(msg.sender); if (i_token.balanceOf(address(this)) < amount) revert InsufficientLiquidity(); diff --git a/contracts/src/v0.8/ccip/pools/LockReleaseTokenPoolAndProxy.sol b/contracts/src/v0.8/ccip/pools/LockReleaseTokenPoolAndProxy.sol index e8c39127de..1671b9650f 100644 --- a/contracts/src/v0.8/ccip/pools/LockReleaseTokenPoolAndProxy.sol +++ b/contracts/src/v0.8/ccip/pools/LockReleaseTokenPoolAndProxy.sol @@ -76,7 +76,9 @@ contract LockReleaseTokenPoolAndProxy is LegacyPoolWrapper, ILiquidityContainer, } // @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == type(ILiquidityContainer).interfaceId || super.supportsInterface(interfaceId); } @@ -88,7 +90,9 @@ contract LockReleaseTokenPoolAndProxy is LegacyPoolWrapper, ILiquidityContainer, /// @notice Sets the LiquidityManager address. /// @dev Only callable by the owner. - function setRebalancer(address rebalancer) external onlyOwner { + function setRebalancer( + address rebalancer + ) external onlyOwner { s_rebalancer = rebalancer; } @@ -100,7 +104,9 @@ contract LockReleaseTokenPoolAndProxy is LegacyPoolWrapper, ILiquidityContainer, /// @notice Adds liquidity to the pool. The tokens should be approved first. /// @param amount The amount of liquidity to provide. - function provideLiquidity(uint256 amount) external { + function provideLiquidity( + uint256 amount + ) external { if (!i_acceptLiquidity) revert LiquidityNotAccepted(); if (s_rebalancer != msg.sender) revert Unauthorized(msg.sender); @@ -110,7 +116,9 @@ contract LockReleaseTokenPoolAndProxy is LegacyPoolWrapper, ILiquidityContainer, /// @notice Removed liquidity to the pool. The tokens will be sent to msg.sender. /// @param amount The amount of liquidity to remove. - function withdrawLiquidity(uint256 amount) external { + function withdrawLiquidity( + uint256 amount + ) external { if (s_rebalancer != msg.sender) revert Unauthorized(msg.sender); if (i_token.balanceOf(address(this)) < amount) revert InsufficientLiquidity(); diff --git a/contracts/src/v0.8/ccip/pools/TokenPool.sol b/contracts/src/v0.8/ccip/pools/TokenPool.sol index ebd613134a..e3b4e92055 100644 --- a/contracts/src/v0.8/ccip/pools/TokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/TokenPool.sol @@ -112,7 +112,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { } /// @inheritdoc IPoolV1 - function isSupportedToken(address token) public view virtual returns (bool) { + function isSupportedToken( + address token + ) public view virtual returns (bool) { return token == address(i_token); } @@ -130,7 +132,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @notice Sets the pool's Router /// @param newRouter The new Router - function setRouter(address newRouter) public onlyOwner { + function setRouter( + address newRouter + ) public onlyOwner { if (newRouter == address(0)) revert ZeroAddressNotAllowed(); address oldRouter = address(s_router); s_router = IRouter(newRouter); @@ -139,7 +143,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { } /// @notice Signals which version of the pool interface is supported - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == Pool.CCIP_POOL_V1 || interfaceId == type(IPoolV1).interfaceId || interfaceId == type(IERC165).interfaceId; } @@ -157,7 +163,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @param lockOrBurnIn The input to validate. /// @dev This function should always be called before executing a lock or burn. Not doing so would allow /// for various exploits. - function _validateLockOrBurn(Pool.LockOrBurnInV1 memory lockOrBurnIn) internal { + function _validateLockOrBurn( + Pool.LockOrBurnInV1 memory lockOrBurnIn + ) internal { if (!isSupportedToken(lockOrBurnIn.localToken)) revert InvalidToken(lockOrBurnIn.localToken); if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(lockOrBurnIn.remoteChainSelector)))) revert CursedByRMN(); _checkAllowList(lockOrBurnIn.originalSender); @@ -175,7 +183,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @param releaseOrMintIn The input to validate. /// @dev This function should always be called before executing a release or mint. Not doing so would allow /// for various exploits. - function _validateReleaseOrMint(Pool.ReleaseOrMintInV1 memory releaseOrMintIn) internal { + function _validateReleaseOrMint( + Pool.ReleaseOrMintInV1 memory releaseOrMintIn + ) internal { if (!isSupportedToken(releaseOrMintIn.localToken)) revert InvalidToken(releaseOrMintIn.localToken); if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(releaseOrMintIn.remoteChainSelector)))) revert CursedByRMN(); _onlyOffRamp(releaseOrMintIn.remoteChainSelector); @@ -198,14 +208,18 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @notice Gets the pool address on the remote chain. /// @param remoteChainSelector Remote chain selector. /// @dev To support non-evm chains, this value is encoded into bytes - function getRemotePool(uint64 remoteChainSelector) public view returns (bytes memory) { + function getRemotePool( + uint64 remoteChainSelector + ) public view returns (bytes memory) { return s_remoteChainConfigs[remoteChainSelector].remotePoolAddress; } /// @notice Gets the token address on the remote chain. /// @param remoteChainSelector Remote chain selector. /// @dev To support non-evm chains, this value is encoded into bytes - function getRemoteToken(uint64 remoteChainSelector) public view returns (bytes memory) { + function getRemoteToken( + uint64 remoteChainSelector + ) public view returns (bytes memory) { return s_remoteChainConfigs[remoteChainSelector].remoteTokenAddress; } @@ -222,7 +236,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { } /// @inheritdoc IPoolV1 - function isSupportedChain(uint64 remoteChainSelector) public view returns (bool) { + function isSupportedChain( + uint64 remoteChainSelector + ) public view returns (bool) { return s_remoteChainSelectors.contains(remoteChainSelector); } @@ -243,7 +259,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @dev Only callable by the owner /// @param chains A list of chains and their new permission status & rate limits. Rate limits /// are only used when the chain is being added through `allowed` being true. - function applyChainUpdates(ChainUpdate[] calldata chains) external virtual onlyOwner { + function applyChainUpdates( + ChainUpdate[] calldata chains + ) external virtual onlyOwner { for (uint256 i = 0; i < chains.length; ++i) { ChainUpdate memory update = chains[i]; RateLimiter._validateTokenBucketConfig(update.outboundRateLimiterConfig, !update.allowed); @@ -304,7 +322,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @notice Sets the rate limiter admin address. /// @dev Only callable by the owner. /// @param rateLimitAdmin The new rate limiter admin address. - function setRateLimitAdmin(address rateLimitAdmin) external onlyOwner { + function setRateLimitAdmin( + address rateLimitAdmin + ) external onlyOwner { s_rateLimitAdmin = rateLimitAdmin; } @@ -372,14 +392,18 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned onRamp for the given chain on the Router. - function _onlyOnRamp(uint64 remoteChainSelector) internal view { + function _onlyOnRamp( + uint64 remoteChainSelector + ) internal view { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!(msg.sender == s_router.getOnRamp(remoteChainSelector))) revert CallerIsNotARampOnRouter(msg.sender); } /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned offRamp for the given chain on the Router. - function _onlyOffRamp(uint64 remoteChainSelector) internal view { + function _onlyOffRamp( + uint64 remoteChainSelector + ) internal view { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!s_router.isOffRamp(remoteChainSelector, msg.sender)) revert CallerIsNotARampOnRouter(msg.sender); } @@ -388,7 +412,9 @@ abstract contract TokenPool is IPoolV1, OwnerIsCreator { // │ Allowlist │ // ================================================================ - function _checkAllowList(address sender) internal view { + function _checkAllowList( + address sender + ) internal view { if (i_allowlistEnabled) { if (!s_allowList.contains(sender)) { revert SenderNotAllowed(sender); diff --git a/contracts/src/v0.8/ccip/pools/USDC/HybridLockReleaseUSDCTokenPool.sol b/contracts/src/v0.8/ccip/pools/USDC/HybridLockReleaseUSDCTokenPool.sol index 5fbd71bb2c..3691ef1c7b 100644 --- a/contracts/src/v0.8/ccip/pools/USDC/HybridLockReleaseUSDCTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/USDC/HybridLockReleaseUSDCTokenPool.sol @@ -145,7 +145,9 @@ contract HybridLockReleaseUSDCTokenPool is USDCTokenPool, USDCBridgeMigrator { /// @notice Gets LiquidityManager, can be address(0) if none is configured. /// @return The current liquidity manager for the given chain selector - function getLiquidityProvider(uint64 remoteChainSelector) external view returns (address) { + function getLiquidityProvider( + uint64 remoteChainSelector + ) external view returns (address) { return s_liquidityProvider[remoteChainSelector]; } @@ -236,7 +238,9 @@ contract HybridLockReleaseUSDCTokenPool is USDCTokenPool, USDCBridgeMigrator { /// @notice Return whether a lane should use the alternative L/R mechanism in the token pool. /// @param remoteChainSelector the remote chain the lane is interacting with /// @return bool Return true if the alternative L/R mechanism should be used - function shouldUseLockRelease(uint64 remoteChainSelector) public view virtual returns (bool) { + function shouldUseLockRelease( + uint64 remoteChainSelector + ) public view virtual returns (bool) { return s_shouldUseLockRelease[remoteChainSelector]; } diff --git a/contracts/src/v0.8/ccip/pools/USDC/USDCBridgeMigrator.sol b/contracts/src/v0.8/ccip/pools/USDC/USDCBridgeMigrator.sol index 98616cd79f..4737a83344 100644 --- a/contracts/src/v0.8/ccip/pools/USDC/USDCBridgeMigrator.sol +++ b/contracts/src/v0.8/ccip/pools/USDC/USDCBridgeMigrator.sol @@ -80,7 +80,9 @@ abstract contract USDCBridgeMigrator is OwnerIsCreator { /// non-canonical form of USDC which they wish to update to canonical. Function will revert if an existing migration /// proposal is already in progress. /// @dev This function can only be called by the owner - function proposeCCTPMigration(uint64 remoteChainSelector) external onlyOwner { + function proposeCCTPMigration( + uint64 remoteChainSelector + ) external onlyOwner { // Prevent overwriting existing migration proposals until the current one is finished if (s_proposedUSDCMigrationChain != 0) revert ExistingMigrationProposal(); @@ -114,7 +116,9 @@ abstract contract USDCBridgeMigrator is OwnerIsCreator { /// @notice Set the address of the circle-controlled wallet which will execute a CCTP lane migration /// @dev The function should only be invoked once the address has been confirmed by Circle prior to /// chain expansion. - function setCircleMigratorAddress(address migrator) external onlyOwner { + function setCircleMigratorAddress( + address migrator + ) external onlyOwner { s_circleUSDCMigrator = migrator; emit CircleMigratorAddressSet(migrator); @@ -125,7 +129,9 @@ abstract contract USDCBridgeMigrator is OwnerIsCreator { /// non-canonical form of USDC at present. /// @return uint256 the amount of USDC locked into the specified lane. If non-zero, the number /// should match the current circulating supply of USDC on the destination chain - function getLockedTokensForChain(uint64 remoteChainSelector) public view returns (uint256) { + function getLockedTokensForChain( + uint64 remoteChainSelector + ) public view returns (uint256) { return s_lockedTokensByChainSelector[remoteChainSelector]; } @@ -148,7 +154,9 @@ abstract contract USDCBridgeMigrator is OwnerIsCreator { /// @dev The sum of locked tokens and excluded tokens should equal the supply of the token on the remote chain /// @param remoteChainSelector The chain for which the excluded tokens are being queried /// @return uint256 amount of tokens excluded from being burned in a CCTP-migration - function getExcludedTokensByChain(uint64 remoteChainSelector) public view returns (uint256) { + function getExcludedTokensByChain( + uint64 remoteChainSelector + ) public view returns (uint256) { return s_tokensExcludedFromBurn[remoteChainSelector]; } } diff --git a/contracts/src/v0.8/ccip/pools/USDC/USDCTokenPool.sol b/contracts/src/v0.8/ccip/pools/USDC/USDCTokenPool.sol index 56ab40c9b5..addfe06da0 100644 --- a/contracts/src/v0.8/ccip/pools/USDC/USDCTokenPool.sol +++ b/contracts/src/v0.8/ccip/pools/USDC/USDCTokenPool.sol @@ -206,13 +206,17 @@ contract USDCTokenPool is TokenPool, ITypeAndVersion { // ================================================================ /// @notice Gets the CCTP domain for a given CCIP chain selector. - function getDomain(uint64 chainSelector) external view returns (Domain memory) { + function getDomain( + uint64 chainSelector + ) external view returns (Domain memory) { return s_chainToDomain[chainSelector]; } /// @notice Sets the CCTP domain for a CCIP chain selector. /// @dev Must verify mapping of selectors -> (domain, caller) offchain. - function setDomains(DomainUpdate[] calldata domains) external onlyOwner { + function setDomains( + DomainUpdate[] calldata domains + ) external onlyOwner { for (uint256 i = 0; i < domains.length; ++i) { DomainUpdate memory domain = domains[i]; if (domain.allowedCaller == bytes32(0) || domain.destChainSelector == 0) revert InvalidDomain(domain); diff --git a/contracts/src/v0.8/ccip/rmn/RMNHome.sol b/contracts/src/v0.8/ccip/rmn/RMNHome.sol index d13385aed8..978b200213 100644 --- a/contracts/src/v0.8/ccip/rmn/RMNHome.sol +++ b/contracts/src/v0.8/ccip/rmn/RMNHome.sol @@ -161,7 +161,9 @@ contract RMNHome is OwnerIsCreator, ITypeAndVersion { /// @param configDigest The digest of the config to fetch. /// @return versionedConfig The config and its version. /// @return ok True if the config was found, false otherwise. - function getConfig(bytes32 configDigest) external view returns (VersionedConfig memory versionedConfig, bool ok) { + function getConfig( + bytes32 configDigest + ) external view returns (VersionedConfig memory versionedConfig, bool ok) { for (uint256 i = 0; i < MAX_CONCURRENT_CONFIGS; ++i) { // We never want to return true for a zero digest, even if the caller is asking for it, as this can expose old // config state that is invalid. @@ -236,7 +238,9 @@ contract RMNHome is OwnerIsCreator, ITypeAndVersion { /// remove it without it ever having to be promoted. It's also possible to revoke the candidate config by setting a /// newer candidate config using `setCandidate`. /// @param configDigest The digest of the config to revoke. This is done to prevent accidental revokes. - function revokeCandidate(bytes32 configDigest) external onlyOwner { + function revokeCandidate( + bytes32 configDigest + ) external onlyOwner { if (configDigest == ZERO_DIGEST) { revert RevokingZeroDigestNotAllowed(); } diff --git a/contracts/src/v0.8/ccip/rmn/RMNRemote.sol b/contracts/src/v0.8/ccip/rmn/RMNRemote.sol index 0d38da22b3..6a4366e29f 100644 --- a/contracts/src/v0.8/ccip/rmn/RMNRemote.sol +++ b/contracts/src/v0.8/ccip/rmn/RMNRemote.sol @@ -76,7 +76,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { mapping(address signer => bool exists) private s_signers; // for more gas efficient verify /// @param localChainSelector the chain selector of the chain this contract is deployed to - constructor(uint64 localChainSelector) { + constructor( + uint64 localChainSelector + ) { if (localChainSelector == 0) revert ZeroValueNotAllowed(); i_localChainSelector = localChainSelector; } @@ -130,7 +132,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { /// @notice Sets the configuration of the contract /// @param newConfig the new configuration /// @dev setting config is atomic; we delete all pre-existing config and set everything from scratch - function setConfig(Config calldata newConfig) external onlyOwner { + function setConfig( + Config calldata newConfig + ) external onlyOwner { // signers are in ascending order of nodeIndex for (uint256 i = 1; i < newConfig.signers.length; ++i) { if (!(newConfig.signers[i - 1].nodeIndex < newConfig.signers[i].nodeIndex)) { @@ -186,7 +190,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { /// @notice Curse a single subject /// @param subject the subject to curse - function curse(bytes16 subject) external { + function curse( + bytes16 subject + ) external { bytes16[] memory subjects = new bytes16[](1); subjects[0] = subject; curse(subjects); @@ -195,7 +201,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { /// @notice Curse an array of subjects /// @param subjects the subjects to curse /// @dev reverts if any of the subjects are already cursed or if there is a duplicate - function curse(bytes16[] memory subjects) public onlyOwner { + function curse( + bytes16[] memory subjects + ) public onlyOwner { for (uint256 i = 0; i < subjects.length; ++i) { if (!s_cursedSubjects.add(subjects[i])) { revert AlreadyCursed(subjects[i]); @@ -206,7 +214,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { /// @notice Uncurse a single subject /// @param subject the subject to uncurse - function uncurse(bytes16 subject) external { + function uncurse( + bytes16 subject + ) external { bytes16[] memory subjects = new bytes16[](1); subjects[0] = subject; uncurse(subjects); @@ -215,7 +225,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { /// @notice Uncurse an array of subjects /// @param subjects the subjects to uncurse /// @dev reverts if any of the subjects are not cursed or if there is a duplicate - function uncurse(bytes16[] memory subjects) public onlyOwner { + function uncurse( + bytes16[] memory subjects + ) public onlyOwner { for (uint256 i = 0; i < subjects.length; ++i) { if (!s_cursedSubjects.remove(subjects[i])) { revert NotCursed(subjects[i]); @@ -238,7 +250,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNRemote { } /// @inheritdoc IRMNRemote - function isCursed(bytes16 subject) external view returns (bool) { + function isCursed( + bytes16 subject + ) external view returns (bool) { if (s_cursedSubjects.length() == 0) { return false; } diff --git a/contracts/src/v0.8/ccip/test/BaseTest.t.sol b/contracts/src/v0.8/ccip/test/BaseTest.t.sol index 0c4d7d632c..4a425af97f 100644 --- a/contracts/src/v0.8/ccip/test/BaseTest.t.sol +++ b/contracts/src/v0.8/ccip/test/BaseTest.t.sol @@ -99,7 +99,9 @@ contract BaseTest is Test { vm.mockCall(address(s_mockRMNRemote), abi.encodeWithSignature("isCursed(bytes16)"), abi.encode(false)); // no curses by defaule } - function _setMockRMNGlobalCurse(bool isCursed) internal { + function _setMockRMNGlobalCurse( + bool isCursed + ) internal { vm.mockCall(address(s_mockRMNRemote), abi.encodeWithSignature("isCursed()"), abi.encode(isCursed)); } diff --git a/contracts/src/v0.8/ccip/test/WETH9.sol b/contracts/src/v0.8/ccip/test/WETH9.sol index fbc19ee2c4..bfd2b5f022 100644 --- a/contracts/src/v0.8/ccip/test/WETH9.sol +++ b/contracts/src/v0.8/ccip/test/WETH9.sol @@ -43,7 +43,9 @@ contract WETH9 { _deposit(); } - function withdraw(uint256 wad) external { + function withdraw( + uint256 wad + ) external { require(balanceOf[msg.sender] >= wad); balanceOf[msg.sender] -= wad; payable(msg.sender).transfer(wad); diff --git a/contracts/src/v0.8/ccip/test/applications/EtherSenderReceiver.t.sol b/contracts/src/v0.8/ccip/test/applications/EtherSenderReceiver.t.sol index cfd402d910..489ebcf8b8 100644 --- a/contracts/src/v0.8/ccip/test/applications/EtherSenderReceiver.t.sol +++ b/contracts/src/v0.8/ccip/test/applications/EtherSenderReceiver.t.sol @@ -107,7 +107,9 @@ contract EtherSenderReceiverTest_validatedMessage is EtherSenderReceiverTest { uint256 internal constant amount = 100; - function test_Fuzz_validatedMessage_msgSenderOverwrite(bytes memory data) public view { + function test_Fuzz_validatedMessage_msgSenderOverwrite( + bytes memory data + ) public view { Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](1); tokenAmounts[0] = Client.EVMTokenAmount({ token: address(0), // callers may not specify this. @@ -130,7 +132,9 @@ contract EtherSenderReceiverTest_validatedMessage is EtherSenderReceiverTest { assertEq(validatedMessage.extraArgs, bytes(""), "extraArgs must be empty"); } - function test_Fuzz_validatedMessage_tokenAddressOverwrite(address token) public view { + function test_Fuzz_validatedMessage_tokenAddressOverwrite( + address token + ) public view { Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](1); tokenAmounts[0] = Client.EVMTokenAmount({token: token, amount: amount}); Client.EVM2AnyMessage memory message = Client.EVM2AnyMessage({ @@ -300,7 +304,9 @@ contract EtherSenderReceiverTest_ccipReceive is EtherSenderReceiverTest { error InvalidTokenAmounts(uint256 gotAmounts); error InvalidToken(address gotToken, address expectedToken); - function test_Fuzz_ccipReceive(uint256 tokenAmount) public { + function test_Fuzz_ccipReceive( + uint256 tokenAmount + ) public { // cap to 10 ether because OWNER only has 10 ether. if (tokenAmount > 10 ether) { return; diff --git a/contracts/src/v0.8/ccip/test/applications/PingPongDemo.t.sol b/contracts/src/v0.8/ccip/test/applications/PingPongDemo.t.sol index f253a72fcb..c9f7493e4b 100644 --- a/contracts/src/v0.8/ccip/test/applications/PingPongDemo.t.sol +++ b/contracts/src/v0.8/ccip/test/applications/PingPongDemo.t.sol @@ -91,7 +91,9 @@ contract PingPong_startPingPong is PingPongDappSetup { _assertPingPongSuccess(message); } - function _assertPingPongSuccess(Internal.EVM2EVMMessage memory message) internal { + function _assertPingPongSuccess( + Internal.EVM2EVMMessage memory message + ) internal { message.messageId = Internal._hash(message, s_metadataHash); vm.expectEmit(); @@ -128,13 +130,17 @@ contract PingPong_ccipReceive is PingPongDappSetup { } contract PingPong_plumbing is PingPongDappSetup { - function test_Fuzz_CounterPartChainSelector_Success(uint64 chainSelector) public { + function test_Fuzz_CounterPartChainSelector_Success( + uint64 chainSelector + ) public { s_pingPong.setCounterpartChainSelector(chainSelector); assertEq(s_pingPong.getCounterpartChainSelector(), chainSelector); } - function test_Fuzz_CounterPartAddress_Success(address counterpartAddress) public { + function test_Fuzz_CounterPartAddress_Success( + address counterpartAddress + ) public { s_pingPong.setCounterpartAddress(counterpartAddress); assertEq(s_pingPong.getCounterpartAddress(), counterpartAddress); diff --git a/contracts/src/v0.8/ccip/test/arm/RMN.t.sol b/contracts/src/v0.8/ccip/test/arm/RMN.t.sol index 85501170e3..da1c98e0d2 100644 --- a/contracts/src/v0.8/ccip/test/arm/RMN.t.sol +++ b/contracts/src/v0.8/ccip/test/arm/RMN.t.sol @@ -1002,7 +1002,9 @@ contract RMN_permaBlessing is RMNSetup { return new address[](0); } - function addresses(address a) private pure returns (address[] memory) { + function addresses( + address a + ) private pure returns (address[] memory) { address[] memory arr = new address[](1); arr[0] = a; return arr; diff --git a/contracts/src/v0.8/ccip/test/arm/RMNSetup.t.sol b/contracts/src/v0.8/ccip/test/arm/RMNSetup.t.sol index 8feacb95f4..4a333306ec 100644 --- a/contracts/src/v0.8/ccip/test/arm/RMNSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/arm/RMNSetup.t.sol @@ -6,7 +6,9 @@ import {IRMN} from "../../interfaces/IRMN.sol"; import {Test} from "forge-std/Test.sol"; -function makeSubjects(bytes16 a) pure returns (bytes16[] memory) { +function makeSubjects( + bytes16 a +) pure returns (bytes16[] memory) { bytes16[] memory subjects = new bytes16[](1); subjects[0] = a; return subjects; @@ -20,14 +22,18 @@ function makeSubjects(bytes16 a, bytes16 b) pure returns (bytes16[] memory) { } // in order from earliest to latest curse ids -function makeCursesHashFromList(bytes32[] memory curseIds) pure returns (bytes28 cursesHash) { +function makeCursesHashFromList( + bytes32[] memory curseIds +) pure returns (bytes28 cursesHash) { for (uint256 i = 0; i < curseIds.length; ++i) { cursesHash = bytes28(keccak256(abi.encode(cursesHash, curseIds[i]))); } } // hides the ugliness from tests -function makeCursesHash(bytes32 a) pure returns (bytes28) { +function makeCursesHash( + bytes32 a +) pure returns (bytes28) { bytes32[] memory curseIds = new bytes32[](1); curseIds[0] = a; return makeCursesHashFromList(curseIds); @@ -102,20 +108,28 @@ contract RMNSetup is Test { return votes; } - function makeTaggedRootSingleton(uint256 index) internal pure returns (IRMN.TaggedRoot[] memory) { + function makeTaggedRootSingleton( + uint256 index + ) internal pure returns (IRMN.TaggedRoot[] memory) { return makeTaggedRootsInclusive(index, index); } - function makeTaggedRoot(uint256 index) internal pure returns (IRMN.TaggedRoot memory) { + function makeTaggedRoot( + uint256 index + ) internal pure returns (IRMN.TaggedRoot memory) { return makeTaggedRootSingleton(index)[0]; } - function makeTaggedRootHash(uint256 index) internal pure returns (bytes32) { + function makeTaggedRootHash( + uint256 index + ) internal pure returns (bytes32) { IRMN.TaggedRoot memory taggedRoot = makeTaggedRootSingleton(index)[0]; return keccak256(abi.encode(taggedRoot.commitStore, taggedRoot.root)); } - function makeCurseId(uint256 index) internal pure returns (bytes16) { + function makeCurseId( + uint256 index + ) internal pure returns (bytes16) { return bytes16(uint128(index)); } @@ -137,7 +151,9 @@ contract RMNSetup is Test { return false; } - function getWeightOfVotesToBlessRoot(IRMN.TaggedRoot memory taggedRoot_) internal view returns (uint16) { + function getWeightOfVotesToBlessRoot( + IRMN.TaggedRoot memory taggedRoot_ + ) internal view returns (uint16) { (, uint16 weight,) = s_rmn.getBlessProgress(taggedRoot_); return weight; } diff --git a/contracts/src/v0.8/ccip/test/arm/RMN_benchmark.t.sol b/contracts/src/v0.8/ccip/test/arm/RMN_benchmark.t.sol index 8564614a74..cd17f023c7 100644 --- a/contracts/src/v0.8/ccip/test/arm/RMN_benchmark.t.sol +++ b/contracts/src/v0.8/ccip/test/arm/RMN_benchmark.t.sol @@ -5,7 +5,9 @@ import {GLOBAL_CURSE_SUBJECT, OWNER_CURSE_VOTE_ADDR, RMN} from "../../RMN.sol"; import {RMNSetup, makeCursesHash, makeSubjects} from "./RMNSetup.t.sol"; contract RMN_voteToBless_Benchmark is RMNSetup { - function test_RootSuccess_gas(uint256 n) internal { + function test_RootSuccess_gas( + uint256 n + ) internal { vm.prank(BLESS_VOTER_1); s_rmn.voteToBless(makeTaggedRootsInclusive(1, n)); } @@ -151,7 +153,9 @@ contract RMN_lazyVoteToCurseUpdate_Benchmark is RMN_voteToCurse_Benchmark { contract RMN_setConfig_Benchmark is RMNSetup { uint256 s_numVoters; - function configWithVoters(uint256 numVoters) internal pure returns (RMN.Config memory) { + function configWithVoters( + uint256 numVoters + ) internal pure returns (RMN.Config memory) { RMN.Config memory cfg = RMN.Config({voters: new RMN.Voter[](numVoters), blessWeightThreshold: 1, curseWeightThreshold: 1}); for (uint256 i = 1; i <= numVoters; ++i) { diff --git a/contracts/src/v0.8/ccip/test/attacks/onRamp/FacadeClient.sol b/contracts/src/v0.8/ccip/test/attacks/onRamp/FacadeClient.sol index ad549e6ccc..8947a27df1 100644 --- a/contracts/src/v0.8/ccip/test/attacks/onRamp/FacadeClient.sol +++ b/contracts/src/v0.8/ccip/test/attacks/onRamp/FacadeClient.sol @@ -30,7 +30,9 @@ contract FacadeClient { /// @dev Calls Router to initiate CCIP send. /// The expectation is that s_msg_sequence will always match the sequence in emitted CCIP messages. - function send(uint256 amount) public { + function send( + uint256 amount + ) public { Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](1); tokenAmounts[0].token = address(i_sourceToken); tokenAmounts[0].amount = amount; diff --git a/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol b/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol index f4784b0d0f..5b80a4e6a2 100644 --- a/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol +++ b/contracts/src/v0.8/ccip/test/capability/CCIPHome.t.sol @@ -76,7 +76,9 @@ contract CCIPHomeTest is Test { ); } - function _getBaseConfig(Internal.OCRPluginType pluginType) internal pure returns (CCIPHome.OCR3Config memory) { + function _getBaseConfig( + Internal.OCRPluginType pluginType + ) internal pure returns (CCIPHome.OCR3Config memory) { CCIPHome.OCR3Node[] memory nodes = new CCIPHome.OCR3Node[](4); for (uint256 i = 0; i < nodes.length; i++) { nodes[i] = CCIPHome.OCR3Node({ @@ -398,7 +400,9 @@ contract CCIPHome_promoteCandidateAndRevokeActive is CCIPHomeTest { assertEq(candidateDigest, ZERO_DIGEST); } - function promoteCandidateAndRevokeActive(Internal.OCRPluginType pluginType) public { + function promoteCandidateAndRevokeActive( + Internal.OCRPluginType pluginType + ) public { CCIPHome.OCR3Config memory config = _getBaseConfig(pluginType); bytes32 firstConfigToPromote = s_ccipHome.setCandidate(DEFAULT_DON_ID, pluginType, config, ZERO_DIGEST); @@ -473,7 +477,9 @@ contract CCIPHome__validateConfig is CCIPHomeTest { s_ccipHome = new CCIPHomeHelper(CAPABILITIES_REGISTRY); } - function _addChainConfig(uint256 numNodes) internal returns (CCIPHome.OCR3Node[] memory nodes) { + function _addChainConfig( + uint256 numNodes + ) internal returns (CCIPHome.OCR3Node[] memory nodes) { return _addChainConfig(numNodes, 1); } diff --git a/contracts/src/v0.8/ccip/test/commitStore/CommitStore.t.sol b/contracts/src/v0.8/ccip/test/commitStore/CommitStore.t.sol index 0976ab96c5..0cc23f8a6d 100644 --- a/contracts/src/v0.8/ccip/test/commitStore/CommitStore.t.sol +++ b/contracts/src/v0.8/ccip/test/commitStore/CommitStore.t.sol @@ -117,7 +117,9 @@ contract CommitStore_constructor is FeeQuoterSetup, OCR2BaseSetup { } contract CommitStore_setMinSeqNr is CommitStoreSetup { - function test_Fuzz_SetMinSeqNr_Success(uint64 minSeqNr) public { + function test_Fuzz_SetMinSeqNr_Success( + uint64 minSeqNr + ) public { vm.expectEmit(); emit CommitStore.SequenceNumberSet(s_commitStore.getExpectedNextSequenceNumber(), minSeqNr); @@ -135,7 +137,9 @@ contract CommitStore_setMinSeqNr is CommitStoreSetup { } contract CommitStore_setDynamicConfig is CommitStoreSetup { - function test_Fuzz_SetDynamicConfig_Success(address priceRegistry) public { + function test_Fuzz_SetDynamicConfig_Success( + address priceRegistry + ) public { vm.assume(priceRegistry != address(0)); CommitStore.StaticConfig memory staticConfig = s_commitStore.getStaticConfig(); CommitStore.DynamicConfig memory dynamicConfig = CommitStore.DynamicConfig({priceRegistry: priceRegistry}); diff --git a/contracts/src/v0.8/ccip/test/e2e/End2End.t.sol b/contracts/src/v0.8/ccip/test/e2e/End2End.t.sol index 114265a248..8c931dd4fc 100644 --- a/contracts/src/v0.8/ccip/test/e2e/End2End.t.sol +++ b/contracts/src/v0.8/ccip/test/e2e/End2End.t.sol @@ -93,7 +93,9 @@ contract E2E is EVM2EVMOnRampSetup, CommitStoreSetup, EVM2EVMOffRampSetup { s_offRamp.execute(execReport, new EVM2EVMOffRamp.GasLimitOverride[](0)); } - function sendRequest(uint64 expectedSeqNum) public returns (Internal.EVM2EVMMessage memory) { + function sendRequest( + uint64 expectedSeqNum + ) public returns (Internal.EVM2EVMMessage memory) { Client.EVM2AnyMessage memory message = _generateTokenMessage(); uint256 expectedFee = s_sourceRouter.getFee(DEST_CHAIN_SELECTOR, message); diff --git a/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol b/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol index 9d98fa7e77..f1a00be78c 100644 --- a/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol @@ -270,7 +270,9 @@ contract FeeQuoterSetup is TokenSetup { assertEq(config1.tokenDecimals, config2.tokenDecimals); } - function _assertTokenPriceFeedConfigUnconfigured(FeeQuoter.TokenPriceFeedConfig memory config) internal pure virtual { + function _assertTokenPriceFeedConfigUnconfigured( + FeeQuoter.TokenPriceFeedConfig memory config + ) internal pure virtual { _assertTokenPriceFeedConfigEquality( config, FeeQuoter.TokenPriceFeedConfig({dataFeedAddress: address(0), tokenDecimals: 0}) ); @@ -433,7 +435,9 @@ contract FeeQuoterFeeSetup is FeeQuoterSetup { return (tokenAmount * ratio) / 1e5; } - function _configUSDCentToWei(uint256 usdCent) internal pure returns (uint256) { + function _configUSDCentToWei( + uint256 usdCent + ) internal pure returns (uint256) { return usdCent * 1e16; } } diff --git a/contracts/src/v0.8/ccip/test/helpers/AggregateRateLimiterHelper.sol b/contracts/src/v0.8/ccip/test/helpers/AggregateRateLimiterHelper.sol index ced605a752..f41bcc430d 100644 --- a/contracts/src/v0.8/ccip/test/helpers/AggregateRateLimiterHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/AggregateRateLimiterHelper.sol @@ -4,9 +4,13 @@ pragma solidity 0.8.24; import "../../AggregateRateLimiter.sol"; contract AggregateRateLimiterHelper is AggregateRateLimiter { - constructor(RateLimiter.Config memory config) AggregateRateLimiter(config) {} + constructor( + RateLimiter.Config memory config + ) AggregateRateLimiter(config) {} - function rateLimitValue(uint256 value) public { + function rateLimitValue( + uint256 value + ) public { _rateLimitValue(value); } diff --git a/contracts/src/v0.8/ccip/test/helpers/BurnMintERC677Helper.sol b/contracts/src/v0.8/ccip/test/helpers/BurnMintERC677Helper.sol index 9d2346996a..c3f95a7e06 100644 --- a/contracts/src/v0.8/ccip/test/helpers/BurnMintERC677Helper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/BurnMintERC677Helper.sol @@ -8,7 +8,9 @@ contract BurnMintERC677Helper is BurnMintERC677, IGetCCIPAdmin { constructor(string memory name, string memory symbol) BurnMintERC677(name, symbol, 18, 0) {} // Gives one full token to any given address. - function drip(address to) external { + function drip( + address to + ) external { _mint(to, 1e18); } diff --git a/contracts/src/v0.8/ccip/test/helpers/CCIPHomeHelper.sol b/contracts/src/v0.8/ccip/test/helpers/CCIPHomeHelper.sol index 8e460b791e..0bc97c7aa5 100644 --- a/contracts/src/v0.8/ccip/test/helpers/CCIPHomeHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/CCIPHomeHelper.sol @@ -4,13 +4,19 @@ pragma solidity 0.8.24; import {CCIPHome} from "../../capability/CCIPHome.sol"; contract CCIPHomeHelper is CCIPHome { - constructor(address capabilitiesRegistry) CCIPHome(capabilitiesRegistry) {} + constructor( + address capabilitiesRegistry + ) CCIPHome(capabilitiesRegistry) {} - function validateConfig(OCR3Config memory cfg) external view { + function validateConfig( + OCR3Config memory cfg + ) external view { return _validateConfig(cfg); } - function ensureInRegistry(bytes32[] memory p2pIds) external view { + function ensureInRegistry( + bytes32[] memory p2pIds + ) external view { return _ensureInRegistry(p2pIds); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/CCIPReaderTester.sol b/contracts/src/v0.8/ccip/test/helpers/CCIPReaderTester.sol index c2acddc796..18afc48918 100644 --- a/contracts/src/v0.8/ccip/test/helpers/CCIPReaderTester.sol +++ b/contracts/src/v0.8/ccip/test/helpers/CCIPReaderTester.sol @@ -13,7 +13,9 @@ contract CCIPReaderTester { /// @notice Gets the next sequence number to be used in the onRamp /// @param destChainSelector The destination chain selector /// @return nextSequenceNumber The next sequence number to be used - function getExpectedNextSequenceNumber(uint64 destChainSelector) external view returns (uint64) { + function getExpectedNextSequenceNumber( + uint64 destChainSelector + ) external view returns (uint64) { return s_destChainSeqNrs[destChainSelector] + 1; } @@ -24,7 +26,9 @@ contract CCIPReaderTester { s_destChainSeqNrs[destChainSelector] = sequenceNumber; } - function getSourceChainConfig(uint64 sourceChainSelector) external view returns (OffRamp.SourceChainConfig memory) { + function getSourceChainConfig( + uint64 sourceChainSelector + ) external view returns (OffRamp.SourceChainConfig memory) { return s_sourceChainConfigs[sourceChainSelector]; } @@ -59,7 +63,9 @@ contract CCIPReaderTester { event CommitReportAccepted(OffRamp.CommitReport report); - function emitCommitReportAccepted(OffRamp.CommitReport memory report) external { + function emitCommitReportAccepted( + OffRamp.CommitReport memory report + ) external { emit CommitReportAccepted(report); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/CommitStoreHelper.sol b/contracts/src/v0.8/ccip/test/helpers/CommitStoreHelper.sol index c8d66b8d72..2759a3312f 100644 --- a/contracts/src/v0.8/ccip/test/helpers/CommitStoreHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/CommitStoreHelper.sol @@ -4,7 +4,9 @@ pragma solidity 0.8.24; import "../../CommitStore.sol"; contract CommitStoreHelper is CommitStore { - constructor(StaticConfig memory staticConfig) CommitStore(staticConfig) {} + constructor( + StaticConfig memory staticConfig + ) CommitStore(staticConfig) {} /// @dev Expose _report for tests function report(bytes calldata commitReport, uint40 epochAndRound) external { diff --git a/contracts/src/v0.8/ccip/test/helpers/ERC20RebasingHelper.sol b/contracts/src/v0.8/ccip/test/helpers/ERC20RebasingHelper.sol index e5ef16d060..617d39af5c 100644 --- a/contracts/src/v0.8/ccip/test/helpers/ERC20RebasingHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/ERC20RebasingHelper.sol @@ -17,11 +17,15 @@ contract ERC20RebasingHelper is ERC20 { _burn(to, amount * s_multiplierPercentage / 100); } - function setMultiplierPercentage(uint16 multiplierPercentage) external { + function setMultiplierPercentage( + uint16 multiplierPercentage + ) external { s_multiplierPercentage = multiplierPercentage; } - function setMintShouldBurn(bool mintShouldBurn) external { + function setMintShouldBurn( + bool mintShouldBurn + ) external { s_mintShouldBurn = mintShouldBurn; } } diff --git a/contracts/src/v0.8/ccip/test/helpers/EVM2EVMOffRampHelper.sol b/contracts/src/v0.8/ccip/test/helpers/EVM2EVMOffRampHelper.sol index 1b537702be..510a79dc91 100644 --- a/contracts/src/v0.8/ccip/test/helpers/EVM2EVMOffRampHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/EVM2EVMOffRampHelper.sol @@ -14,7 +14,9 @@ contract EVM2EVMOffRampHelper is EVM2EVMOffRamp, IgnoreContractSize { _setExecutionState(sequenceNumber, state); } - function getExecutionStateBitMap(uint64 bitmapIndex) public view returns (uint256) { + function getExecutionStateBitMap( + uint64 bitmapIndex + ) public view returns (uint256) { return s_executionStates[bitmapIndex]; } @@ -49,7 +51,9 @@ contract EVM2EVMOffRampHelper is EVM2EVMOffRamp, IgnoreContractSize { return _trialExecute(message, offchainTokenData, tokenGasOverrides); } - function report(bytes calldata executableMessages) external { + function report( + bytes calldata executableMessages + ) external { _report(executableMessages); } diff --git a/contracts/src/v0.8/ccip/test/helpers/EtherSenderReceiverHelper.sol b/contracts/src/v0.8/ccip/test/helpers/EtherSenderReceiverHelper.sol index 71a5cdc7ab..e357645bcb 100644 --- a/contracts/src/v0.8/ccip/test/helpers/EtherSenderReceiverHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/EtherSenderReceiverHelper.sol @@ -5,17 +5,25 @@ import {EtherSenderReceiver} from "../../applications/EtherSenderReceiver.sol"; import {Client} from "../../libraries/Client.sol"; contract EtherSenderReceiverHelper is EtherSenderReceiver { - constructor(address router) EtherSenderReceiver(router) {} + constructor( + address router + ) EtherSenderReceiver(router) {} - function validatedMessage(Client.EVM2AnyMessage calldata message) public view returns (Client.EVM2AnyMessage memory) { + function validatedMessage( + Client.EVM2AnyMessage calldata message + ) public view returns (Client.EVM2AnyMessage memory) { return _validatedMessage(message); } - function validateFeeToken(Client.EVM2AnyMessage calldata message) public payable { + function validateFeeToken( + Client.EVM2AnyMessage calldata message + ) public payable { _validateFeeToken(message); } - function publicCcipReceive(Client.Any2EVMMessage memory message) public { + function publicCcipReceive( + Client.Any2EVMMessage memory message + ) public { _ccipReceive(message); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/MaybeRevertingBurnMintTokenPool.sol b/contracts/src/v0.8/ccip/test/helpers/MaybeRevertingBurnMintTokenPool.sol index 7290e91509..a3273ffdbd 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MaybeRevertingBurnMintTokenPool.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MaybeRevertingBurnMintTokenPool.sol @@ -18,15 +18,21 @@ contract MaybeRevertingBurnMintTokenPool is BurnMintTokenPool { address router ) BurnMintTokenPool(token, allowlist, rmnProxy, router) {} - function setShouldRevert(bytes calldata revertReason) external { + function setShouldRevert( + bytes calldata revertReason + ) external { s_revertReason = revertReason; } - function setSourceTokenData(bytes calldata sourceTokenData) external { + function setSourceTokenData( + bytes calldata sourceTokenData + ) external { s_sourceTokenData = sourceTokenData; } - function setReleaseOrMintMultiplier(uint256 multiplier) external { + function setReleaseOrMintMultiplier( + uint256 multiplier + ) external { s_releaseOrMintMultiplier = multiplier; } diff --git a/contracts/src/v0.8/ccip/test/helpers/MerkleHelper.sol b/contracts/src/v0.8/ccip/test/helpers/MerkleHelper.sol index ccb05681f1..231b386656 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MerkleHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MerkleHelper.sol @@ -14,7 +14,9 @@ library MerkleHelper { /// d c /// / \ /// a b - function getMerkleRoot(bytes32[] memory hashedLeaves) public pure returns (bytes32) { + function getMerkleRoot( + bytes32[] memory hashedLeaves + ) public pure returns (bytes32) { require(hashedLeaves.length <= 256); while (hashedLeaves.length > 1) { hashedLeaves = computeNextLayer(hashedLeaves); @@ -25,7 +27,9 @@ library MerkleHelper { /// @notice Computes a single layer of a merkle proof by hashing each pair (i, i+1) for /// each i, i+2, i+4.. n. When an uneven number of leaves is supplied the last item /// is simply included as the last element in the result set and not hashed. - function computeNextLayer(bytes32[] memory layer) public pure returns (bytes32[] memory) { + function computeNextLayer( + bytes32[] memory layer + ) public pure returns (bytes32[] memory) { uint256 leavesLen = layer.length; if (leavesLen == 1) return layer; diff --git a/contracts/src/v0.8/ccip/test/helpers/MessageHasher.sol b/contracts/src/v0.8/ccip/test/helpers/MessageHasher.sol index ea8ba98d44..db89a38612 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MessageHasher.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MessageHasher.sol @@ -61,15 +61,21 @@ contract MessageHasher { return abi.encode(leafDomainSeparator, implicitMetadataHash, fixedSizeFieldsHash, dataHash, tokenAmountsHash); } - function encodeEVMExtraArgsV1(Client.EVMExtraArgsV1 memory extraArgs) public pure returns (bytes memory) { + function encodeEVMExtraArgsV1( + Client.EVMExtraArgsV1 memory extraArgs + ) public pure returns (bytes memory) { return Client._argsToBytes(extraArgs); } - function encodeEVMExtraArgsV2(Client.EVMExtraArgsV2 memory extraArgs) public pure returns (bytes memory) { + function encodeEVMExtraArgsV2( + Client.EVMExtraArgsV2 memory extraArgs + ) public pure returns (bytes memory) { return Client._argsToBytes(extraArgs); } - function decodeEVMExtraArgsV1(uint256 gasLimit) public pure returns (Client.EVMExtraArgsV1 memory) { + function decodeEVMExtraArgsV1( + uint256 gasLimit + ) public pure returns (Client.EVMExtraArgsV1 memory) { return Client.EVMExtraArgsV1(gasLimit); } diff --git a/contracts/src/v0.8/ccip/test/helpers/MessageInterceptorHelper.sol b/contracts/src/v0.8/ccip/test/helpers/MessageInterceptorHelper.sol index a54145da84..80cdf61602 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MessageInterceptorHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MessageInterceptorHelper.sol @@ -14,7 +14,9 @@ contract MessageInterceptorHelper is IMessageInterceptor { } /// @inheritdoc IMessageInterceptor - function onInboundMessage(Client.Any2EVMMessage memory message) external view { + function onInboundMessage( + Client.Any2EVMMessage memory message + ) external view { if (s_invalidMessageIds[message.messageId]) { revert MessageValidationError(bytes("Invalid message")); } diff --git a/contracts/src/v0.8/ccip/test/helpers/MultiAggregateRateLimiterHelper.sol b/contracts/src/v0.8/ccip/test/helpers/MultiAggregateRateLimiterHelper.sol index d011ba0685..7c2e6cc8c2 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MultiAggregateRateLimiterHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MultiAggregateRateLimiterHelper.sol @@ -10,7 +10,9 @@ contract MultiAggregateRateLimiterHelper is MultiAggregateRateLimiter { address[] memory authorizedCallers ) MultiAggregateRateLimiter(feeQuoter, authorizedCallers) {} - function getTokenValue(Client.EVMTokenAmount memory tokenAmount) public view returns (uint256) { + function getTokenValue( + Client.EVMTokenAmount memory tokenAmount + ) public view returns (uint256) { return _getTokenValue(tokenAmount); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/MultiOCR3Helper.sol b/contracts/src/v0.8/ccip/test/helpers/MultiOCR3Helper.sol index 003a5326b8..e760b79935 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MultiOCR3Helper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MultiOCR3Helper.sol @@ -10,7 +10,9 @@ contract MultiOCR3Helper is MultiOCR3Base { /// Defined in storage since it cannot be passed as calldata due to strict transmit checks uint8 internal s_transmitOcrPluginType; - function setTransmitOcrPluginType(uint8 ocrPluginType) external { + function setTransmitOcrPluginType( + uint8 ocrPluginType + ) external { s_transmitOcrPluginType = ocrPluginType; } @@ -39,7 +41,9 @@ contract MultiOCR3Helper is MultiOCR3Base { return "MultiOCR3BaseHelper 1.0.0"; } - function _afterOCR3ConfigSet(uint8 ocrPluginType) internal virtual override { + function _afterOCR3ConfigSet( + uint8 ocrPluginType + ) internal virtual override { emit AfterConfigSet(ocrPluginType); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/MultiTokenPool.sol b/contracts/src/v0.8/ccip/test/helpers/MultiTokenPool.sol index 5a1bf5021d..93eee7249a 100644 --- a/contracts/src/v0.8/ccip/test/helpers/MultiTokenPool.sol +++ b/contracts/src/v0.8/ccip/test/helpers/MultiTokenPool.sol @@ -108,7 +108,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { } /// @inheritdoc IPoolV1 - function isSupportedToken(address token) public view virtual returns (bool) { + function isSupportedToken( + address token + ) public view virtual returns (bool) { return s_tokens.contains(token); } @@ -130,7 +132,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { /// @notice Sets the pool's Router /// @param newRouter The new Router - function setRouter(address newRouter) public onlyOwner { + function setRouter( + address newRouter + ) public onlyOwner { if (newRouter == address(0)) revert ZeroAddressNotAllowed(); address oldRouter = address(s_router); s_router = IRouter(newRouter); @@ -139,7 +143,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { } /// @notice Signals which version of the pool interface is supported - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == Pool.CCIP_POOL_V1 || interfaceId == type(IPoolV1).interfaceId || interfaceId == type(IERC165).interfaceId; } @@ -157,7 +163,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { /// @param lockOrBurnIn The input to validate. /// @dev This function should always be called before executing a lock or burn. Not doing so would allow /// for various exploits. - function _validateLockOrBurn(Pool.LockOrBurnInV1 memory lockOrBurnIn) internal { + function _validateLockOrBurn( + Pool.LockOrBurnInV1 memory lockOrBurnIn + ) internal { if (!isSupportedToken(lockOrBurnIn.localToken)) revert InvalidToken(lockOrBurnIn.localToken); if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(lockOrBurnIn.remoteChainSelector)))) revert CursedByRMN(); _checkAllowList(lockOrBurnIn.originalSender); @@ -175,7 +183,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { /// @param releaseOrMintIn The input to validate. /// @dev This function should always be called before executing a lock or burn. Not doing so would allow /// for various exploits. - function _validateReleaseOrMint(Pool.ReleaseOrMintInV1 memory releaseOrMintIn) internal { + function _validateReleaseOrMint( + Pool.ReleaseOrMintInV1 memory releaseOrMintIn + ) internal { if (!isSupportedToken(releaseOrMintIn.localToken)) revert InvalidToken(releaseOrMintIn.localToken); if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(releaseOrMintIn.remoteChainSelector)))) revert CursedByRMN(); _onlyOffRamp(releaseOrMintIn.remoteChainSelector); @@ -226,7 +236,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { } /// @inheritdoc IPoolV1 - function isSupportedChain(uint64 remoteChainSelector) public view returns (bool) { + function isSupportedChain( + uint64 remoteChainSelector + ) public view returns (bool) { return s_remoteChainSelectors.contains(remoteChainSelector); } @@ -357,14 +369,18 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned onRamp for the given chain on the Router. - function _onlyOnRamp(uint64 remoteChainSelector) internal view { + function _onlyOnRamp( + uint64 remoteChainSelector + ) internal view { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!(msg.sender == s_router.getOnRamp(remoteChainSelector))) revert CallerIsNotARampOnRouter(msg.sender); } /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned offRamp for the given chain on the Router. - function _onlyOffRamp(uint64 remoteChainSelector) internal view { + function _onlyOffRamp( + uint64 remoteChainSelector + ) internal view { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!s_router.isOffRamp(remoteChainSelector, msg.sender)) revert CallerIsNotARampOnRouter(msg.sender); } @@ -373,7 +389,9 @@ abstract contract MultiTokenPool is IPoolV1, OwnerIsCreator { // │ Allowlist │ // ================================================================ - function _checkAllowList(address sender) internal view { + function _checkAllowList( + address sender + ) internal view { if (i_allowlistEnabled && !s_allowList.contains(sender)) revert SenderNotAllowed(sender); } diff --git a/contracts/src/v0.8/ccip/test/helpers/OCR2Helper.sol b/contracts/src/v0.8/ccip/test/helpers/OCR2Helper.sol index cb66352ff6..8bac7e8c00 100644 --- a/contracts/src/v0.8/ccip/test/helpers/OCR2Helper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/OCR2Helper.sol @@ -34,5 +34,7 @@ contract OCR2Helper is OCR2Base(false) { return "OCR2BaseHelper 1.0.0"; } - function _beforeSetConfig(bytes memory _onchainConfig) internal override {} + function _beforeSetConfig( + bytes memory _onchainConfig + ) internal override {} } diff --git a/contracts/src/v0.8/ccip/test/helpers/OCR2NoChecksHelper.sol b/contracts/src/v0.8/ccip/test/helpers/OCR2NoChecksHelper.sol index a1ececa326..3885fa11b7 100644 --- a/contracts/src/v0.8/ccip/test/helpers/OCR2NoChecksHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/OCR2NoChecksHelper.sol @@ -28,11 +28,15 @@ contract OCR2NoChecksHelper is OCR2BaseNoChecks { ); } - function _report(bytes calldata report) internal override {} + function _report( + bytes calldata report + ) internal override {} function typeAndVersion() public pure override returns (string memory) { return "OCR2BaseHelper 1.0.0"; } - function _beforeSetConfig(bytes memory _onchainConfig) internal override {} + function _beforeSetConfig( + bytes memory _onchainConfig + ) internal override {} } diff --git a/contracts/src/v0.8/ccip/test/helpers/RateLimiterHelper.sol b/contracts/src/v0.8/ccip/test/helpers/RateLimiterHelper.sol index 8fb96a0c1c..6cd1c18705 100644 --- a/contracts/src/v0.8/ccip/test/helpers/RateLimiterHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/RateLimiterHelper.sol @@ -8,7 +8,9 @@ contract RateLimiterHelper { RateLimiter.TokenBucket internal s_rateLimiter; - constructor(RateLimiter.Config memory config) { + constructor( + RateLimiter.Config memory config + ) { s_rateLimiter = RateLimiter.TokenBucket({ rate: config.rate, capacity: config.capacity, @@ -26,7 +28,9 @@ contract RateLimiterHelper { return s_rateLimiter._currentTokenBucketState(); } - function setTokenBucketConfig(RateLimiter.Config memory config) external { + function setTokenBucketConfig( + RateLimiter.Config memory config + ) external { s_rateLimiter._setTokenBucketConfig(config); } diff --git a/contracts/src/v0.8/ccip/test/helpers/ReportCodec.sol b/contracts/src/v0.8/ccip/test/helpers/ReportCodec.sol index 2e50124ab4..3bd97035c8 100644 --- a/contracts/src/v0.8/ccip/test/helpers/ReportCodec.sol +++ b/contracts/src/v0.8/ccip/test/helpers/ReportCodec.sol @@ -8,11 +8,15 @@ contract ReportCodec { event ExecuteReportDecoded(Internal.ExecutionReportSingleChain[] report); event CommitReportDecoded(OffRamp.CommitReport report); - function decodeExecuteReport(bytes memory report) public pure returns (Internal.ExecutionReportSingleChain[] memory) { + function decodeExecuteReport( + bytes memory report + ) public pure returns (Internal.ExecutionReportSingleChain[] memory) { return abi.decode(report, (Internal.ExecutionReportSingleChain[])); } - function decodeCommitReport(bytes memory report) public pure returns (OffRamp.CommitReport memory) { + function decodeCommitReport( + bytes memory report + ) public pure returns (OffRamp.CommitReport memory) { return abi.decode(report, (OffRamp.CommitReport)); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/TokenPoolHelper.sol b/contracts/src/v0.8/ccip/test/helpers/TokenPoolHelper.sol index 4965d1ed2f..75f6b1b85d 100644 --- a/contracts/src/v0.8/ccip/test/helpers/TokenPoolHelper.sol +++ b/contracts/src/v0.8/ccip/test/helpers/TokenPoolHelper.sol @@ -26,11 +26,15 @@ contract TokenPoolHelper is TokenPool { return Pool.ReleaseOrMintOutV1({destinationAmount: releaseOrMintIn.amount}); } - function onlyOnRampModifier(uint64 remoteChainSelector) external view { + function onlyOnRampModifier( + uint64 remoteChainSelector + ) external view { _onlyOnRamp(remoteChainSelector); } - function onlyOffRampModifier(uint64 remoteChainSelector) external view { + function onlyOffRampModifier( + uint64 remoteChainSelector + ) external view { _onlyOffRamp(remoteChainSelector); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/receivers/ConformingReceiver.sol b/contracts/src/v0.8/ccip/test/helpers/receivers/ConformingReceiver.sol index 159cd7a851..d4102da075 100644 --- a/contracts/src/v0.8/ccip/test/helpers/receivers/ConformingReceiver.sol +++ b/contracts/src/v0.8/ccip/test/helpers/receivers/ConformingReceiver.sol @@ -9,7 +9,9 @@ contract ConformingReceiver is CCIPReceiver { constructor(address router, address feeToken) CCIPReceiver(router) {} - function _ccipReceive(Client.Any2EVMMessage memory) internal virtual override { + function _ccipReceive( + Client.Any2EVMMessage memory + ) internal virtual override { emit MessageReceived(); } } diff --git a/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol b/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol index 01b9b77d37..091c628f09 100644 --- a/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol +++ b/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol @@ -17,27 +17,37 @@ contract MaybeRevertMessageReceiver is IAny2EVMMessageReceiver, IERC165 { bool public s_toRevert; bytes private s_err; - constructor(bool toRevert) { + constructor( + bool toRevert + ) { s_manager = msg.sender; s_toRevert = toRevert; } - function setRevert(bool toRevert) external { + function setRevert( + bool toRevert + ) external { s_toRevert = toRevert; } - function setErr(bytes memory err) external { + function setErr( + bytes memory err + ) external { s_err = err; } /// @notice IERC165 supports an interfaceId /// @param interfaceId The interfaceId to check /// @return true if the interfaceId is supported - function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure override returns (bool) { return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; } - function ccipReceive(Client.Any2EVMMessage calldata) external override { + function ccipReceive( + Client.Any2EVMMessage calldata + ) external override { if (s_toRevert) { revert CustomError(s_err); } diff --git a/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiverNo165.sol b/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiverNo165.sol index 4f56394c4e..7db4eab3b2 100644 --- a/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiverNo165.sol +++ b/contracts/src/v0.8/ccip/test/helpers/receivers/MaybeRevertMessageReceiverNo165.sol @@ -9,16 +9,22 @@ contract MaybeRevertMessageReceiverNo165 is IAny2EVMMessageReceiver { event MessageReceived(); - constructor(bool toRevert) { + constructor( + bool toRevert + ) { s_manager = msg.sender; s_toRevert = toRevert; } - function setRevert(bool toRevert) external { + function setRevert( + bool toRevert + ) external { s_toRevert = toRevert; } - function ccipReceive(Client.Any2EVMMessage calldata) external override { + function ccipReceive( + Client.Any2EVMMessage calldata + ) external override { if (s_toRevert) { revert(); } diff --git a/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuser.sol b/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuser.sol index b69bbcaa43..562de05f66 100644 --- a/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuser.sol +++ b/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuser.sol @@ -19,11 +19,15 @@ contract ReentrancyAbuser is CCIPReceiver { s_offRamp = offRamp; } - function setPayload(Internal.ExecutionReport calldata payload) public { + function setPayload( + Internal.ExecutionReport calldata payload + ) public { s_payload = payload; } - function _ccipReceive(Client.Any2EVMMessage memory) internal override { + function _ccipReceive( + Client.Any2EVMMessage memory + ) internal override { // Use original message gas limits in manual execution EVM2EVMOffRamp.GasLimitOverride[] memory gasOverrides = _getGasLimitsFromMessages(s_payload.messages); diff --git a/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuserMultiRamp.sol b/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuserMultiRamp.sol index c8eee48808..3f068151a1 100644 --- a/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuserMultiRamp.sol +++ b/contracts/src/v0.8/ccip/test/helpers/receivers/ReentrancyAbuserMultiRamp.sol @@ -17,11 +17,15 @@ contract ReentrancyAbuserMultiRamp is CCIPReceiver { s_offRamp = offRamp; } - function setPayload(Internal.ExecutionReportSingleChain calldata payload) public { + function setPayload( + Internal.ExecutionReportSingleChain calldata payload + ) public { s_payload = payload; } - function _ccipReceive(Client.Any2EVMMessage memory) internal override { + function _ccipReceive( + Client.Any2EVMMessage memory + ) internal override { // Use original message gas limits in manual execution uint256 numMsgs = s_payload.messages.length; OffRamp.GasLimitOverride[][] memory gasOverrides = new OffRamp.GasLimitOverride[][](1); diff --git a/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_2.sol b/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_2.sol index 44de2787c6..20343bc1c9 100644 --- a/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_2.sol +++ b/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_2.sol @@ -96,7 +96,9 @@ abstract contract TokenPool1_2 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == type(IPoolPriorTo1_5).interfaceId || interfaceId == type(IERC165).interfaceId; } @@ -106,13 +108,17 @@ abstract contract TokenPool1_2 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @notice Checks whether something is a permissioned onRamp on this contract. /// @return true if the given address is a permissioned onRamp. - function isOnRamp(address onRamp) public view returns (bool) { + function isOnRamp( + address onRamp + ) public view returns (bool) { return s_onRamps.contains(onRamp); } /// @notice Checks whether something is a permissioned offRamp on this contract. /// @return true if the given address is a permissioned offRamp. - function isOffRamp(address offRamp) public view returns (bool) { + function isOffRamp( + address offRamp + ) public view returns (bool) { return s_offRamps.contains(offRamp); } @@ -195,24 +201,32 @@ abstract contract TokenPool1_2 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { // ================================================================ /// @notice Consumes outbound rate limiting capacity in this pool - function _consumeOnRampRateLimit(uint256 amount) internal { + function _consumeOnRampRateLimit( + uint256 amount + ) internal { s_onRampRateLimits[msg.sender]._consume(amount, address(i_token)); } /// @notice Consumes inbound rate limiting capacity in this pool - function _consumeOffRampRateLimit(uint256 amount) internal { + function _consumeOffRampRateLimit( + uint256 amount + ) internal { s_offRampRateLimits[msg.sender]._consume(amount, address(i_token)); } /// @notice Gets the token bucket with its values for the block it was requested at. /// @return The token bucket. - function currentOnRampRateLimiterState(address onRamp) external view returns (RateLimiter.TokenBucket memory) { + function currentOnRampRateLimiterState( + address onRamp + ) external view returns (RateLimiter.TokenBucket memory) { return s_onRampRateLimits[onRamp]._currentTokenBucketState(); } /// @notice Gets the token bucket with its values for the block it was requested at. /// @return The token bucket. - function currentOffRampRateLimiterState(address offRamp) external view returns (RateLimiter.TokenBucket memory) { + function currentOffRampRateLimiterState( + address offRamp + ) external view returns (RateLimiter.TokenBucket memory) { return s_offRampRateLimits[offRamp]._currentTokenBucketState(); } @@ -254,7 +268,9 @@ abstract contract TokenPool1_2 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { // │ Allowlist │ // ================================================================ - modifier checkAllowList(address sender) { + modifier checkAllowList( + address sender + ) { if (i_allowlistEnabled && !s_allowList.contains(sender)) revert SenderNotAllowed(sender); _; } diff --git a/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_4.sol b/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_4.sol index 168afee4f0..26107cdefd 100644 --- a/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_4.sol +++ b/contracts/src/v0.8/ccip/test/legacy/BurnMintTokenPool1_4.sol @@ -114,7 +114,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @notice Sets the pool's Router /// @param newRouter The new Router - function setRouter(address newRouter) public onlyOwner { + function setRouter( + address newRouter + ) public onlyOwner { if (newRouter == address(0)) revert ZeroAddressNotAllowed(); address oldRouter = address(s_router); s_router = IRouter(newRouter); @@ -123,7 +125,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { return interfaceId == type(IPoolPriorTo1_5).interfaceId || interfaceId == type(IERC165).interfaceId; } @@ -133,7 +137,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @notice Checks whether a chain selector is permissioned on this contract. /// @return true if the given chain selector is a permissioned remote chain. - function isSupportedChain(uint64 remoteChainSelector) public view returns (bool) { + function isSupportedChain( + uint64 remoteChainSelector + ) public view returns (bool) { return s_remoteChainSelectors.contains(remoteChainSelector); } @@ -154,7 +160,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @dev Only callable by the owner /// @param chains A list of chains and their new permission status & rate limits. Rate limits /// are only used when the chain is being added through `allowed` being true. - function applyChainUpdates(ChainUpdate[] calldata chains) external virtual onlyOwner { + function applyChainUpdates( + ChainUpdate[] calldata chains + ) external virtual onlyOwner { for (uint256 i = 0; i < chains.length; ++i) { ChainUpdate memory update = chains[i]; RateLimiter._validateTokenBucketConfig(update.outboundRateLimiterConfig, !update.allowed); @@ -256,7 +264,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned onRamp for the given chain on the Router. - modifier onlyOnRamp(uint64 remoteChainSelector) { + modifier onlyOnRamp( + uint64 remoteChainSelector + ) { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!(msg.sender == s_router.getOnRamp(remoteChainSelector))) revert CallerIsNotARampOnRouter(msg.sender); _; @@ -264,7 +274,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { /// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender /// is a permissioned offRamp for the given chain on the Router. - modifier onlyOffRamp(uint64 remoteChainSelector) { + modifier onlyOffRamp( + uint64 remoteChainSelector + ) { if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector); if (!s_router.isOffRamp(remoteChainSelector, msg.sender)) revert CallerIsNotARampOnRouter(msg.sender); _; @@ -274,7 +286,9 @@ abstract contract TokenPool1_4 is IPoolPriorTo1_5, OwnerIsCreator, IERC165 { // │ Allowlist │ // ================================================================ - modifier checkAllowList(address sender) { + modifier checkAllowList( + address sender + ) { if (i_allowlistEnabled && !s_allowList.contains(sender)) revert SenderNotAllowed(sender); _; } @@ -331,7 +345,9 @@ abstract contract BurnMintTokenPoolAbstract is TokenPool1_4 { /// @notice Contains the specific burn call for a pool. /// @dev overriding this method allows us to create pools with different burn signatures /// without duplicating the underlying logic. - function _burn(uint256 amount) internal virtual; + function _burn( + uint256 amount + ) internal virtual; /// @notice Burn the token in the pool /// @param amount Amount to burn @@ -392,7 +408,9 @@ contract BurnMintTokenPool1_4 is BurnMintTokenPoolAbstract, ITypeAndVersion { ) TokenPool1_4(token, allowlist, armProxy, router) {} /// @inheritdoc BurnMintTokenPoolAbstract - function _burn(uint256 amount) internal virtual override { + function _burn( + uint256 amount + ) internal virtual override { IBurnMintERC20(address(i_token)).burn(amount); } } diff --git a/contracts/src/v0.8/ccip/test/legacy/TokenPoolAndProxy.t.sol b/contracts/src/v0.8/ccip/test/legacy/TokenPoolAndProxy.t.sol index 9645d70b7a..ad41c76326 100644 --- a/contracts/src/v0.8/ccip/test/legacy/TokenPoolAndProxy.t.sol +++ b/contracts/src/v0.8/ccip/test/legacy/TokenPoolAndProxy.t.sol @@ -595,7 +595,9 @@ contract LockReleaseTokenPoolPoolAndProxy_canAcceptLiquidity is LockReleaseToken } contract LockReleaseTokenPoolPoolAndProxy_provideLiquidity is LockReleaseTokenPoolAndProxySetup { - function test_Fuzz_ProvideLiquidity_Success(uint256 amount) public { + function test_Fuzz_ProvideLiquidity_Success( + uint256 amount + ) public { uint256 balancePre = s_token.balanceOf(OWNER); s_token.approve(address(s_lockReleaseTokenPoolAndProxy), amount); @@ -614,7 +616,9 @@ contract LockReleaseTokenPoolPoolAndProxy_provideLiquidity is LockReleaseTokenPo s_lockReleaseTokenPoolAndProxy.provideLiquidity(1); } - function test_Fuzz_ExceedsAllowance(uint256 amount) public { + function test_Fuzz_ExceedsAllowance( + uint256 amount + ) public { vm.assume(amount > 0); vm.expectRevert("ERC20: insufficient allowance"); s_lockReleaseTokenPoolAndProxy.provideLiquidity(amount); @@ -630,7 +634,9 @@ contract LockReleaseTokenPoolPoolAndProxy_provideLiquidity is LockReleaseTokenPo } contract LockReleaseTokenPoolPoolAndProxy_withdrawalLiquidity is LockReleaseTokenPoolAndProxySetup { - function test_Fuzz_WithdrawalLiquidity_Success(uint256 amount) public { + function test_Fuzz_WithdrawalLiquidity_Success( + uint256 amount + ) public { uint256 balancePre = s_token.balanceOf(OWNER); s_token.approve(address(s_lockReleaseTokenPoolAndProxy), amount); s_lockReleaseTokenPoolAndProxy.provideLiquidity(amount); diff --git a/contracts/src/v0.8/ccip/test/mocks/MockCommitStore.sol b/contracts/src/v0.8/ccip/test/mocks/MockCommitStore.sol index aff06016fa..941977367e 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockCommitStore.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockCommitStore.sol @@ -23,7 +23,9 @@ contract MockCommitStore is ICommitStore { return s_expectedNextSequenceNumber; } - function setExpectedNextSequenceNumber(uint64 nextSeqNum) external { + function setExpectedNextSequenceNumber( + uint64 nextSeqNum + ) external { s_expectedNextSequenceNumber = nextSeqNum; } diff --git a/contracts/src/v0.8/ccip/test/mocks/MockE2EUSDCTransmitter.sol b/contracts/src/v0.8/ccip/test/mocks/MockE2EUSDCTransmitter.sol index bbd9c7dcc6..c9226a47c3 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockE2EUSDCTransmitter.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockE2EUSDCTransmitter.sol @@ -72,7 +72,9 @@ contract MockE2EUSDCTransmitter is IMessageTransmitterWithRelay { return s_shouldSucceed; } - function setShouldSucceed(bool shouldSucceed) external { + function setShouldSucceed( + bool shouldSucceed + ) external { s_shouldSucceed = shouldSucceed; } diff --git a/contracts/src/v0.8/ccip/test/mocks/MockRMN.sol b/contracts/src/v0.8/ccip/test/mocks/MockRMN.sol index 343078cc37..435c669763 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockRMN.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockRMN.sol @@ -17,7 +17,9 @@ contract MockRMN is IRMN { s_blessedByRoot[taggedRoot.commitStore][taggedRoot.root] = blessed; } - function setGlobalCursed(bool cursed) external { + function setGlobalCursed( + bool cursed + ) external { s_globalCursed = cursed; } @@ -27,7 +29,9 @@ contract MockRMN is IRMN { /// @notice Setting a revert error with length of 0 will disable reverts /// @dev Useful to test revert handling of ARMProxy - function setIsCursedRevert(bytes calldata revertErr) external { + function setIsCursedRevert( + bytes calldata revertErr + ) external { s_isCursedRevert = revertErr; } @@ -40,14 +44,18 @@ contract MockRMN is IRMN { return s_globalCursed; } - function isCursed(bytes16 subject) external view returns (bool) { + function isCursed( + bytes16 subject + ) external view returns (bool) { if (s_isCursedRevert.length > 0) { revert CustomError(s_isCursedRevert); } return s_globalCursed || s_cursedBySubject[subject]; } - function isBlessed(IRMN.TaggedRoot calldata taggedRoot) external view returns (bool) { + function isBlessed( + IRMN.TaggedRoot calldata taggedRoot + ) external view returns (bool) { return s_blessedByRoot[taggedRoot.commitStore][taggedRoot.root]; } } diff --git a/contracts/src/v0.8/ccip/test/mocks/MockRMN1_0.sol b/contracts/src/v0.8/ccip/test/mocks/MockRMN1_0.sol index d1a488d557..2f1df4926c 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockRMN1_0.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockRMN1_0.sol @@ -54,14 +54,18 @@ contract MockRMN is IRMN, OwnerIsCreator { return s_curse; } - function isCursed(bytes16 subject) external view override returns (bool) { + function isCursed( + bytes16 subject + ) external view override returns (bool) { if (s_err.length != 0) { revert CustomError(s_err); } return s_curse || s_curseBySubject[subject]; } - function voteToCurse(bytes32) external { + function voteToCurse( + bytes32 + ) external { s_curse = true; } @@ -69,7 +73,9 @@ contract MockRMN is IRMN, OwnerIsCreator { s_curseBySubject[subject] = true; } - function ownerUnvoteToCurse(OldRMN.UnvoteToCurseRecord[] memory) external { + function ownerUnvoteToCurse( + OldRMN.UnvoteToCurseRecord[] memory + ) external { s_curse = false; } @@ -77,11 +83,15 @@ contract MockRMN is IRMN, OwnerIsCreator { s_curseBySubject[subject] = false; } - function setRevert(bytes memory err) external { + function setRevert( + bytes memory err + ) external { s_err = err; } - function isBlessed(IRMN.TaggedRoot calldata) external view override returns (bool) { + function isBlessed( + IRMN.TaggedRoot calldata + ) external view override returns (bool) { return !s_curse; } diff --git a/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol b/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol index 6ca0bc073a..3ded9fd78f 100644 --- a/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol +++ b/contracts/src/v0.8/ccip/test/mocks/MockRouter.sol @@ -119,7 +119,9 @@ contract MockCCIPRouter is IRouter, IRouterClient { return mockMsgId; } - function _fromBytes(bytes calldata extraArgs) internal pure returns (Client.EVMExtraArgsV2 memory) { + function _fromBytes( + bytes calldata extraArgs + ) internal pure returns (Client.EVMExtraArgsV2 memory) { if (extraArgs.length == 0) { return Client.EVMExtraArgsV2({gasLimit: DEFAULT_GAS_LIMIT, allowOutOfOrderExecution: false}); } @@ -135,12 +137,16 @@ contract MockCCIPRouter is IRouter, IRouterClient { } /// @notice Always returns true to make sure this check can be performed on any chain. - function isChainSupported(uint64) external pure returns (bool supported) { + function isChainSupported( + uint64 + ) external pure returns (bool supported) { return true; } /// @notice Returns an empty array. - function getSupportedTokens(uint64) external pure returns (address[] memory tokens) { + function getSupportedTokens( + uint64 + ) external pure returns (address[] memory tokens) { return new address[](0); } @@ -150,12 +156,16 @@ contract MockCCIPRouter is IRouter, IRouterClient { } /// @notice Sets the fees returned by getFee but is only checked when using native fee tokens - function setFee(uint256 feeAmount) external { + function setFee( + uint256 feeAmount + ) external { s_mockFeeTokenAmount = feeAmount; } /// @notice Always returns address(1234567890) - function getOnRamp(uint64 /* destChainSelector */ ) external pure returns (address onRampAddress) { + function getOnRamp( + uint64 /* destChainSelector */ + ) external pure returns (address onRampAddress) { return address(1234567890); } diff --git a/contracts/src/v0.8/ccip/test/ocr/MultiOCR3BaseSetup.t.sol b/contracts/src/v0.8/ccip/test/ocr/MultiOCR3BaseSetup.t.sol index 6f6219bc9b..9cfddf0dd5 100644 --- a/contracts/src/v0.8/ccip/test/ocr/MultiOCR3BaseSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/ocr/MultiOCR3BaseSetup.t.sol @@ -84,7 +84,9 @@ contract MultiOCR3BaseSetup is BaseTest { vm.assertEq(configA.transmitters, configB.transmitters); } - function _assertOCRConfigUnconfigured(MultiOCR3Base.OCRConfig memory config) internal pure { + function _assertOCRConfigUnconfigured( + MultiOCR3Base.OCRConfig memory config + ) internal pure { assertEq(config.configInfo.configDigest, bytes32("")); assertEq(config.signers.length, 0); assertEq(config.transmitters.length, 0); diff --git a/contracts/src/v0.8/ccip/test/offRamp/EVM2EVMOffRamp.t.sol b/contracts/src/v0.8/ccip/test/offRamp/EVM2EVMOffRamp.t.sol index 493d02c7c2..876d74144d 100644 --- a/contracts/src/v0.8/ccip/test/offRamp/EVM2EVMOffRamp.t.sol +++ b/contracts/src/v0.8/ccip/test/offRamp/EVM2EVMOffRamp.t.sol @@ -248,7 +248,9 @@ contract EVM2EVMOffRamp_execute is EVM2EVMOffRampSetup { assertEq(startingBalance + amounts[0], dstToken0.balanceOf(message.receiver)); } - function test_Fuzz_getSenderNonce(uint8 trialExecutions) public { + function test_Fuzz_getSenderNonce( + uint8 trialExecutions + ) public { vm.assume(trialExecutions > 1); Internal.EVM2EVMMessage[] memory messages; @@ -279,7 +281,9 @@ contract EVM2EVMOffRamp_execute is EVM2EVMOffRampSetup { assertEq(s_offRamp.getSenderNonce(messages[0].sender), nonceBefore, "sender nonce is not as expected"); } - function test_Fuzz_getSenderNonceWithPrevOffRamp_Success(uint8 trialExecutions) public { + function test_Fuzz_getSenderNonceWithPrevOffRamp_Success( + uint8 trialExecutions + ) public { vm.assume(trialExecutions > 1); // Fuzz a random nonce for getSenderNonce test_Fuzz_getSenderNonce(trialExecutions); @@ -543,7 +547,9 @@ contract EVM2EVMOffRamp_execute is EVM2EVMOffRampSetup { assertEq(uint64(2), s_offRamp.getSenderNonce(OWNER)); } - function test_Fuzz_InterleavingOrderedAndUnorderedMessages_Success(bool[7] memory orderings) public { + function test_Fuzz_InterleavingOrderedAndUnorderedMessages_Success( + bool[7] memory orderings + ) public { Internal.EVM2EVMMessage[] memory messages = new Internal.EVM2EVMMessage[](orderings.length); // number of tokens needs to be capped otherwise we hit UnsupportedNumberOfTokens. Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](3); @@ -981,7 +987,9 @@ contract EVM2EVMOffRamp_executeSingleMessage is EVM2EVMOffRampSetup { s_offRamp.executeSingleMessage(message, new bytes[](message.tokenAmounts.length), new uint32[](0)); } - function _generateMsgWithoutTokens(uint256 gasLimit) internal view returns (Internal.EVM2EVMMessage memory) { + function _generateMsgWithoutTokens( + uint256 gasLimit + ) internal view returns (Internal.EVM2EVMMessage memory) { Internal.EVM2EVMMessage memory message = _generateAny2EVMMessageNoTokens(1); message.gasLimit = gasLimit; message.data = ""; @@ -2055,7 +2063,9 @@ contract EVM2EVMOffRamp__releaseOrMintTokens is EVM2EVMOffRampSetup { /// forge-config: default.fuzz.runs = 32 /// forge-config: ccip.fuzz.runs = 1024 // Uint256 gives a good range of values to test, both inside and outside of the eth address space. - function test_Fuzz__releaseOrMintTokens_AnyRevertIsCaught_Success(uint256 destPool) public { + function test_Fuzz__releaseOrMintTokens_AnyRevertIsCaught_Success( + uint256 destPool + ) public { // Input 447301751254033913445893214690834296930546521452, which is 0x4E59B44847B379578588920CA78FBF26C0B4956C // triggers some Create2Deployer and causes it to fail vm.assume(destPool != 447301751254033913445893214690834296930546521452); @@ -2165,7 +2175,9 @@ contract EVM2EVMOffRamp_updateRateLimitTokens is EVM2EVMOffRampSetup { assertEq(adds[1].destToken, destTokens[0]); } - function test_Fuzz_UpdateRateLimitTokens(uint8 numTokens) public { + function test_Fuzz_UpdateRateLimitTokens( + uint8 numTokens + ) public { // Needs to be more than 1 so that the division doesn't round down and the even makes the comparisons simpler vm.assume(numTokens > 1 && numTokens % 2 == 0); diff --git a/contracts/src/v0.8/ccip/test/offRamp/OffRamp.t.sol b/contracts/src/v0.8/ccip/test/offRamp/OffRamp.t.sol index 9cf0321a85..e86784ce88 100644 --- a/contracts/src/v0.8/ccip/test/offRamp/OffRamp.t.sol +++ b/contracts/src/v0.8/ccip/test/offRamp/OffRamp.t.sol @@ -695,7 +695,9 @@ contract OffRamp_executeSingleReport is OffRampSetup { assertEq(uint64(2), s_inboundNonceManager.getInboundNonce(SOURCE_CHAIN_SELECTOR_1, abi.encode(OWNER))); } - function test_Fuzz_InterleavingOrderedAndUnorderedMessages_Success(bool[7] memory orderings) public { + function test_Fuzz_InterleavingOrderedAndUnorderedMessages_Success( + bool[7] memory orderings + ) public { Internal.Any2EVMRampMessage[] memory messages = new Internal.Any2EVMRampMessage[](orderings.length); // number of tokens needs to be capped otherwise we hit UnsupportedNumberOfTokens. Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](3); @@ -990,7 +992,9 @@ contract OffRamp_executeSingleReport is OffRampSetup { ); } - function _constructCommitReport(bytes32 merkleRoot) internal view returns (OffRamp.CommitReport memory) { + function _constructCommitReport( + bytes32 merkleRoot + ) internal view returns (OffRamp.CommitReport memory) { Internal.MerkleRoot[] memory roots = new Internal.MerkleRoot[](1); roots[0] = Internal.MerkleRoot({ sourceChainSelector: SOURCE_CHAIN_SELECTOR_1, @@ -2969,7 +2973,9 @@ contract OffRamp_releaseOrMintTokens is OffRampSetup { /// forge-config: default.fuzz.runs = 32 /// forge-config: ccip.fuzz.runs = 1024 // Uint256 gives a good range of values to test, both inside and outside of the eth address space. - function test_Fuzz__releaseOrMintTokens_AnyRevertIsCaught_Success(address destPool) public { + function test_Fuzz__releaseOrMintTokens_AnyRevertIsCaught_Success( + address destPool + ) public { // Input 447301751254033913445893214690834296930546521452, which is 0x4E59B44847B379578588920CA78FBF26C0B4956C // triggers some Create2Deployer and causes it to fail vm.assume(destPool != 0x4e59b44847b379578588920cA78FbF26c0B4956C); diff --git a/contracts/src/v0.8/ccip/test/offRamp/OffRampSetup.t.sol b/contracts/src/v0.8/ccip/test/offRamp/OffRampSetup.t.sol index 0fb4ff5094..4202807102 100644 --- a/contracts/src/v0.8/ccip/test/offRamp/OffRampSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/offRamp/OffRampSetup.t.sol @@ -188,7 +188,9 @@ contract OffRampSetup is FeeQuoterSetup, MultiOCR3BaseSetup { _setupMultipleOffRampsFromConfigs(sourceChainConfigs); } - function _setupMultipleOffRampsFromConfigs(OffRamp.SourceChainConfigArgs[] memory sourceChainConfigs) internal { + function _setupMultipleOffRampsFromConfigs( + OffRamp.SourceChainConfigArgs[] memory sourceChainConfigs + ) internal { s_offRamp.applySourceChainConfigUpdates(sourceChainConfigs); Router.OnRamp[] memory onRampUpdates = new Router.OnRamp[](0); @@ -223,7 +225,9 @@ contract OffRampSetup is FeeQuoterSetup, MultiOCR3BaseSetup { uint32 internal constant MAX_TOKEN_POOL_RELEASE_OR_MINT_GAS = 200_000; uint32 internal constant MAX_TOKEN_POOL_TRANSFER_GAS = 50_000; - function _generateDynamicOffRampConfig(address feeQuoter) internal pure returns (OffRamp.DynamicConfig memory) { + function _generateDynamicOffRampConfig( + address feeQuoter + ) internal pure returns (OffRamp.DynamicConfig memory) { return OffRamp.DynamicConfig({ permissionLessExecutionThresholdSeconds: PERMISSION_LESS_EXECUTION_THRESHOLD_SECONDS, feeQuoter: feeQuoter, @@ -463,7 +467,9 @@ contract OffRampSetup is FeeQuoterSetup, MultiOCR3BaseSetup { s_offRamp.commit(reportContext, abi.encode(commitReport), rs, ss, rawVs); } - function _execute(Internal.ExecutionReportSingleChain[] memory reports) internal { + function _execute( + Internal.ExecutionReportSingleChain[] memory reports + ) internal { bytes32[3] memory reportContext = [s_configDigestExec, s_configDigestExec, s_configDigestExec]; vm.startPrank(s_validTransmitters[0]); @@ -526,7 +532,9 @@ contract OffRampSetup is FeeQuoterSetup, MultiOCR3BaseSetup { } } - function _assertNoEmit(bytes32 eventSelector) internal { + function _assertNoEmit( + bytes32 eventSelector + ) internal { Vm.Log[] memory logs = vm.getRecordedLogs(); for (uint256 i = 0; i < logs.length; i++) { diff --git a/contracts/src/v0.8/ccip/test/onRamp/EVM2EVMOnRamp.t.sol b/contracts/src/v0.8/ccip/test/onRamp/EVM2EVMOnRamp.t.sol index f0cd0f80ed..40309a8da6 100644 --- a/contracts/src/v0.8/ccip/test/onRamp/EVM2EVMOnRamp.t.sol +++ b/contracts/src/v0.8/ccip/test/onRamp/EVM2EVMOnRamp.t.sol @@ -67,7 +67,9 @@ contract EVM2EVMOnRamp_constructor is EVM2EVMOnRampSetup { } contract EVM2EVMOnRamp_payNops_fuzz is EVM2EVMOnRampSetup { - function test_Fuzz_NopPayNops_Success(uint96 nopFeesJuels) public { + function test_Fuzz_NopPayNops_Success( + uint96 nopFeesJuels + ) public { (EVM2EVMOnRamp.NopAndWeight[] memory nopsAndWeights, uint256 weightsTotal) = s_onRamp.getNops(); // To avoid NoFeesToPay vm.assume(nopFeesJuels > weightsTotal); @@ -1045,7 +1047,9 @@ contract EVM2EVMOnRamp_getFeeSetup is EVM2EVMOnRampSetup { return (tokenAmount * ratio) / 1e5; } - function configUSDCentToWei(uint256 usdCent) internal pure returns (uint256) { + function configUSDCentToWei( + uint256 usdCent + ) internal pure returns (uint256) { return usdCent * 1e16; } } diff --git a/contracts/src/v0.8/ccip/test/onRamp/OnRamp.t.sol b/contracts/src/v0.8/ccip/test/onRamp/OnRamp.t.sol index 16889db39e..5ccd20b015 100644 --- a/contracts/src/v0.8/ccip/test/onRamp/OnRamp.t.sol +++ b/contracts/src/v0.8/ccip/test/onRamp/OnRamp.t.sol @@ -809,7 +809,9 @@ contract OnRamp_withdrawFeeTokens is OnRampSetup { } } - function test_Fuzz_WithdrawFeeTokens_Success(uint256[5] memory amounts) public { + function test_Fuzz_WithdrawFeeTokens_Success( + uint256[5] memory amounts + ) public { vm.startPrank(OWNER); address[] memory feeTokens = new address[](amounts.length); for (uint256 i = 0; i < amounts.length; ++i) { diff --git a/contracts/src/v0.8/ccip/test/onRamp/OnRampSetup.t.sol b/contracts/src/v0.8/ccip/test/onRamp/OnRampSetup.t.sol index 541146bdaf..7ba22d9458 100644 --- a/contracts/src/v0.8/ccip/test/onRamp/OnRampSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/onRamp/OnRampSetup.t.sol @@ -105,7 +105,9 @@ contract OnRampSetup is FeeQuoterFeeSetup { ); } - function _generateDynamicOnRampConfig(address feeQuoter) internal pure returns (OnRamp.DynamicConfig memory) { + function _generateDynamicOnRampConfig( + address feeQuoter + ) internal pure returns (OnRamp.DynamicConfig memory) { return OnRamp.DynamicConfig({ feeQuoter: feeQuoter, reentrancyGuardEntered: false, @@ -116,7 +118,9 @@ contract OnRampSetup is FeeQuoterFeeSetup { } // Slicing is only available for calldata. So we have to build a new bytes array. - function _removeFirst4Bytes(bytes memory data) internal pure returns (bytes memory) { + function _removeFirst4Bytes( + bytes memory data + ) internal pure returns (bytes memory) { bytes memory result = new bytes(data.length - 4); for (uint256 i = 4; i < data.length; ++i) { result[i - 4] = data[i]; @@ -124,7 +128,9 @@ contract OnRampSetup is FeeQuoterFeeSetup { return result; } - function _generateDestChainConfigArgs(IRouter router) internal pure returns (OnRamp.DestChainConfigArgs[] memory) { + function _generateDestChainConfigArgs( + IRouter router + ) internal pure returns (OnRamp.DestChainConfigArgs[] memory) { OnRamp.DestChainConfigArgs[] memory destChainConfigs = new OnRamp.DestChainConfigArgs[](1); destChainConfigs[0] = OnRamp.DestChainConfigArgs({destChainSelector: DEST_CHAIN_SELECTOR, router: router, allowListEnabled: false}); diff --git a/contracts/src/v0.8/ccip/test/pools/BurnMintSetup.t.sol b/contracts/src/v0.8/ccip/test/pools/BurnMintSetup.t.sol index 220f6ca112..7bf0ce57d5 100644 --- a/contracts/src/v0.8/ccip/test/pools/BurnMintSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/BurnMintSetup.t.sol @@ -21,7 +21,9 @@ contract BurnMintSetup is RouterSetup { s_burnMintERC677 = new BurnMintERC677("Chainlink Token", "LINK", 18, 0); } - function _applyChainUpdates(address pool) internal { + function _applyChainUpdates( + address pool + ) internal { TokenPool.ChainUpdate[] memory chains = new TokenPool.ChainUpdate[](1); chains[0] = TokenPool.ChainUpdate({ remoteChainSelector: DEST_CHAIN_SELECTOR, diff --git a/contracts/src/v0.8/ccip/test/pools/BurnWithFromMintRebasingTokenPool.t.sol b/contracts/src/v0.8/ccip/test/pools/BurnWithFromMintRebasingTokenPool.t.sol index c88f030c56..ea5b4a2c43 100644 --- a/contracts/src/v0.8/ccip/test/pools/BurnWithFromMintRebasingTokenPool.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/BurnWithFromMintRebasingTokenPool.t.sol @@ -50,7 +50,9 @@ contract BurnWithFromMintTokenPool_releaseOrMint is BurnWithFromMintRebasingToke assertEq(balancePre + amount, s_rebasingToken.balanceOf(address(OWNER))); } - function testFuzz_releaseOrMint_rebasing_success(uint16 multiplierPercentage) public { + function testFuzz_releaseOrMint_rebasing_success( + uint16 multiplierPercentage + ) public { uint256 amount = 1000; uint256 expectedAmount = amount * multiplierPercentage / 100; s_rebasingToken.setMultiplierPercentage(multiplierPercentage); @@ -72,7 +74,9 @@ contract BurnWithFromMintTokenPool_releaseOrMint is BurnWithFromMintRebasingToke s_pool.releaseOrMint(_getReleaseOrMintIn(amount)); } - function _getReleaseOrMintIn(uint256 amount) internal view returns (Pool.ReleaseOrMintInV1 memory) { + function _getReleaseOrMintIn( + uint256 amount + ) internal view returns (Pool.ReleaseOrMintInV1 memory) { return Pool.ReleaseOrMintInV1({ originalSender: bytes(""), receiver: OWNER, diff --git a/contracts/src/v0.8/ccip/test/pools/HybridLockReleaseUSDCTokenPool.t.sol b/contracts/src/v0.8/ccip/test/pools/HybridLockReleaseUSDCTokenPool.t.sol index ddb8c29dc2..73426129ef 100644 --- a/contracts/src/v0.8/ccip/test/pools/HybridLockReleaseUSDCTokenPool.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/HybridLockReleaseUSDCTokenPool.t.sol @@ -126,7 +126,9 @@ contract USDCTokenPoolSetup is BaseTest { s_router.applyRampUpdates(onRampUpdates, new Router.OffRamp[](0), offRampUpdates); } - function _generateUSDCMessage(USDCMessage memory usdcMessage) internal pure returns (bytes memory) { + function _generateUSDCMessage( + USDCMessage memory usdcMessage + ) internal pure returns (bytes memory) { return abi.encodePacked( usdcMessage.version, usdcMessage.sourceDomain, diff --git a/contracts/src/v0.8/ccip/test/pools/LockReleaseTokenPool.t.sol b/contracts/src/v0.8/ccip/test/pools/LockReleaseTokenPool.t.sol index ed8a1cf31f..eea7f2af4c 100644 --- a/contracts/src/v0.8/ccip/test/pools/LockReleaseTokenPool.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/LockReleaseTokenPool.t.sol @@ -76,7 +76,9 @@ contract LockReleaseTokenPool_setRebalancer is LockReleaseTokenPoolSetup { } contract LockReleaseTokenPool_lockOrBurn is LockReleaseTokenPoolSetup { - function test_Fuzz_LockOrBurnNoAllowList_Success(uint256 amount) public { + function test_Fuzz_LockOrBurnNoAllowList_Success( + uint256 amount + ) public { amount = bound(amount, 1, _getOutboundRateLimiterConfig().capacity); vm.startPrank(s_allowedOnRamp); @@ -316,7 +318,9 @@ contract LockReleaseTokenPool_canAcceptLiquidity is LockReleaseTokenPoolSetup { } contract LockReleaseTokenPool_provideLiquidity is LockReleaseTokenPoolSetup { - function test_Fuzz_ProvideLiquidity_Success(uint256 amount) public { + function test_Fuzz_ProvideLiquidity_Success( + uint256 amount + ) public { uint256 balancePre = s_token.balanceOf(OWNER); s_token.approve(address(s_lockReleaseTokenPool), amount); @@ -335,7 +339,9 @@ contract LockReleaseTokenPool_provideLiquidity is LockReleaseTokenPoolSetup { s_lockReleaseTokenPool.provideLiquidity(1); } - function test_Fuzz_ExceedsAllowance(uint256 amount) public { + function test_Fuzz_ExceedsAllowance( + uint256 amount + ) public { vm.assume(amount > 0); vm.expectRevert("ERC20: insufficient allowance"); s_lockReleaseTokenPool.provideLiquidity(amount); @@ -351,7 +357,9 @@ contract LockReleaseTokenPool_provideLiquidity is LockReleaseTokenPoolSetup { } contract LockReleaseTokenPool_withdrawalLiquidity is LockReleaseTokenPoolSetup { - function test_Fuzz_WithdrawalLiquidity_Success(uint256 amount) public { + function test_Fuzz_WithdrawalLiquidity_Success( + uint256 amount + ) public { uint256 balancePre = s_token.balanceOf(OWNER); s_token.approve(address(s_lockReleaseTokenPool), amount); s_lockReleaseTokenPool.provideLiquidity(amount); diff --git a/contracts/src/v0.8/ccip/test/pools/TokenPool.t.sol b/contracts/src/v0.8/ccip/test/pools/TokenPool.t.sol index 2c1bc0ed57..766a4870f6 100644 --- a/contracts/src/v0.8/ccip/test/pools/TokenPool.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/TokenPool.t.sol @@ -109,7 +109,9 @@ contract TokenPool_setRemotePool is TokenPoolSetup { } contract TokenPool_applyChainUpdates is TokenPoolSetup { - function assertState(TokenPool.ChainUpdate[] memory chainUpdates) public view { + function assertState( + TokenPool.ChainUpdate[] memory chainUpdates + ) public view { uint64[] memory chainSelectors = s_tokenPool.getSupportedChains(); for (uint256 i = 0; i < chainUpdates.length; i++) { assertEq(chainUpdates[i].remoteChainSelector, chainSelectors[i]); diff --git a/contracts/src/v0.8/ccip/test/pools/USDCTokenPool.t.sol b/contracts/src/v0.8/ccip/test/pools/USDCTokenPool.t.sol index b71094a310..da5caba9d7 100644 --- a/contracts/src/v0.8/ccip/test/pools/USDCTokenPool.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/USDCTokenPool.t.sol @@ -118,7 +118,9 @@ contract USDCTokenPoolSetup is BaseTest { s_router.applyRampUpdates(onRampUpdates, new Router.OffRamp[](0), offRampUpdates); } - function _generateUSDCMessage(USDCMessage memory usdcMessage) internal pure returns (bytes memory) { + function _generateUSDCMessage( + USDCMessage memory usdcMessage + ) internal pure returns (bytes memory) { return abi.encodePacked( usdcMessage.version, usdcMessage.sourceDomain, diff --git a/contracts/src/v0.8/ccip/test/rmn/RMNRemoteSetup.t.sol b/contracts/src/v0.8/ccip/test/rmn/RMNRemoteSetup.t.sol index ad25abcf1a..131dfec7cb 100644 --- a/contracts/src/v0.8/ccip/test/rmn/RMNRemoteSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/rmn/RMNRemoteSetup.t.sol @@ -36,7 +36,9 @@ contract RMNRemoteSetup is BaseTest { /// @notice sets up a list of signers with strictly increasing onchain public keys /// @dev signers do not have to be in order when configured, but they do when generating signatures /// rather than sort signers every time, we do it once here and store the sorted list - function _setupSigners(uint256 numSigners) internal { + function _setupSigners( + uint256 numSigners + ) internal { // remove any existing config while (s_signerWallets.length > 0) { s_signerWallets.pop(); @@ -123,7 +125,9 @@ contract RMNRemoteSetup is BaseTest { } /// @notice bubble sort on a storage array of wallets - function _sort(Vm.Wallet[] storage wallets) private { + function _sort( + Vm.Wallet[] storage wallets + ) private { bool swapped; for (uint256 i = 1; i < wallets.length; i++) { swapped = false; diff --git a/contracts/src/v0.8/ccip/test/router/Router.t.sol b/contracts/src/v0.8/ccip/test/router/Router.t.sol index 95d3c2f293..2163f807d0 100644 --- a/contracts/src/v0.8/ccip/test/router/Router.t.sol +++ b/contracts/src/v0.8/ccip/test/router/Router.t.sol @@ -313,7 +313,9 @@ contract Router_ccipSend is EVM2EVMOnRampSetup { s_sourceRouter.ccipSend(wrongChain, message); } - function test_Fuzz_UnsupportedFeeToken_Reverts(address wrongFeeToken) public { + function test_Fuzz_UnsupportedFeeToken_Reverts( + address wrongFeeToken + ) public { // We have three fee tokens set, all others should revert. vm.assume(address(s_sourceFeeToken) != wrongFeeToken); vm.assume(address(s_sourceRouter.getWrappedNative()) != wrongFeeToken); @@ -327,7 +329,9 @@ contract Router_ccipSend is EVM2EVMOnRampSetup { s_sourceRouter.ccipSend(DEST_CHAIN_SELECTOR, message); } - function test_Fuzz_UnsupportedToken_Reverts(address wrongToken) public { + function test_Fuzz_UnsupportedToken_Reverts( + address wrongToken + ) public { for (uint256 i = 0; i < s_sourceTokens.length; ++i) { vm.assume(address(s_sourceTokens[i]) != wrongToken); } @@ -399,7 +403,9 @@ contract Router_applyRampUpdates is RouterSetup { s_receiver = new MaybeRevertMessageReceiver(false); } - function _assertOffRampRouteSucceeds(Router.OffRamp memory offRamp) internal { + function _assertOffRampRouteSucceeds( + Router.OffRamp memory offRamp + ) internal { vm.startPrank(offRamp.offRamp); Client.Any2EVMMessage memory message = _generateReceiverMessage(offRamp.sourceChainSelector); @@ -407,7 +413,9 @@ contract Router_applyRampUpdates is RouterSetup { s_sourceRouter.routeMessage(message, GAS_FOR_CALL_EXACT_CHECK, 100_000, address(s_receiver)); } - function _assertOffRampRouteReverts(Router.OffRamp memory offRamp) internal { + function _assertOffRampRouteReverts( + Router.OffRamp memory offRamp + ) internal { vm.startPrank(offRamp.offRamp); vm.expectRevert(IRouter.OnlyOffRamp.selector); @@ -416,7 +424,9 @@ contract Router_applyRampUpdates is RouterSetup { ); } - function test_Fuzz_OffRampUpdates(address[20] memory offRampsInput) public { + function test_Fuzz_OffRampUpdates( + address[20] memory offRampsInput + ) public { Router.OffRamp[] memory offRamps = new Router.OffRamp[](20); for (uint256 i = 0; i < offRampsInput.length; ++i) { @@ -595,7 +605,9 @@ contract Router_applyRampUpdates is RouterSetup { } } - function test_Fuzz_OnRampUpdates(Router.OnRamp[] memory onRamps) public { + function test_Fuzz_OnRampUpdates( + Router.OnRamp[] memory onRamps + ) public { // Test adding onRamps for (uint256 i = 0; i < onRamps.length; ++i) { vm.expectEmit(); @@ -668,7 +680,9 @@ contract Router_applyRampUpdates is RouterSetup { } contract Router_setWrappedNative is EVM2EVMOnRampSetup { - function test_Fuzz_SetWrappedNative_Success(address wrappedNative) public { + function test_Fuzz_SetWrappedNative_Success( + address wrappedNative + ) public { s_sourceRouter.setWrappedNative(wrappedNative); assertEq(wrappedNative, s_sourceRouter.getWrappedNative()); } @@ -694,7 +708,9 @@ contract Router_routeMessage is EVM2EVMOffRampSetup { vm.startPrank(address(s_offRamp)); } - function _generateManualGasLimit(uint256 callDataLength) internal view returns (uint256) { + function _generateManualGasLimit( + uint256 callDataLength + ) internal view returns (uint256) { return ((gasleft() - 2 * (16 * callDataLength + GAS_FOR_CALL_EXACT_CHECK)) * 62) / 64; } @@ -796,7 +812,9 @@ contract Router_routeMessage is EVM2EVMOffRampSetup { assertGt(gasUsed, 3_000); } - function test_Fuzz_ExecutionEvent_Success(bytes calldata error) public { + function test_Fuzz_ExecutionEvent_Success( + bytes calldata error + ) public { Client.Any2EVMMessage memory message = _generateReceiverMessage(SOURCE_CHAIN_SELECTOR); s_reverting_receiver.setErr(error); diff --git a/contracts/src/v0.8/ccip/test/router/RouterSetup.t.sol b/contracts/src/v0.8/ccip/test/router/RouterSetup.t.sol index 7297721baa..f4c1114bf2 100644 --- a/contracts/src/v0.8/ccip/test/router/RouterSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/router/RouterSetup.t.sol @@ -26,7 +26,9 @@ contract RouterSetup is BaseTest { } } - function _generateReceiverMessage(uint64 chainSelector) internal pure returns (Client.Any2EVMMessage memory) { + function _generateReceiverMessage( + uint64 chainSelector + ) internal pure returns (Client.Any2EVMMessage memory) { Client.EVMTokenAmount[] memory ta = new Client.EVMTokenAmount[](0); return Client.Any2EVMMessage({ messageId: bytes32("a"), diff --git a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol index fab044d60d..cf40fb62d2 100644 --- a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol +++ b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/RegistryModuleOwnerCustom.t.sol @@ -105,7 +105,9 @@ contract RegistryModuleOwnerCustom_registerAdminViaOwner is RegistryModuleOwnerC } contract AccessController is AccessControl { - constructor(address admin) { + constructor( + address admin + ) { _grantRole(DEFAULT_ADMIN_ROLE, admin); } } diff --git a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/TokenAdminRegistry.t.sol b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/TokenAdminRegistry.t.sol index ada0369045..a5c2487478 100644 --- a/contracts/src/v0.8/ccip/test/tokenAdminRegistry/TokenAdminRegistry.t.sol +++ b/contracts/src/v0.8/ccip/test/tokenAdminRegistry/TokenAdminRegistry.t.sol @@ -99,7 +99,9 @@ contract TokenAdminRegistry_setPool is TokenAdminRegistrySetup { } contract TokenAdminRegistry_getAllConfiguredTokens is TokenAdminRegistrySetup { - function test_Fuzz_getAllConfiguredTokens_Success(uint8 numberOfTokens) public { + function test_Fuzz_getAllConfiguredTokens_Success( + uint8 numberOfTokens + ) public { TokenAdminRegistry cleanTokenAdminRegistry = new TokenAdminRegistry(); for (uint160 i = 0; i < numberOfTokens; ++i) { cleanTokenAdminRegistry.proposeAdministrator(address(i), address(i + 1000)); diff --git a/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol b/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol index 799875b758..4392fa8c56 100644 --- a/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol +++ b/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol @@ -20,7 +20,9 @@ contract RegistryModuleOwnerCustom is ITypeAndVersion { // The TokenAdminRegistry contract ITokenAdminRegistry internal immutable i_tokenAdminRegistry; - constructor(address tokenAdminRegistry) { + constructor( + address tokenAdminRegistry + ) { if (tokenAdminRegistry == address(0)) { revert AddressZero(); } @@ -30,21 +32,27 @@ contract RegistryModuleOwnerCustom is ITypeAndVersion { /// @notice Registers the admin of the token using the `getCCIPAdmin` method. /// @param token The token to register the admin for. /// @dev The caller must be the admin returned by the `getCCIPAdmin` method. - function registerAdminViaGetCCIPAdmin(address token) external { + function registerAdminViaGetCCIPAdmin( + address token + ) external { _registerAdmin(token, IGetCCIPAdmin(token).getCCIPAdmin()); } /// @notice Registers the admin of the token using the `owner` method. /// @param token The token to register the admin for. /// @dev The caller must be the admin returned by the `owner` method. - function registerAdminViaOwner(address token) external { + function registerAdminViaOwner( + address token + ) external { _registerAdmin(token, IOwner(token).owner()); } /// @notice Registers the admin of the token using OZ's AccessControl DEFAULT_ADMIN_ROLE. /// @param token The token to register the admin for. /// @dev The caller must have the DEFAULT_ADMIN_ROLE as defined by the contract itself. - function registerAccessControlDefaultAdmin(address token) external { + function registerAccessControlDefaultAdmin( + address token + ) external { bytes32 defaultAdminRole = AccessControl(token).DEFAULT_ADMIN_ROLE(); if (!AccessControl(token).hasRole(defaultAdminRole, msg.sender)) { revert RequiredRoleNotFound(msg.sender, defaultAdminRole, token); diff --git a/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol b/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol index fd995ca96a..fbe821ebc7 100644 --- a/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol +++ b/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol @@ -50,7 +50,9 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea /// @notice Returns all pools for the given tokens. /// @dev Will return address(0) for tokens that do not have a pool. - function getPools(address[] calldata tokens) external view returns (address[] memory) { + function getPools( + address[] calldata tokens + ) external view returns (address[] memory) { address[] memory pools = new address[](tokens.length); for (uint256 i = 0; i < tokens.length; ++i) { pools[i] = s_tokenConfig[tokens[i]].tokenPool; @@ -59,14 +61,18 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea } /// @inheritdoc ITokenAdminRegistry - function getPool(address token) external view returns (address) { + function getPool( + address token + ) external view returns (address) { return s_tokenConfig[token].tokenPool; } /// @notice Returns the configuration for a token. /// @param token The token to get the configuration for. /// @return config The configuration for the token. - function getTokenConfig(address token) external view returns (TokenConfig memory) { + function getTokenConfig( + address token + ) external view returns (TokenConfig memory) { return s_tokenConfig[token]; } @@ -136,7 +142,9 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea /// @notice Accepts the administrator role for a token. /// @param localToken The token to accept the administrator role for. /// @dev This function can only be called by the pending administrator. - function acceptAdminRole(address localToken) external { + function acceptAdminRole( + address localToken + ) external { TokenConfig storage config = s_tokenConfig[localToken]; if (config.pendingAdministrator != msg.sender) { revert OnlyPendingAdministrator(msg.sender, localToken); @@ -187,13 +195,17 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea /// @notice Checks if an address is a registry module. /// @param module The address to check. /// @return True if the address is a registry module, false otherwise. - function isRegistryModule(address module) public view returns (bool) { + function isRegistryModule( + address module + ) public view returns (bool) { return s_registryModules.contains(module); } /// @notice Adds a new registry module to the list of allowed modules. /// @param module The module to add. - function addRegistryModule(address module) external onlyOwner { + function addRegistryModule( + address module + ) external onlyOwner { if (s_registryModules.add(module)) { emit RegistryModuleAdded(module); } @@ -201,7 +213,9 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea /// @notice Removes a registry module from the list of allowed modules. /// @param module The module to remove. - function removeRegistryModule(address module) external onlyOwner { + function removeRegistryModule( + address module + ) external onlyOwner { if (s_registryModules.remove(module)) { emit RegistryModuleRemoved(module); } @@ -212,7 +226,9 @@ contract TokenAdminRegistry is ITokenAdminRegistry, ITypeAndVersion, OwnerIsCrea // ================================================================ /// @notice Checks if an address is the administrator of the given token. - modifier onlyTokenAdmin(address token) { + modifier onlyTokenAdmin( + address token + ) { if (s_tokenConfig[token].administrator != msg.sender) { revert OnlyAdministrator(msg.sender, token); }