@@ -8,6 +8,7 @@ import {ITypeAndVersion} from "@chainlink/contracts/src/v0.8/shared/interfaces/I
88
99import {Client} from "../../libraries/Client.sol " ;
1010
11+ import {FinalityCodec} from "../../libraries/FinalityCodec.sol " ;
1112import {IERC165 } from "@openzeppelin/contracts@5.3.0/utils/introspection/IERC165.sol " ;
1213import {EnumerableSet} from "@openzeppelin/contracts@5.3.0/utils/structs/EnumerableSet.sol " ;
1314
@@ -33,7 +34,8 @@ abstract contract BaseVerifier is ICrossChainVerifierV1, ITypeAndVersion {
3334 IRouter router; // ──────────╮ Local router to use for messages to/fom this chain.
3435 uint16 feeUSDCents; // │ The fee in US dollar cents for messages to this remote chain. [0, $655.35]
3536 uint32 gasForVerification; //│ The gas to reserve for verification of messages on the remote chain.
36- uint32 payloadSizeBytes; // │ The size of the verification payload on the remote chain.
37+ uint16 payloadSizeBytes; // │ The size of the verification payload on the remote chain.
38+ bytes2 finalityConfig; // │ The finality configuration for the local chain for messages to the remote chain.
3739 bool allowlistEnabled; // ───╯ True if the allowlist is enabled.
3840 EnumerableSet.AddressSet allowedSendersList; // The list of addresses allowed to send messages.
3941 }
@@ -44,7 +46,8 @@ abstract contract BaseVerifier is ICrossChainVerifierV1, ITypeAndVersion {
4446 bool allowlistEnabled; // │ True if the allowlist is enabled.
4547 uint16 feeUSDCents; // ────────╯ The fee in US dollar cents for messages to this remote chain.
4648 uint32 gasForVerification; // ─╮ The gas to reserve for verification of messages on the remote chain.
47- uint32 payloadSizeBytes; // ───╯ The size of the verification payload on the remote chain.
49+ uint16 payloadSizeBytes; // │ The size of the verification payload on the remote chain.
50+ bytes2 finalityConfig; // ─────╯ The finality configuration for the local chain for messages to the remote chain.
4851 }
4952
5053 /// @dev Struct to hold the allowlist configuration args per dest chain.
@@ -108,17 +111,29 @@ abstract contract BaseVerifier is ICrossChainVerifierV1, ITypeAndVersion {
108111
109112 /// @notice get ChainConfig configured for the remoteChainSelector.
110113 /// @param remoteChainSelector The remote chain selector.
111- /// @return allowlistEnabled boolean indicator to specify if allowlist check is enabled.
112- /// @return router address of the local router.
114+ /// @return remoteChainConfig The struct containing the remote chain settings.
113115 /// @return allowedSendersList list of addresses that are allowed to send messages to the remote chain.
114116 function getRemoteChainConfig (
115117 uint64 remoteChainSelector
116- ) external view virtual returns (bool allowlistEnabled , address router , address [] memory allowedSendersList ) {
118+ )
119+ external
120+ view
121+ virtual
122+ returns (RemoteChainConfigArgs memory remoteChainConfig , address [] memory allowedSendersList )
123+ {
117124 RemoteChainConfig storage config = _getRemoteChainConfig (remoteChainSelector);
118- allowlistEnabled = config.allowlistEnabled;
119- router = address (config.router);
120- allowedSendersList = config.allowedSendersList.values ();
121- return (allowlistEnabled, router, allowedSendersList);
125+ return (
126+ RemoteChainConfigArgs ({
127+ router: config.router,
128+ remoteChainSelector: remoteChainSelector,
129+ allowlistEnabled: config.allowlistEnabled,
130+ feeUSDCents: config.feeUSDCents,
131+ gasForVerification: config.gasForVerification,
132+ payloadSizeBytes: config.payloadSizeBytes,
133+ finalityConfig: config.finalityConfig
134+ }),
135+ config.allowedSendersList.values ()
136+ );
122137 }
123138
124139 function _getRemoteChainConfig (
@@ -152,6 +167,7 @@ abstract contract BaseVerifier is ICrossChainVerifierV1, ITypeAndVersion {
152167 remoteChainConfig.gasForVerification = remoteChainConfigArg.gasForVerification;
153168 // The payload could be zero bytes if no offchain data is required.
154169 remoteChainConfig.payloadSizeBytes = remoteChainConfigArg.payloadSizeBytes;
170+ remoteChainConfig.finalityConfig = remoteChainConfigArg.finalityConfig;
155171
156172 emit RemoteChainConfigSet (
157173 remoteChainSelector, address (remoteChainConfigArg.router), remoteChainConfig.allowlistEnabled
@@ -241,16 +257,16 @@ abstract contract BaseVerifier is ICrossChainVerifierV1, ITypeAndVersion {
241257 uint64 destChainSelector ,
242258 Client.EVM2AnyMessage memory , // message
243259 bytes memory , // extraArgs
244- bytes2 // finalityConfig
260+ bytes2 requestedFinality
245261 ) external view virtual returns (uint16 feeUSDCents , uint32 gasForVerification , uint32 payloadSizeBytes ) {
246- if (s_remoteChainConfigs[destChainSelector].router == IRouter (address (0 ))) {
262+ RemoteChainConfig storage config = _getRemoteChainConfig (destChainSelector);
263+
264+ if (config.router == IRouter (address (0 ))) {
247265 revert RemoteChainNotSupported (destChainSelector);
248266 }
249- return (
250- s_remoteChainConfigs[destChainSelector].feeUSDCents,
251- s_remoteChainConfigs[destChainSelector].gasForVerification,
252- s_remoteChainConfigs[destChainSelector].payloadSizeBytes
253- );
267+ FinalityCodec._ensureRequestedFinalityAllowed (requestedFinality, config.finalityConfig);
268+
269+ return (config.feeUSDCents, config.gasForVerification, config.payloadSizeBytes);
254270 }
255271
256272 function _assertNotCursedByRMN (
0 commit comments