delvtech / hyperdrive

An automated market maker for fixed and variable yield with on-demand terms.
Apache License 2.0
26 stars 3 forks source link

ERC20Forwarder and ERC20ForwarderFactory test cleanup and tests #964

Closed jrhea closed 4 months ago

jrhea commented 4 months ago

Description

I had 3 options to test IERC20ForwarderFactory.InvalidForwarderAddress revert:

image

1) add a zero address check to the revert in ERC20ForwarderFactory.create() 2) remove that revert altogether 3) add a virtual keyword to ERC20ForwarderFactory.getForwarder() so it could be tested as-is.

I chose option 3. I'm curious if y'all see a better way. Here are the details of the cleanup made to the tests and the increased coverage:


@jalextowle

github-actions[bot] commented 4 months ago

Hyperdrive Gas Benchmark

Benchmark suite Current: 826ba907dd5a37672b4d61e5ac5bcc71e9149cf6 Previous: b3f33e9bb384edecc7f131e8114037e3da4c4780 Deviation Status
addLiquidity: min 33893 gas 33893 gas 0% 🟰
addLiquidity: avg 144624 gas 144699 gas -0.0518% βœ…
addLiquidity: max 428335 gas 428319 gas 0.0037% 🚨
checkpoint: min 40220 gas 40220 gas 0% 🟰
checkpoint: avg 104118 gas 104021 gas 0.0933% 🚨
checkpoint: max 212154 gas 212154 gas 0% 🟰
closeLong: min 31517 gas 31517 gas 0% 🟰
closeLong: avg 138082 gas 137987 gas 0.0688% 🚨
closeLong: max 2640435 gas 2640435 gas 0% 🟰
closeShort: min 31394 gas 31394 gas 0% 🟰
closeShort: avg 132801 gas 132925 gas -0.0933% βœ…
closeShort: max 227565 gas 227565 gas 0% 🟰
initialize: min 31305 gas 31305 gas 0% 🟰
initialize: avg 253630 gas 253633 gas -0.0012% βœ…
initialize: max 322760 gas 322760 gas 0% 🟰
openLong: min 33437 gas 33437 gas 0% 🟰
openLong: avg 167135 gas 167174 gas -0.0233% βœ…
openLong: max 253162 gas 253162 gas 0% 🟰
openShort: min 33959 gas 33959 gas 0% 🟰
openShort: avg 170455 gas 170339 gas 0.0681% 🚨
openShort: max 385650 gas 385650 gas 0% 🟰
redeemWithdrawalShares: min 31227 gas 31227 gas 0% 🟰
redeemWithdrawalShares: avg 61993 gas 62010 gas -0.0274% βœ…
redeemWithdrawalShares: max 167572 gas 167572 gas 0% 🟰
removeLiquidity: min 31191 gas 31191 gas 0% 🟰
removeLiquidity: avg 223199 gas 223379 gas -0.0806% βœ…
removeLiquidity: max 398887 gas 398887 gas 0% 🟰

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