Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

[230415 Audit][v1.3] Dev -> Master #202

Merged
merged 27 commits into from
Jul 24, 2023
Merged

[230415 Audit][v1.3] Dev -> Master #202

merged 27 commits into from
Jul 24, 2023

Conversation

arjun-io
Copy link
Collaborator

No description provided.

arjun-io and others added 27 commits April 5, 2023 17:49
* Chainlink Bisection Oracle for Phase Discovery

* more unit test coverage

* fix integration test

* add comments

* improve comments, code readability

* improve integration tests

* minor cleanup

* include uint64 cast

* aggregatorRoundId helper

---------

Co-authored-by: Kevin Britz <kevin@equilibria.xyz>
* Create README.md

* Update README.md

* Update README.md

* started concept for multiinvoker rollup optimization

* Update README.md

* Update README.md

* changed visibility of invoker actions

* adding testing for rollup invoker

* finished unit tests of multiinvokerrollup

* cleanup solidity  + implement pr suggestions

* update interface

* deployment

* wrap / unwrap prefixing fix

* delete file

* more style and comments

* decode uint len < 32 check + more cleanup

* more style

* comment coverage

* function visibility, mutability, ordering

* comment formatting + coverage

* more comment cleanup

* more nitpicks

* brizzle logical changes

* move uint length check to relevant

* move uint length check to relevant

* simplify function levels

* simplify function levels

* style changes

* update cache storage scheme

* deploy new proxy and impl

* add isRollup util

* handle both rollup and non rollup deployments

* update rollup invoker

* final sc cleanup

* update deploy

* update test

* integration tests

* more coverage

* coverage + fixed tests

* added error coverage and moved revert up level

* fix internal calls, update tests

* remove .only

---------

Co-authored-by: Kevin Britz <kevin@equilibria.xyz>
Co-authored-by: Arjun Rao <2940142+arjun-io@users.noreply.github.com>
* Create README.md

* Update README.md

* Update README.md

* started concept for multiinvoker rollup optimization

* Update README.md

* Update README.md

* changed visibility of invoker actions

* adding testing for rollup invoker

* finished unit tests of multiinvokerrollup

* cleanup solidity  + implement pr suggestions

* update interface

* deployment

* wrap / unwrap prefixing fix

* delete file

* more style and comments

* decode uint len < 32 check + more cleanup

* more style

* comment coverage

* function visibility, mutability, ordering

* comment formatting + coverage

* more comment cleanup

* more nitpicks

* brizzle logical changes

* move uint length check to relevant

* move uint length check to relevant

* fix pragma version

* simplify function levels

* simplify function levels

* style changes

* update cache storage scheme

* deploy new proxy and impl

* add isRollup util

* handle both rollup and non rollup deployments

* update rollup invoker

* final sc cleanup

* update deploy

* update test

* integration tests

* more coverage

* initial commit

* charge fee changes

* coverage + fixed tests

* added error coverage and moved revert up level

* update charge fee

* add charge fee data to tests

* test name misspelled

* fix internal calls, update tests

* remove .only

* added coverage and debug charge fee

* merge conflicts

* added comments

* added comments

* added unwrapped charge fee action

* test commit

* test commit

* address comments

* fix multiinvoke test

* swap wrapped for CHARGE_FEE

* remove log

* kevin cleanup

---------

Co-authored-by: Kevin Britz <kevin@equilibria.xyz>
Co-authored-by: Arjun Rao <2940142+arjun-io@users.noreply.github.com>
* Refactor into struct

Signed-off-by: Fennel <0xfennel@proton.me>

* Initial implementation pass

* Change events

* Quick changes to compiler settings

* Move around test files

* Get rid of _deposit

* Fix interface

* Fix existing tests, along with some bugs

* Add addMarket() and updateWeight()

Signed-off-by: Fennel <0xfennel@proton.me>

* fix build

* immutable definition rework

* remove erc20

* market account type

* add perennial lib

* epoch rewrite

* TODOs

* clean up current speoch

* fix asset snapshotting

* existing tests working

* re-combine logic

* make static storage multi-asset

* basic multi-asset test

* make upgrade compatible

* equivalent multi-asset tests

* todos

* add stale epoch fix

* starting pending tests

* fix epoch stamping issue

* TODOs

* fix takerlimit tests

* add upgrade note

* run optimizer always in vaults

* add epoch getters

---------

Signed-off-by: Fennel <0xfennel@proton.me>
Co-authored-by: Fennel <0xfennel@proton.me>
Co-authored-by: Arjun Rao <2940142+arjun-io@users.noreply.github.com>
* Multi-Asset Upgrades Verification Tests

* move setupTokenHolders to shared
* Add more validations in BalancedVault constructor

* Fix CI

* Change error name

* Fix typo, validate product payoffs

* Add check that previous impl's markets are prefix of current

* Natspec
…174)

* Mark updateClosed as nonReentrant

* Move incentivizer refunds to settled flow

* Mark updateClosed as notPaused (#175)
* Don't return struct when deducting program fee

* move program total
* convert to action enum

* cheaper calldata allocation

* magic collision byte

* compiler destructuring fix

* enforce 1 byte fallback sig

* fix previous commit

* minor fixes

* changs magic byte + add collision assertions

* enforce and test invoke id byte
@arjun-io arjun-io merged commit e21e9e4 into master Jul 24, 2023
14 checks passed
@arjun-io arjun-io deleted the dev branch July 24, 2023 21:27
@github-actions
Copy link

Integration Test Coverage Report

Coverage after merging dev into master will be
94.03%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial/contracts/collateral
   Collateral.sol83.57%65%100%96.72%110, 112–113, 120–121, 161, 212, 236, 236, 246, 257, 278–279, 53, 55–57, 86, 88–89, 91–93
packages/perennial/contracts/collateral/types
   OptimisticLedger.sol100%100%100%100%
packages/perennial/contracts/controller
   Controller.sol75.96%48.44%88.37%92.11%126, 140, 153, 166–167, 181–182, 191–192, 201–202, 211–212, 221–222, 232–233, 243–244, 254–255, 265, 274, 283, 292, 312, 320, 329, 337, 355, 355, 355–356, 376, 386, 392, 399, 60, 85
   UControllerProvider.sol84.62%62.50%100%100%33–34, 40, 47, 54, 61
packages/perennial/contracts/incentivizer
   Incentivizer.sol81.82%58.62%100%96.67%128, 140, 153, 166, 168, 183–184, 201, 213, 300, 310, 332, 339, 42–45, 50–53, 83–86, 97
packages/perennial/contracts/incentivizer/types
   ProductManager.sol94.03%75%100%97.73%158–159, 163, 223
   Program.sol100%100%100%100%
packages/perennial/contracts/interfaces
   ICollateral.sol100%100%100%100%
   IContractPayoffProvider.sol100%100%100%100%
   IController.sol100%100%100%100%
   IIncentivizer.sol100%100%100%100%
   IMultiInvoker.sol100%100%100%100%
   IMultiInvokerRollup.sol100%100%100%100%
   IParamProvider.sol100%100%100%100%
   IPayoffProvider.sol100%100%100%100%
   IPerennialLens.sol100%100%100%100%
   IProduct.sol100%100%100%100%
packages/perennial/contracts/interfaces/types
   Accumulator.sol100%100%100%100%
   PackedAccumulator.sol100%100%100%100%
   PackedPosition.sol100%100%100%100%
   PayoffDefinition.sol77.78%41.67%100%94.12%39, 42, 60–61, 65–66, 66, 79
   PendingFeeUpdates.sol93.02%70%100%100%34, 51, 68
   Position.sol100%100%100%100%
   PrePosition.sol100%100%100%100%
   ProgramInfo.sol80%33.33%100%100%51–52, 52, 52
packages/perennial/contracts/lens
   PerennialLens.sol86.07%51.79%100%99.07%103, 168, 177, 186, 195, 205, 214, 226, 240, 250, 261, 274, 292, 302, 312, 322, 334, 348, 363, 375, 387, 399, 404–405, 423, 437, 464, 65
packages/perennial/contracts/multiinvoker
   MultiInvoker.sol98.19%94.23%100%100%356, 372, 50
   MultiInvokerRollup.sol91.84%85%92.86%94.62%187, 219, 225–226, 228, 239–240, 240, 240, 298, 71
packages/perennial/contracts/product
   Product.sol84.97%68.25%97.62%98.31%136, 208, 212–216, 244, 246–249, 281, 285–290, 318, 320–324, 346, 346, 47, 494, 494, 494, 505, 505–506, 515, 534, 541, 548–549, 554, 569, 68
   UParamProvider.sol83.85%64.52%93.55%97.06%103, 113, 122, 132, 144, 157, 167, 179, 192, 202, 214, 236, 236, 236, 236–237, 254, 286, 36, 94, 94, 94, 94–95
   UPayoffProvider.sol88%50%100%100%33, 36, 63
packages/perennial/contracts/product/types/accumulator
   AccountAccumulator.sol100%100%100%100%
   VersionedAccumulator.sol100%100%100%100%
packages/perennial/contracts/product/types/position
   AccountPosition.sol92.86%50%100%100%107, 107
   VersionedPosition.sol100%100%100%100%
packages/perennial/contracts/test
   TestnetBatcher.sol0%100%0%0%16–18, 20–21, 25, 30–32, 34, 39–41, 43, 48
   TestnetDSU.sol0%0%0%0%18, 21, 21–22, 22, 22, 24, 27, 27–28, 30, 34, 34, 34–35
   TestnetProductProvider.sol100%100%100%100%
   TestnetReserve.sol0%100%0%0%15–16, 20–21, 23–24, 28–30, 32–33, 37, 41
   TestnetUSDC.sol0%100%0%0%12, 16
   TestnetVault.sol100%100%100%100%

@github-actions
Copy link

Unit Test Coverage Report

Coverage after merging dev into master will be
98.68%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial/contracts/collateral
   Collateral.sol93.57%85%100%100%110, 113, 236, 53, 57, 86, 91–93
packages/perennial/contracts/collateral/types
   OptimisticLedger.sol100%100%100%100%
packages/perennial/contracts/controller
   Controller.sol100%100%100%100%
   UControllerProvider.sol97.44%93.75%100%100%33
packages/perennial/contracts/incentivizer
   Incentivizer.sol95.80%89.66%100%100%140, 153, 166, 185, 42, 83
packages/perennial/contracts/incentivizer/types
   ProductManager.sol100%100%100%100%
   Program.sol100%100%100%100%
packages/perennial/contracts/interfaces
   ICollateral.sol100%100%100%100%
   IContractPayoffProvider.sol100%100%100%100%
   IController.sol100%100%100%100%
   IIncentivizer.sol100%100%100%100%
   IMultiInvoker.sol100%100%100%100%
   IMultiInvokerRollup.sol100%100%100%100%
   IParamProvider.sol100%100%100%100%
   IPayoffProvider.sol100%100%100%100%
   IPerennialLens.sol100%100%100%100%
   IProduct.sol100%100%100%100%
packages/perennial/contracts/interfaces/types
   Accumulator.sol100%100%100%100%
   PackedAccumulator.sol100%100%100%100%
   PackedPosition.sol100%100%100%100%
   PayoffDefinition.sol91.67%75%100%100%61, 66, 79
   PendingFeeUpdates.sol90.70%60%100%100%34, 51, 68, 80
   Position.sol100%100%100%100%
   PrePosition.sol100%100%100%100%
   ProgramInfo.sol100%100%100%100%
packages/perennial/contracts/lens
   PerennialLens.sol87.06%53.57%100%100%103, 168, 177, 186, 195, 205, 214, 226, 240, 250, 261, 274, 292, 302, 312, 322, 334, 348, 363, 375, 387, 399, 423, 437, 464, 65
packages/perennial/contracts/multiinvoker
   MultiInvoker.sol92.77%90.38%95.24%93.55%156–157, 159, 372, 386, 386, 386–388, 390, 49
   MultiInvokerRollup.sol92.52%90%92.86%93.55%180, 187, 187–190, 192, 240, 250–251
packages/perennial/contracts/product
   Product.sol91.61%80.95%100%100%136, 208, 212–214, 216, 244, 247–248, 281, 285, 287–288, 290, 318, 320–323, 346, 346, 494, 494, 68
   UParamProvider.sol91.93%79.03%100%100%113, 132, 144, 167, 179, 202, 214, 236, 254, 254, 262, 36, 94
   UPayoffProvider.sol96%83.33%100%100%33
packages/perennial/contracts/product/types/accumulator
   AccountAccumulator.sol100%100%100%100%
   VersionedAccumulator.sol100%100%100%100%
packages/perennial/contracts/product/types/position
   AccountPosition.sol100%100%100%100%
   VersionedPosition.sol100%100%100%100%
packages/perennial/contracts/test
   TestnetBatcher.sol100%100%100%100%
   TestnetDSU.sol100%100%100%100%
   TestnetProductProvider.sol100%100%100%100%
   TestnetReserve.sol100%100%100%100%
   TestnetUSDC.sol100%100%100%100%
   TestnetVault.sol88.24%100%80%91.67%44

@github-actions
Copy link

[Vaults] Integration Test Coverage Report

Coverage after merging dev into master will be
0.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-vaults/contracts/balanced
   BalancedVault.sol0%0%0%0%113, 113–115, 118–119, 122–124, 124, 124–125, 135, 144–145, 154–155, 155, 155, 157, 157, 157–161, 163–166, 169, 171, 182, 182, 182, 184–185, 185, 185, 187, 187, 187–191, 193–196, 199, 201, 209, 211–215, 218–220, 220, 220, 222, 224, 234–236, 245–246, 256–257, 265–266, 274–275, 284–285, 293–294, 303–304, 313–314, 316, 325–326, 328, 336, 336, 336, 345–346, 346, 346, 351, 360–361, 361, 361, 366, 377, 379, 379, 379–384, 386–387, 389–392, 394, 396–397, 400–403, 406, 406, 406–407, 407, 407–412, 414, 414, 414–420, 422, 433–434, 443–444, 444, 444–445, 448–449, 451, 451, 451–453, 453, 453–454, 458–459, 461, 461, 461–463, 463, 463–464, 475, 479, 479, 479–480, 483–485, 485, 485, 485, 485, 487–489, 491–492, 502, 504, 504, 504, 506–508, 508, 511, 514, 514, 514, 516–518, 518, 518, 520, 530, 532, 532, 532–534, 534, 534–535, 544–546, 554, 563–564, 575, 575, 575–576, 586–588, 591, 601–602, 614, 614, 614–616, 616, 616, 618, 628, 628, 628, 628, 628, 628, 628, 640, 640, 640–642, 642, 642, 657, 657, 657–658, 667, 671, 671, 671, 680, 680, 680–681, 691, 691, 691–692, 701, 701, 701–702, 712, 712, 712–713, 721–723, 736, 736, 736–737, 747, 747, 747–748, 758–760, 764, 773, 784–785, 788, 798–799, 801, 814, 814, 814–816, 816, 816
   BalancedVaultDefinition.sol0%0%0%0%100, 100, 100, 102–103, 103, 103–104, 104, 104–105, 105, 105–106, 106, 106, 108–110, 110, 110–111, 111, 111–112, 112, 112, 114–115, 115, 115, 118, 118, 118, 120–122, 124, 124, 124, 126–127, 127, 127–130, 130, 130–131, 131, 131, 142, 142, 142–143, 143, 143, 145, 81, 81, 81, 83–87, 89–90, 90, 90–92, 94, 94, 94–95, 95, 95–96, 96, 96, 98, 98, 98–99, 99, 99
packages/perennial-vaults/contracts/interfaces
   IBalancedVault.sol100%100%100%100%
   IBalancedVaultDefinition.sol100%100%100%100%

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants