Skip to content

Commit a37c3ce

Browse files
committed
fix naming, comments, errors
1 parent 9b2adcb commit a37c3ce

10 files changed

Lines changed: 22 additions & 14 deletions

File tree

chains/evm/contracts/ccvs/VersionedVerifierResolver.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
pragma solidity ^0.8.24;
33

44
import {ICrossChainVerifierResolver} from "../interfaces/ICrossChainVerifierResolver.sol";
5-
import {FeeTokenHandler} from "../libraries/FeeTokenHandler.sol";
65
import {ITypeAndVersion} from "@chainlink/contracts/src/v0.8/shared/interfaces/ITypeAndVersion.sol";
76

7+
import {FeeTokenHandler} from "../libraries/FeeTokenHandler.sol";
88
import {Ownable2StepMsgSender} from "@chainlink/contracts/src/v0.8/shared/access/Ownable2StepMsgSender.sol";
99

1010
import {EnumerableSet} from "@openzeppelin/contracts@5.3.0/utils/structs/EnumerableSet.sol";

chains/evm/contracts/ccvs/components/BaseVerifier.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ abstract contract BaseVerifier is ICrossChainVerifierV1, ITypeAndVersion {
3232

3333
// solhint-disable-next-line gas-struct-packing
3434
struct RemoteChainConfig {
35-
IRouter router; // ──────────╮ Local router to use for messages to/fom this chain.
35+
IRouter router; // ──────────╮ Local router to use for messages to/from this chain.
3636
uint16 feeUSDCents; // │ The fee in US dollar cents for messages to this remote chain. [0, $655.35]
3737
uint32 gasForVerification; //│ The gas to reserve for verification of messages on the remote chain.
3838
uint16 payloadSizeBytes; // │ The size of the verification payload on the remote chain.
@@ -265,6 +265,8 @@ abstract contract BaseVerifier is ICrossChainVerifierV1, ITypeAndVersion {
265265
if (config.router == IRouter(address(0))) {
266266
revert RemoteChainNotSupported(destChainSelector);
267267
}
268+
// Validate the shape of the requested finality before checking whether it is permitted by the stored config.
269+
FinalityCodec._validateRequestedFinality(requestedFinality);
268270
FinalityCodec._ensureRequestedFinalityAllowed(requestedFinality, config.finalityConfig);
269271

270272
return (config.feeUSDCents, config.gasForVerification, config.payloadSizeBytes);

chains/evm/contracts/executor/Executor.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ contract Executor is IExecutor, Ownable2StepMsgSender {
210210
if (!remoteChainConfig.enabled) {
211211
revert InvalidDestChain(destChainSelector);
212212
}
213+
// Validate the shape of the requested finality before checking whether it is permitted by the allowed config.
214+
FinalityCodec._validateRequestedFinality(requestedFinality);
213215
FinalityCodec._ensureRequestedFinalityAllowed(requestedFinality, s_dynamicConfig.allowedFinalityConfig);
214216

215217
if (s_dynamicConfig.ccvAllowlistEnabled) {

chains/evm/contracts/libraries/MessageV1Codec.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ library MessageV1Codec {
136136
// Configurable per-message finality value.
137137
bytes2 finality;
138138
// A hash of the verifiers and executor addresses. This is used by the offchain systems to validate the list of CCVs
139-
// and executor that should be used for this message. This has no meaning on the destination chain ans is not
139+
// and executor that should be used for this message. This has no meaning on the destination chain and is not
140140
// checked against anything.
141141
bytes32 ccvAndExecutorHash;
142142
// Variable length fields - must match wire format order.

chains/evm/contracts/offRamp/OffRamp.sol

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,13 @@ contract OffRamp is ITypeAndVersion, Ownable2StepMsgSender {
499499
address[] memory requiredReceiverCCVs;
500500
if (isTokenOnlyTransfer) {
501501
if (tokenTransfer.length > 0) {
502-
// For token-only transfers, we skip querying the receiver for CCVs, and don't add the defaults. This enables
503-
// pure token transfers to only require the pool CCVs, as the token issuer is the only party that takes any risk.
502+
// For token-only transfers with tokens, we skip querying the receiver for CCVs, and don't add the defaults.
503+
// This enables pure token transfers to only require the pool CCVs, as the token issuer is the only party that
504+
// takes any risk. As a consequence, the receiver's finality policy (getCCVsAndFinalityConfig) is intentionally
505+
// NOT checked against message.finality for this path — finality enforcement is delegated entirely to the pool
506+
// (which validates finality in _validateReleaseOrMint). If a receiver wants to enforce its own finality policy
507+
// for token transfers it must NOT qualify as a token-only transfer (i.e. it must have a non-zero data payload
508+
// or a non-zero ccipReceiveGasLimit).
504509
requiredReceiverCCVs = new address[](0);
505510
optionalCCVs = new address[](0);
506511
optionalThreshold = 0;

chains/evm/contracts/pools/USDC/CCTPThroughCCVTokenPool.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// SPDX-License-Identifier: BUSL-1.1
22
pragma solidity ^0.8.24;
33

4+
import {ICrossChainVerifierResolver} from "../../interfaces/ICrossChainVerifierResolver.sol";
45
import {IPoolV1} from "../../interfaces/IPool.sol";
56
import {IPoolV2} from "../../interfaces/IPoolV2.sol";
67
import {ITypeAndVersion} from "@chainlink/contracts/src/v0.8/shared/interfaces/ITypeAndVersion.sol";
78

89
import {CCTPVerifier} from "../../ccvs/CCTPVerifier.sol";
9-
import {ICrossChainVerifierResolver} from "../../interfaces/ICrossChainVerifierResolver.sol";
1010
import {Pool} from "../../libraries/Pool.sol";
1111
import {USDCSourcePoolDataCodec} from "../../libraries/USDCSourcePoolDataCodec.sol";
1212
import {TokenPool} from "../TokenPool.sol";

chains/evm/contracts/test/Router/Router.recoverTokens.t.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// SPDX-License-Identifier: BUSL-1.1
22
pragma solidity ^0.8.24;
33

4-
import {IERC20} from "@openzeppelin/contracts@5.3.0/token/ERC20/IERC20.sol";
5-
64
import {Router} from "../../Router.sol";
7-
85
import {MaybeRevertMessageReceiver} from "../helpers/receivers/MaybeRevertMessageReceiver.sol";
96
import {RouterSetup} from "./RouterSetup.t.sol";
107

8+
import {IERC20} from "@openzeppelin/contracts@5.3.0/token/ERC20/IERC20.sol";
9+
1110
contract Router_recoverTokens is RouterSetup {
1211
function test_RecoverTokens() public {
1312
// Assert we can recover sourceToken

chains/evm/contracts/test/ccvs/components/BaseVerifier/BaseVerifier.getFee.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ contract BaseVerifier_getFee is BaseVerifierSetup {
3737
s_baseVerifier.applyRemoteChainConfigUpdates(configs);
3838

3939
Client.EVM2AnyMessage memory message;
40-
// Request 10 blocks — meets the minimum of 5 (request more security than required is fine).
40+
// Request 10 blocks — meets the minimum of 10 (requesting at least the minimum is allowed).
4141
(uint256 feeUSDCents,,) =
4242
s_baseVerifier.getFee(DEST_CHAIN_SELECTOR, message, "", FinalityCodec._encodeBlockDepth(10));
4343
assertEq(feeUSDCents, DEFAULT_CCV_FEE_USD_CENTS);

chains/evm/contracts/test/pools/TokenPool/TokenPool.getFee.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ contract TokenPool_getFee is AdvancedPoolHooksSetup {
7777

7878
// Reverts
7979

80-
function test_getFee_RevertWhen_FastFinalityNotEnabled() public {
80+
function test_getFee_RevertWhen_FtfNotAllowedByPool() public {
8181
bytes2 requestedFinality = bytes2(uint16(1)); // Any non-zero value triggers custom finality path
8282

8383
vm.expectRevert(
@@ -86,7 +86,7 @@ contract TokenPool_getFee is AdvancedPoolHooksSetup {
8686
s_tokenPool.getFee(address(s_token), DEST_CHAIN_SELECTOR, 1e18, address(0), requestedFinality, "");
8787
}
8888

89-
function test_getFee_RevertWhen_InvalidFinalityConfig() public {
89+
function test_getFee_RevertWhen_RequestedDepthBelowMinimum() public {
9090
bytes2 minFinality = bytes2(uint16(10));
9191

9292
// Set fast finality config with minimum of 10 blocks

chains/evm/contracts/test/pools/TokenPool/TokenPool.validateLockOrBurn.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ contract TokenPool_validateLockOrBurn is AdvancedPoolHooksSetup {
155155
s_tokenPool.validateLockOrBurn(lockOrBurnIn, bytes2(uint16(type(uint16).max)), "", fee);
156156
}
157157

158-
function test_validateLockOrBurn_RevertWhen_InvalidFinalityConfig() public {
158+
function test_validateLockOrBurn_RevertWhen_RequestedDepthBelowMinimum() public {
159159
bytes2 minFinality = bytes2(uint16(5));
160160
s_tokenPool.setFinalityConfig(minFinality);
161161
vm.startPrank(s_allowedOnRamp);
@@ -167,7 +167,7 @@ contract TokenPool_validateLockOrBurn is AdvancedPoolHooksSetup {
167167
s_tokenPool.validateLockOrBurn(_buildLockOrBurnIn(1000e18), requestedFinality, "", 0);
168168
}
169169

170-
function test_validateLockOrBurn_RevertWhen_FastFinalityNotEnabled() public {
170+
function test_validateLockOrBurn_RevertWhen_FtfNotAllowedByPool() public {
171171
vm.startPrank(OWNER);
172172
s_tokenPool.setFinalityConfig(bytes2(0));
173173

0 commit comments

Comments
 (0)