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

Add reentrancy guard #38

Merged
merged 1 commit into from
Jul 22, 2023
Merged

Add reentrancy guard #38

merged 1 commit into from
Jul 22, 2023

Conversation

arjun-io
Copy link
Collaborator

No description provided.

@arjun-io arjun-io requested a review from kbrizzle July 21, 2023 19:52
@github-actions
Copy link

[Oracle] Integration Test Coverage Report

Coverage after merging arjun/nonreentrant into main will be
100.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-oracle/contracts
   Oracle.sol100%100%100%100%
   OracleFactory.sol100%100%100%100%
packages/perennial-oracle/contracts/interfaces
   IOracle.sol100%100%100%100%
   IOracleFactory.sol100%100%100%100%
   IOracleProvider.sol100%100%100%100%
   IOracleProviderFactory.sol100%100%100%100%
   IPythFactory.sol100%100%100%100%
   IPythOracle.sol100%100%100%100%
packages/perennial-oracle/contracts/pyth
   PythFactory.sol88.68%70%100%100%104, 115, 44, 53, 60, 87
   PythOracle.sol94.25%84.38%100%100%120, 205, 66, 77–78
packages/perennial-oracle/contracts/types
   OracleVersion.sol100%100%100%100%

@github-actions
Copy link

[Payoff] Integration Test Code Coverage Report

Coverage after merging arjun/nonreentrant into main will be
100.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-payoff/contracts
   PayoffFactory.sol100%100%100%100%
packages/perennial-payoff/contracts/interfaces
   IPayoffFactory.sol100%100%100%100%
packages/perennial-payoff/contracts/payoff
   Giga.sol100%100%100%100%
   Kilo.sol100%100%100%100%
   KiloPowerHalf.sol100%100%100%100%
   KiloPowerTwo.sol100%100%100%100%
   Mega.sol100%100%100%100%
   MegaPowerTwo.sol100%100%100%100%
   Micro.sol100%100%100%100%
   MicroPowerTwo.sol100%100%100%100%
   Milli.sol100%100%100%100%
   MilliPowerHalf.sol100%100%100%100%
   MilliPowerTwo.sol100%100%100%100%
   Nano.sol100%100%100%100%
   PowerHalf.sol100%100%100%100%
   PowerTwo.sol100%100%100%100%

@github-actions
Copy link

[Payoff] Unit Test Code Coverage Report

Coverage after merging arjun/nonreentrant into main will be
100.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-payoff/contracts
   PayoffFactory.sol100%100%100%100%
packages/perennial-payoff/contracts/interfaces
   IPayoffFactory.sol100%100%100%100%
packages/perennial-payoff/contracts/payoff
   Giga.sol100%100%100%100%
   Kilo.sol100%100%100%100%
   KiloPowerHalf.sol100%100%100%100%
   KiloPowerTwo.sol100%100%100%100%
   Mega.sol100%100%100%100%
   MegaPowerTwo.sol100%100%100%100%
   Micro.sol100%100%100%100%
   MicroPowerTwo.sol100%100%100%100%
   Milli.sol100%100%100%100%
   MilliPowerHalf.sol100%100%100%100%
   MilliPowerTwo.sol100%100%100%100%
   Nano.sol100%100%100%100%
   PowerHalf.sol100%100%100%100%
   PowerTwo.sol100%100%100%100%

@github-actions
Copy link

[Vault] Unit Test Coverage Report

Coverage after merging arjun/nonreentrant into main will be
41.56%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-vault/contracts
   Vault.sol0%0%0%0%104–105, 114, 116, 116, 116, 123, 125, 125, 125, 130, 130–131, 133–134, 134, 134, 137, 143, 143, 143–144, 144, 144, 146, 148–150, 157, 157–158, 160, 160, 160, 162–166, 171, 171–172, 174–175, 180, 180–183, 190, 190–192, 194–196, 209, 209–211, 213–216, 222–223, 223, 223–226, 228, 246, 246, 246–248, 248, 248–250, 250, 250–252, 252, 252–254, 254, 254–256, 256, 256–257, 259, 259, 259, 262, 262, 262, 265, 268–270, 273–275, 277, 291, 291, 291–293, 295, 295, 295, 300–301, 316, 320–323, 325, 331, 335, 335, 335, 339–341, 354, 356, 356, 356, 356, 356, 358, 364–365, 365, 365–368, 368, 368–369, 376, 379, 381, 391, 405, 407–410, 412, 414–417, 420–422, 424–427, 430–431, 434–435, 438–440, 447–449, 456, 456, 456–458, 466, 466, 466, 468–471, 473, 473, 473, 473, 473, 475, 480, 487–489, 499–501, 503–505, 58, 58–59, 61–63, 69, 76, 83, 89, 95–96
   VaultFactory.sol0%0%0%0%23, 27, 27–28, 40, 40–42, 49–50
packages/perennial-vault/contracts/interfaces
   IVault.sol100%100%100%100%
   IVaultFactory.sol100%100%100%100%
packages/perennial-vault/contracts/lib
   StrategyLib.sol0%0%0%0%101–104, 106–107, 109–110, 112–113, 127–129, 138, 64–66, 68, 70–73, 76, 80, 80, 80–81, 81, 85, 87
packages/perennial-vault/contracts/test
   AccountTester.sol100%100%100%100%
   CheckpointTester.sol100%100%100%100%
   MappingTester.sol100%100%100%100%
   RegistrationTester.sol100%100%100%100%
   VaultParameterTest.sol100%100%100%100%
packages/perennial-vault/contracts/types
   Account.sol100%100%100%100%
   Checkpoint.sol100%100%100%100%
   Mapping.sol100%100%100%100%
   Registration.sol100%100%100%100%
   VaultParameter.sol100%100%100%100%

@github-actions
Copy link

[Oracle] Unit Test Coverage Report

Coverage after merging arjun/nonreentrant into main will be
49.26%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-oracle/contracts
   Oracle.sol100%100%100%100%
   OracleFactory.sol100%100%100%100%
packages/perennial-oracle/contracts/interfaces
   IOracle.sol100%100%100%100%
   IOracleFactory.sol100%100%100%100%
   IPythFactory.sol100%100%100%100%
   IPythOracle.sol100%100%100%100%
packages/perennial-oracle/contracts/pyth
   PythFactory.sol0%0%0%0%104, 104–106, 113–115, 115, 115–116, 38–39, 44, 44–45, 47–48, 53, 53–54, 60, 60–61, 63, 65, 72–73, 73, 76, 82, 87, 87–89, 89, 89–90, 90, 90–91, 91, 91, 93, 98
   PythOracle.sol0%0%0%0%101, 109–110, 116, 116, 116, 116, 116–117, 127, 127, 132, 132, 132–133, 133, 133, 135–136, 138, 138, 138–139, 142, 142, 142–143, 145, 145, 145, 148, 148, 148, 154–156, 167, 167, 167–169, 172, 175, 175, 175, 177–178, 185–188, 190, 202, 204, 210, 215, 215, 215–216, 59, 66, 66–68, 70, 70, 70, 72, 77, 77–78, 78, 78, 78, 78–79, 87, 93, 93, 93, 95

@arjun-io arjun-io merged commit ece6764 into main Jul 22, 2023
7 of 11 checks passed
@arjun-io arjun-io deleted the arjun/nonreentrant branch July 22, 2023 06:24
@github-actions
Copy link

[Core] Integration Test Coverage Report

Coverage after merging arjun/nonreentrant into main will be
77.39%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial/contracts
   Market.sol72.11%48.44%89.19%86.05%103, 103–105, 110, 117, 124–126, 135, 137, 137, 137–138, 138, 138–140, 140, 140–141, 141, 141, 143, 150, 150, 150, 152–154, 159, 161–162, 164–165, 258–260, 414, 451, 488–489, 489, 489, 489, 496, 496, 498–499, 499, 502, 504–505, 505, 507–508, 508, 512, 516, 516, 518, 520, 520, 524, 527, 529, 529, 531, 534, 534, 540, 542, 546, 546, 548–549, 549, 566–567, 615, 620, 626–628, 632–634, 64, 87, 96
   MarketFactory.sol60.53%42.86%71.43%70.59%37, 48, 57–58, 64, 66, 72, 75–76, 88, 88, 88–89
packages/perennial/contracts/interfaces
   IMarket.sol100%100%100%100%
   IMarketFactory.sol100%100%100%100%
   IOracleProvider.sol100%100%100%100%
   IOracleProviderFactory.sol100%100%100%100%
   IPayoffProvider.sol100%100%100%100%
packages/perennial/contracts/test
   GlobalTester.sol0%100%0%0%10, 14, 23–25, 29–31
   LocalTester.sol0%100%0%0%10, 14, 18–20, 29–31, 39–41
   MarketParameterTester.sol0%100%0%0%10, 18
   OrderTester.sol0%100%0%0%13, 15, 19, 23, 30, 34
   PositionTester.sol0%100%0%0%102, 106, 110, 114, 118, 12, 125, 133, 140, 148, 152, 16, 160, 164, 17–18, 28–30, 39–42, 46–48, 52–54, 58–60, 64–66, 70, 74, 78, 82, 86, 90, 94, 98
   ProtocolParameterTester.sol0%100%0%0%10, 14
   RiskParameterTester.sol0%100%0%0%10, 14
   VersionTester.sol0%100%0%0%10, 14, 26, 28, 38
packages/perennial/contracts/types
   Global.sol78.85%50%100%100%105–115
   Local.sol80.49%57.14%83.33%95.24%114–118, 88, 96
   MarketParameter.sol67.57%38.89%100%93.75%101, 103, 105, 105, 105, 105, 117–119, 96, 98–99
   OracleVersion.sol100%100%100%100%
   Order.sol85.71%62.50%100%100%73, 79, 92
   Position.sol89.83%62.50%100%100%300, 429–439
   ProtocolParameter.sol72.41%50%100%100%63–70
   RiskParameter.sol72.09%50%100%100%131, 136, 141, 143, 148, 150, 152, 154, 164–167
   Version.sol90.18%70.59%100%98.57%200–201, 356–364

@github-actions
Copy link

[Vault] Integration Test Coverage Report

Coverage after merging arjun/nonreentrant into main will be
85.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-vault/contracts
   Vault.sol97.21%95.45%96.67%98.06%180, 180–183, 259
   VaultFactory.sol85.71%50%100%100%27, 40
packages/perennial-vault/contracts/interfaces
   IVault.sol100%100%100%100%
   IVaultFactory.sol100%100%100%100%
packages/perennial-vault/contracts/lib
   StrategyLib.sol100%100%100%100%
packages/perennial-vault/contracts/test
   AccountTester.sol0%100%0%0%10, 14, 23, 25, 27, 36, 38, 40, 44, 46, 48
   CheckpointTester.sol0%100%0%0%10, 14, 18, 20, 22, 29, 31, 33, 41, 43, 45, 49, 53, 57, 61, 65, 69, 73
   MappingTester.sol0%100%0%0%10, 14, 18, 20, 22, 26, 28, 30, 34, 38, 42, 46
   RegistrationTester.sol0%100%0%0%10, 14
   VaultParameterTest.sol0%100%0%0%10, 14
packages/perennial-vault/contracts/types
   Account.sol82.86%50%100%100%122–127
   Checkpoint.sol88.64%68.75%100%100%130, 184, 222–229
   Mapping.sol95.12%80%100%100%100, 95
   Registration.sol81.82%50%100%100%39–40
   VaultParameter.sol87.50%50%100%100%30

kbrizzle pushed a commit that referenced this pull request Jul 22, 2023
arjun-io added a commit that referenced this pull request Jul 23, 2023
* contract + unit cleanup

* clean unit

* cleanup contracts

* integration setup, liquidate, and orders

* push pyth

* add pyth commitNonRequest price test

* intermediary

* fee withdrawal rounding error

* order stuff

* remove receiver

* more tests

* inv more

* fix wrap/unwrap tests

* add vault setup

* Add reentrancy guard (#38)

* add market pending limit (#41)

* TODO

* add storage layout notes

* latestId refactor (#42)

* refactor start

* market unit test update 1

* market errors gone

* almost working

* fix bug

* Cleanup and fix flaky tests (#43)

* use hh helpers to fix flakiness

* skip coverage for testers

* Update READMEs and remove old deployments (#44)

* Update package READMEs

* remove old deployments

* put back helper for clarity

* storage layout for marketparameter

* version storage layout

* vault test working

* use correct fundWallet

* more coverage

* intermediate

* addressing unit tests

* remove unused code

---------

Co-authored-by: nd <[email protected]>
Co-authored-by: Kevin Britz <[email protected]>
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.

2 participants