@@ -4,8 +4,9 @@ pragma solidity ^0.8.24;
44import {IExecutor} from "../interfaces/IExecutor.sol " ;
55
66import {FeeTokenHandler} from "../libraries/FeeTokenHandler.sol " ;
7- import {Ownable2StepMsgSender } from "@chainlink/contracts/src/v0.8/shared/access/Ownable2StepMsgSender .sol " ;
7+ import {FinalityCodec } from "../libraries/FinalityCodec .sol " ;
88
9+ import {Ownable2StepMsgSender} from "@chainlink/contracts/src/v0.8/shared/access/Ownable2StepMsgSender.sol " ;
910import {IERC20 } from "@openzeppelin/contracts@5.3.0/token/ERC20/IERC20.sol " ;
1011import {SafeERC20} from "@openzeppelin/contracts@5.3.0/token/ERC20/utils/SafeERC20.sol " ;
1112import {EnumerableSet} from "@openzeppelin/contracts@5.3.0/utils/structs/EnumerableSet.sol " ;
@@ -19,7 +20,6 @@ contract Executor is IExecutor, Ownable2StepMsgSender {
1920 error ExceedsMaxCCVs (uint256 provided , uint256 max );
2021 error InvalidCCV (address ccv );
2122 error InvalidDestChain (uint64 destChainSelector );
22- error Executor__RequestedBlockDepthTooLow (uint16 blockConfirmationsRequested , uint16 minBlockConfirmations );
2323 error InvalidMaxPossibleCCVsPerMsg (uint256 maxPossibleCCVsPerMsg );
2424
2525 event CCVAllowlistUpdated (bool enabled );
@@ -41,7 +41,7 @@ contract Executor is IExecutor, Ownable2StepMsgSender {
4141
4242 struct DynamicConfig {
4343 address feeAggregator; // ───────╮ Address to send withdrawn fees to.
44- uint16 minBlockConfirmations ; // │ Minimum number of block confirmations allowed (0 = finality) .
44+ bytes2 allowedFinalityConfig ; // │ The allowed finality config according to the `FinalityCodec` encoding .
4545 bool ccvAllowlistEnabled; // ────╯ Whether the CCV allowlist is enabled.
4646 }
4747
@@ -142,15 +142,14 @@ contract Executor is IExecutor, Ownable2StepMsgSender {
142142 function _setDynamicConfig (
143143 DynamicConfig memory dynamicConfig
144144 ) internal {
145- // Zero is a valid value for minBlockConfirmations, indicating that finality is requested.
146145 s_dynamicConfig = dynamicConfig;
147146
148147 emit ConfigSet (dynamicConfig);
149148 }
150149
151150 /// @inheritdoc IExecutor
152- function getMinBlockConfirmations () external view virtual returns (uint16 ) {
153- return s_dynamicConfig.minBlockConfirmations ;
151+ function getAllowedFinalityConfig () external view virtual returns (bytes2 ) {
152+ return s_dynamicConfig.allowedFinalityConfig ;
154153 }
155154
156155 /// @notice Returns the list of CCVs that the executor supports.
@@ -196,12 +195,12 @@ contract Executor is IExecutor, Ownable2StepMsgSender {
196195
197196 /// @notice Validates whether or not the executor can process the message and returns the fee required to do so.
198197 /// @param destChainSelector The destination chain selector.
199- /// @param finalityConfig The requested finality encoding for the message. `bytes2(0)` indicates waiting for finality.
198+ /// @param requestedFinality The requested finality encoding for the message. `bytes2(0)` indicates waiting for finality.
200199 /// @param ccvs The CCVs that are requested on source.
201200 /// @return usdCentsFee The USD denominated fee for the executor.
202201 function getFee (
203202 uint64 destChainSelector ,
204- bytes2 finalityConfig ,
203+ bytes2 requestedFinality ,
205204 address [] calldata ccvs ,
206205 bytes calldata , // extraArgs
207206 address // feeToken
@@ -210,10 +209,7 @@ contract Executor is IExecutor, Ownable2StepMsgSender {
210209 if (! remoteChainConfig.enabled) {
211210 revert InvalidDestChain (destChainSelector);
212211 }
213- uint16 requested = uint16 (finalityConfig);
214- if (requested != 0 && requested < s_dynamicConfig.minBlockConfirmations) {
215- revert Executor__RequestedBlockDepthTooLow (requested, s_dynamicConfig.minBlockConfirmations);
216- }
212+ FinalityCodec._ensureRequestedFinalityAllowed (requestedFinality, s_dynamicConfig.allowedFinalityConfig);
217213
218214 if (s_dynamicConfig.ccvAllowlistEnabled) {
219215 for (uint256 i = 0 ; i < ccvs.length ; ++ i) {
0 commit comments