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

[Fix] Increment nextVersionIndexToCommit in unrequested commit flow #100

Merged
merged 2 commits into from
Sep 17, 2023

Conversation

kbrizzle
Copy link
Collaborator

@kbrizzle kbrizzle commented Sep 16, 2023

Fixes an issue where a requested version with a lower timestamp could be committed after an unrequested version with a higher stamp (thereby making latest() travel backwards), if it's underlying VAA's timestamp was increasing.

This solves the issue so that this cannot occur.

@github-actions
Copy link

[Payoff] Integration Test Code Coverage Report

Coverage after merging britz-fix-backwards-oracle-issue 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 britz-fix-backwards-oracle-issue 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

[Oracle] Unit Test Coverage Report

Coverage after merging britz-fix-backwards-oracle-issue into main will be
78.71%
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.sol57.14%31.82%77.78%72%100, 106, 117, 44, 53, 60–61, 75, 84, 89, 89–91, 91, 91–92, 92, 92–93, 93, 93, 95
   PythOracle_Arbitrum.sol0%100%0%0%15, 20
   PythOracle_Optimism.sol0%100%0%0%15, 20
   PythOracle.sol52.89%35.42%73.33%62.07%114–115, 121, 121, 121, 132, 137–138, 144, 148–149, 151, 151, 151, 154, 154, 154, 177, 177, 177, 182–183, 186, 189, 189, 189–190, 193–194, 194, 194, 196, 196, 196–197, 197, 197–199, 199, 199, 199, 199, 201–203, 245, 66, 70, 76, 81, 83, 93

@github-actions
Copy link

[Extensions] Unit Test Coverage Report

Coverage after merging britz-fix-backwards-oracle-issue into main will be
80.28%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-extensions/contracts
   MultiInvoker.sol75.86%69.77%86.36%78.23%104, 144–145, 148–150, 152, 157, 226, 226–227, 229, 231, 240, 283, 283, 285, 288, 297, 297, 299, 302, 320, 322, 322, 322–323, 325, 330, 340–341, 344–345, 347, 384, 387–388, 388, 388–390, 390, 390, 392–393, 414, 420, 443, 460, 77, 80–82
packages/perennial-extensions/contracts/interfaces
   IMultiInvoker.sol100%100%100%100%
packages/perennial-extensions/contracts/types
   TriggerOrder.sol78.26%62.50%100%94.44%34–35, 62–69

@github-actions
Copy link

[Vault] Unit Test Coverage Report

Coverage after merging britz-fix-backwards-oracle-issue into main will be
28.76%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-vault/contracts
   Vault.sol0%0%0%0%100, 106, 112–113, 121–122, 131, 133, 133, 133, 140, 142, 142, 142, 147, 147–148, 150–151, 151, 151, 154, 160, 160, 160–161, 161, 161, 163, 165–167, 174, 174–176, 184, 184, 184, 186–190, 195, 195–197, 203–204, 209, 209–212, 219, 219–221, 223–225, 238, 238–240, 242–245, 251–252, 252, 252–255, 257, 275, 275, 275–276, 276, 276, 279, 279, 279–281, 281, 281–283, 283, 283–285, 285, 285–287, 287, 287–289, 289, 289–290, 292, 292, 292, 295, 298–300, 303–305, 307, 321, 321, 321–323, 325, 325, 325, 330–331, 346, 350–353, 355, 361, 364, 364, 364, 367, 367, 367, 371–373, 386, 388, 388, 388, 388, 388, 390, 396–397, 397, 397–400, 400, 400–401, 408, 411, 413, 423, 437, 439–442, 444, 446–449, 452–453, 455–458, 461–466, 469–470, 473, 473, 473–475, 482, 482, 482–484, 491, 491, 491–493, 500, 500, 500, 502–505, 507, 507, 507–508, 508, 508, 508, 513, 519, 529–531, 539–540, 562–564, 570–572, 582–584, 586–588, 59, 59–60, 62–66, 72, 79, 86, 93
   VaultFactory.sol0%0%0%0%30–31, 35, 35–36, 48, 48–49, 52, 56–58, 60, 67–68
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%107–111, 114–115, 120, 123–124, 131, 144, 146, 149–150, 162–164, 173, 70–72, 74, 76–79, 82, 86, 88, 88, 88, 88, 88–89, 91, 93
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%

@kbrizzle kbrizzle requested a review from arjun-io September 17, 2023 21:25
@github-actions
Copy link

[Oracle] Integration Test Coverage Report

Coverage after merging britz-fix-backwards-oracle-issue into main will be
78.71%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-oracle/contracts
   Oracle.sol33.75%30%41.67%34.21%100, 100, 100, 102–103, 103, 103, 105, 107, 107, 107–108, 115, 118–119, 119, 119, 121, 126, 126, 126–128, 20, 30, 37, 37–38, 40, 44–45, 52–53, 58, 63, 70, 70, 70–73, 73, 73–74, 76, 82
   OracleFactory.sol58.33%40.63%70%73.33%103–105, 105, 105–106, 112, 112, 112–113, 33, 41, 48, 48–50, 57–59, 62, 73–75, 78, 85, 94–95
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.sol89.29%72.73%100%100%106, 117, 44, 53, 60, 89
   PythOracle_Arbitrum.sol100%100%100%100%
   PythOracle_Optimism.sol100%100%100%100%
   PythOracle.sol98.35%95.83%100%100%132, 232

@github-actions
Copy link

[Core] Integration Test Coverage Report

Coverage after merging britz-fix-backwards-oracle-issue into main will be
91.92%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial/contracts
   Market.sol75.32%53%88.57%85.55%100–101, 106, 113, 120–122, 131, 133, 133, 133–134, 134, 134–136, 136, 136–137, 137, 137, 139, 146, 146, 146, 148–150, 155, 157–158, 160–161, 257–259, 401, 447, 488–489, 489, 489, 489, 498–499, 504–505, 507, 507, 507–508, 512, 518–519, 519, 528, 528, 528, 532, 537, 548, 554–555, 581–582, 60, 639, 644, 83, 92, 99, 99
   MarketFactory.sol69.70%50%83.33%80%37, 48, 57–58, 64, 66, 72, 75–76
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/types
   Global.sol78.57%50%100%100%115–126
   Invalidation.sol60%100%66.67%57.14%28–30
   Local.sol80%56.25%83.33%95.65%128–133, 89, 97
   MarketParameter.sol69.57%40.91%100%95%113, 115–116, 118, 120, 122, 122, 122, 122, 134–138
   OracleVersion.sol100%100%100%100%
   Order.sol89.74%75%100%100%109, 123, 74, 80
   Position.sol83.23%56.25%94.12%95.89%147–148, 210, 228, 285, 397–399, 466–468, 497–509
   ProtocolParameter.sol75%50%100%100%60–61, 67–71
   RiskParameter.sol72.41%50%100%100%143, 148, 153, 155, 160, 162, 164, 166, 168, 170, 180–185
   Version.sol90.18%70.59%100%98.57%192–193, 362–370

@kbrizzle kbrizzle merged commit 3e7c37d into main Sep 17, 2023
@kbrizzle kbrizzle deleted the britz-fix-backwards-oracle-issue branch September 17, 2023 22:09
@arjun-io arjun-io changed the title [WIP] Unrequested allowing out of order commits [Fix] Increment nextVersionIndexToCommit in unrequested commit flow Sep 17, 2023
@github-actions
Copy link

[Extensions] Integration Test Coverage Report

Coverage after merging britz-fix-backwards-oracle-issue into main will be
99.30%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-extensions/contracts
   MultiInvoker.sol96.12%89.53%100%100%157, 226, 285, 299, 384, 388, 390, 414, 460
packages/perennial-extensions/contracts/interfaces
   IMultiInvoker.sol100%100%100%100%
packages/perennial-extensions/contracts/types
   TriggerOrder.sol89.13%83.33%100%94.44%34–35, 62–64

@github-actions
Copy link

[Vault] Integration Test Coverage Report

Coverage after merging britz-fix-backwards-oracle-issue into main will be
99.02%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial-vault/contracts
   Vault.sol97.55%96.05%97.22%98.28%209, 209–212, 292
   VaultFactory.sol89.47%50%100%100%35, 48
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/types
   Account.sol82.86%50%100%100%126–131
   Checkpoint.sol88.64%68.75%100%100%132, 186, 224–231
   Mapping.sol95.12%80%100%100%100, 95
   Registration.sol81.82%50%100%100%41–42
   VaultParameter.sol87.50%50%100%100%31

@github-actions
Copy link

[Core] Unit Test Coverage Report

Coverage after merging britz-fix-backwards-oracle-issue into main will be
99.78%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/perennial/contracts
   Market.sol98.70%96%100%100%489, 489, 528, 83
   MarketFactory.sol100%100%100%100%
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/types
   Global.sol100%100%100%100%
   Invalidation.sol100%100%100%100%
   Local.sol95.56%100%83.33%95.65%97
   MarketParameter.sol100%100%100%100%
   OracleVersion.sol100%100%100%100%
   Order.sol100%100%100%100%
   Position.sol100%100%100%100%
   ProtocolParameter.sol100%100%100%100%
   RiskParameter.sol100%100%100%100%
   Version.sol100%100%100%100%

@kbrizzle kbrizzle added the protocol change Modifies the protocol label Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
protocol change Modifies the protocol
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants