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

[CT-1160] add relevant protos to dydxprotocol #2162

Merged
merged 5 commits into from
Sep 15, 2024
Merged

Conversation

jayy04
Copy link
Contributor

@jayy04 jayy04 commented Aug 27, 2024

Changelist

[Describe or list the changes made in this PR]

Test Plan

[Describe how this PR was tested (if applicable)]

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.

Summary by CodeRabbit

  • New Features

    • Introduced a new AuthenticatorData message for enhanced account management.
    • Added a querying service for account authenticators, enabling retrieval of specific and all authenticators associated with an account.
    • Implemented account management functionalities for adding and removing authenticators.
  • Enhancements

    • Expanded data structures for better organization and management of account authenticators.
    • Established a standardized interface for managing and validating accounts with various authenticator types.

@jayy04 jayy04 requested a review from a team as a code owner August 27, 2024 15:34
Copy link

linear bot commented Aug 27, 2024

Copy link
Contributor

coderabbitai bot commented Aug 27, 2024

Walkthrough

The changes introduce new protocol buffer messages and services within the dydxprotocol.accountplus package. Key updates include the addition of functionalities for managing account authenticators, enabling their addition, removal, and querying. These modifications enhance the structure and capabilities of account management within the protocol.

Changes

Files Change Summary
proto/dydxprotocol/accountplus/genesis.proto, proto/dydxprotocol/accountplus/models.proto New message types AuthenticatorData and AccountAuthenticator added; modifications to GenesisState to include new fields for tracking authenticators.
proto/dydxprotocol/accountplus/query.proto, proto/dydxprotocol/accountplus/tx.proto New Query service with methods for retrieving authenticators; new Msg service for adding/removing authenticators, with relevant request/response messages.
indexer/packages/v4-protos/src/codegen/dydxprotocol/* Updates to client implementations and exports to integrate the new accountplus functionalities into the existing framework.
indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts, indexer/packages/v4-protos/src/codegen/google/bundle.ts Reorganization of import statements and adjustments to export structures for better clarity and modularity.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant AuthenticatorService
    participant AccountManager

    Client->>AuthenticatorService: AddAuthenticator(request)
    AuthenticatorService->>AccountManager: Process addition
    AccountManager-->>AuthenticatorService: Confirm addition
    AuthenticatorService-->>Client: Respond with success

    Client->>AuthenticatorService: RemoveAuthenticator(request)
    AuthenticatorService->>AccountManager: Process removal
    AccountManager-->>AuthenticatorService: Confirm removal
    AuthenticatorService-->>Client: Respond with success

    Client->>AuthenticatorService: GetAuthenticators(request)
    AuthenticatorService->>AccountManager: Fetch all authenticators
    AccountManager-->>AuthenticatorService: Return list of authenticators
    AuthenticatorService-->>Client: Respond with list
Loading

Poem

🐇 In the meadow where accounts play,
Authenticators join the fray.
With new IDs and types galore,
Manage them all, oh what a score!
Hopping through updates, we cheer and sing,
In the world of proto, let the fun begin! 🎉


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 testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 testing code 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 and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
Early access features: disabled

We are currently testing the following features in early access:

  • Anthropic claude-3-5-sonnet for code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues on the discussion post.

Copy link
Contributor

@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.

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 260a66a and 3b90c9d.

Files ignored due to path filters (5)
  • protocol/x/accountplus/types/genesis.pb.go is excluded by !**/*.pb.go
  • protocol/x/accountplus/types/models.pb.go is excluded by !**/*.pb.go
  • protocol/x/accountplus/types/query.pb.go is excluded by !**/*.pb.go
  • protocol/x/accountplus/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
  • protocol/x/accountplus/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (4)
  • proto/dydxprotocol/accountplus/genesis.proto (1 hunks)
  • proto/dydxprotocol/accountplus/models.proto (1 hunks)
  • proto/dydxprotocol/accountplus/query.proto (1 hunks)
  • proto/dydxprotocol/accountplus/tx.proto (1 hunks)
Additional context used
buf
proto/dydxprotocol/accountplus/models.proto

2-2: Files with package "dydxprotocol.accountplus" must be within a directory "dydxprotocol/accountplus" relative to root but were in directory "proto/dydxprotocol/accountplus".

(PACKAGE_DIRECTORY_MATCH)

proto/dydxprotocol/accountplus/query.proto

4-4: import "google/api/annotations.proto": file does not exist

(COMPILE)

proto/dydxprotocol/accountplus/tx.proto

4-4: import "cosmos/msg/v1/msg.proto": file does not exist

(COMPILE)

Additional comments not posted (11)
proto/dydxprotocol/accountplus/models.proto (1)

1-22: LGTM!

The AccountAuthenticator message is well-defined and follows protobuf conventions. The comments provide clear explanations of the fields and their purposes.

The code changes are approved.

Tools
buf

2-2: Files with package "dydxprotocol.accountplus" must be within a directory "dydxprotocol/accountplus" relative to root but were in directory "proto/dydxprotocol/accountplus".

(PACKAGE_DIRECTORY_MATCH)

proto/dydxprotocol/accountplus/genesis.proto (2)

10-21: LGTM!

The AuthenticatorData message is well-defined and follows protobuf conventions. The comments provide clear explanations of the fields and their purposes.

The code changes are approved.


27-33: LGTM!

The modifications to the GenesisState message enhance the structure of the protocol's genesis state. The comments provide clear explanations of the new fields and their purposes.

The code changes are approved.

proto/dydxprotocol/accountplus/query.proto (3)

9-23: LGTM!

The service definition is well-structured and follows gRPC conventions. The comments provide clear explanations of the RPC methods and their purposes.

The code changes are approved.


26-32: LGTM!

The message definitions are well-structured and follow protobuf conventions. The comments provide clear explanations of the fields and their purposes.

The code changes are approved.


34-42: LGTM!

The message definitions are well-structured and follow protobuf conventions. The comments provide clear explanations of the fields and their purposes.

The code changes are approved.

proto/dydxprotocol/accountplus/tx.proto (5)

1-2: LGTM!

The syntax and package declarations are correct.

The code changes are approved.


7-7: LGTM!

The go_package option declaration is correct.

The code changes are approved.


9-17: LGTM!

The service definition and RPC methods are correctly defined.

The code changes are approved.


19-51: LGTM!

The message definitions are correctly defined.

The code changes are approved.


4-5: Verify the existence of the imported file.

The import cosmos/msg/v1/msg.proto does not exist according to the static analysis tool.

Run the following script to verify the existence of the imported file:

Tools
buf

4-4: import "cosmos/msg/v1/msg.proto": file does not exist

(COMPILE)

proto/dydxprotocol/accountplus/models.proto Show resolved Hide resolved
proto/dydxprotocol/accountplus/query.proto Show resolved Hide resolved
Copy link
Contributor

@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.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3b90c9d and 0c4f80a.

Files selected for processing (2)
  • protocol/app/testdata/default_genesis_state.json (1 hunks)
  • protocol/scripts/genesis/sample_pregenesis.json (1 hunks)
Additional comments not posted (4)
protocol/app/testdata/default_genesis_state.json (2)

133-133: LGTM!

The addition of the next_authenticator_id field is appropriate and correctly initialized with "0".

The code changes are approved.


134-134: LGTM!

The addition of the authenticator_data field is appropriate and correctly initialized as an empty array.

The code changes are approved.

protocol/scripts/genesis/sample_pregenesis.json (2)

641-641: Addition of authenticator_data field.

The authenticator_data field is added as an empty array. Ensure that this field is populated correctly during runtime and that its structure is well-defined in the relevant documentation.

Verify that the authenticator_data field is correctly populated and utilized in the codebase.


642-642: Addition of next_authenticator_id field.

The next_authenticator_id field is added with an initial value of "0". Ensure that this field is incremented correctly during runtime and that its usage is well-documented.

Verify that the next_authenticator_id field is correctly incremented and utilized in the codebase.

Copy link
Contributor

@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.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0c4f80a and fe869a3.

Files selected for processing (13)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts (4 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/models.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (2 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts
Additional comments not posted (69)
indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts (3)

6-14: LGTM!

The constructor is correctly initializing the req property and binding methods.

The code changes are approved.


18-21: LGTM!

The method is correctly constructing the endpoint URL and making a GET request.

The code changes are approved.


25-28: LGTM!

The method is correctly constructing the endpoint URL and making a GET request.

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts (1)

8-8: LGTM!

The addition of the accountplus property enhances the functionality of the dydxprotocol object. The dynamic import pattern is consistent with the existing code.

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts (4)

6-12: LGTM!

The interface is correctly defining the methods for adding and removing authenticators.

The code changes are approved.


16-20: LGTM!

The constructor is correctly initializing the rpc property and binding methods.

The code changes are approved.


22-26: LGTM!

The method is correctly encoding the request, making an RPC request, and decoding the response.

The code changes are approved.


28-32: LGTM!

The method is correctly encoding the request, making an RPC request, and decoding the response.

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts (1)

12-14: LGTM!

The addition of the accountplus property enhances the functionality of the createLCDClient by integrating additional capabilities related to the accountplus module. The asynchronous import ensures that the module is loaded only when needed, which is efficient.

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts (1)

1-49: LGTM!

The file is well-structured and provides a clear implementation of the gRPC querier service for the accountplus module. The methods for querying authenticators are correctly implemented, and the createRpcQueryExtension function ensures that the extension can be easily integrated with the QueryClient.

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts (1)

12-12: LGTM!

The addition of the accountplus property enhances the functionality of the createRPCQueryClient by integrating an additional RPC query extension related to the accountplus feature. The dynamic import ensures that the module is loaded only when needed, which is efficient.

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/models.ts (6)

9-26: LGTM!

The AccountAuthenticator interface is well-defined with necessary fields and appropriate comments.

The code changes are approved.


34-51: LGTM!

The AccountAuthenticatorSDKType interface is well-defined with necessary fields and appropriate comments.

The code changes are approved.


54-59: LGTM!

The createBaseAccountAuthenticator function correctly initializes the fields of AccountAuthenticator.

The code changes are approved.


62-77: LGTM!

The AccountAuthenticator.encode function correctly encodes the fields of AccountAuthenticator.

The code changes are approved.


79-107: LGTM!

The AccountAuthenticator.decode function correctly decodes the fields of AccountAuthenticator.

The code changes are approved.


109-114: LGTM!

The AccountAuthenticator.fromPartial function correctly initializes the fields of AccountAuthenticator from a partial object.

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts (12)

11-19: LGTM!

The AuthenticatorData interface is well-defined with necessary fields and appropriate comments.

The code changes are approved.


27-35: LGTM!

The AuthenticatorDataSDKType interface is well-defined with necessary fields and appropriate comments.

The code changes are approved.


40-49: LGTM!

The GenesisState interface is well-defined with necessary fields and appropriate comments.

The code changes are approved.


54-63: LGTM!

The GenesisStateSDKType interface is well-defined with necessary fields and appropriate comments.

The code changes are approved.


66-70: LGTM!

The createBaseAuthenticatorData function correctly initializes the fields of AuthenticatorData.

The code changes are approved.


73-83: LGTM!

The AuthenticatorData.encode function correctly encodes the fields of AuthenticatorData.

The code changes are approved.


86-109: LGTM!

The AuthenticatorData.decode function correctly decodes the fields of AuthenticatorData.

The code changes are approved.


112-116: LGTM!

The AuthenticatorData.fromPartial function correctly initializes the fields of AuthenticatorData from a partial object.

The code changes are approved.


120-125: LGTM!

The createBaseGenesisState function correctly initializes the fields of GenesisState.

The code changes are approved.


Line range hint 128-142: LGTM!

The GenesisState.encode function correctly encodes the fields of GenesisState.

The code changes are approved.


Line range hint 145-165: LGTM!

The GenesisState.decode function correctly decodes the fields of GenesisState.

The code changes are approved.


178-180: LGTM!

The GenesisState.fromPartial function correctly initializes the fields of GenesisState from a partial object.

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts (9)

6-8: LGTM!

The GetAuthenticatorsRequest interface is well-defined with necessary fields and appropriate comments.

The code changes are approved.


18-19: LGTM!

The GetAuthenticatorsResponse interface is well-defined with necessary fields and appropriate comments.

The code changes are approved.


28-30: LGTM!

The GetAuthenticatorRequest interface is well-defined with necessary fields and appropriate comments.

The code changes are approved.


40-41: LGTM!

The GetAuthenticatorResponse interface is well-defined with necessary fields and appropriate comments.

The code changes are approved.


49-52: LGTM!

The createBaseGetAuthenticatorsRequest function correctly initializes the fields of GetAuthenticatorsRequest.

The code changes are approved.


56-62: LGTM!

The GetAuthenticatorsRequest.encode function correctly encodes the fields of GetAuthenticatorsRequest.

The code changes are approved.


64-83: LGTM!

The GetAuthenticatorsRequest.decode function correctly decodes the fields of GetAuthenticatorsRequest.

The code changes are approved.


86-90: LGTM!

The GetAuthenticatorsRequest.fromPartial function correctly initializes the fields of GetAuthenticatorsRequest from a partial object.

The code changes are approved.


94-97: LGTM!

The createBaseGetAuthenticatorsResponse function correctly initializes the fields of GetAuthenticatorsResponse.

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts (26)

5-9: LGTM!

The MsgAddAuthenticator interface is correctly defined.

The code changes are approved.


12-16: LGTM!

The MsgAddAuthenticatorSDKType interface is correctly defined.

The code changes are approved.


19-22: LGTM!

The MsgAddAuthenticatorResponse interface is correctly defined.

The code changes are approved.


25-28: LGTM!

The MsgAddAuthenticatorResponseSDKType interface is correctly defined.

The code changes are approved.


34-37: LGTM!

The MsgRemoveAuthenticator interface is correctly defined.

The code changes are approved.


43-45: LGTM!

The MsgRemoveAuthenticatorSDKType interface is correctly defined.

The code changes are approved.


96-101: LGTM!

The createBaseMsgAddAuthenticator function is correctly implemented.

The code changes are approved.


104-119: LGTM!

The MsgAddAuthenticator.encode function is correctly implemented.

The code changes are approved.


121-149: LGTM!

The MsgAddAuthenticator.decode function is correctly implemented.

The code changes are approved.


151-157: LGTM!

The MsgAddAuthenticator.fromPartial function is correctly implemented.

The code changes are approved.


161-164: LGTM!

The createBaseMsgAddAuthenticatorResponse function is correctly implemented.

The code changes are approved.


167-174: LGTM!

The MsgAddAuthenticatorResponse.encode function is correctly implemented.

The code changes are approved.


176-196: LGTM!

The MsgAddAuthenticatorResponse.decode function is correctly implemented.

The code changes are approved.


198-202: LGTM!

The MsgAddAuthenticatorResponse.fromPartial function is correctly implemented.

The code changes are approved.


206-210: LGTM!

The createBaseMsgRemoveAuthenticator function is correctly implemented.

The code changes are approved.


213-224: LGTM!

The MsgRemoveAuthenticator.encode function is correctly implemented.

The code changes are approved.


226-250: LGTM!

The MsgRemoveAuthenticator.decode function is correctly implemented.

The code changes are approved.


252-257: LGTM!

The MsgRemoveAuthenticator.fromPartial function is correctly implemented.

The code changes are approved.


261-264: LGTM!

The createBaseMsgRemoveAuthenticatorResponse function is correctly implemented.

The code changes are approved.


267-274: LGTM!

The MsgRemoveAuthenticatorResponse.encode function is correctly implemented.

The code changes are approved.


276-296: LGTM!

The MsgRemoveAuthenticatorResponse.decode function is correctly implemented.

The code changes are approved.


298-302: LGTM!

The MsgRemoveAuthenticatorResponse.fromPartial function is correctly implemented.

The code changes are approved.


306-309: LGTM!

The createBaseTxExtension function is correctly implemented.

The code changes are approved.


312-322: LGTM!

The TxExtension.encode function is correctly implemented.

The code changes are approved.


324-352: LGTM!

The TxExtension.decode function is correctly implemented.

The code changes are approved.


355-359: LGTM!

The TxExtension.fromPartial function is correctly implemented.

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (5)

3-5: LGTM!

The import statements for accountplus are correctly defined.

The code changes are approved.


6-9: LGTM!

The import statements for affiliates are correctly defined.

The code changes are approved.


10-13: LGTM!

The import statements for assets are correctly defined.

The code changes are approved.


14-18: LGTM!

The import statements for blocktime are correctly defined.

The code changes are approved.


19-24: LGTM!

The import statements for bridge are correctly defined.

The code changes are approved.

Copy link
Contributor

@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.

Actionable comments posted: 3

Outside diff range, codebase verification and nitpick comments (2)
indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts (2)

85-85: Consider using a type alias instead of an empty interface.

An empty interface is equivalent to {}. For better readability, consider using a type alias instead:

type MsgSetActiveStateResponse = Record<string, never>;
Tools
Biome

[error] 85-85: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


88-88: Consider using a type alias instead of an empty interface.

An empty interface is equivalent to {}. For better readability, consider using a type alias instead:

type MsgSetActiveStateResponseSDKType = Record<string, never>;
Tools
Biome

[error] 88-88: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fe869a3 and a1a3263.

Files ignored due to path filters (5)
  • protocol/x/accountplus/types/genesis.pb.go is excluded by !**/*.pb.go
  • protocol/x/accountplus/types/params.pb.go is excluded by !**/*.pb.go
  • protocol/x/accountplus/types/query.pb.go is excluded by !**/*.pb.go
  • protocol/x/accountplus/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
  • protocol/x/accountplus/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (17)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts (4 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/params.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (2 hunks)
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts (1 hunks)
  • proto/dydxprotocol/accountplus/genesis.proto (1 hunks)
  • proto/dydxprotocol/accountplus/models.proto (1 hunks)
  • proto/dydxprotocol/accountplus/params.proto (1 hunks)
  • proto/dydxprotocol/accountplus/query.proto (1 hunks)
  • proto/dydxprotocol/accountplus/tx.proto (1 hunks)
  • protocol/app/testdata/default_genesis_state.json (1 hunks)
  • protocol/scripts/genesis/sample_pregenesis.json (1 hunks)
Files skipped from review as they are similar to previous changes (8)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts
  • protocol/app/testdata/default_genesis_state.json
  • protocol/scripts/genesis/sample_pregenesis.json
Additional context used
buf
proto/dydxprotocol/accountplus/params.proto

4-4: import "gogoproto/gogo.proto": file does not exist

(COMPILE)

proto/dydxprotocol/accountplus/models.proto

2-2: Files with package "dydxprotocol.accountplus" must be within a directory "dydxprotocol/accountplus" relative to root but were in directory "proto/dydxprotocol/accountplus".

(PACKAGE_DIRECTORY_MATCH)

proto/dydxprotocol/accountplus/query.proto

4-4: import "gogoproto/gogo.proto": file does not exist

(COMPILE)

proto/dydxprotocol/accountplus/tx.proto

4-4: import "cosmos/msg/v1/msg.proto": file does not exist

(COMPILE)

Biome
indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts

[error] 7-7: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 10-10: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts

[error] 85-85: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 88-88: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

Additional comments not posted (32)
proto/dydxprotocol/accountplus/params.proto (1)

4-4: Verify the existence of the imported file.

The static analysis tool buf reports that the imported file gogoproto/gogo.proto does not exist.

Run the following script to verify the existence of the imported file:

Tools
buf

4-4: import "gogoproto/gogo.proto": file does not exist

(COMPILE)

proto/dydxprotocol/accountplus/models.proto (1)

9-23: LGTM!

The AccountAuthenticator message definition looks good. The comments provide a clear explanation of the message and its fields.

proto/dydxprotocol/accountplus/genesis.proto (4)

6-6: LGTM!

The import statement is necessary to use the message types defined in the models.proto file.


14-22: LGTM!

The AuthenticatorData message is a well-defined message type that enhances the structure of the protocol's genesis state by allowing for a more organized representation of accounts and their associated authenticators.


32-32: LGTM!

The next_authenticator_id field is a useful addition to the GenesisState message as it helps in managing the authenticator IDs.


36-37: LGTM!

The authenticator_data field is a useful addition to the GenesisState message as it allows for a more organized representation of accounts and their associated authenticators within the genesis state.

indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/params.ts (1)

1-67: LGTM!

The code segment follows the protocol buffer style guide and naming conventions. It is well-structured, modular, and provides clear and concise documentation for the parameters. The encoding, decoding, and creation of Params objects are handled correctly.

proto/dydxprotocol/accountplus/query.proto (2)

12-31: LGTM!

The Query service definition looks good and follows the standard practices for defining gRPC services in proto files.


33-59: LGTM!

The request and response message definitions look good and follow the best practices for defining protocol buffer messages.

proto/dydxprotocol/accountplus/tx.proto (8)

10-21: LGTM!

The Msg service definition looks good:

  • The service defines 3 RPC methods for managing account authenticators.
  • Each RPC method has a request and response message type defined.
  • The service definition follows the protocol buffer style guide.

The code changes are approved.


24-31: LGTM!

The MsgAddAuthenticator message definition looks good:

  • The message has 3 fields for specifying the sender, authenticator type, and data.
  • The message has amino.name and cosmos.msg.v1.signer options set correctly.
  • The message definition follows the protocol buffer style guide.

The code changes are approved.


33-34: LGTM!

The MsgAddAuthenticatorResponse message definition looks good:

  • The message has 1 field for indicating the success status of the operation.
  • The message definition follows the protocol buffer style guide.

The code changes are approved.


38-44: LGTM!

The MsgRemoveAuthenticator message definition looks good:

  • The message has 2 fields for specifying the sender and the ID of the authenticator to remove.
  • The message has amino.name and cosmos.msg.v1.signer options set correctly.
  • The message definition follows the protocol buffer style guide.

The code changes are approved.


46-48: LGTM!

The MsgRemoveAuthenticatorResponse message definition looks good:

  • The message has 1 field for indicating the success status of the operation.
  • The message definition follows the protocol buffer style guide.

The code changes are approved.


51-57: LGTM!

The MsgSetActiveState message definition looks good:

  • The message has 2 fields for specifying the sender and the active state.
  • The message has amino.name and cosmos.msg.v1.signer options set correctly.
  • The message definition follows the protocol buffer style guide.

The code changes are approved.


59-60: LGTM!

The MsgSetActiveStateResponse message definition looks good:

  • The message has no fields, which is acceptable for a response message that doesn't need to convey any information.
  • The message definition follows the protocol buffer style guide.

The code changes are approved.


64-68: LGTM!

The TxExtension message definition looks good:

  • The message has 1 repeated field for holding the IDs of the selected authenticators.
  • The field type uint64 is appropriate for representing authenticator IDs.
  • The message definition follows the protocol buffer style guide.

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts (6)

12-21: LGTM!

The AuthenticatorData interface is well-defined and serves the purpose of storing account authenticators data.


40-54: LGTM!

The modifications to the GenesisState interface are appropriate and enhance the state management of accounts by allowing the storage of multiple authenticators per account and tracking the next authenticator ID.


73-78: LGTM!

The createBaseAuthenticatorData function is correctly implemented and initializes the AuthenticatorData object with default values.


81-91: LGTM!

The AuthenticatorData.encode function correctly encodes the address and authenticators fields of the AuthenticatorData message.


93-117: LGTM!

The AuthenticatorData.decode function correctly decodes the address and authenticators fields of the AuthenticatorData message.


119-124: LGTM!

The AuthenticatorData.fromPartial function correctly initializes the address and authenticators fields of the AuthenticatorData message from the partial object.

indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts (1)

25-28: LGTM!

The code changes are approved.

indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts (8)

1-2: LGTM!

The imports are necessary and look good.


5-16: LGTM!

The MsgAddAuthenticator interface and its SDK type are defined correctly.


19-28: LGTM!

The MsgAddAuthenticatorResponse interface and its SDK type are defined correctly.


34-46: LGTM!

The MsgRemoveAuthenticator interface and its SDK type are defined correctly.


52-70: LGTM!

The MsgRemoveAuthenticatorResponse interface and its SDK type are defined correctly.


73-82: LGTM!

The MsgSetActiveState interface and its SDK type are defined correctly.


94-112: LGTM!

The TxExtension interface and its SDK type are defined correctly.


114-468: LGTM!

The encoding, decoding, and utility functions for the defined interfaces are implemented correctly and follow the protocol buffer conventions.

syntax = "proto3";
package dydxprotocol.accountplus;

import "cosmos/msg/v1/msg.proto";
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix the missing import cosmos/msg/v1/msg.proto.

The static analysis tool buf indicates that the import cosmos/msg/v1/msg.proto does not exist, which will cause compilation errors.

Please check if the import path is correct. If the file exists in the repository, ensure that the path is specified relative to the root of the repository.

Do you want me to help find the correct import path or open a GitHub issue to track this problem?

Tools
buf

4-4: import "cosmos/msg/v1/msg.proto": file does not exist

(COMPILE)

export interface QueryParamsRequest {}
/** QueryParamsRequest is request type for the Query/Params RPC method. */

export interface QueryParamsRequestSDKType {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a type alias instead of an empty interface.

An empty interface is equivalent to {} and serves no purpose.

Use a type alias instead:

-export interface QueryParamsRequestSDKType {}
+export type QueryParamsRequestSDKType = Record<string, never>;
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export interface QueryParamsRequestSDKType {}
export type QueryParamsRequestSDKType = Record<string, never>;
Tools
Biome

[error] 10-10: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

import { DeepPartial, Long } from "../../helpers";
/** QueryParamsRequest is request type for the Query/Params RPC method. */

export interface QueryParamsRequest {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a type alias instead of an empty interface.

An empty interface is equivalent to {} and serves no purpose.

Use a type alias instead:

-export interface QueryParamsRequest {}
+export type QueryParamsRequest = Record<string, never>;
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export interface QueryParamsRequest {}
export type QueryParamsRequest = Record<string, never>;
Tools
Biome

[error] 7-7: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

@jayy04 jayy04 merged commit cbd23b1 into main Sep 15, 2024
39 checks passed
@jayy04 jayy04 deleted the jy/smart-account-proto branch September 15, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants