From 2d1c2a823848e3053ef2ffd8f2055cd5056497ec Mon Sep 17 00:00:00 2001 From: 0xrlawrence Date: Mon, 31 Aug 2026 17:08:08 +0800 Subject: [PATCH] refactor: drop the external self-call in verifyBatchInclusion The seven-argument overload delegated to the eight-argument one through this.verifyBatchInclusion(...), which leaves the contract and comes back in via a STATICCALL just to pass address(0). Move the body into an internal _verifyBatchInclusion and have both overloads call it directly. The external ABI is unchanged: both overloads are still present and still view, and onlyWhenNotPaused(2) still guards each entry point. Co-Authored-By: Claude Opus 5 --- .../src/core/AlignedLayerServiceManager.sol | 44 ++++++++++++++----- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/contracts/src/core/AlignedLayerServiceManager.sol b/contracts/src/core/AlignedLayerServiceManager.sol index 79bd310fed..fd731a4950 100644 --- a/contracts/src/core/AlignedLayerServiceManager.sol +++ b/contracts/src/core/AlignedLayerServiceManager.sol @@ -266,6 +266,29 @@ contract AlignedLayerServiceManager is uint256 verificationDataBatchIndex, address senderAddress ) external view onlyWhenNotPaused(2) returns (bool) { + return + _verifyBatchInclusion( + proofCommitment, + pubInputCommitment, + provingSystemAuxDataCommitment, + proofGeneratorAddr, + batchMerkleRoot, + merkleProof, + verificationDataBatchIndex, + senderAddress + ); + } + + function _verifyBatchInclusion( + bytes32 proofCommitment, + bytes32 pubInputCommitment, + bytes32 provingSystemAuxDataCommitment, + bytes20 proofGeneratorAddr, + bytes32 batchMerkleRoot, + bytes memory merkleProof, + uint256 verificationDataBatchIndex, + address senderAddress + ) internal view returns (bool) { bytes32 batchIdentifier; if (senderAddress == address(0)) { batchIdentifier = batchMerkleRoot; @@ -310,16 +333,17 @@ contract AlignedLayerServiceManager is bytes memory merkleProof, uint256 verificationDataBatchIndex ) external view onlyWhenNotPaused(2) returns (bool) { - return this.verifyBatchInclusion( - proofCommitment, - pubInputCommitment, - provingSystemAuxDataCommitment, - proofGeneratorAddr, - batchMerkleRoot, - merkleProof, - verificationDataBatchIndex, - address(0) - ); + return + _verifyBatchInclusion( + proofCommitment, + pubInputCommitment, + provingSystemAuxDataCommitment, + proofGeneratorAddr, + batchMerkleRoot, + merkleProof, + verificationDataBatchIndex, + address(0) + ); }