@@ -9,11 +9,11 @@ import {IRMN} from "../interfaces/IRMN.sol";
99import {IRouter} from "../interfaces/IRouter.sol " ;
1010
1111import {FeeTokenHandler} from "../libraries/FeeTokenHandler.sol " ;
12+ import {FinalityCodec} from "../libraries/FinalityCodec.sol " ;
1213import {Pool} from "../libraries/Pool.sol " ;
1314import {RateLimiter} from "../libraries/RateLimiter.sol " ;
1415import {Ownable2StepMsgSender} from "@chainlink/contracts/src/v0.8/shared/access/Ownable2StepMsgSender.sol " ;
1516
16- import {FinalityCodec} from "../libraries/FinalityCodec.sol " ;
1717import {IERC20 } from "@openzeppelin/contracts@5.3.0/token/ERC20/IERC20.sol " ;
1818import {IERC20Metadata } from "@openzeppelin/contracts@5.3.0/token/ERC20/extensions/IERC20Metadata.sol " ;
1919import {SafeERC20} from "@openzeppelin/contracts@5.3.0/token/ERC20/utils/SafeERC20.sol " ;
@@ -43,8 +43,6 @@ abstract contract TokenPool is IPoolV1V2, Ownable2StepMsgSender {
4343 using RateLimiter for RateLimiter.TokenBucket;
4444 using SafeERC20 for IERC20 ;
4545
46- error InvalidFinalityConfig (uint16 requested , uint16 minFinality );
47- error FastFinalityNotEnabled ();
4846 error InvalidTransferFeeBps (uint256 bps );
4947 error InvalidTokenTransferFeeConfig (uint64 destChainSelector );
5048 error CallerIsNotARampOnRouter (address caller );
@@ -89,7 +87,7 @@ abstract contract TokenPool is IPoolV1V2, Ownable2StepMsgSender {
8987 RateLimiter.Config outboundRateLimiterConfig ,
9088 RateLimiter.Config inboundRateLimiterConfig
9189 );
92- event FinalityConfigSet (bytes2 minFinality );
90+ event FinalityConfigSet (bytes2 allowedFinality );
9391 event AdvancedPoolHooksUpdated (IAdvancedPoolHooks oldHook , IAdvancedPoolHooks newHook );
9492
9593 struct ChainUpdate {
@@ -253,7 +251,8 @@ abstract contract TokenPool is IPoolV1V2, Ownable2StepMsgSender {
253251 function setFinalityConfig (
254252 bytes2 allowedFinality
255253 ) public virtual onlyOwner {
256- // Every value
254+ // Any bytes2 value is accepted as allowedFinality; the FinalityCodec semantics are enforced when requests are
255+ // checked against this value via FinalityCodec._ensureRequestedFinalityAllowed.
257256 s_finalityConfig = allowedFinality;
258257
259258 emit FinalityConfigSet (allowedFinality);
@@ -485,6 +484,10 @@ abstract contract TokenPool is IPoolV1V2, Ownable2StepMsgSender {
485484 revert InvalidSourcePoolAddress (releaseOrMintIn.sourcePoolAddress);
486485 }
487486 if (finalityConfig != WAIT_FOR_FINALITY) {
487+ // Validate that the finality carried in the inbound message is permitted by this pool's config. This mirrors
488+ // the outbound check in _validateLockOrBurn and ensures the FTF inbound rate-limit bucket is only consumed for
489+ // modes the pool has explicitly enabled, even if a future OffRamp skips this check.
490+ FinalityCodec._ensureRequestedFinalityAllowed (finalityConfig, s_finalityConfig);
488491 _consumeFastFinalityInboundRateLimit (releaseOrMintIn.localToken, releaseOrMintIn.remoteChainSelector, localAmount);
489492 } else {
490493 _consumeInboundRateLimit (releaseOrMintIn.localToken, releaseOrMintIn.remoteChainSelector, localAmount);
@@ -1066,8 +1069,7 @@ abstract contract TokenPool is IPoolV1V2, Ownable2StepMsgSender {
10661069 virtual
10671070 returns (uint256 feeUSDCents , uint32 destGasOverhead , uint32 destBytesOverhead , uint16 tokenFeeBps , bool isEnabled )
10681071 {
1069- // Use the codec to validate that the requested finality is allowed by the pool's configuration. This will revert
1070- // if the requested finality is not allowed.
1072+ // Validate that the requested finality is well-formed and permitted by this pool's config.
10711073 FinalityCodec._ensureRequestedFinalityAllowed (finalityConfig, s_finalityConfig);
10721074
10731075 TokenTransferFeeConfig memory feeConfig = s_tokenTransferFeeConfig[destChainSelector];
0 commit comments