From d87d655a706d54bcd715b70ba6f0bb641c0f7ad4 Mon Sep 17 00:00:00 2001 From: aboudjem Date: Fri, 13 Oct 2023 17:38:12 +0400 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=99=88=20Remove=20ignore=20linting=20?= =?UTF-8?q?rules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/BatchedSessionRouterModule.sol | 3 +-- .../smart-account/modules/ForwardFlowModule.sol | 13 ++++--------- .../test/upgrades/BaseSmartAccountNew.sol | 4 ---- .../test/upgrades/v1/BaseSmartAccountV1.sol | 4 ---- .../test/upgrades/v1/FallbackManagerV1.sol | 1 - .../test/upgrades/v1/SmartAccountV1.sol | 4 ++-- 6 files changed, 7 insertions(+), 22 deletions(-) diff --git a/contracts/smart-account/modules/BatchedSessionRouterModule.sol b/contracts/smart-account/modules/BatchedSessionRouterModule.sol index f4c7da29..d38efa4f 100644 --- a/contracts/smart-account/modules/BatchedSessionRouterModule.sol +++ b/contracts/smart-account/modules/BatchedSessionRouterModule.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.17; -/* solhint-disable function-max-lines,no-unused-import */ +/* solhint-disable function-max-lines */ import {BaseAuthorizationModule} from "./BaseAuthorizationModule.sol"; import {ISessionValidationModule} from "../interfaces/modules/ISessionValidationModule.sol"; @@ -11,7 +11,6 @@ import {_packValidationData} from "@account-abstraction/contracts/core/Helpers.s import {UserOperation} from "@account-abstraction/contracts/interfaces/UserOperation.sol"; import {IBatchedSessionRouterModule} from "../interfaces/modules/IBatchedSessionRouterModule.sol"; import {IAuthorizationModule} from "../interfaces/IAuthorizationModule.sol"; -import {ISignatureValidator} from "../interfaces/ISignatureValidator.sol"; /** * @title Batched Session Router diff --git a/contracts/smart-account/modules/ForwardFlowModule.sol b/contracts/smart-account/modules/ForwardFlowModule.sol index b91f25fb..8dcf2192 100644 --- a/contracts/smart-account/modules/ForwardFlowModule.sol +++ b/contracts/smart-account/modules/ForwardFlowModule.sol @@ -6,8 +6,6 @@ import {Enum} from "../common/Enum.sol"; import {ReentrancyGuard} from "../common/ReentrancyGuard.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; -/* solhint-disable function-max-lines */ - struct Transaction { address to; Enum.Operation operation; @@ -248,11 +246,9 @@ contract ForwardFlowModule is ReentrancyGuard { } } - // We require some gas to emit the events (at least 2500) after the execution and some to - // perform code until the execution (7500 = call the external function + checks inside it) - // We also include the 1/64 in the check that is not send along with a call to counteract - // potential shortings because of EIP-150 - // Bitshift left 6 bits means multiplying by 64, just more gas efficient + // We need gas for events post-execution (~2500) and for code pre-execution (~7500: external call + checks). + // Including 1/64th for EIP-150 to address potential gas shortfalls. + // Bitshift left 6 bits (multiply by 64) is used for gas efficiency. if ( gasleft() < Math.max((_tx.targetTxGas << 6) / 63, _tx.targetTxGas + 2500) + 7500 @@ -285,9 +281,8 @@ contract ForwardFlowModule is ReentrancyGuard { } // Transfer transaction costs to tx.origin to avoid intermediate contract payments. - uint256 payment; if (refundInfo.gasPrice != 0) { - payment = _handlePayment( + uint256 payment = _handlePayment( smartAccount, startGas - gasleft(), refundInfo.baseGas, diff --git a/contracts/smart-account/test/upgrades/BaseSmartAccountNew.sol b/contracts/smart-account/test/upgrades/BaseSmartAccountNew.sol index 5e17690c..8bc47f6e 100644 --- a/contracts/smart-account/test/upgrades/BaseSmartAccountNew.sol +++ b/contracts/smart-account/test/upgrades/BaseSmartAccountNew.sol @@ -1,10 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.17; -/* solhint-disable avoid-low-level-calls */ -/* solhint-disable no-inline-assembly */ -/* solhint-disable reason-string */ - import {IAccount} from "@account-abstraction/contracts/interfaces/IAccount.sol"; import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol"; import {UserOperationLib, UserOperation} from "@account-abstraction/contracts/interfaces/UserOperation.sol"; diff --git a/contracts/smart-account/test/upgrades/v1/BaseSmartAccountV1.sol b/contracts/smart-account/test/upgrades/v1/BaseSmartAccountV1.sol index 1b938bba..8fdcb958 100644 --- a/contracts/smart-account/test/upgrades/v1/BaseSmartAccountV1.sol +++ b/contracts/smart-account/test/upgrades/v1/BaseSmartAccountV1.sol @@ -1,10 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.17; -/* solhint-disable avoid-low-level-calls */ -/* solhint-disable no-inline-assembly */ -/* solhint-disable reason-string */ - import {IAccount} from "@account-abstraction/contracts/interfaces/IAccount.sol"; import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol"; import {UserOperationLib, UserOperation} from "@account-abstraction/contracts/interfaces/UserOperation.sol"; diff --git a/contracts/smart-account/test/upgrades/v1/FallbackManagerV1.sol b/contracts/smart-account/test/upgrades/v1/FallbackManagerV1.sol index b46513ba..8a9bb392 100644 --- a/contracts/smart-account/test/upgrades/v1/FallbackManagerV1.sol +++ b/contracts/smart-account/test/upgrades/v1/FallbackManagerV1.sol @@ -14,7 +14,6 @@ abstract contract FallbackManagerV1 is SelfAuthorized, IFallbackManager { bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d4; - // solhint-disable-next-line payable-fallback,no-complex-fallback fallback() external { bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT; diff --git a/contracts/smart-account/test/upgrades/v1/SmartAccountV1.sol b/contracts/smart-account/test/upgrades/v1/SmartAccountV1.sol index c71bcec1..71779052 100644 --- a/contracts/smart-account/test/upgrades/v1/SmartAccountV1.sol +++ b/contracts/smart-account/test/upgrades/v1/SmartAccountV1.sol @@ -331,7 +331,7 @@ contract SmartAccountV1 is address payable refundReceiver ) private returns (uint256 payment) { if (tokenGasPriceFactor == 0) revert TokenGasPriceFactorCanNotBeZero(); - // solhint-disable-next-line avoid-tx-origin + address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver; @@ -378,7 +378,7 @@ contract SmartAccountV1 is ) external returns (uint256 requiredGas) { require(tokenGasPriceFactor != 0, "invalid tokenGasPriceFactor"); uint256 startGas = gasleft(); - // solhint-disable-next-line avoid-tx-origin + address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver; From 3941e63f48ab518771365fdb045e588e521e3674 Mon Sep 17 00:00:00 2001 From: aboudjem Date: Fri, 13 Oct 2023 17:56:07 +0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=A5=20remove=20ISignatureValidator?= =?UTF-8?q?=20reference?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contracts/smart-account/modules/BatchedSessionRouterModule.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/smart-account/modules/BatchedSessionRouterModule.sol b/contracts/smart-account/modules/BatchedSessionRouterModule.sol index d38efa4f..efeb33d3 100644 --- a/contracts/smart-account/modules/BatchedSessionRouterModule.sol +++ b/contracts/smart-account/modules/BatchedSessionRouterModule.sol @@ -12,6 +12,7 @@ import {UserOperation} from "@account-abstraction/contracts/interfaces/UserOpera import {IBatchedSessionRouterModule} from "../interfaces/modules/IBatchedSessionRouterModule.sol"; import {IAuthorizationModule} from "../interfaces/IAuthorizationModule.sol"; + /** * @title Batched Session Router * @dev Built to process executeBatch and executeBatch_y6U calls @@ -129,7 +130,6 @@ contract BatchedSessionRouter is } /** - * @inheritdoc ISignatureValidator * @dev isValidSignature according to BaseAuthorizationModule * @param _dataHash Hash of the data to be validated. * @param _signature Signature over the the _dataHash.