delvtech / hyperdrive

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

Checkpoint Incentivization #1050

Closed jalextowle closed 3 months ago

jalextowle commented 3 months ago

Description

This PR implements a system that can be used to incentivize checkpoint rewards. This system has been intentionally designed to be flexible enough to adjust to new demands and to be able to be ignored entirely.

One interesting thing that came up while testing is that rewarding the minting of past checkpoints is potentially dangerous. This is dangerous because a minter could go back and mint all of the past checkpoints to drain the subrewarder's source address.

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, the corresponding checklist can be removed.

[[Reviewer Name]]

coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 9409259507

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/src/factory/HyperdriveFactory.sol 2 4 50.0%
contracts/src/internal/HyperdriveCheckpoint.sol 4 6 66.67%
contracts/src/rewarder/HyperdriveCheckpointRewarder.sol 0 11 0.0%
contracts/src/rewarder/ERC20HyperdriveCheckpointSubrewarder.sol 0 23 0.0%
<!-- Total: 8 46 17.39% -->
Totals Coverage Status
Change from base Build 9408759390: -1.4%
Covered Lines: 1839
Relevant Lines: 2007

💛 - Coveralls
coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 9410839032

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/src/factory/HyperdriveFactory.sol 2 4 50.0%
contracts/src/internal/HyperdriveCheckpoint.sol 4 6 66.67%
contracts/src/rewarder/HyperdriveCheckpointRewarder.sol 0 11 0.0%
contracts/src/rewarder/HyperdriveCheckpointSubrewarder.sol 0 23 0.0%
<!-- Total: 8 46 17.39% -->
Files with Coverage Reduction New Missed Lines %
contracts/src/libraries/LPMath.sol 3 83.52%
<!-- Total: 3 -->
Totals Coverage Status
Change from base Build 9408759390: -1.5%
Covered Lines: 1837
Relevant Lines: 2007

💛 - Coveralls
coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 9412344697

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/src/factory/HyperdriveFactory.sol 2 4 50.0%
contracts/src/internal/HyperdriveCheckpoint.sol 4 6 66.67%
contracts/src/factory/HyperdriveRegistry.sol 11 19 57.89%
contracts/src/rewarder/HyperdriveCheckpointRewarder.sol 0 11 0.0%
contracts/src/rewarder/HyperdriveCheckpointSubrewarder.sol 0 26 0.0%
<!-- Total: 25 74 33.78% -->
Totals Coverage Status
Change from base Build 9412155075: -2.1%
Covered Lines: 1921
Relevant Lines: 2117

💛 - Coveralls
coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 9412488587

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/src/internal/HyperdriveAdmin.sol 3 4 75.0%
contracts/src/factory/HyperdriveFactory.sol 2 4 50.0%
contracts/src/internal/HyperdriveCheckpoint.sol 4 6 66.67%
contracts/src/factory/HyperdriveRegistry.sol 11 19 57.89%
contracts/src/rewarder/HyperdriveCheckpointRewarder.sol 0 11 0.0%
contracts/src/rewarder/HyperdriveCheckpointSubrewarder.sol 0 26 0.0%
<!-- Total: 25 75 33.33% -->
Totals Coverage Status
Change from base Build 9412155075: -2.1%
Covered Lines: 1926
Relevant Lines: 2123

💛 - Coveralls
coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 9412570934

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/src/factory/HyperdriveFactory.sol 2 4 50.0%
contracts/src/internal/HyperdriveCheckpoint.sol 4 6 66.67%
contracts/src/factory/HyperdriveRegistry.sol 11 19 57.89%
contracts/src/rewarder/HyperdriveCheckpointRewarder.sol 0 11 0.0%
contracts/src/rewarder/HyperdriveCheckpointSubrewarder.sol 0 26 0.0%
<!-- Total: 26 75 34.67% -->
Totals Coverage Status
Change from base Build 9412155075: -2.1%
Covered Lines: 1927
Relevant Lines: 2123

💛 - Coveralls
coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 9412615106

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/src/factory/HyperdriveFactory.sol 2 4 50.0%
contracts/src/internal/HyperdriveCheckpoint.sol 4 6 66.67%
contracts/src/factory/HyperdriveRegistry.sol 11 19 57.89%
contracts/src/rewarder/HyperdriveCheckpointRewarder.sol 0 11 0.0%
contracts/src/rewarder/HyperdriveCheckpointSubrewarder.sol 0 26 0.0%
<!-- Total: 25 74 33.78% -->
Totals Coverage Status
Change from base Build 9412155075: -2.1%
Covered Lines: 1927
Relevant Lines: 2123

💛 - Coveralls
coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 9413218263

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/src/factory/HyperdriveFactory.sol 2 4 50.0%
contracts/src/internal/HyperdriveCheckpoint.sol 4 6 66.67%
contracts/src/rewarder/HyperdriveCheckpointRewarder.sol 9 12 75.0%
contracts/src/factory/HyperdriveRegistry.sol 11 19 57.89%
contracts/src/rewarder/HyperdriveCheckpointSubrewarder.sol 0 26 0.0%
<!-- Total: 34 75 45.33% -->
Totals Coverage Status
Change from base Build 9412155075: -1.7%
Covered Lines: 1936
Relevant Lines: 2124

💛 - Coveralls
coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 9476156961

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/src/factory/HyperdriveFactory.sol 2 4 50.0%
contracts/src/rewarder/HyperdriveCheckpointRewarder.sol 9 12 75.0%
contracts/src/factory/HyperdriveRegistry.sol 11 19 57.89%
contracts/src/rewarder/HyperdriveCheckpointSubrewarder.sol 26 34 76.47%
<!-- Total: 65 86 75.58% -->
Totals Coverage Status
Change from base Build 9412155075: -0.6%
Covered Lines: 1967
Relevant Lines: 2133

💛 - Coveralls
github-actions[bot] commented 3 months ago

Hyperdrive Gas Benchmark

Benchmark suite Current: b2c9b9337fe52110f0a8bbf5f3c699efd1d1edc1 Previous: 3bd0e1b8be01f394ee8844a9766d5b985c49063e Deviation Status
addLiquidity: min 33937 gas 33827 gas 0.3252% 🚨
addLiquidity: avg 155274 gas 155628 gas -0.2275%
addLiquidity: max 429437 gas 429092 gas 0.0804% 🚨
checkpoint: min 40316 gas 40292 gas 0.0596% 🚨
checkpoint: avg 144535 gas 142288 gas 1.5792% 🚨
checkpoint: max 255830 gas 253424 gas 0.9494% 🚨
closeLong: min 31361 gas 31361 gas 0% 🟰
closeLong: avg 136371 gas 135868 gas 0.3702% 🚨
closeLong: max 2621435 gas 2621386 gas 0.0019% 🚨
closeShort: min 31327 gas 31349 gas -0.0702%
closeShort: avg 132386 gas 132103 gas 0.2142% 🚨
closeShort: max 272530 gas 309547 gas -11.9584%
initialize: min 31349 gas 31371 gas -0.0701%
initialize: avg 333274 gas 330952 gas 0.7016% 🚨
initialize: max 399922 gas 397010 gas 0.7335% 🚨
openLong: min 33370 gas 33370 gas 0% 🟰
openLong: avg 174250 gas 173896 gas 0.2036% 🚨
openLong: max 335241 gas 306958 gas 9.2140% 🚨
openShort: min 33936 gas 33936 gas 0% 🟰
openShort: avg 168978 gas 168432 gas 0.3242% 🚨
openShort: max 415910 gas 415705 gas 0.0493% 🚨
redeemWithdrawalShares: min 31251 gas 31251 gas 0% 🟰
redeemWithdrawalShares: avg 75249 gas 74801 gas 0.5989% 🚨
redeemWithdrawalShares: max 305633 gas 210204 gas 45.3983% 🚨
removeLiquidity: min 31301 gas 31301 gas 0% 🟰
removeLiquidity: avg 214819 gas 215004 gas -0.0860%
removeLiquidity: max 404206 gas 403959 gas 0.0611% 🚨

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

coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 9509899842

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/src/factory/HyperdriveFactory.sol 2 4 50.0%
contracts/src/rewarder/HyperdriveCheckpointRewarder.sol 9 12 75.0%
contracts/src/factory/HyperdriveRegistry.sol 11 19 57.89%
contracts/src/rewarder/HyperdriveCheckpointSubrewarder.sol 26 34 76.47%
<!-- Total: 65 86 75.58% -->
Files with Coverage Reduction New Missed Lines %
contracts/src/libraries/LPMath.sol 1 83.14%
<!-- Total: 1 -->
Totals Coverage Status
Change from base Build 9504821912: -0.8%
Covered Lines: 1965
Relevant Lines: 2133

💛 - Coveralls