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

use structs instead of viaIR #367

Merged
merged 1 commit into from
Nov 30, 2023
Merged

use structs instead of viaIR #367

merged 1 commit into from
Nov 30, 2023

Conversation

YouStillAlive
Copy link
Member

@YouStillAlive YouStillAlive commented Nov 29, 2023

Alternative way to fix stack too deep error.

Solidity can generate EVM bytecode in two different ways: Either directly from Solidity to EVM opcodes (“old codegen”) or through an intermediate representation (“IR”) in Yul (“new codegen” or “IR-based codegen”).

Reasons to use structs.

  • Setting viaIR to true in compiler settings results in zero coverage. link
  • Hardhat don't completely support the viaIR option yet. link

Copy link

Gas Test Report 📊

The gas test results are as follows:

LockDealNFT

Contract Method Min Max Avg # calls
LockDealNFT approvePoolTransfers(bool) 22087 43999 33043 8
LockDealNFT renounceOwnership() - - 23339 1
LockDealNFT safeTransferFrom(address,address,uint256,bytes) 303756 1296212 645768 28
LockDealNFT safeTransferFrom(address,address,uint256) 117895 353244 193343 25
LockDealNFT setApprovedContract(address,bool) 28194 50594 47721 52
LockDealNFT setBaseURI(string) 51149 79688 70175 3
LockDealNFT transferFrom(address,address,uint256) 101218 119668 110443 2
LockDealNFT transferOwnership(address) - - 28694 1
LockDealNFT updateAllMetadata() - - 24533 2

Simple Providers

Contract Method Min Max Avg # calls
DealProvider createNewPool(address[],uint256[],bytes) 259161 289961 270810 68
LockDealProvider createNewPool(address[],uint256[],bytes) 294062 309580 304803 15
TimedDealProvider createNewPool(address[],uint256[],bytes) 354236 382971 366262 32

Advanced Providers

Contract Method Min Max Avg # calls
BundleProvider createNewPool(address[],uint256[][],bytes) 915184 929184 928760 33
RefundProvider createNewRefundPool(address[],uint256[],bytes,bytes) 1245415 1350070 1339261 30

Builders

Contract Method Min Max Avg # calls
SimpleBuilder buildMassPools(address[],((address,uint256)[],uint256),uint256[],bytes) 2047749 27348022 12395982 18
SimpleRefundBuilder buildMassPools(address[],((address,uint256)[],uint256),uint256[][],bytes,bytes) 4576691 45384353 22388250 18

Deployments

Contract Min Max Avg % of limit
BundleProvider - - 2476192 1.9 %
CollateralProvider 3197413 3197425 3197422 2.5 %
DealProvider - - 1494667 1.1 %
ERC20Token - - 789284 0.6 %
LockDealNFT 5122322 5187557 5125109 3.9 %
LockDealProvider 1637276 1637288 1637285 1.3 %
RefundProvider - - 3109551 2.4 %
SimpleBuilder - - 1137247 0.9 %
SimpleRefundBuilder - - 2170304 1.7 %
TimedDealProvider - - 1873839 1.4 %

Copy link

codecov bot commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6a6a591) 0.00% compared to head (d5d66b4) 99.86%.
Report is 2 commits behind head on ironblocks.

Additional details and impacted files
@@               Coverage Diff               @@
##           ironblocks     #367       +/-   ##
===============================================
+ Coverage        0.00%   99.86%   +99.86%     
===============================================
  Files              22       22               
  Lines             723      726        +3     
  Branches          179      179               
===============================================
+ Hits                0      725      +725     
+ Misses            723        1      -722     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@YouStillAlive YouStillAlive changed the title use structs instead of viaIR use structs instead of viaIR Nov 29, 2023
@Lomet Lomet merged commit 099c1a5 into ironblocks Nov 30, 2023
4 checks passed
@Lomet Lomet deleted the ironblocks-coverage-fix branch November 30, 2023 10:19
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.

2 participants