From 76d005709a29a7166ce9043f471355bcd6fde533 Mon Sep 17 00:00:00 2001 From: GarmashAlex Date: Tue, 10 Feb 2026 17:28:22 +0300 Subject: [PATCH 1/3] perf(crosschain): use parseV1Calldata in _isAuthorizedGateway --- contracts/crosschain/CrosschainLinked.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/crosschain/CrosschainLinked.sol b/contracts/crosschain/CrosschainLinked.sol index 032120d8a26..f68d3e05961 100644 --- a/contracts/crosschain/CrosschainLinked.sol +++ b/contracts/crosschain/CrosschainLinked.sol @@ -97,7 +97,9 @@ abstract contract CrosschainLinked is ERC7786Recipient { address instance, bytes calldata sender ) internal view virtual override returns (bool) { - (address gateway, bytes memory router) = getLink(_extractChain(sender)); + (bytes2 chainType, bytes calldata chainReference, ) = sender.parseV1Calldata(); + bytes memory chain = InteroperableAddress.formatV1(chainType, chainReference, hex""); + (address gateway, bytes memory router) = getLink(chain); return instance == gateway && sender.equal(router); } From 80048d23d65983073defb741b44f9c0a576c5796 Mon Sep 17 00:00:00 2001 From: Hadrien Croubois Date: Thu, 26 Feb 2026 09:52:40 +0100 Subject: [PATCH 2/3] Update CrosschainLinked.sol --- contracts/crosschain/CrosschainLinked.sol | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/contracts/crosschain/CrosschainLinked.sol b/contracts/crosschain/CrosschainLinked.sol index f68d3e05961..70597531e80 100644 --- a/contracts/crosschain/CrosschainLinked.sol +++ b/contracts/crosschain/CrosschainLinked.sol @@ -97,9 +97,7 @@ abstract contract CrosschainLinked is ERC7786Recipient { address instance, bytes calldata sender ) internal view virtual override returns (bool) { - (bytes2 chainType, bytes calldata chainReference, ) = sender.parseV1Calldata(); - bytes memory chain = InteroperableAddress.formatV1(chainType, chainReference, hex""); - (address gateway, bytes memory router) = getLink(chain); + (address gateway, bytes memory router) = getLink(_extractChainCalldata(sender)); return instance == gateway && sender.equal(router); } @@ -107,4 +105,9 @@ abstract contract CrosschainLinked is ERC7786Recipient { (bytes2 chainType, bytes memory chainReference, ) = self.parseV1(); return InteroperableAddress.formatV1(chainType, chainReference, hex""); } + + function _extractChainCalldata(bytes calldata self) private pure returns (bytes memory) { + (bytes2 chainType, bytes calldata chainReference, ) = self.parseV1Calldata(); + return InteroperableAddress.formatV1(chainType, chainReference, hex""); + } } From 115245c6d8f763b869f78d272c47ed403ca33790 Mon Sep 17 00:00:00 2001 From: Hadrien Croubois Date: Wed, 4 Mar 2026 13:29:37 +0100 Subject: [PATCH 3/3] Update CrosschainLinked.sol --- contracts/crosschain/CrosschainLinked.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/crosschain/CrosschainLinked.sol b/contracts/crosschain/CrosschainLinked.sol index 59dcae88a41..0bd7da67ad9 100644 --- a/contracts/crosschain/CrosschainLinked.sol +++ b/contracts/crosschain/CrosschainLinked.sol @@ -98,7 +98,7 @@ abstract contract CrosschainLinked is ERC7786Recipient { address instance, bytes calldata sender ) internal view virtual override returns (bool) { - (address gateway, bytes memory router) = getLink(_extractChainCalldata(sender)); + (address gateway, bytes memory router) = getLink(_extractChainCalldata(sender)); return instance == gateway && sender.equal(router); }