Skip to content

Commit

Permalink
fix: lint, test
Browse files Browse the repository at this point in the history
  • Loading branch information
howydev committed Jul 10, 2024
1 parent b570ce6 commit 05332c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
7 changes: 5 additions & 2 deletions src/plugins/NativeTokenLimitPlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ contract NativeTokenLimitPlugin is BasePlugin, IExecutionHook, IValidationHook {

// No implementation, no revert
// Runtime spends no account gas, and we check native token spend limits in exec hooks
// solhint-disable-next-line no-empty-blocks
function preRuntimeValidationHook(uint8, address, uint256, bytes calldata) external pure override {}
function preRuntimeValidationHook(uint8, address, uint256, bytes calldata, bytes calldata)
external
pure
override
{} // solhint-disable-line no-empty-blocks

/// @inheritdoc IPlugin
// solhint-disable-next-line no-empty-blocks
Expand Down
14 changes: 5 additions & 9 deletions test/plugin/NativeTokenLimitPlugin.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import {EntryPoint} from "@eth-infinitism/account-abstraction/core/EntryPoint.sol";
import {PackedUserOperation} from "@eth-infinitism/account-abstraction/interfaces/PackedUserOperation.sol";

import {UpgradeableModularAccount} from "../../src/account/UpgradeableModularAccount.sol";
Expand All @@ -14,10 +13,9 @@ import {IStandardExecutor, Call} from "../../src/interfaces/IStandardExecutor.so
import {PluginManifest} from "../../src/interfaces/IPlugin.sol";

import {MSCAFactoryFixture} from "../mocks/MSCAFactoryFixture.sol";
import {OptimizedTest} from "../utils/OptimizedTest.sol";
import {AccountTestBase} from "../utils/AccountTestBase.sol";

contract NativeTokenLimitPluginTest is OptimizedTest {
EntryPoint public entryPoint = new EntryPoint();
contract NativeTokenLimitPluginTest is AccountTestBase {
address public recipient = address(1);
address payable public bundler = payable(address(2));
PluginManifest internal _m;
Expand Down Expand Up @@ -87,7 +85,7 @@ contract NativeTokenLimitPluginTest is OptimizedTest {
preVerificationGas: gas3,
gasFees: bytes32(uint256(uint128(gasPrice))),
paymasterAndData: "",
signature: abi.encodePacked(FunctionReferenceLib.pack(address(validationPlugin), 0), uint8(1))
signature: _encodeSignature(FunctionReferenceLib.pack(address(validationPlugin), 0), 1, "")
});
}

Expand Down Expand Up @@ -184,9 +182,7 @@ contract NativeTokenLimitPluginTest is OptimizedTest {

function test_runtime_executeLimit() public {
assertEq(plugin.limits(0, address(acct)), 10 ether);
acct.executeWithAuthorization(
_getExecuteWithValue(5 ether), abi.encodePacked(validationFunction, uint8(1))
);
acct.executeWithAuthorization(_getExecuteWithValue(5 ether), _encodeSignature(validationFunction, 1, ""));
assertEq(plugin.limits(0, address(acct)), 5 ether);
}

Expand All @@ -198,7 +194,7 @@ contract NativeTokenLimitPluginTest is OptimizedTest {

assertEq(plugin.limits(0, address(acct)), 10 ether);
acct.executeWithAuthorization(
abi.encodeCall(IStandardExecutor.executeBatch, (calls)), abi.encodePacked(validationFunction, uint8(1))
abi.encodeCall(IStandardExecutor.executeBatch, (calls)), _encodeSignature(validationFunction, 1, "")
);
assertEq(plugin.limits(0, address(acct)), 4 ether - 100001);
}
Expand Down

0 comments on commit 05332c9

Please sign in to comment.