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

[protocol][feat] add RPC query endpoint for withdrawal gating information #964

Merged

Conversation

lucas-dydx
Copy link
Contributor

Changelist

Add RPC query endpoint for withdrawal gating information.

Test Plan

Added unit tests, and will use when testing withdrawal gating E2E in dev / staging env.

Author/Reviewer Checklist

  • If this PR has changes that result in a different app state given the same prior state and transaction list, manually add the state-breaking label.
  • If the PR has breaking postgres changes to the indexer add the indexer-postgres-breaking label.
  • If this PR isn't state-breaking but has changes that modify behavior in PrepareProposal or ProcessProposal, manually add the label proposal-breaking.
  • If this PR is one of many that implement a specific feature, manually label them all feature:[feature-name].
  • If you wish to for mergify-bot to automatically create a PR to backport your change to a release branch, manually add the label backport/[branch-name].
  • Manually add any of the following labels: refactor, chore, bug.

Copy link

coderabbitai bot commented Jan 12, 2024

Walkthrough

The updates introduce new functionalities to query and handle withdrawal and transfer block information within a blockchain protocol. A method getWithdrawalAndTransfersBlockedInfo has been added across various components to enable querying block status and re-enablement times. Changes include additional error handling in mock functions, a new constant for chain outage duration, and updated logic in subaccount management to consider withdrawal and transfer restrictions post-outage.

Changes

File Path Change Summary
.../v4-protos/src/codegen/dydxprotocol/subaccounts/query.lcd.ts
.../v4-protos/src/codegen/dydxprotocol/subaccounts/query.rpc.Query.ts
.../v4-protos/src/codegen/dydxprotocol/subaccounts/query.ts
Added getWithdrawalAndTransfersBlockedInfo method to query withdrawal and transfer block info.
proto/dydxprotocol/subaccounts/query.proto Introduced GetWithdrawalAndTransfersBlockedInfo RPC method with request and response types.
.../mocks/MemClob.go
.../mocks/MemClobKeeper.go
.../mocks/QueryClient.go
Added error return values and conditional logic to handle different return types; included new mock function for querying block info.
.../subaccounts/keeper/grpc_query_withdrawal_and_transfers_blocked_info.go
.../subaccounts/keeper/grpc_query_withdrawal_and_transfers_blocked_info_test.go
Implemented and tested the function to retrieve block info on withdrawals and transfers.
.../subaccounts/keeper/subaccount.go Modified internalCanUpdateSubaccounts method to include chain outage duration in logic.
.../subaccounts/types/update.go Added a new constant for chain outage duration affecting withdrawal and transfer block logic.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@lucas-dydx lucas-dydx changed the base branch from main to lucas-dydx/protocol-gate-withdrawals-after-chain-outage January 12, 2024 18:58
@lucas-dydx lucas-dydx marked this pull request as ready for review January 12, 2024 19:00
chainOutageSeenAtBlock, chainOutageExists := downtimeInfo.BlockInfo.Height, downtimeInfo.BlockInfo.Height > 0
negativeTncSubaccountSeenAtBlock, negativeTncSubaccountSeenAtBlockExists := k.GetNegativeTncSubaccountSeenAtBlock(ctx)

// Withdrawals and transfers are blocked at the
Copy link
Contributor

Choose a reason for hiding this comment

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

finish your thought 👑

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😭

negativeTncSubaccountSeenAtBlock, negativeTncSubaccountSeenAtBlockExists := k.GetNegativeTncSubaccountSeenAtBlock(ctx)

// Withdrawals and transfers are blocked at the
withdrawalsAndTransfersBlockedUntilBlock := uint32(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Blocked until block 0 means no blocking right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, essentially means withdrawals and transfers are unblocked at block 0 (not blocked)

Copy link
Contributor

@roy-dydx roy-dydx left a comment

Choose a reason for hiding this comment

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

blocktime usage looks good to me.

@lucas-dydx lucas-dydx force-pushed the lucas-dydx/protocol/feat/add-rpc-endpoint-for-gated-withdrawals branch from 7470ff8 to dab4323 Compare January 12, 2024 23:02
@lucas-dydx lucas-dydx force-pushed the lucas-dydx/protocol-gate-withdrawals-after-chain-outage branch from d4c6e40 to 0647bcd Compare January 17, 2024 21:43
@lucas-dydx lucas-dydx force-pushed the lucas-dydx/protocol/feat/add-rpc-endpoint-for-gated-withdrawals branch from 05343c5 to 7b565ff Compare January 17, 2024 22:16
Base automatically changed from lucas-dydx/protocol-gate-withdrawals-after-chain-outage to main January 18, 2024 18:05
@lucas-dydx lucas-dydx force-pushed the lucas-dydx/protocol/feat/add-rpc-endpoint-for-gated-withdrawals branch from 4e6e7da to ef56034 Compare January 18, 2024 22:35
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 10

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2c5e561 and ef56034.
Files ignored due to path filters (2)
  • protocol/x/subaccounts/types/query.pb.go is excluded by: !**/*.pb.go
  • protocol/x/subaccounts/types/query.pb.gw.go is excluded by: !**/*.pb.gw.go
Files selected for processing (11)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/query.lcd.ts (3 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/query.rpc.Query.ts (5 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/query.ts (2 hunks)
  • proto/dydxprotocol/subaccounts/query.proto (2 hunks)
  • protocol/mocks/MemClob.go (17 hunks)
  • protocol/mocks/MemClobKeeper.go (13 hunks)
  • protocol/mocks/QueryClient.go (1 hunks)
  • protocol/x/subaccounts/keeper/grpc_query_withdrawal_and_transfers_blocked_info.go (1 hunks)
  • protocol/x/subaccounts/keeper/grpc_query_withdrawal_and_transfers_blocked_info_test.go (1 hunks)
  • protocol/x/subaccounts/keeper/subaccount.go (1 hunks)
  • protocol/x/subaccounts/types/update.go (2 hunks)
Additional comments: 17
protocol/x/subaccounts/keeper/grpc_query_withdrawal_and_transfers_blocked_info.go (1)
  • 13-44: The implementation of GetWithdrawalAndTransfersBlockedInfo method seems correct. It checks for a nil request, retrieves the downtime information, and calculates the block until which withdrawals and transfers are blocked based on the existence of a chain outage or a negative TNC subaccount. The response is constructed appropriately with the relevant block information.
indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/query.lcd.ts (1)
  • 38-50: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [3-48]

The addition of the getWithdrawalAndTransfersBlockedInfo method to the LCDQueryClient class is implemented correctly. It binds the method to the class instance and defines the async function to make the appropriate GET request to the endpoint. The method signature and endpoint match the expected functionality described in the PR objectives.

proto/dydxprotocol/subaccounts/query.proto (2)
  • 26-33: The new RPC method GetWithdrawalAndTransfersBlockedInfo is defined correctly in the query.proto file. The method has the correct HTTP GET annotation and does not require any request parameters, which aligns with the expected functionality.
  • 58-68: The message QueryGetWithdrawalAndTransfersBlockedInfoResponse is defined correctly with the appropriate fields to convey the block information for withdrawal and transfer gating. The field names are clear and consistent with the domain language.
indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/query.rpc.Query.ts (2)
  • 10-21: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [4-47]

The Query interface and its implementation QueryClientImpl have been correctly updated to include the new getWithdrawalAndTransfersBlockedInfo method. The method is bound to the instance and uses the correct RPC request and response types.

  • 63-64: The createRpcQueryExtension function is correctly extended to include the getWithdrawalAndTransfersBlockedInfo method, allowing for the proper extension of the QueryClient.
protocol/x/subaccounts/types/update.go (1)
  • 127-127: The new constant WITHDRAWAL_AND_TRANSFERS_BLOCKED_AFTER_CHAIN_OUTAGE_DURATION is set to 5 minutes, which is consistent with the PR objectives. The import of the time package is necessary for this constant definition.
protocol/x/subaccounts/keeper/grpc_query_withdrawal_and_transfers_blocked_info_test.go (1)
  • 19-214: The test cases for TestQueryWithdrawalAndTransfersBlockedInfo are comprehensive and cover various scenarios, including nil requests, no negative TNC subaccount or chain outage, and the presence of either or both conditions. The setup functions and assertions are correctly implemented to validate the behavior of the GetWithdrawalAndTransfersBlockedInfo method.
indexer/packages/v4-protos/src/codegen/dydxprotocol/subaccounts/query.ts (2)
  • 54-79: The interfaces QueryGetWithdrawalAndTransfersBlockedInfoRequest and QueryGetWithdrawalAndTransfersBlockedInfoResponse are defined correctly. They match the expected structure for the query request and response types, with appropriate field names and types.
  • 282-377: The functions createBaseQueryGetWithdrawalAndTransfersBlockedInfoRequest and createBaseQueryGetWithdrawalAndTransfersBlockedInfoResponse along with their associated encode, decode, and fromPartial methods are implemented correctly. They follow the established patterns for working with Protobuf messages in TypeScript.
protocol/mocks/MemClobKeeper.go (4)
  • 98-102: The return signature of CanDeleverageSubaccount has not changed, but the mock function's implementation has been modified. Ensure that this change is intentional and correctly reflects the desired behavior of the mock.

Please verify that the changes to the mock function CanDeleverageSubaccount are intentional and correctly implemented.

  • 230-233: The return signature of IsLiquidatable has not changed, but the mock function's implementation has been modified. Ensure that this change is intentional and correctly reflects the desired behavior of the mock.

Please verify that the changes to the mock function IsLiquidatable are intentional and correctly implemented.

  • 303-309: The return signature of ProcessSingleMatch has not changed, but the mock function's implementation has been modified. Ensure that this change is intentional and correctly reflects the desired behavior of the mock.

Please verify that the changes to the mock function ProcessSingleMatch are intentional and correctly implemented.

  • 350-355: The return signature of ReplayPlaceOrder has not changed, but the mock function's implementation has been modified. Ensure that this change is intentional and correctly reflects the desired behavior of the mock.

Please verify that the changes to the mock function ReplayPlaceOrder are intentional and correctly implemented.

protocol/mocks/MemClob.go (1)
  • 177-180: The return signature of GetOperationsToReplay has not changed, but the mock function's implementation has been modified. Ensure that this change is intentional and correctly reflects the desired behavior of the mock.

Please verify that the changes to the mock function GetOperationsToReplay are intentional and correctly implemented.

protocol/x/subaccounts/keeper/subaccount.go (1)
  • 508-511: The GetDowntimeInfoFor method is now called with an additional argument, types.WITHDRAWAL_AND_TRANSFERS_BLOCKED_AFTER_CHAIN_OUTAGE_DURATION. This constant should be defined elsewhere in the codebase, and its usage here implies a change in the logic for handling chain outages.
Verification successful

The constant WITHDRAWAL_AND_TRANSFERS_BLOCKED_AFTER_CHAIN_OUTAGE_DURATION is indeed defined in the codebase, specifically in the file protocol/x/subaccounts/types/update.go, and it is set to 5 minutes. The usage of this constant is found in two places within the subaccounts module:

  1. In subaccount.go, where it is passed as an argument to the GetDowntimeInfoFor method.
  2. In grpc_query_withdrawal_and_transfers_blocked_info.go, suggesting it is also used in the context of a gRPC query related to withdrawal and transfers blocking information.

The review comment is consistent with the codebase, confirming that the internalCanUpdateSubaccounts method has been modified to include this constant as a parameter in a method call, which aligns with the PR's objective to handle withdrawal gating logic.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the constant is defined and check for its usage across the codebase.
rg 'WITHDRAWAL_AND_TRANSFERS_BLOCKED_AFTER_CHAIN_OUTAGE_DURATION' --type go

Length of output: 466

protocol/mocks/QueryClient.go (1)
  • 396-427: The new mock function GetWithdrawalAndTransfersBlockedInfo is consistent with the existing mock functions in terms of structure and parameter handling. Ensure that the actual RPC implementation matches this mock signature.

Comment on lines +32 to +35
var r1 map[subaccountstypes.SubaccountId]subaccountstypes.UpdateResult
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.ClobPairId, map[subaccountstypes.SubaccountId][]clobtypes.PendingOpenOrder) (bool, map[subaccountstypes.SubaccountId]subaccountstypes.UpdateResult)); ok {
return rf(ctx, clobPairId, subaccountOpenOrders)
}
Copy link

Choose a reason for hiding this comment

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

The return signature of AddOrderToOrderbookCollatCheck has been changed to include an error, but the actual return statement in the mock function has not been updated to reflect this change.

- return r0, r1
+ return r0, r1, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
var r1 map[subaccountstypes.SubaccountId]subaccountstypes.UpdateResult
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.ClobPairId, map[subaccountstypes.SubaccountId][]clobtypes.PendingOpenOrder) (bool, map[subaccountstypes.SubaccountId]subaccountstypes.UpdateResult)); ok {
return rf(ctx, clobPairId, subaccountOpenOrders)
}
var r1 map[subaccountstypes.SubaccountId]subaccountstypes.UpdateResult
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.ClobPairId, map[subaccountstypes.SubaccountId][]clobtypes.PendingOpenOrder) (bool, map[subaccountstypes.SubaccountId]subaccountstypes.UpdateResult, error)); ok {
return rf(ctx, clobPairId, subaccountOpenOrders)
}

Comment on lines +58 to +63
var r1 clobtypes.OrderStatus
var r2 *clobtypes.OffchainUpdates
var r3 error
if rf, ok := ret.Get(0).(func(types.Context, *clobtypes.Order, clobtypes.MemClob) (subaccountstypes.BaseQuantums, clobtypes.OrderStatus, *clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, order, memclob)
}
Copy link

Choose a reason for hiding this comment

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

The return signature of AddPreexistingStatefulOrder has been changed to include multiple return types and an error, but the actual return statement in the mock function has not been updated to reflect this change.

- return r0, r1, r2, r3
+ return r0, r1, r2, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
var r1 clobtypes.OrderStatus
var r2 *clobtypes.OffchainUpdates
var r3 error
if rf, ok := ret.Get(0).(func(types.Context, *clobtypes.Order, clobtypes.MemClob) (subaccountstypes.BaseQuantums, clobtypes.OrderStatus, *clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, order, memclob)
}
var r1 clobtypes.OrderStatus
var r2 *clobtypes.OffchainUpdates
var r3 error
if rf, ok := ret.Get(0).(func(types.Context, *clobtypes.Order, clobtypes.MemClob) (subaccountstypes.BaseQuantums, clobtypes.OrderStatus, *clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, order, memclob)
}
return r0, r1, r2, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic

Comment on lines +159 to +162
var r1 bool
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.OrderId) (clobtypes.LongTermOrderPlacement, bool)); ok {
return rf(ctx, orderId)
}
Copy link

Choose a reason for hiding this comment

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

The return signature of GetLongTermOrderPlacement has been changed to include an error, but the actual return statement in the mock function has not been updated to reflect this change.

- return r0, r1
+ return r0, r1, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
var r1 bool
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.OrderId) (clobtypes.LongTermOrderPlacement, bool)); ok {
return rf(ctx, orderId)
}
var r1 bool
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.OrderId) (clobtypes.LongTermOrderPlacement, bool)); ok {
r0, r1 := rf(ctx, orderId)
return r0, r1, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic
}

Comment on lines +275 to +278
var r1 *big.Int
if rf, ok := ret.Get(0).(func(types.Context, subaccountstypes.SubaccountId, uint32, *big.Int, bool) ([]clobtypes.MatchPerpetualDeleveraging_Fill, *big.Int)); ok {
return rf(ctx, liquidatedSubaccountId, perpetualId, deltaQuantumsTotal, isFinalSettlement)
}
Copy link

Choose a reason for hiding this comment

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

The return signature of OffsetSubaccountPerpetualPosition has been changed to include an error, but the actual return statement in the mock function has not been updated to reflect this change.

- return r0, r1
+ return r0, r1, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
var r1 *big.Int
if rf, ok := ret.Get(0).(func(types.Context, subaccountstypes.SubaccountId, uint32, *big.Int, bool) ([]clobtypes.MatchPerpetualDeleveraging_Fill, *big.Int)); ok {
return rf(ctx, liquidatedSubaccountId, perpetualId, deltaQuantumsTotal, isFinalSettlement)
}
var r1 *big.Int
if rf, ok := ret.Get(0).(func(types.Context, subaccountstypes.SubaccountId, uint32, *big.Int, bool) ([]clobtypes.MatchPerpetualDeleveraging_Fill, *big.Int, error)); ok {
return rf(ctx, liquidatedSubaccountId, perpetualId, deltaQuantumsTotal, isFinalSettlement)
}

Comment on lines +28 to +31
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, *clobtypes.MsgCancelOrder) (*clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, msgCancelOrder)
}
Copy link

Choose a reason for hiding this comment

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

The return signature of CancelOrder has been changed to include an error, but the actual return statement in the mock function has not been updated to reflect this change.

- return r0, r1
+ return r0, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, *clobtypes.MsgCancelOrder) (*clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, msgCancelOrder)
}
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, *clobtypes.MsgCancelOrder) (*clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, msgCancelOrder), nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic
}

Comment on lines +73 to +76
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, subaccountstypes.SubaccountId, uint32, *big.Int, bool) (*big.Int, error)); ok {
return rf(ctx, subaccountId, perpetualId, deltaQuantums, isFinalSettlement)
}
Copy link

Choose a reason for hiding this comment

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

The return signature of DeleverageSubaccount has been changed to include an error, but the actual return statement in the mock function has not been updated to reflect this change.

- return r0, r1
+ return r0, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, subaccountstypes.SubaccountId, uint32, *big.Int, bool) (*big.Int, error)); ok {
return rf(ctx, subaccountId, perpetualId, deltaQuantums, isFinalSettlement)
}
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, subaccountstypes.SubaccountId, uint32, *big.Int, bool) (*big.Int, error)); ok {
return rf(ctx, subaccountId, perpetualId, deltaQuantums, isFinalSettlement), nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic
}

Comment on lines +267 to +270
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.ClobPair, perpetualstypes.GetPricePremiumParams) (int32, error)); ok {
return rf(ctx, clobPair, params)
}
Copy link

Choose a reason for hiding this comment

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

The return signature of GetPricePremium has been changed to include an error, but the actual return statement in the mock function has not been updated to reflect this change.

- return r0, r1
+ return r0, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.ClobPair, perpetualstypes.GetPricePremiumParams) (int32, error)); ok {
return rf(ctx, clobPair, params)
}
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.ClobPair, perpetualstypes.GetPricePremiumParams) (int32, error)); ok {
return rf(ctx, clobPair, params), nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic
}

Comment on lines +291 to +294
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.ClobPairId, subaccountstypes.SubaccountId, clobtypes.Order_Side) ([]clobtypes.Order, error)); ok {
return rf(ctx, clobPairId, subaccountId, side)
}
Copy link

Choose a reason for hiding this comment

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

The return signature of GetSubaccountOrders has been changed to include an error, but the actual return statement in the mock function has not been updated to reflect this change.

- return r0, r1
+ return r0, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.ClobPairId, subaccountstypes.SubaccountId, clobtypes.Order_Side) ([]clobtypes.Order, error)); ok {
return rf(ctx, clobPairId, subaccountId, side)
}
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.ClobPairId, subaccountstypes.SubaccountId, clobtypes.Order_Side) ([]clobtypes.Order, error)); ok {
return rf(ctx, clobPairId, subaccountId, side), nil
}

Comment on lines +322 to +327
var r1 clobtypes.OrderStatus
var r2 *clobtypes.OffchainUpdates
var r3 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.Order) (subaccountstypes.BaseQuantums, clobtypes.OrderStatus, *clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, order)
}
Copy link

Choose a reason for hiding this comment

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

The return signature of PlaceOrder has been changed to include an error, but the actual return statement in the mock function has not been updated to reflect this change.

- return r0, r1, r2, r3
+ return r0, r1, r2, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
var r1 clobtypes.OrderStatus
var r2 *clobtypes.OffchainUpdates
var r3 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.Order) (subaccountstypes.BaseQuantums, clobtypes.OrderStatus, *clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, order)
}
var r1 clobtypes.OrderStatus
var r2 *clobtypes.OffchainUpdates
var r3 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.Order) (subaccountstypes.BaseQuantums, clobtypes.OrderStatus, *clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, order)
}
// Assuming default nil error for the mock, adjust as needed based on the mock's logic
return r0, r1, r2, nil

Comment on lines +362 to +367
var r1 clobtypes.OrderStatus
var r2 *clobtypes.OffchainUpdates
var r3 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.LiquidationOrder) (subaccountstypes.BaseQuantums, clobtypes.OrderStatus, *clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, liquidationOrder)
}
Copy link

Choose a reason for hiding this comment

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

The return signature of PlacePerpetualLiquidation has been changed to include an error, but the actual return statement in the mock function has not been updated to reflect this change.

- return r0, r1, r2, r3
+ return r0, r1, r2, nil // Assuming default nil error for the mock, adjust as needed based on the mock's logic

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
var r1 clobtypes.OrderStatus
var r2 *clobtypes.OffchainUpdates
var r3 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.LiquidationOrder) (subaccountstypes.BaseQuantums, clobtypes.OrderStatus, *clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, liquidationOrder)
}
var r1 clobtypes.OrderStatus
var r2 *clobtypes.OffchainUpdates
var r3 error
if rf, ok := ret.Get(0).(func(types.Context, clobtypes.LiquidationOrder) (subaccountstypes.BaseQuantums, clobtypes.OrderStatus, *clobtypes.OffchainUpdates, error)); ok {
return rf(ctx, liquidationOrder)
}
// Assuming default nil error for the mock, adjust as needed based on the mock's logic
return r0, r1, r2, nil

@lucas-dydx lucas-dydx merged commit 9e091fd into main Jan 19, 2024
33 checks passed
@lucas-dydx lucas-dydx deleted the lucas-dydx/protocol/feat/add-rpc-endpoint-for-gated-withdrawals branch January 19, 2024 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants