From 9c9886fe0fecd16986afb6a45ae0dfccff619c76 Mon Sep 17 00:00:00 2001 From: leekt Date: Wed, 15 Nov 2023 15:32:27 +0900 Subject: [PATCH] fix: warning removed, forge fmt --- src/Kernel.sol | 6 +++--- src/validator/WeightedECDSAValidator.sol | 6 +++--- test/foundry/KernelTestBase.sol | 5 ----- test/foundry/validator/SessionKeyValidator.t.sol | 5 +++-- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/Kernel.sol b/src/Kernel.sol index 873032fe..9687c120 100644 --- a/src/Kernel.sol +++ b/src/Kernel.sol @@ -257,9 +257,9 @@ contract Kernel is EIP712, Compatibility, KernelStorage { function _domainSeparator() internal view override returns (bytes32) { // Obtain the name and version from the _domainNameAndVersion function. - (string memory name, string memory version) = _domainNameAndVersion(); - bytes32 nameHash = keccak256(bytes(name)); - bytes32 versionHash = keccak256(bytes(version)); + (string memory _name, string memory _version) = _domainNameAndVersion(); + bytes32 nameHash = keccak256(bytes(_name)); + bytes32 versionHash = keccak256(bytes(_version)); // Use the proxy address for the EIP-712 domain separator. address proxyAddress = address(this); diff --git a/src/validator/WeightedECDSAValidator.sol b/src/validator/WeightedECDSAValidator.sol index b991c159..faa4f3bc 100644 --- a/src/validator/WeightedECDSAValidator.sol +++ b/src/validator/WeightedECDSAValidator.sol @@ -127,7 +127,7 @@ contract WeightedECDSAValidator is EIP712, IKernelValidator { proposal.status = ProposalStatus.Rejected; } - function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingFunds) + function validateUserOp(UserOperation calldata userOp, bytes32, uint256) external payable returns (ValidationData validationData) @@ -175,11 +175,11 @@ contract WeightedECDSAValidator is EIP712, IKernelValidator { } } - function validCaller(address, bytes calldata) external view override returns (bool) { + function validCaller(address, bytes calldata) external pure override returns (bool) { return false; } - function validateSignature(bytes32 hash, bytes calldata signature) external view returns (ValidationData) { + function validateSignature(bytes32, bytes calldata) external pure returns (ValidationData) { return SIG_VALIDATION_FAILED; } } diff --git a/test/foundry/KernelTestBase.sol b/test/foundry/KernelTestBase.sol index 88e43e81..b4501cdd 100644 --- a/test/foundry/KernelTestBase.sol +++ b/test/foundry/KernelTestBase.sol @@ -209,11 +209,6 @@ abstract contract KernelTestBase is Test { function test_fail_validate_wrongsignature() external { bytes32 hash = keccak256(abi.encodePacked("hello world")); - bytes32 digest = keccak256( - abi.encodePacked( - "\x19\x01", ERC4337Utils._buildDomainSeparator(KERNEL_NAME, KERNEL_VERSION, address(kernel)), hash - ) - ); bytes memory sig = getWrongSignature(hash); assertEq(kernel.isValidSignature(hash, sig), bytes4(0xffffffff)); } diff --git a/test/foundry/validator/SessionKeyValidator.t.sol b/test/foundry/validator/SessionKeyValidator.t.sol index 3cb1fa1f..bf831ec2 100644 --- a/test/foundry/validator/SessionKeyValidator.t.sol +++ b/test/foundry/validator/SessionKeyValidator.t.sol @@ -239,9 +239,10 @@ contract SessionKeyValidatorTest is KernelECDSATest { struct BatchTestConfig { uint8 count; } + function test_scenario_batch(TestConfig memory config, BatchTestConfig memory batchConfig) public { vm.warp(1000); - if(batchConfig.count == 0) { + if (batchConfig.count == 0) { batchConfig.count = 1; } config.runs = 0; @@ -292,7 +293,7 @@ contract SessionKeyValidatorTest is KernelECDSATest { ); bytes32[][] memory proofs = new bytes32[][](batchConfig.count); Permission[] memory usingPermission = new Permission[](batchConfig.count); - for(uint256 i = 0; i < batchConfig.count; i++) { + for (uint256 i = 0; i < batchConfig.count; i++) { proofs[i] = _getProof(data, config.indexToUse, config.wrongProof); usingPermission[i] = permissions[config.indexToUse]; }