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

Adds a reentrancy guard #455

Merged
merged 12 commits into from
Jul 13, 2023
Merged

Adds a reentrancy guard #455

merged 12 commits into from
Jul 13, 2023

Conversation

jalextowle
Copy link
Contributor

@jalextowle jalextowle commented Jul 12, 2023

Fixes: #427.

Along with adding the reentrancy guard and fully testing that Hyperdrive's core functions cannot be reentered, I did some refactoring of the test framework. After this PR, the methodology used in the test wrappers should be much more consistent, and the Hyperdrive test framework supports ether. Aside from this, I re-did the test wrapper API so that configurations can be overrided more easily and in a more readable format.

@jalextowle jalextowle marked this pull request as draft July 12, 2023 02:35
@coveralls
Copy link
Collaborator

coveralls commented Jul 12, 2023

Coverage Status

coverage: 96.18% (-0.2%) from 96.372% when pulling d5093d5 on jalextowle/bug/steth-reentrancy into fb74a17 on main.

@jalextowle jalextowle force-pushed the jalextowle/bug/steth-reentrancy branch from cc1cee1 to 335900f Compare July 12, 2023 04:41
@github-actions
Copy link

github-actions bot commented Jul 12, 2023

Hyperdrive Gas Benchmark

Benchmark suite Current: d5093d5 Previous: 5007450 Deviation Status
addLiquidity: min 785 gas 709 gas 10.7193% 🚨
addLiquidity: avg 43439 gas 45498 gas -4.5255%
addLiquidity: max 80524 gas 77728 gas 3.5972% 🚨
checkpoint: min 514 gas 514 gas 0% 🟰
checkpoint: avg 23044 gas 23019 gas 0.1086% 🚨
checkpoint: max 33438 gas 33407 gas 0.0928% 🚨
closeLong: min 852 gas 659 gas 29.2868% 🚨
closeLong: avg 45985 gas 47497 gas -3.1834%
closeLong: max 85978 gas 83240 gas 3.2893% 🚨
closeShort: min 809 gas 616 gas 31.3312% 🚨
closeShort: avg 40932 gas 42330 gas -3.3026%
closeShort: max 73498 gas 84477 gas -12.9964%
initialize: min 714 gas 532 gas 34.2105% 🚨
initialize: avg 159493 gas 160281 gas -0.4916%
initialize: max 233625 gas 161781 gas 44.4082% 🚨
openLong: min 740 gas 661 gas 11.9516% 🚨
openLong: avg 114654 gas 114770 gas -0.1011%
openLong: max 180018 gas 175911 gas 2.3347% 🚨
openShort: min 782 gas 709 gas 10.2962% 🚨
openShort: avg 149158 gas 159830 gas -6.6771%
openShort: max 219306 gas 218810 gas 0.2267% 🚨
removeLiquidity: min 762 gas 569 gas 33.9192% 🚨
removeLiquidity: avg 57259 gas 62682 gas -8.6516%
removeLiquidity: max 119378 gas 116558 gas 2.4194% 🚨

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

@jalextowle jalextowle marked this pull request as ready for review July 12, 2023 20:10
Copy link
Contributor

@ControlCplusControlV ControlCplusControlV 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 some minor comments

test/utils/HyperdriveTest.sol Show resolved Hide resolved
test/utils/HyperdriveTest.sol Outdated Show resolved Hide resolved
Copy link
Contributor

@ControlCplusControlV ControlCplusControlV left a comment

Choose a reason for hiding this comment

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

:shipit:

@jalextowle jalextowle force-pushed the jalextowle/bug/steth-reentrancy branch from 9385501 to 5ac65e9 Compare July 13, 2023 17:45
@jalextowle jalextowle enabled auto-merge (squash) July 13, 2023 17:45
@jalextowle jalextowle merged commit 6d713fe into main Jul 13, 2023
@jalextowle jalextowle deleted the jalextowle/bug/steth-reentrancy branch July 13, 2023 18:09
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.

Reentrancy in StEthHyperdrive.openShort
4 participants