Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change some tests #46

Merged
merged 3 commits into from
Nov 13, 2024
Merged

fix: change some tests #46

merged 3 commits into from
Nov 13, 2024

Conversation

sakulstra
Copy link
Contributor

No description provided.

Copy link
Contributor

github-actions bot commented Nov 13, 2024

Foundry report

forge 0.0.2 (48c6b1a 2024-11-13T00:24:02.674061760Z)
Build log
Compiling 79 files with Solc 0.8.28
installing solc version "0.8.28"
Successfully installed solc 0.8.28
Solc 0.8.28 finished in 3.31s
Compiler run successful with warnings:
Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> src/mocks/ERC721.sol:933:23:
    |
933 |     function tokenURI(uint256 id) public view override returns (string memory) {
    |                       ^^^^^^^^^^

Warning (2018): Function state mutability can be restricted to pure
   --> src/mocks/ERC721.sol:923:5:
    |
923 |     function name() public view override returns (string memory) {
    |     ^ (Relevant source part starts here and spans across multiple lines).

Warning (2018): Function state mutability can be restricted to pure
   --> src/mocks/ERC721.sol:928:5:
    |
928 |     function symbol() public view override returns (string memory) {
    |     ^ (Relevant source part starts here and spans across multiple lines).

Warning (2018): Function state mutability can be restricted to pure
   --> src/mocks/ERC721.sol:933:5:
    |
933 |     function tokenURI(uint256 id) public view override returns (string memory) {
    |     ^ (Relevant source part starts here and spans across multiple lines).

Warning (2018): Function state mutability can be restricted to view
  --> test/PermissionlessRescuable.t.sol:63:3:
   |
63 |   function test_whoShouldReceiveFunds() public {
   |   ^ (Relevant source part starts here and spans across multiple lines).

Warning (2018): Function state mutability can be restricted to view
  --> test/UpgradeableOwnableWithGuardian.t.sol:29:3:
   |
29 |   function test_initializer() external {
   |   ^ (Relevant source part starts here and spans across multiple lines).

| Contract                    | Runtime Size (B) | Initcode Size (B) | Runtime Margin (B) | Initcode Margin (B) |
|-----------------------------|------------------|-------------------|--------------------|---------------------|
| Address                     |               85 |               135 |             24,491 |              49,017 |
| ChainHelpers                |               85 |               135 |             24,491 |              49,017 |
| ChainIds                    |               85 |               135 |             24,491 |              49,017 |
| Create2Utils                |              162 |               212 |             24,414 |              48,940 |
| Create3                     |               85 |               135 |             24,491 |              49,017 |
| Create3Factory              |            1,094 |             1,122 |             23,482 |              48,030 |
| ERC1967Proxy                |              170 |             1,226 |             24,406 |              47,926 |
| ERC20                       |            2,331 |             3,020 |             22,245 |              46,132 |
| EnumerableSet               |               85 |               135 |             24,491 |              49,017 |
| ImplOwnableWithGuardian     |            1,464 |             1,492 |             23,112 |              47,660 |
| MockContract                |              759 |             1,021 |             23,817 |              48,131 |
| MockERC721                  |            2,421 |             2,449 |             22,155 |              46,703 |
| MockImpl                    |              465 |               690 |             24,111 |              48,462 |
| PermissionlessRescuable     |            1,908 |             2,081 |             22,668 |              47,071 |
| ProxyAdmin                  |            1,640 |             1,758 |             22,936 |              47,394 |
| Rescuable                   |            1,807 |             1,958 |             22,769 |              47,194 |
| Rescuable721                |            2,043 |             2,201 |             22,533 |              46,951 |
| SafeCast                    |               85 |               135 |             24,491 |              49,017 |
| SafeERC20                   |               85 |               135 |             24,491 |              49,017 |
| StorageSlot                 |               85 |               135 |             24,491 |              49,017 |
| TestNetChainIds             |               85 |               135 |             24,491 |              49,017 |
| TransparentProxyFactory     |            7,036 |             7,064 |             17,540 |              42,088 |
| TransparentUpgradeableProxy |            2,043 |             3,409 |             22,533 |              45,743 |
Test success 🌈
Compiling 42 files with Solc 0.8.24
Solc 0.8.24 finished in 1.50s
Compiler run successful!

Compiling 42 files with zksolc and ZKsync solc 0.8.24
zksolc and ZKsync solc 0.8.24 finished in 10.90s
Compiler run successful with warnings:
Warning

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Warning: Your code or one of its dependencies uses the 'extcodesize' instruction, which is       │
│ usually needed in the following cases:                                                           │
│   1. To detect whether an address belongs to a smart contract.                                   │
│   2. To detect whether the deploy code execution has finished.                                   │
│ zkSync Era comes with native account abstraction support (so accounts are smart contracts,       │
│ including private-key controlled EOAs), and you should avoid differentiating between contracts   │
│ and non-contract addresses.                                                                      │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
--> lib/forge-std/src/StdCheats.sol
Warning

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Warning: Your code or one of its dependencies uses the 'extcodesize' instruction, which is       │
│ usually needed in the following cases:                                                           │
│   1. To detect whether an address belongs to a smart contract.                                   │
│   2. To detect whether the deploy code execution has finished.                                   │
│ zkSync Era comes with native account abstraction support (so accounts are smart contracts,       │
│ including private-key controlled EOAs), and you should avoid differentiating between contracts   │
│ and non-contract addresses.                                                                      │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
--> lib/forge-std/src/StdUtils.sol
Warning

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Warning: It looks like you are using 'ecrecover' to validate a signature of a user account.      │
│ zkSync Era comes with native account abstraction support, therefore it is highly recommended NOT │
│ to rely on the fact that the account has an ECDSA private key attached to it since accounts might│
│ implement other signature schemes.                                                               │
│ Read more about Account Abstraction at https://v2-docs.zksync.io/dev/developer-guides/aa.html    │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
--> lib/forge-std/src/mocks/MockERC20.sol
Warning

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Warning: Your code or one of its dependencies uses the 'extcodesize' instruction, which is       │
│ usually needed in the following cases:                                                           │
│   1. To detect whether an address belongs to a smart contract.                                   │
│   2. To detect whether the deploy code execution has finished.                                   │
│ zkSync Era comes with native account abstraction support (so accounts are smart contracts,       │
│ including private-key controlled EOAs), and you should avoid differentiating between contracts   │
│ and non-contract addresses.                                                                      │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
--> lib/forge-std/src/mocks/MockERC721.sol

Ran 5 tests for zksync/test/TransparentProxyFactoryZkSync.t.sol:TestTransparentProxyFactoryZkSync
[PASS] testCreate(address) (runs: 256, μ: 2251771, ~: 2343479)
[PASS] testCreateDeterministic(address,bytes32) (runs: 256, μ: 2679856, ~: 2767978)
[PASS] testCreateDeterministicProxyAdmin(address,bytes32) (runs: 256, μ: 2021506, ~: 2106573)
[PASS] testCreateDeterministicWithDeterministicProxy(bytes32,bytes32) (runs: 256, μ: 2975087, ~: 2975087)
[PASS] testCreateProxyAdmin(address,bytes32) (runs: 256, μ: 1815211, ~: 1898551)
Suite result: ok. 5 passed; 0 failed; 0 skipped; finished in 10.23s (36.10s CPU time)

Ran 1 test suite in 10.23s (10.23s CPU time): 5 tests passed, 0 failed, 0 skipped (5 total tests)
Gas report

Create3Factory

  • gas: 219061
  • size: 1122
Method min mean median max calls
create(bytes32,bytes) ↓-86%42275 ↓-29%210285 ↓-0.14%294086 294494 ↑50%3

TransparentProxyFactory

  • gas: 1573941
  • size: 7064
Method min mean median max calls
createDeterministic(address,address,bytes,bytes32) ↓-0.0085%566283 ↓-0.036%566385 ↓-0.036%566385 ↓-0.064%566487 2
createDeterministicProxyAdmin(address,bytes32) ↑0.14%411920 ↑0.069%411920 ↑0.069%411920 411920 2

ImplOwnableWithGuardian

  • gas: ↑11%314524
  • size: ↑14%1198
Method min mean median max calls
guardian() ↓-85%352 ↓-72%637 ↓-85%352 ↑2.9%2352 ↑600%7
mock_onlyGuardian() 23394 23446 23446 23498 2
owner() ↓-86%339 ↓-73%624 ↓-86%339 2339 ↑600%7
transferOwnership(address) 28570 28570 28570 28570 6
updateGuardian(address) 26169 ↑6.5%29998 ↑8.3%30519 ↑1.1%30519 ↑350%9

Rescuable721

  • gas: 495549
  • size: 2233
Method min mean median max calls
emergency721TokenTransfer(address,address,uint256) 22423 ↓-0.25%40964 ↓-0.25%40964 ↓-0.34%59505 2

ImplOwnableWithGuardian

  • gas: 369723
  • size: 1492
Method min mean median max calls
guardian() 2391 2391 2391 2391 1
initialize(address,address) 93656 93656 93656 93656 6
mock_onlyGuardian() 23513 23513 23513 23513 1
mock_onlyOwnerOrGuardian() 25753 25753 25753 25753 1
owner() 2379 2379 2379 2379 1
updateGuardian(address) 26343 29136 30532 30535 3
🔮 Coverage report
File Line Coverage Function Coverage Branch Coverage
src/contracts/access-control/OwnableWithGuardian.sol $^{↑12\%}{\color{orange}90\%}$
$9 / 10$
20
$^{↑17\%}{\color{orange}87.5\%}$
$7 / 8$
OwnableWithGuardian.onlyOwnerOrGuardian
$^{↑100\%}{\color{green}100\%}$
$4 / 4$
src/contracts/access-control/UpgradeableOwnableWithGuardian.sol ${\color{green}100\%}$
$14 / 14$
${\color{green}100\%}$
$9 / 9$
${\color{green}100\%}$
$2 / 2$
src/contracts/create3/Create3.sol ${\color{orange}92.86\%}$
$13 / 14$
66
${\color{red}80\%}$
$4 / 5$
Create3.create3
${\color{red}33.33\%}$
$1 / 3$
src/contracts/create3/Create3Factory.sol ${\color{green}100\%}$
$4 / 4$
${\color{green}100\%}$
$2 / 2$
${\color{green}100\%}$
$0 / 0$
src/contracts/oz-common/Ownable.sol ${\color{red}80\%}$
$8 / 10$
37, 63
${\color{red}71.43\%}$
$5 / 7$
Ownable.onlyOwner
Ownable.renounceOwnership
${\color{red}50\%}$
$2 / 4$
src/contracts/oz-common/SafeERC20.sol ${\color{red}13.64\%}$
$3 / 22$
46, 54, 55, 64, 65, 66, 68, 78, 80, 81, 82, 100, 101, 102, 103, 104, 121, 138, 139
${\color{red}25\%}$
$2 / 8$
SafeERC20.safeTransferFrom
SafeERC20.safeIncreaseAllowance
SafeERC20.safeDecreaseAllowance
SafeERC20.forceApprove
SafeERC20.safePermit
SafeERC20._callOptionalReturnBool
${\color{red}0\%}$
$0 / 4$
src/contracts/transparent-proxy/ERC1967Proxy.sol ${\color{green}100\%}$
$2 / 2$
${\color{green}100\%}$
$2 / 2$
${\color{green}100\%}$
$0 / 0$
src/contracts/transparent-proxy/ERC1967Upgrade.sol ${\color{green}100\%}$
$13 / 13$
${\color{green}100\%}$
$7 / 7$
${\color{red}60\%}$
$3 / 5$
src/contracts/transparent-proxy/Initializable.sol ${\color{red}68.42\%}$
$13 / 19$
124, 128, 129, 131, 132, 140
${\color{red}60\%}$
$3 / 5$
Initializable.reinitializer
Initializable.onlyInitializing
${\color{red}45.45\%}$
$5 / 11$
src/contracts/transparent-proxy/Proxy.sol ${\color{orange}90\%}$
$9 / 10$
45
${\color{green}100\%}$
$4 / 4$
${\color{green}100\%}$
$0 / 0$
src/contracts/transparent-proxy/ProxyAdmin.sol ${\color{red}0\%}$
$0 / 9$
33, 34, 35, 48, 49, 50, 64, 78, 94
${\color{red}0\%}$
$0 / 5$
ProxyAdmin.getProxyImplementation
ProxyAdmin.getProxyAdmin
ProxyAdmin.changeProxyAdmin
ProxyAdmin.upgrade
ProxyAdmin.upgradeAndCall
${\color{red}0\%}$
$0 / 4$
src/contracts/transparent-proxy/TransparentProxyFactory.sol ${\color{green}100\%}$
$2 / 2$
${\color{green}100\%}$
$1 / 1$
${\color{green}100\%}$
$0 / 0$
src/contracts/transparent-proxy/TransparentProxyFactoryBase.sol ${\color{red}58.82\%}$
$10 / 17$
24, 26, 27, 32, 33, 35, 36
${\color{red}66.67\%}$
$4 / 6$
TransparentProxyFactoryBase.create
TransparentProxyFactoryBase.createProxyAdmin
${\color{green}100\%}$
$0 / 0$
src/contracts/transparent-proxy/TransparentUpgradeableProxy.sol ${\color{red}27.27\%}$
$3 / 11$
53, 56, 70, 83, 94, 103, 117, 124
${\color{red}22.22\%}$
$2 / 9$
TransparentUpgradeableProxy.ifAdmin
TransparentUpgradeableProxy.admin
TransparentUpgradeableProxy.implementation
TransparentUpgradeableProxy.changeAdmin
TransparentUpgradeableProxy.upgradeTo
TransparentUpgradeableProxy.upgradeToAndCall
TransparentUpgradeableProxy._admin
${\color{red}25\%}$
$1 / 4$
src/contracts/utils/PermissionlessRescuable.sol ${\color{green}100\%}$
$2 / 2$
${\color{green}100\%}$
$2 / 2$
${\color{green}100\%}$
$0 / 0$
src/contracts/utils/Rescuable.sol ${\color{green}100\%}$
$4 / 4$
${\color{green}100\%}$
$3 / 3$
${\color{green}100\%}$
$1 / 1$
src/contracts/utils/Rescuable721.sol ${\color{green}100\%}$
$2 / 2$
${\color{green}100\%}$
$1 / 1$
${\color{green}100\%}$
$0 / 0$
src/contracts/utils/RescuableBase.sol ${\color{green}100\%}$
$8 / 8$
${\color{green}100\%}$
$2 / 2$
${\color{green}100\%}$
$1 / 1$

@sakulstra sakulstra merged commit a1eb1d8 into main Nov 13, 2024
1 check passed
@sakulstra sakulstra deleted the test/ci-lcov branch November 13, 2024 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant