Skip to content

Commit 2e27f8b

Browse files
committed
internal functions for erc1967factory
1 parent ade2d14 commit 2e27f8b

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

gas/ecdsa/report.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Running 8 tests for test/foundry/Kernel.t.sol:KernelTest
77
[PASS] test_initialize_twice() (gas: 20885)
88
[PASS] test_set_default_validator() (gas: 361374)
99
[PASS] test_set_execution() (gas: 411711)
10-
[PASS] test_validate_signature() (gas: 164810)
10+
[PASS] test_validate_signature() (gas: 163680)
1111
[PASS] test_validate_userOp() (gas: 1729466)
12-
Test result: ok. 8 passed; 0 failed; 0 skipped; finished in 2.77ms
12+
Test result: ok. 8 passed; 0 failed; 0 skipped; finished in 2.82ms
1313
| src/Kernel.sol:Kernel contract | | | | | |
1414
|--------------------------------|-----------------|-------|--------|-------|---------|
1515
| Deployment Cost | Deployment Size | | | | |
@@ -29,11 +29,10 @@ Test result: ok. 8 passed; 0 failed; 0 skipped; finished in 2.77ms
2929
| src/factory/KernelFactory.sol:KernelFactory contract | | | | | |
3030
|------------------------------------------------------|-----------------|--------|--------|--------|---------|
3131
| Deployment Cost | Deployment Size | | | | |
32-
| 594023 | 3050 | | | | |
32+
| 437471 | 2268 | | | | |
3333
| Function Name | min | avg | median | max | # calls |
34-
| createAccount | 132097 | 132874 | 132097 | 139097 | 9 |
35-
| deployDeterministicAndCall | 130534 | 131089 | 130534 | 135534 | 9 |
36-
| setImplementation | 22862 | 22862 | 22862 | 22862 | 8 |
34+
| createAccount | 130967 | 131744 | 130967 | 137967 | 9 |
35+
| setImplementation | 22796 | 22796 | 22796 | 22796 | 8 |
3736

3837

3938

src/factory/AdminLessERC1967Factory.sol

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ contract AdminLessERC1967Factory {
4949
/// @dev Deploys a proxy for `implementation`,
5050
/// and returns its address.
5151
/// The value passed into this function will be forwarded to the proxy.
52-
function deploy(address implementation) public payable returns (address proxy) {
52+
function deploy(address implementation) internal returns (address proxy) {
5353
proxy = deployAndCall(implementation, _emptyData());
5454
}
5555

@@ -58,8 +58,7 @@ contract AdminLessERC1967Factory {
5858
/// The value passed into this function will be forwarded to the proxy.
5959
/// Then, calls the proxy with abi encoded `data`.
6060
function deployAndCall(address implementation, bytes calldata data)
61-
public
62-
payable
61+
internal
6362
returns (address proxy)
6463
{
6564
proxy = _deploy(implementation, bytes32(0), false, data);
@@ -69,8 +68,7 @@ contract AdminLessERC1967Factory {
6968
/// and returns its deterministic address.
7069
/// The value passed into this function will be forwarded to the proxy.
7170
function deployDeterministic(address implementation, bytes32 salt)
72-
public
73-
payable
71+
internal
7472
returns (address proxy)
7573
{
7674
proxy = deployDeterministicAndCall(implementation, salt, _emptyData());
@@ -84,7 +82,7 @@ contract AdminLessERC1967Factory {
8482
address implementation,
8583
bytes32 salt,
8684
bytes calldata data
87-
) public payable returns (address proxy) {
85+
) internal returns (address proxy) {
8886
/// @solidity memory-safe-assembly
8987
assembly {
9088
// If the salt does not start with the zero address or the caller.

src/factory/KernelFactory.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ contract KernelFactory is AdminLessERC1967Factory, Ownable{
2727
{
2828
require(isAllowedImplementation[_implementation], "KernelFactory: implementation not allowed");
2929
bytes32 salt = bytes32(uint256(keccak256(abi.encodePacked(_data, _index))) & type(uint96).max);
30-
proxy = this.deployDeterministicAndCall(_implementation, salt, _data);
30+
proxy = deployDeterministicAndCall(_implementation, salt, _data);
3131
}
3232

3333
function getAccountAddress(bytes calldata _data, uint256 _index)

0 commit comments

Comments
 (0)