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

Remove absolute position update #512

Open
wants to merge 31 commits into
base: v2.4
Choose a base branch
from

Conversation

packages/core/contracts/Market.sol Outdated Show resolved Hide resolved
packages/core/contracts/types/Order.sol Outdated Show resolved Hide resolved
packages/core/contracts/types/Order.sol Show resolved Hide resolved
packages/core/contracts/types/Order.sol Outdated Show resolved Hide resolved
packages/core/contracts/Market.sol Outdated Show resolved Hide resolved
@kbrizzle kbrizzle mentioned this pull request Dec 16, 2024
@prateekdefi prateekdefi requested a review from kbrizzle December 16, 2024 18:42
@kbrizzle
Copy link
Collaborator

This one looks like it's on the right track now 👍

@prateekdefi prateekdefi marked this pull request as ready for review December 23, 2024 10:26
@prateekdefi prateekdefi requested a review from EdNoepel December 23, 2024 10:26
Copy link
Contributor

@EdNoepel EdNoepel left a comment

Choose a reason for hiding this comment

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

Looks pretty good; just a few nits inline.

expect((await market.pendingOrders(user.address, 2)).protection).to.eq(1)
})

it('liquidates a user with close', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Note to self: We can no longer liquidate with update, only close, explaining why two tests are no longer needed here.

},
]
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Appreciate the cleanup.

@@ -761,16 +760,16 @@ export function RunManagerTests(name: string, getFixture: (overrides?: CallOverr
expect(canExecuteBefore).to.be.false

// time passes, other users interact with market
let positionA = (await market.positions(userA.address)).maker
let positionC = (await market.positions(userC.address)).short
let positionADelta
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would have named this positionDeltaA to prevent jumbling uppercase letters together.

/// @param timestamp The current timestamp
/// @param position The current position
/// @param makerAmount The magnitude and direction of maker position
/// @param takerAmount The magnitude and direction of taker position
/// @param collateral The change in the collateral
/// @param protect Whether the order is protected
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// @param protect Whether the order is protected
/// @param protect True when liquidating the position

@@ -80,12 +80,13 @@ library OrderLib {
(UFixed6Lib.ZERO, UFixed6Lib.ZERO, UFixed6Lib.ZERO, UFixed6Lib.ZERO, UFixed6Lib.ZERO, UFixed6Lib.ZERO);
}

/// @notice Creates a new order from the an intent order request
/// @notice Creates a new order from the an intent and delta order request
Copy link
Contributor

Choose a reason for hiding this comment

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

from the an intent and delta doesn't sound right. If this from method is really used for both use cases, it could read from an intent or delta.

Base automatically changed from prateek/pe-1629-remove-magic-values to v2.4 December 24, 2024 10:41
@prateekdefi prateekdefi requested a review from EdNoepel December 24, 2024 11:15
Copy link
Contributor

@EdNoepel EdNoepel left a comment

Choose a reason for hiding this comment

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

LGTM

newOrder.makerReferral = makerAmount.abs().mul(referralFee);
newOrder.takerReferral = takerAmount.abs().mul(referralFee);
newOrder.protection = protect ? 1 : 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need to change the order here? might want to leave in the original slot just to reduce the changeset.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it happened while merging, reverting to old order.

/// @param collateral The collateral delta of the order (positive for deposit, negative for withdrawal)
/// @param referrer The referrer of the order
function update(
address account,
Fixed6 amount,
Fixed6 takerAmount,
Copy link
Collaborator

Choose a reason for hiding this comment

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

what if we went the other direction for these and named them taker and maker like you did in the Trigger Order code for both overloads? might be a little more succint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the trigger orders i have used makerDelta and takerDelta. I think taker and maker are used in multiInvoker here. I agree that it will be more succinct but I like takerAmount more than taker as it helps with readability and think that we should rename to takerAmount in multiInvoker as well.

.muldiv(marketContext.registration.leverage, marketContext.latestPrice.abs())
.max(marketContext.minPosition)
.min(marketContext.maxPosition);
target.position = _getTargetPosition(marketContext, marketAssets);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of pulling this out into it's own function what if we did:

  • change target.position to UFixed6 newMaker.
  • add new line target.position = Fixed6Lib.from(newMaker).sub(Fixed6Lib.from(marketContext.currentAccountPosition.maker));

/// @dev The new position
UFixed6 position;
/// @dev The amount of change in position
Fixed6 position;
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we should change the name of this field to taker? not that's not representing a absolute position anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you mean change this to maker? Maybe we can change this to makerDelta or positionDelta?

@prateekdefi prateekdefi requested a review from kbrizzle January 6, 2025 18:58
Copy link

github-actions bot commented Jan 6, 2025

[Periphery] Unit Test Coverage Report

Coverage after merging prateek/pe-1630-remove-absolute-position-update into v2.4 will be
63.66%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/oracle/contracts
   Oracle.sol100%100%100%100%
   OracleFactory.sol92.59%100%85.71%95%58
packages/oracle/contracts/chainlink
   ChainlinkFactory.sol100%100%100%100%
packages/oracle/contracts/keeper
   KeeperFactory.sol87.06%100%76.92%88.89%165–166, 168–169, 213, 240, 83–84
   KeeperOracle.sol72.37%100%70.59%72.88%110, 163, 165–167, 169, 171–175, 178–179, 224, 73, 87
packages/oracle/contracts/keeper/libs
   DedupLib.sol100%100%100%100%
packages/oracle/contracts/keeper/types
   KeeperOracleParameter.sol100%100%100%100%
   PriceResponse.sol100%100%100%100%
packages/oracle/contracts/metaquants
   MetaQuantsFactory.sol0%100%0%0%25–27, 33–36, 40, 51–52, 54–57, 59, 61, 63, 65–66, 75
packages/oracle/contracts/payoff
   Inverse.sol100%100%100%100%
   PowerHalf.sol100%100%100%100%
   PowerTwo.sol100%100%100%100%
packages/oracle/contracts/pyth
   PythFactory.sol100%100%100%100%
packages/oracle/contracts/types
   OracleParameter.sol100%100%100%100%
packages/periphery/contracts/CollateralAccounts
   Account.sol27.78%100%22.22%29.63%101, 106–107, 56, 62, 65–66, 69, 74–76, 79, 81–82, 87, 92–95
   AccountVerifier.sol100%100%100%100%
   Controller.sol81%100%100%75.95%103–105, 112–113, 204, 216, 227, 229–231, 235–237, 240, 250–252, 259
   Controller_Arbitrum.sol0%100%0%0%29, 41
   Controller_Incentivized.sol0%100%0%0%111, 128–129, 146, 154, 156–157, 164, 183, 186, 205, 208, 227, 230, 249, 252, 271, 274, 286–287, 290, 293, 302–303, 305, 307, 309, 56, 72–77, 94
   Controller_Optimism.sol0%100%0%0%29, 41
packages/periphery/contracts/CollateralAccounts/libs
   RebalanceLib.sol0%100%0%0%26, 29–30, 32–33, 36, 39, 43
packages/periphery/contracts/CollateralAccounts/test
   RebalanceConfigTester.sol100%100%100%100%
packages/periphery/contracts/CollateralAccounts/types
   Action.sol100%100%100%100%
   DeployAccount.sol100%100%100%100%
   MarketTransfer.sol100%100%100%100%
   RebalanceConfig.sol100%100%100%100%
   RebalanceConfigChange.sol100%100%100%100%
   RelayedAccessUpdateBatch.sol100%100%100%100%
   RelayedGroupCancellation.sol100%100%100%100%
   RelayedNonceCancellation.sol100%100%100%100%
   RelayedOperatorUpdate.sol100%100%100%100%
   RelayedSignerUpdate.sol100%100%100%100%
   Withdrawal.sol100%100%100%100%
packages/periphery/contracts/Coordinator
   Coordinator.sol100%100%100%100%
packages/periphery/contracts/MultiInvoker
   MultiInvoker.sol84.62%100%90%83.33%137, 139, 146, 149, 213, 317, 332, 350, 352–353, 355, 377, 85–86
packages/periphery/contracts/TriggerOrders
   Manager.sol81.71%100%83.33%81.25%167–168, 170, 208, 212, 214, 216, 237–239, 254–255
   Manager_Arbitrum.sol100%100%100%100%
   Manager_Optimism.sol0%100%0%0%27, 35
   OrderVerifier.sol100%100%100%100%
packages/periphery/contracts/TriggerOrders/test
   TriggerOrderTester.sol100%100%100%100%
packages/periphery/contracts/TriggerOrders/types
   Action.sol100%100%100%100%
   CancelOrderAction.sol100%100%100%100%
   InterfaceFee.sol100%100%100%100%
   PlaceOrderAction.sol100%100%100%100%
   TriggerOrder.sol100%100%100%100%
packages/vault/contracts
   Vault.sol0%100%0%0%102, 109, 115, 121–122, 130–131, 140, 142, 149, 151, 157, 159–160, 163, 169–170, 172, 174–175, 182–184, 192–196, 203, 205, 207, 213, 215, 217–220, 223, 229–230, 236–237, 243–244, 250–251, 253–254, 261–262, 264–266, 280–281, 283–286, 291–292, 298–299, 301–303, 321–322, 325–335, 338, 341–343, 346–348, 350, 357, 367–368, 375, 378, 382–383, 389–390, 393, 396, 400, 413, 415, 423–428, 438, 444, 461, 474, 476–479, 481, 483–484, 487–489, 493–495, 498–500, 507–509, 516, 529–530, 533, 545–546, 551–552, 74, 76–79, 82, 88, 95
   VaultFactory.sol0%100%0%0%33–34, 39, 53, 57–59, 61
packages/vault/contracts/libs
   StrategyLib.sol0%100%0%0%116–117, 119–120, 122–126, 132, 135–136, 150, 153, 157, 159, 162, 164, 168, 177–181, 183–184, 186–187, 189, 195, 197, 200–203, 206, 211, 90–95
packages/vault/contracts/types
   Account.sol100%100%100%100%
   Checkpoint.sol100%100%100%100%
   Registration.sol100%100%100%100%
   VaultParameter.sol100%100%100%100%

Copy link

github-actions bot commented Jan 6, 2025

[Core] Integration Test Coverage Report

Coverage after merging prateek/pe-1630-remove-absolute-position-update into v2.4 will be
98.57%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/core/contracts
   InsuranceFund.sol80%50%100%100%29, 34, 39, 39, 49
   Market.sol98.61%94.90%100%100%129, 143, 200, 704, 876
   MarketFactory.sol96.74%90.63%100%100%128, 154, 183
   Verifier.sol84.85%75%100%100%35, 48, 64, 80, 96
packages/core/contracts/interfaces
   IInsuranceFund.sol100%100%100%100%
   IMarket.sol100%100%100%100%
   IMarketFactory.sol100%100%100%100%
   IMarketFactorySigners.sol100%100%100%100%
   IOracleProvider.sol100%100%100%100%
   IOracleProviderFactory.sol100%100%100%100%
   IVerifier.sol100%100%100%100%
packages/core/contracts/libs
   CheckpointLib.sol100%100%100%100%
   InvariantLib.sol60.66%47.50%100%85%109, 115–116, 35–36, 38–39, 39, 39, 39, 48, 52, 52, 60, 65–66, 66, 72–73, 77, 83–84, 84, 98
   VersionLib.sol98.76%95.83%100%99.18%442–443
packages/core/contracts/types
   AccessUpdate.sol100%100%100%100%
   AccessUpdateBatch.sol100%100%100%100%
   Checkpoint.sol74.07%50%100%100%50–56
   Global.sol79.69%53.57%100%100%145–157
   Guarantee.sol89.55%65%100%100%197–199, 222–225
   Intent.sol100%100%100%100%
   Local.sol82.14%50%100%100%84–88
   MarketParameter.sol76.67%50%100%87.50%100–101, 85–86, 88–89, 99
   OperatorUpdate.sol100%100%100%100%
   OracleReceipt.sol100%100%100%100%
   OracleVersion.sol100%100%100%100%
   Order.sol88.02%68.97%96.67%98.73%126, 146, 146, 204, 360–365, 436–438, 464–469
   Position.sol86.32%61.11%90%93.62%111, 148, 203, 216, 300, 330–332, 377, 395
   ProtocolParameter.sol74.36%50%100%100%81–83, 89–95
   RiskParameter.sol69.23%47.73%100%96.77%134, 140, 142, 148, 150–151, 153–154, 156, 158, 160, 168, 168, 168–169, 171, 181–188
   SignerUpdate.sol100%100%100%100%
   Version.sol70.27%50%100%100%100–119, 98–99

Copy link

github-actions bot commented Jan 6, 2025

Code Size Diff:

View Report
 ·---------------------------------|--------------------------------|--------------------------------·
 |  Solc version: 0.8.24           ·  Optimizer enabled: true       ·  Runs: 1000000                 │
 ··································|································|·································
 |  Contract Name                  ·  Deployed size (KiB) (change)  ·  Initcode size (KiB) (change)  │
 ··································|································|·································
 |  AccessUpdateBatchLib           ·                 0.169 (0.000)  ·                 0.198 (0.000)  │
 ··································|································|·································
 |  AccessUpdateLib                ·                 0.169 (0.000)  ·                 0.198 (0.000)  │
 ··································|································|·································
 |  Accumulator6Lib                ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  Accumulator6StorageLib         ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  Address                        ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  AddressStorageLib              ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  AdiabaticMath6                 ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  BeaconProxy                    ·                 0.693 (0.000)  ·                 1.796 (0.000)  │
 ··································|································|·································
 |  BoolStorageLib                 ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  Bytes32StorageLib              ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  CheckpointLib                  ·                 7.131 (0.000)  ·                 7.163 (0.000)  │
 ··································|································|·································
 |  CheckpointStorageLib           ·                 0.751 (0.000)  ·                 0.783 (0.000)  │
 ··································|································|·································
 |  CheckpointTester               ·                 8.129 (0.000)  ·                 8.155 (0.000)  │
 ··································|································|·································
 |  CommonLib                      ·                 0.169 (0.000)  ·                 0.198 (0.000)  │
 ··································|································|·································
 |  Create2                        ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  CurveMath6                     ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  ECDSA                          ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  EnumerableSet                  ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  ERC1967Proxy                   ·                 0.220 (0.000)  ·                 1.007 (0.000)  │
 ··································|································|·································
 |  ERC20                          ·                 3.235 (0.000)  ·                 4.142 (0.000)  │
 ··································|································|·································
 |  ERC20PresetMinterPauser        ·                 8.197 (0.000)  ·                 9.599 (0.000)  │
 ··································|································|·································
 |  Fixed18Lib                     ·                 0.486 (0.000)  ·                 0.517 (0.000)  │
 ··································|································|·································
 |  Fixed18StorageLib              ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  Fixed6Lib                      ·                 0.481 (0.000)  ·                 0.512 (0.000)  │
 ··································|································|·································
 |  Fixed6StorageLib               ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  GlobalLib                      ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  GlobalStorageLib               ·                 1.199 (0.000)  ·                 1.231 (0.000)  │
 ··································|································|·································
 |  GlobalTester                   ·                 2.215 (0.000)  ·                 2.241 (0.000)  │
 ··································|································|·································
 |  GroupCancellationLib           ·                 0.169 (0.000)  ·                 0.198 (0.000)  │
 ··································|································|·································
 |  GuaranteeGlobalTester          ·                 2.583 (0.000)  ·                 2.609 (0.000)  │
 ··································|································|·································
 |  GuaranteeLib                   ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  GuaranteeLocalTester           ·                 2.991 (0.000)  ·                 3.018 (0.000)  │
 ··································|································|·································
 |  GuaranteeStorageGlobalLib      ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  GuaranteeStorageLib            ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  GuaranteeStorageLocalLib       ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  InsuranceFund                  ·                 3.378 (0.000)  ·                 3.552 (0.000)  │
 ··································|································|·································
 |  Int256StorageLib               ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  IntentLib                      ·                 0.169 (0.000)  ·                 0.198 (0.000)  │
 ··································|································|·································
 |  InvariantLib                   ·                 6.911 (0.000)  ·                 6.943 (0.000)  │
 ··································|································|·································
 |  LinearAdiabatic6Lib            ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  LocalLib                       ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  LocalStorageLib                ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  LocalTester                    ·                 1.359 (0.000)  ·                 1.386 (0.000)  │
 ··································|································|·································
 |  Market                         ·               22.069 (-1.651)  ·               22.210 (-1.651)  │
 ··································|································|·································
 |  MarketFactory                  ·                11.860 (0.000)  ·                12.076 (0.000)  │
 ··································|································|·································
 |  MarketParameterStorageLib      ·                 1.079 (0.000)  ·                 1.111 (0.000)  │
 ··································|································|·································
 |  MarketParameterTester          ·                 1.260 (0.000)  ·                 1.286 (0.000)  │
 ··································|································|·································
 |  Math                           ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  MockToken                      ·                3.929 (-0.013)  ·                4.677 (-0.013)  │
 ··································|································|·································
 |  NoopAdiabatic6Lib              ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  NumberMath                     ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  OperatorUpdateLib              ·                 0.169 (0.000)  ·                 0.198 (0.000)  │
 ··································|································|·································
 |  OrderGlobalTester              ·                 4.098 (0.000)  ·                 4.124 (0.000)  │
 ··································|································|·································
 |  OrderLib                       ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  OrderLocalTester               ·                 3.993 (0.000)  ·                 4.020 (0.000)  │
 ··································|································|·································
 |  OrderStorageGlobalLib          ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  OrderStorageLib                ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  OrderStorageLocalLib           ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  PAccumulator6Lib               ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  PController6Lib                ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  PositionGlobalTester           ·                 5.058 (0.000)  ·                 5.084 (0.000)  │
 ··································|································|·································
 |  PositionLib                    ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  PositionLocalTester            ·                 5.108 (0.000)  ·                 5.135 (0.000)  │
 ··································|································|·································
 |  PositionStorageGlobalLib       ·                 0.526 (0.000)  ·                 0.559 (0.000)  │
 ··································|································|·································
 |  PositionStorageLib             ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  PositionStorageLocalLib        ·                 0.569 (0.000)  ·                 0.602 (0.000)  │
 ··································|································|·································
 |  ProtocolParameterStorageLib    ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  ProtocolParameterTester        ·                 1.341 (0.000)  ·                 1.367 (0.000)  │
 ··································|································|·································
 |  ProxyAdmin                     ·                 2.255 (0.000)  ·                 2.348 (0.000)  │
 ··································|································|·································
 |  RiskParameterStorageLib        ·                 2.816 (0.000)  ·                 2.849 (0.000)  │
 ··································|································|·································
 |  RiskParameterTester            ·                 2.478 (0.000)  ·                 2.504 (0.000)  │
 ··································|································|·································
 |  SafeERC20                      ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  SignatureChecker               ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  SignedMath                     ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  SignerUpdateLib                ·                 0.169 (0.000)  ·                 0.198 (0.000)  │
 ··································|································|·································
 |  StorageSlot                    ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  Strings                        ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  TimelockController             ·                 9.532 (0.000)  ·                10.858 (0.000)  │
 ··································|································|·································
 |  Token18Lib                     ·                 0.138 (0.000)  ·                 0.166 (0.000)  │
 ··································|································|·································
 |  Token18StorageLib              ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  TransparentUpgradeableProxy    ·                 2.590 (0.000)  ·                 3.633 (0.000)  │
 ··································|································|·································
 |  UFixed18Lib                    ·                 0.303 (0.000)  ·                 0.333 (0.000)  │
 ··································|································|·································
 |  UFixed18StorageLib             ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  UFixed6Lib                     ·                 0.291 (0.000)  ·                 0.321 (0.000)  │
 ··································|································|·································
 |  UFixed6StorageLib              ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  Uint256StorageLib              ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  UJumpRateUtilizationCurve6Lib  ·                 0.056 (0.000)  ·                 0.083 (0.000)  │
 ··································|································|·································
 |  UpgradeableBeacon              ·                 1.165 (0.000)  ·                 1.462 (0.000)  │
 ··································|································|·································
 |  Verifier                       ·                 8.411 (0.000)  ·                 8.734 (0.000)  │
 ··································|································|·································
 |  VersionLib                     ·                11.684 (0.000)  ·                11.716 (0.000)  │
 ··································|································|·································
 |  VersionStorageLib              ·                 1.882 (0.000)  ·                 1.914 (0.000)  │
 ··································|································|·································
 |  VersionTester                  ·                 8.442 (0.000)  ·                 8.469 (0.000)  │
 ·---------------------------------|--------------------------------|--------------------------------·

Copy link

github-actions bot commented Jan 6, 2025

Gas Report Diff:

View Report
··········································································································································
|  Solidity and Network Configuration                                                                                                    │
·······································|······················|······················|······················|·····························
|  Solidity: 0.8.24                    ·  Optim: true         ·  Runs: 1000000       ·  viaIR: true         ·   Block: 32,000,000 gas    │
·······································|······················|······················|······················|·····························
|  Methods                                                                                                                               │
·······································|······················|······················|······················|··············|··············
|  Contracts / Methods                 ·  Min                 ·  Max                 ·  Avg                 ·  # calls     ·  usd (avg)  │
·······································|······················|······················|······················|··············|··············
|  ERC20                               ·                                                                                                 │
·······································|······················|······················|······················|··············|··············
|      approve                         ·              46,727  ·              47,051  ·              46,755  ·         135  ·          -  │
·······································|······················|······················|······················|··············|··············
|      transfer                        ·              30,283  ·              47,395  ·              40,551  ·          10  ·          -  │
·······································|······················|······················|······················|··············|··············
|  ERC20PresetMinterPauser             ·                                                                                                 │
·······································|······················|······················|······················|··············|··············
|      pause                           ·                   -  ·                   -  ·              53,568  ·           1  ·          -  │
·······································|······················|······················|······················|··············|··············
|  InsuranceFund                       ·                                                                                                 │
·······································|······················|······················|······················|··············|··············
|      claim                           ·                   -  ·                   -  ·         121,398 +52  ·           2  ·          -  │
·······································|······················|······················|······················|··············|··············
|      initialize                      ·              77,156  ·             103,246  ·              85,959  ·           6  ·          -  │
·······································|······················|······················|······················|··············|··············
|      resolve                         ·                   -  ·                   -  ·        477,773 +129  ·           2  ·          -  │
·······································|······················|······················|······················|··············|··············
|  Market                              ·                                                                                                 │
·······································|······················|······················|······················|··············|··············
|      claimExposure                   ·          77,082 +16  ·          80,509 +17  ·          78,796 +17  ·           2  ·          -  │
·······································|······················|······················|······················|··············|··············
|      claimFee                        ·          80,429 +39  ·         102,455 +48  ·         87,013 +315  ·          23  ·          -  │
·······································|······················|······················|······················|··············|··············
|      close                           ·    368,014 -194,195  ·    760,677 +195,061  ·     535,617 -28,863  ·          25  ·          -  │
·······································|······················|······················|······················|··············|··············
|      settle                          ·         159,036 +31  ·         590,696 +34  ·         376,852 +33  ·         145  ·          -  │
·······································|······················|······················|······················|··············|··············
|      update                          ·    280,350 -205,572  ·    678,467 +188,098  ·      490,281 +2,700  ·          37  ·          -  │
·······································|······················|······················|······················|··············|··············
|      update                          ·         718,564 +77  ·         759,310 +77  ·         752,513 +77  ·           6  ·          -  │
·······································|······················|······················|······················|··············|··············
|      update                          ·             275,540  ·             800,168  ·             589,956  ·         118  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateBeneficiary               ·                   -  ·                   -  ·          65,888 +19  ·          63  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateCoordinator               ·                   -  ·                   -  ·          66,546 -14  ·          63  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateParameter                 ·          62,771 -40  ·          82,719 -40  ·          77,535 -95  ·          91  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateRiskParameter             ·         103,397 +29  ·         160,815 +29  ·        141,994 -163  ·          97  ·          -  │
·······································|······················|······················|······················|··············|··············
|  MarketFactory                       ·                                                                                                 │
·······································|······················|······················|······················|··············|··············
|      create                          ·                   -  ·                   -  ·             413,520  ·          65  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateAccessBatch               ·                   -  ·                   -  ·              79,655  ·           1  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateAccessBatchWithSignature  ·                   -  ·                   -  ·             132,559  ·           1  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateExtension                 ·                   -  ·                   -  ·              55,047  ·           2  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateOperator                  ·              53,226  ·              53,238  ·              53,232  ·           2  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateOperatorWithSignature     ·                   -  ·                   -  ·             101,962  ·           1  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateParameter                 ·              44,980  ·              62,068  ·              46,716  ·          20  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updatePauser                    ·                   -  ·                   -  ·              54,216  ·           2  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateReferralFee               ·              37,782  ·              54,882  ·              52,032  ·          12  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateSigner                    ·              31,778  ·              53,690  ·              44,925  ·           5  ·          -  │
·······································|······················|······················|······················|··············|··············
|      updateSignerWithSignature       ·                   -  ·                   -  ·             101,619  ·           1  ·          -  │
·······································|······················|······················|······················|··············|··············
|  Verifier                            ·                                                                                                 │
·······································|······················|······················|······················|··············|··············
|      initialize                      ·                   -  ·                   -  ·              76,409  ·           2  ·          -  │
·······································|······················|······················|······················|··············|··············
|  Deployments                                                ·                                             ·  % of limit  ·             │
·······································|······················|······················|······················|··············|··············
|  CheckpointLib                       ·                   -  ·                   -  ·           1,630,371  ·       5.1 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  CheckpointStorageLib                ·                   -  ·                   -  ·             218,154  ·       0.7 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  GlobalStorageLib                    ·                   -  ·                   -  ·             316,344  ·         1 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  InsuranceFund                       ·                   -  ·                   -  ·         796,144 +12  ·       2.5 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  InvariantLib                        ·                   -  ·                   -  ·           1,576,200  ·       4.9 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  Market                              ·  4,942,309 -365,786  ·  4,942,321 -365,786  ·  4,942,315 -365,786  ·      15.4 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  MarketFactory                       ·           2,665,277  ·           2,665,289  ·           2,665,283  ·       8.3 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  MarketParameterStorageLib           ·                   -  ·                   -  ·             289,767  ·       0.9 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  PositionStorageGlobalLib            ·                   -  ·                   -  ·             168,733  ·       0.5 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  PositionStorageLocalLib             ·                   -  ·                   -  ·             178,242  ·       0.6 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  ProxyAdmin                          ·                   -  ·                   -  ·             574,001  ·       1.8 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  RiskParameterStorageLib             ·                   -  ·                   -  ·             670,390  ·       2.1 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  TransparentUpgradeableProxy         ·                   -  ·                   -  ·             689,929  ·       2.2 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  Verifier                            ·                   -  ·                   -  ·           1,906,491  ·         6 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  VersionLib                          ·                   -  ·                   -  ·           2,635,888  ·       8.2 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  VersionStorageLib                   ·                   -  ·                   -  ·             467,797  ·       1.5 %  ·          -  │
·······································|······················|······················|······················|··············|··············
|  Key                                                                                                                                   │
··········································································································································
|  ◯  Execution gas for this method does not include intrinsic gas overhead                                                              │
··········································································································································
|  △  Cost was non-zero but below the precision setting for the currency display (see options)                                           │
··········································································································································
|  Toolchain:  hardhat                                                                                                                   │
··········································································································································

Copy link

github-actions bot commented Jan 6, 2025

[Periphery] Integration Test Coverage Report

Coverage after merging prateek/pe-1630-remove-absolute-position-update into v2.4 will be
93.65%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/oracle/contracts
   Oracle.sol65.33%100%65%65.45%111–112, 121, 142, 155, 178–179, 181, 183–184, 195, 197, 202–203, 54, 67–68, 94, 99
   OracleFactory.sol100%100%100%100%
packages/oracle/contracts/chainlink
   ChainlinkFactory.sol100%100%100%100%
packages/oracle/contracts/keeper
   KeeperFactory.sol97.65%100%92.31%98.61%213
   KeeperOracle.sol97.37%100%94.12%98.31%87
packages/oracle/contracts/keeper/libs
   DedupLib.sol100%100%100%100%
packages/oracle/contracts/keeper/types
   KeeperOracleParameter.sol93.75%100%100%92.31%56
   PriceResponse.sol100%100%100%100%
packages/oracle/contracts/metaquants
   MetaQuantsFactory.sol100%100%100%100%
packages/oracle/contracts/payoff
   Inverse.sol0%100%0%0%9
   PowerHalf.sol0%100%0%0%13
   PowerTwo.sol100%100%100%100%
packages/oracle/contracts/pyth
   PythFactory.sol100%100%100%100%
packages/oracle/contracts/types
   OracleParameter.sol100%100%100%100%
packages/periphery/contracts/CollateralAccounts
   Account.sol100%100%100%100%
   AccountVerifier.sol91.67%100%91.67%91.67%38
   Controller.sol92%100%90.48%92.41%147, 155, 271, 274, 289, 306
   Controller_Arbitrum.sol100%100%100%100%
   Controller_Incentivized.sol100%100%100%100%
   Controller_Optimism.sol0%100%0%0%29, 41
packages/periphery/contracts/CollateralAccounts/libs
   RebalanceLib.sol100%100%100%100%
packages/periphery/contracts/CollateralAccounts/test
   RebalanceConfigTester.sol0%100%0%0%10, 14
packages/periphery/contracts/CollateralAccounts/types
   Action.sol100%100%100%100%
   DeployAccount.sol100%100%100%100%
   MarketTransfer.sol100%100%100%100%
   RebalanceConfig.sol20%100%33.33%14.29%34–35, 43–44, 46, 50
   RebalanceConfigChange.sol85.71%100%100%83.33%43
   RelayedAccessUpdateBatch.sol100%100%100%100%
   RelayedGroupCancellation.sol100%100%100%100%
   RelayedNonceCancellation.sol100%100%100%100%
   RelayedOperatorUpdate.sol100%100%100%100%
   RelayedSignerUpdate.sol100%100%100%100%
   Withdrawal.sol100%100%100%100%
packages/periphery/contracts/Coordinator
   Coordinator.sol0%100%0%0%20, 26–27, 33–34, 40–42, 49–50
packages/periphery/contracts/MultiInvoker
   MultiInvoker.sol99.04%100%100%98.81%317
packages/periphery/contracts/TriggerOrders
   Manager.sol100%100%100%100%
   Manager_Arbitrum.sol100%100%100%100%
   Manager_Optimism.sol0%100%0%0%27, 35
   OrderVerifier.sol100%100%100%100%
packages/periphery/contracts/TriggerOrders/test
   TriggerOrderTester.sol0%100%0%0%17, 21, 25, 29
packages/periphery/contracts/TriggerOrders/types
   Action.sol100%100%100%100%
   CancelOrderAction.sol100%100%100%100%
   InterfaceFee.sol100%100%100%100%
   PlaceOrderAction.sol100%100%100%100%
   TriggerOrder.sol95.74%100%100%94.59%122, 47
packages/vault/contracts
   Vault.sol100%100%100%100%
   VaultFactory.sol100%100%100%100%
packages/vault/contracts/libs
   StrategyLib.sol95.83%100%80%97.67%211
packages/vault/contracts/types
   Account.sol100%100%100%100%
   Checkpoint.sol100%100%100%100%
   Registration.sol100%100%100%100%
   VaultParameter.sol100%100%100%100%

Copy link

github-actions bot commented Jan 6, 2025

[Periphery] Combined Test Coverage Report

Coverage after merging prateek/pe-1630-remove-absolute-position-update into v2.4 will be
99.18%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/oracle/contracts
   Oracle.sol100%100%100%100%
   OracleFactory.sol100%100%100%100%
packages/oracle/contracts/chainlink
   ChainlinkFactory.sol100%100%100%100%
packages/oracle/contracts/keeper
   KeeperFactory.sol97.65%100%92.31%98.61%213
   KeeperOracle.sol97.37%100%94.12%98.31%87
packages/oracle/contracts/keeper/libs
   DedupLib.sol100%100%100%100%
packages/oracle/contracts/keeper/types
   KeeperOracleParameter.sol100%100%100%100%
   PriceResponse.sol100%100%100%100%
packages/oracle/contracts/metaquants
   MetaQuantsFactory.sol100%100%100%100%
packages/oracle/contracts/payoff
   Inverse.sol100%100%100%100%
   PowerHalf.sol100%100%100%100%
   PowerTwo.sol100%100%100%100%
packages/oracle/contracts/pyth
   PythFactory.sol100%100%100%100%
packages/oracle/contracts/types
   OracleParameter.sol100%100%100%100%
packages/periphery/contracts/CollateralAccounts
   Account.sol100%100%100%100%
   AccountVerifier.sol100%100%100%100%
   Controller.sol100%100%100%100%
   Controller_Arbitrum.sol100%100%100%100%
   Controller_Incentivized.sol100%100%100%100%
   Controller_Optimism.sol0%100%0%0%29, 41
packages/periphery/contracts/CollateralAccounts/libs
   RebalanceLib.sol100%100%100%100%
packages/periphery/contracts/CollateralAccounts/test
   RebalanceConfigTester.sol100%100%100%100%
packages/periphery/contracts/CollateralAccounts/types
   Action.sol100%100%100%100%
   DeployAccount.sol100%100%100%100%
   MarketTransfer.sol100%100%100%100%
   RebalanceConfig.sol100%100%100%100%
   RebalanceConfigChange.sol100%100%100%100%
   RelayedAccessUpdateBatch.sol100%100%100%100%
   RelayedGroupCancellation.sol100%100%100%100%
   RelayedNonceCancellation.sol100%100%100%100%
   RelayedOperatorUpdate.sol100%100%100%100%
   RelayedSignerUpdate.sol100%100%100%100%
   Withdrawal.sol100%100%100%100%
packages/periphery/contracts/Coordinator
   Coordinator.sol100%100%100%100%
packages/periphery/contracts/MultiInvoker
   MultiInvoker.sol99.04%100%100%98.81%317
packages/periphery/contracts/TriggerOrders
   Manager.sol100%100%100%100%
   Manager_Arbitrum.sol100%100%100%100%
   Manager_Optimism.sol0%100%0%0%27, 35
   OrderVerifier.sol100%100%100%100%
packages/periphery/contracts/TriggerOrders/test
   TriggerOrderTester.sol100%100%100%100%
packages/periphery/contracts/TriggerOrders/types
   Action.sol100%100%100%100%
   CancelOrderAction.sol100%100%100%100%
   InterfaceFee.sol100%100%100%100%
   PlaceOrderAction.sol100%100%100%100%
   TriggerOrder.sol100%100%100%100%
packages/vault/contracts
   Vault.sol100%100%100%100%
   VaultFactory.sol100%100%100%100%
packages/vault/contracts/libs
   StrategyLib.sol95.83%100%80%97.67%211
packages/vault/contracts/types
   Account.sol100%100%100%100%
   Checkpoint.sol100%100%100%100%
   Registration.sol100%100%100%100%
   VaultParameter.sol100%100%100%100%

Copy link

github-actions bot commented Jan 6, 2025

[Core] Unit Test Coverage Report

Coverage after merging prateek/pe-1630-remove-absolute-position-update into v2.4 will be
100.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/core/contracts
   InsuranceFund.sol100%100%100%100%
   Market.sol100%100%100%100%
   MarketFactory.sol100%100%100%100%
   Verifier.sol93.94%90%100%100%35, 80
packages/core/contracts/interfaces
   IInsuranceFund.sol100%100%100%100%
   IMarket.sol100%100%100%100%
   IMarketFactory.sol100%100%100%100%
   IMarketFactorySigners.sol100%100%100%100%
   IOracleProvider.sol100%100%100%100%
   IOracleProviderFactory.sol100%100%100%100%
   IVerifier.sol100%100%100%100%
packages/core/contracts/libs
   CheckpointLib.sol100%100%100%100%
   InvariantLib.sol91.80%87.50%100%100%38–39, 39, 39, 39
   VersionLib.sol100%100%100%100%
packages/core/contracts/types
   AccessUpdate.sol100%100%100%100%
   AccessUpdateBatch.sol100%100%100%100%
   Checkpoint.sol100%100%100%100%
   Global.sol96.88%92.86%100%100%151, 153
   Guarantee.sol100%100%100%100%
   Intent.sol100%100%100%100%
   Local.sol100%100%100%100%
   MarketParameter.sol100%100%100%100%
   OperatorUpdate.sol100%100%100%100%
   OracleReceipt.sol100%100%100%100%
   OracleVersion.sol100%100%100%100%
   Order.sol99.40%98.28%100%100%363
   Position.sol100%100%100%100%
   ProtocolParameter.sol100%100%100%100%
   RiskParameter.sol96.15%93.18%100%100%181, 184, 188
   SignerUpdate.sol100%100%100%100%
   Version.sol100%100%100%100%

Copy link

github-actions bot commented Jan 6, 2025

[Core] Combined Test Coverage Report

Coverage after merging prateek/pe-1630-remove-absolute-position-update into v2.4 will be
100.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/core/contracts
   InsuranceFund.sol100%100%100%100%
   Market.sol100%100%100%100%
   MarketFactory.sol100%100%100%100%
   Verifier.sol100%100%100%100%
packages/core/contracts/libs
   CheckpointLib.sol100%100%100%100%
   InvariantLib.sol100%100%100%100%
   VersionLib.sol100%100%100%100%
packages/core/contracts/types
   AccessUpdate.sol100%100%100%100%
   AccessUpdateBatch.sol100%100%100%100%
   Checkpoint.sol100%100%100%100%
   Global.sol100%100%100%100%
   Guarantee.sol100%100%100%100%
   Intent.sol100%100%100%100%
   Local.sol100%100%100%100%
   MarketParameter.sol100%100%100%100%
   OperatorUpdate.sol100%100%100%100%
   Order.sol100%100%100%100%
   Position.sol100%100%100%100%
   ProtocolParameter.sol100%100%100%100%
   RiskParameter.sol100%100%100%100%
   SignerUpdate.sol100%100%100%100%
   Version.sol100%100%100%100%

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.

3 participants