delvtech / hyperdrive

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

update `calc_open_short` to match solidity #981

Closed dpaiton closed 1 month ago

dpaiton commented 3 months ago

Resolved Issues

Description

image

Review Checklists

Please check each item before approving the pull request. While going through the checklist, it is recommended to leave comments on items that are referenced in the checklist to make sure that they are reviewed. If there are multiple reviewers, copy the checklists into sections titled ## [Reviewer Name]. If the PR doesn't touch Solidity and/or Rust, the corresponding checklist can be removed.

[[Reviewer Name]]

Rust

github-actions[bot] commented 3 months ago

Hyperdrive Gas Benchmark

Benchmark suite Current: 387207797669800b8471ff0043c8cc31f73c687e Previous: dada2f960df0457e64eb6116e98595cb1f62c48e Deviation Status
addLiquidity: min 33893 gas 33893 gas 0% 🟰
addLiquidity: avg 144356 gas 144301 gas 0.0381% 🚨
addLiquidity: max 428319 gas 428319 gas 0% 🟰
checkpoint: min 40220 gas 40220 gas 0% 🟰
checkpoint: avg 103991 gas 104067 gas -0.0730% ✅
checkpoint: max 212154 gas 212154 gas 0% 🟰
closeLong: min 31517 gas 31517 gas 0% 🟰
closeLong: avg 138088 gas 137774 gas 0.2279% 🚨
closeLong: max 2640435 gas 2640435 gas 0% 🟰
closeShort: min 31394 gas 31394 gas 0% 🟰
closeShort: avg 132792 gas 132727 gas 0.0490% 🚨
closeShort: max 227553 gas 227565 gas -0.0053% ✅
initialize: min 31305 gas 31305 gas 0% 🟰
initialize: avg 253634 gas 253638 gas -0.0016% ✅
initialize: max 322760 gas 322760 gas 0% 🟰
openLong: min 33437 gas 33437 gas 0% 🟰
openLong: avg 167194 gas 167331 gas -0.0819% ✅
openLong: max 253057 gas 253162 gas -0.0415% ✅
openShort: min 33959 gas 33959 gas 0% 🟰
openShort: avg 170213 gas 170153 gas 0.0353% 🚨
openShort: max 385545 gas 385650 gas -0.0272% ✅
redeemWithdrawalShares: min 31227 gas 31227 gas 0% 🟰
redeemWithdrawalShares: avg 61882 gas 61916 gas -0.0549% ✅
redeemWithdrawalShares: max 167572 gas 167572 gas 0% 🟰
removeLiquidity: min 31191 gas 31191 gas 0% 🟰
removeLiquidity: avg 223873 gas 223242 gas 0.2827% 🚨
removeLiquidity: max 398903 gas 398887 gas 0.0040% 🚨

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

coveralls commented 2 months ago

Coverage Status

coverage: 93.271%. remained the same when pulling 387207797669800b8471ff0043c8cc31f73c687e on dpaiton/fix-open-short into 91d0e7f4170cbdec90e001a591bae52b37b70ba6 on main.

dpaiton commented 1 month ago

Closing in favor of rewritten PR in the hyperdrive-rs repo. https://github.com/delvtech/hyperdrive-rs/pull/116