Skip to content

Added target2 and target3 to address the code size problem#713

Merged
jalextowle merged 6 commits intomainfrom
jalextowle/fix/codesize
Dec 19, 2023
Merged

Added target2 and target3 to address the code size problem#713
jalextowle merged 6 commits intomainfrom
jalextowle/fix/codesize

Conversation

@jalextowle
Copy link
Copy Markdown
Contributor

This PR adds two more target contracts which further distributes the Hyperdrive code. After this update, we should have plenty of room for the remaining features and bug-fixes that are planned before audits. Here is a snapshot of the code sizes:

|             Contract              | Bytecode Size |     Margin    |
| --------------------------------- | ------------- | ------------- |
| AssetId                           |         141.0 |       24435.0 |
| BondWrapper                       |        8565.0 |       16011.0 |
| DsrManager                        |           0.0 |       24576.0 |
| ERC20Forwarder                    |        5596.0 |       18980.0 |
| ERC4626Base                       |           0.0 |       24576.0 |
| ERC4626Hyperdrive                 |        6939.0 |       17637.0 |
| ERC4626HyperdriveCoreDeployer     |        8847.0 |       15729.0 |
| ERC4626HyperdriveDeployer         |        2811.0 |       21765.0 |
| ERC4626Target0                    |       18881.0 |        5695.0 |
| ERC4626Target0Deployer            |       20467.0 |        4109.0 |
| ERC4626Target1                    |       21861.0 |        2715.0 |
| ERC4626Target1Deployer            |       23447.0 |        1129.0 |
| ERC4626Target2                    |       22561.0 |        2015.0 |
| ERC4626Target2Deployer            |       24147.0 |         429.0 |
| ERC4626Target3                    |       20715.0 |        3861.0 |
| ERC4626Target3Deployer            |       22301.0 |        2275.0 |
| FixedPointMath                    |         141.0 |       24435.0 |
| ForwarderFactory                  |        6729.0 |       17847.0 |
| Hyperdrive                        |           0.0 |       24576.0 |
| HyperdriveAdmin                   |           0.0 |       24576.0 |
| HyperdriveBase                    |           0.0 |       24576.0 |
| HyperdriveCheckpoint              |           0.0 |       24576.0 |
| HyperdriveFactory                 |        9867.0 |       14709.0 |
| HyperdriveLP                      |           0.0 |       24576.0 |
| HyperdriveLong                    |           0.0 |       24576.0 |
| HyperdriveMath                    |         141.0 |       24435.0 |
| HyperdriveMultiToken              |           0.0 |       24576.0 |
| HyperdriveShort                   |           0.0 |       24576.0 |
| HyperdriveStorage                 |           0.0 |       24576.0 |
| HyperdriveTarget0                 |           0.0 |       24576.0 |
| HyperdriveTarget1                 |           0.0 |       24576.0 |
| HyperdriveTarget2                 |           0.0 |       24576.0 |
| HyperdriveTarget3                 |           0.0 |       24576.0 |
| IERC20                            |           0.0 |       24576.0 |
| IERC20Mint                        |           0.0 |       24576.0 |
| IERC20Permit                      |           0.0 |       24576.0 |
| IERC4626                          |           0.0 |       24576.0 |
| IERC4626Hyperdrive                |           0.0 |       24576.0 |
| IERC4626HyperdriveCore            |           0.0 |       24576.0 |
| IERC4626HyperdriveDeployer        |           0.0 |       24576.0 |
| IERC4626HyperdriveRead            |           0.0 |       24576.0 |
| IForwarderFactory                 |           0.0 |       24576.0 |
| IHyperdrive                       |           0.0 |       24576.0 |
| IHyperdriveCore                   |           0.0 |       24576.0 |
| IHyperdriveDeployer               |           0.0 |       24576.0 |
| IHyperdriveRead                   |           0.0 |       24576.0 |
| IHyperdriveTargetDeployer         |           0.0 |       24576.0 |
| ILido                             |           0.0 |       24576.0 |
| IMultiToken                       |           0.0 |       24576.0 |
| IMultiTokenCore                   |           0.0 |       24576.0 |
| IMultiTokenMetadata               |           0.0 |       24576.0 |
| IMultiTokenRead                   |           0.0 |       24576.0 |
| IWETH                             |           0.0 |       24576.0 |
| LPMath                            |         141.0 |       24435.0 |
| Pot                               |           0.0 |       24576.0 |
| SafeCast                          |         141.0 |       24435.0 |
| YieldSpaceMath                    |         141.0 |       24435.0 |

@jalextowle jalextowle requested a review from jrhea December 19, 2023 07:00
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 19, 2023

Hyperdrive Gas Benchmark

Benchmark suite Current: e16e844 Previous: 54dbf65 Deviation Status
addLiquidity: min 1600 gas 1600 gas 0% 🟰
addLiquidity: avg 54967 gas 52537 gas 4.6253% 🚨
addLiquidity: max 232446 gas 232092 gas 0.1525% 🚨
checkpoint: min 1172 gas 1216 gas -3.6184%
checkpoint: avg 48000 gas 47973 gas 0.0563% 🚨
checkpoint: max 202123 gas 201955 gas 0.0832% 🚨
closeLong: min 1580 gas 1690 gas -6.5089%
closeLong: avg 26558 gas 26522 gas 0.1357% 🚨
closeLong: max 139624 gas 139742 gas -0.0844%
closeShort: min 1549 gas 1693 gas -8.5056%
closeShort: avg 28766 gas 28799 gas -0.1146%
closeShort: max 144389 gas 98675 gas 46.3278% 🚨
initialize: min 1538 gas 1605 gas -4.1745%
initialize: avg 181781 gas 181825 gas -0.0242%
initialize: max 256760 gas 256942 gas -0.0708%
openLong: min 1509 gas 736 gas 105.0272% 🚨
openLong: avg 40485 gas 39667 gas 2.0622% 🚨
openLong: max 162207 gas 161281 gas 0.5742% 🚨
openShort: min 1519 gas 702 gas 116.3818% 🚨
openShort: avg 47377 gas 46301 gas 2.3239% 🚨
openShort: max 161536 gas 160559 gas 0.6085% 🚨
redeemWithdrawalShares: min 1575 gas 1598 gas -1.4393%
redeemWithdrawalShares: avg 19295 gas 17072 gas 13.0213% 🚨
redeemWithdrawalShares: max 84767 gas 80228 gas 5.6576% 🚨
removeLiquidity: min 1661 gas 1661 gas 0% 🟰
removeLiquidity: avg 118260 gas 121035 gas -2.2927%
removeLiquidity: max 258848 gas 258376 gas 0.1827% 🚨

This comment was automatically generated by workflow using github-action-benchmark.

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Dec 19, 2023

Coverage Status

coverage: 95.057% (+0.03%) from 95.024%
when pulling e16e844 on jalextowle/fix/codesize
into 6c0f5a4 on main.

Comment thread contracts/src/instances/ERC4626Target2Deployer.sol Outdated
Comment thread contracts/src/instances/ERC4626Target3Deployer.sol Outdated
Comment thread contracts/src/external/HyperdriveTarget2.sol Outdated
Copy link
Copy Markdown
Contributor

@jrhea jrhea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a couple of nits and a couple of questions:

  1. I noticed you removed the Natspec comments from Hyperdrive.sol and wondered if it would be the better to keep this in the top level function for discover-ability in docs. Just a thought

  2. At some point it wouldn't hurt to get Hyperdrive.sol up to 100% coverage

@jalextowle jalextowle force-pushed the jalextowle/fix/codesize branch from 2df8eb9 to 0ee91fc Compare December 19, 2023 18:50
@jalextowle jalextowle enabled auto-merge (squash) December 19, 2023 19:05
@jalextowle jalextowle merged commit 10464a0 into main Dec 19, 2023
@jalextowle jalextowle deleted the jalextowle/fix/codesize branch December 19, 2023 23:08
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.

3 participants