Skip to content

Commit c937fc7

Browse files
Filipp MakarovFilipp Makarov
authored andcommitted
chore: fix gas limits
1 parent c1c896d commit c937fc7

3 files changed

Lines changed: 24 additions & 8 deletions

File tree

contracts/forwarder/Forwarder.sol

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ pragma solidity ^0.8.27;
33

44
/**
55
* @title EtherForwarder
6-
* @dev A contract that forwards received Ether to a specified address
6+
* @notice A contract that forwards received Ether to a specified address
7+
* @author Biconomy
78
*/
89
contract EtherForwarder {
910
error ZeroAddress();
1011
error ForwardFailed();
1112

1213
/**
13-
* @dev Forwards the received Ether to the specified destination address
14+
* @notice Forwards the received Ether to the specified destination address
1415
* @param destination The address to forward the Ether to
1516
*/
1617
function forward(address destination) external payable {
@@ -36,7 +37,7 @@ contract EtherForwarder {
3637
}
3738

3839
/**
39-
* @dev Prevents accidental Ether transfers without a destination
40+
* @notice Prevents accidental Ether transfers without a destination
4041
* intentionally using sting and not a custom error here
4142
*/
4243
receive() external payable {
@@ -45,7 +46,7 @@ contract EtherForwarder {
4546
}
4647

4748
/**
48-
* @dev Prevents accidental Ether transfers without a destination
49+
* @notice Prevents accidental Ether transfers without a destination
4950
* intentionally using sting and not a custom error here
5051
*/
5152
fallback() external payable {

contracts/lib/util/EcdsaHelperLib.sol

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,36 @@ pragma solidity ^0.8.27;
33

44
import { ECDSA } from "solady/utils/ECDSA.sol";
55

6+
/**
7+
* @title EcdsaHelperLib
8+
* @notice A library that provides helper functions for ECDSA operations
9+
* @author Biconomy
10+
*/
611
library EcdsaHelperLib {
712
using ECDSA for bytes32;
8-
913
/**
14+
* @notice Checks if the signature is valid for the given hash and expected signer
15+
* @param expectedSigner The expected signer of the signature
16+
* @param hash The hash of the data to be signed
17+
* @param signature The signature to be validated
18+
* @return bool True if the signature is valid, false otherwise
1019
* @dev Solady ECDSA does not revert on incorrect signatures.
1120
* Instead, it returns address(0) as the recovered address.
1221
* Make sure to never pass address(0) as expectedSigner to this function.
1322
*/
23+
// solhint-disable-next-line gas-named-return-values
24+
1425
function isValidSignature(address expectedSigner, bytes32 hash, bytes memory signature) internal view returns (bool) {
1526
if (hash.tryRecover(signature) == expectedSigner) return true;
1627
if (hash.toEthSignedMessageHash().tryRecover(signature) == expectedSigner) return true;
1728
return false;
1829
}
1930

2031
/**
32+
* @notice Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
33+
* @param domainSeparator The domain separator of the typed data
34+
* @param structHash The struct hash of the typed data
35+
* @return digest The keccak256 digest of the typed data
2136
* @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
2237
*
2338
* The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with

test/unit/node-paymaster/percentage-premium/PercentagePremium_Test.t.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ contract PercentagePremium_Paymaster_Test is BaseTest {
6969
callData: callData,
7070
wallet: wallet,
7171
preVerificationGasLimit: 50e3,
72-
verificationGasLimit: 35e3,
72+
verificationGasLimit: 55e3,
7373
callGasLimit: 100e3
7474
});
7575

@@ -109,7 +109,7 @@ contract PercentagePremium_Paymaster_Test is BaseTest {
109109
// test percentage user single
110110
function test_percentage_user_single() public {
111111
_premiumPercentage = 1_700_000;
112-
uint128 pmValidationGasLimit = 15_000;
112+
uint128 pmValidationGasLimit = 25_000;
113113
// ~ 12_000 is raw PM.postOp gas spent
114114
// here we add more for emitting events in the wrapper + refunds etc in EP
115115
uint128 pmPostOpGasLimit = 37_000;
@@ -164,7 +164,7 @@ contract PercentagePremium_Paymaster_Test is BaseTest {
164164
public
165165
{
166166
preVerificationGasLimit = bound(preVerificationGasLimit, 1e5, 5e6);
167-
verificationGasLimit = uint128(bound(verificationGasLimit, 50e3, 5e6));
167+
verificationGasLimit = uint128(bound(verificationGasLimit, 55e3, 5e6));
168168
callGasLimit = uint128(bound(callGasLimit, 100e3, 5e6));
169169
premiumPercentage = bound(premiumPercentage, 0, 200e5);
170170
pmValidationGasLimit = uint128(bound(pmValidationGasLimit, 30e3, 5e6));

0 commit comments

Comments
 (0)