Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add megavault operator params and update message #2259

Merged
merged 4 commits into from
Sep 16, 2024
Merged

add megavault operator params and update message #2259

merged 4 commits into from
Sep 16, 2024

Conversation

tqin7
Copy link
Contributor

@tqin7 tqin7 commented Sep 16, 2024

Changelist

add OperatorParams and MsgUpdateOperatorParams

Test Plan

  • unit tests
  • future integration test on overall megavault flow

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

Release Notes

  • New Features

    • Introduced operatorParams for enhanced vault configuration.
    • Added functionality to update operator parameters via the messaging service.
  • Improvements

    • Enhanced structured handling for operator-specific data within vault parameters.
    • Improved initialization and exportation of operator parameters in the vault's genesis state.
    • Added support for operator-specific settings in the genesis configuration.
  • Testing Enhancements

    • Expanded test coverage for operator parameter management and validation scenarios.

These updates improve the flexibility and robustness of vault management, allowing for better operator configuration and error handling.

@tqin7 tqin7 requested a review from a team as a code owner September 16, 2024 13:58
Copy link

linear bot commented Sep 16, 2024

Copy link
Contributor

coderabbitai bot commented Sep 16, 2024

Walkthrough

The changes introduce enhancements to the vault system's management of operator parameters. New interfaces and methods are added to facilitate the encoding, decoding, and updating of operator parameters within the genesis state and transaction messages. Additionally, JSON structures are updated to accommodate these new parameters, supporting future extensibility in operator configurations.

Changes

Files Change Summary
indexer/packages/v4-protos/..., params.ts, tx.rpc.msg.ts, tx.ts Added operatorParams to GenesisState and new interfaces for OperatorParams, including encoding/decoding logic and RPC methods for updating operator parameters.
proto/dydxprotocol/vault/..., params.proto, tx.proto Introduced OperatorParams message and added UpdateOperatorParams RPC method for managing operator configurations.
protocol/app/testdata/default_genesis_state.json, sample_pregenesis.json, testutil/constants/genesis.go Added "operator_params" key initialized with an operator address to support operator configurations.
protocol/x/vault/genesis.go Implemented functionality for managing operator parameters in genesis initialization and export.
protocol/app/msgs/all_msgs.go, internal_msgs.go, internal_msgs_test.go Introduced message types for MsgUpdateOperatorParams and its response to handle operator parameter updates.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MsgClientImpl
    participant Keeper
    participant Vault

    User->>MsgClientImpl: updateOperatorParams(request)
    MsgClientImpl->>Keeper: SetOperatorParams(params)
    Keeper-->>Vault: Update operator parameters
    Vault-->>Keeper: Confirmation
    Keeper-->>MsgClientImpl: Success response
    MsgClientImpl-->>User: Confirmation of update
Loading

Poem

🐇 In the vault where treasures gleam,
New parameters now take their dream.
Operators dance with data in hand,
Configurations grow, oh so grand!
With tests to guard and methods to call,
Our rabbit code hops, standing tall! 🌟


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c8479f1 and 005b931.

Files selected for processing (2)
  • protocol/x/vault/types/genesis.go (1 hunks)
  • protocol/x/vault/types/params.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • protocol/x/vault/types/params.go
Additional comments not posted (1)
protocol/x/vault/types/genesis.go (1)

7-7: LGTM!

The addition of the OperatorParams field to the GenesisState struct is a valid change that aligns with the PR objective of introducing new components related to the megavault functionality. The use of the DefaultOperatorParams() function ensures that the field is properly initialized with default values.


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>, please review it.
    -- 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 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.

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

Outside diff range and nitpick comments (1)
proto/dydxprotocol/vault/genesis.proto (1)

24-25: LGTM!

The addition of the OperatorParams field to the GenesisState message aligns with the PR objective of introducing new components related to the megavault functionality. The non-nullable annotation ensures that the operator parameters are always present in the genesis state.

To ensure backward compatibility, consider the following:

  • Provide a default value for the OperatorParams field in case it is not explicitly set during the genesis state initialization.
  • Implement a migration strategy to handle the transition from the old genesis state format to the new one that includes the OperatorParams field.
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1c7884e and 52bff17.

Files ignored due to path filters (3)
  • protocol/x/vault/types/genesis.pb.go is excluded by !**/*.pb.go
  • protocol/x/vault/types/params.pb.go is excluded by !**/*.pb.go
  • protocol/x/vault/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (20)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts (7 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts (2 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.rpc.msg.ts (4 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts (3 hunks)
  • proto/dydxprotocol/vault/genesis.proto (1 hunks)
  • proto/dydxprotocol/vault/params.proto (2 hunks)
  • proto/dydxprotocol/vault/tx.proto (2 hunks)
  • protocol/app/testdata/default_genesis_state.json (1 hunks)
  • protocol/scripts/genesis/sample_pregenesis.json (1 hunks)
  • protocol/testutil/constants/genesis.go (1 hunks)
  • protocol/x/vault/genesis.go (3 hunks)
  • protocol/x/vault/keeper/msg_server_update_operator_params.go (1 hunks)
  • protocol/x/vault/keeper/msg_server_update_operator_params_test.go (1 hunks)
  • protocol/x/vault/keeper/params.go (1 hunks)
  • protocol/x/vault/keeper/params_test.go (1 hunks)
  • protocol/x/vault/types/errors.go (1 hunks)
  • protocol/x/vault/types/keys.go (1 hunks)
  • protocol/x/vault/types/keys_test.go (1 hunks)
  • protocol/x/vault/types/params.go (1 hunks)
  • protocol/x/vault/types/params_test.go (1 hunks)
Files skipped from review due to trivial changes (2)
  • protocol/app/testdata/default_genesis_state.json
  • protocol/testutil/constants/genesis.go
Additional context used
buf
proto/dydxprotocol/vault/params.proto

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

(COMPILE)

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

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

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


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

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

Additional comments not posted (27)
protocol/x/vault/keeper/msg_server_update_operator_params.go (1)

14-32: LGTM!

The UpdateOperatorParams function is implemented correctly and follows best practices:

  • It checks the authority of the message sender to ensure only authorized users can update the operator parameters.
  • It handles errors appropriately by returning the corresponding error if the authority check fails or if setting the operator parameters fails.
  • It is modular as it delegates the actual setting of operator parameters to another function SetOperatorParams.
  • It returns an empty response on success, which is a common pattern in gRPC services.

The code is secure, robust, and modular.

protocol/x/vault/types/keys_test.go (1)

23-23: LGTM!

The new assertion in TestStateKeys correctly verifies that types.OperatorParamsKey is defined as "OperatorParams". This enhances the test coverage and ensures the integrity of the key without altering any existing functionality.

protocol/x/vault/types/keys.go (1)

39-41: LGTM!

The addition of the OperatorParamsKey constant is a clear and appropriate way to introduce a specific identifier for accessing operator-related configurations or settings. This aligns with the PR objective of enhancing the megavault functionality and improves the clarity and organization of the codebase.

protocol/x/vault/types/params.go (1)

65-72: LGTM!

The Validate function correctly checks if the Operator field is non-empty and returns an appropriate error if it's empty. This validation logic enhances the robustness of the code by ensuring that an essential parameter is always provided.

protocol/x/vault/keeper/msg_server_update_operator_params_test.go (1)

16-75: Excellent test coverage for the UpdateOperatorParams function!

The test function TestMsgUpdateOperatorParams is well-structured and comprehensive. It covers both positive and negative scenarios, ensuring that the UpdateOperatorParams function behaves as expected.

Some positive aspects of the test function:

  • Clear and descriptive naming of test cases, enhancing readability and maintainability.
  • Utilization of the testapp package to create a controlled testing environment.
  • Assertions using the require package, following Go testing best practices.
  • Checking for expected error messages in failure scenarios, providing thorough test coverage.

The test function not only improves the reliability of the codebase but also serves as valuable documentation for the expected behavior of the UpdateOperatorParams function.

Great job on the test implementation!

protocol/x/vault/genesis.go (3)

44-51: LGTM!

The changes ensure that the operator address is always set during the genesis initialization process. If the operator address is not provided, it defaults to the governance module's address, which is a sensible fallback mechanism. The operator parameters are then persisted in the keeper for future use.

The changes are well-structured and follow the existing coding patterns in the file.


5-5: LGTM!

The import statement for the lib package is correctly placed along with other import statements at the top of the file. This import is necessary to access the GovModuleAddress constant used in the InitGenesis function.


65-65: LGTM!

The change to include the operator parameters in the exported genesis state is necessary and aligns with the changes made in the InitGenesis function. By exporting the operator parameters, the module ensures that the operator information is preserved when the genesis state is exported.

The GetOperatorParams method is correctly used to retrieve the operator parameters from the keeper.

protocol/x/vault/types/errors.go (1)

124-128: LGTM!

The new error variable ErrEmptyOperator is registered correctly with a unique error code and a descriptive message. It enhances the error handling capabilities of the module by providing a specific error case for an empty operator address.

proto/dydxprotocol/vault/params.proto (1)

52-55: LGTM!

The new message type OperatorParams and its field operator are well-defined and serve the purpose of storing parameters related to the megavault operator. The use of the custom scalar type cosmos.AddressString ensures that the operator field adheres to the expected address format.

This addition enhances the protocol's capability to manage operator-specific configurations within the vault parameters, aligning with the PR objectives.

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

3-3: LGTM!

The import statement correctly adds the new message types related to updating operator parameters, which aligns with the PR objective.


12-14: LGTM!

The updateOperatorParams method is correctly added to the Msg interface, using the new message types for the request and response. This aligns with the PR objective.


49-53: LGTM!

The updateOperatorParams method is correctly implemented in the MsgClientImpl class, following the same pattern as other methods. The RPC method name, request encoding, and response decoding are all handled correctly.

protocol/x/vault/keeper/params.go (2)

126-136: LGTM!

The function logic is correct, and the implementation follows best practices:

  • It uses a specific key (OperatorParamsKey) to retrieve the value from the store, avoiding potential key collisions.
  • It uses k.cdc.MustUnmarshal to unmarshal the retrieved value, which will panic if the unmarshal fails, indicating a critical issue with the stored data that needs immediate attention.

138-153: LGTM!

The function logic is correct, and the implementation follows best practices:

  • It validates the params using the params.Validate() method before setting them in the store, ensuring data integrity.
  • It uses a specific key (OperatorParamsKey) to set the value in the store, avoiding potential key collisions.
  • It uses k.cdc.MustMarshal to marshal the params, which will panic if the marshal fails, indicating a critical issue with the data being set that needs immediate attention.
protocol/x/vault/types/params_test.go (1)

136-169: LGTM!

The TestValidateOperatorParams function is well-structured and follows the table-driven testing approach. It covers the important scenarios for validating the OperatorParams structure, including success cases for a valid operator (Alice's address) and the governance module account, as well as a failure case for an empty operator string.

The test function uses appropriate assertions to verify the expected behavior and enhances the test coverage for the operator parameter validation logic.

proto/dydxprotocol/vault/tx.proto (3)

23-25: LGTM!

The new RPC method UpdateOperatorParams is declared correctly with the appropriate input and output message types. The comment provides a clear description of the purpose of the method, which aligns with the PR objective of introducing new components related to the megavault functionality.


118-127: LGTM!

The new message type MsgUpdateOperatorParams is defined correctly with the appropriate fields and annotations. The authority field ensures that only the authorized address can update the operator parameters, and the non-nullable params field ensures that all the required parameters are provided. The message type aligns with the PR objective of introducing new components related to the megavault functionality.


129-130: LGTM!

The new message type MsgUpdateOperatorParamsResponse is defined correctly as an empty message. It serves as the response type for the UpdateOperatorParams RPC method, indicating that no specific data needs to be returned upon successful execution of the method.

protocol/x/vault/keeper/params_test.go (1)

169-199: LGTM!

The TestGetSetOperatorParams function is a well-structured test that comprehensively validates the functionality of getting and setting operator parameters within the VaultKeeper. It covers the following scenarios:

  1. Checking the default operator at genesis (governance module account).
  2. Setting a new operator to a specific account (Alice) and verifying the change.
  3. Attempting to set an invalid operator (empty string) and expecting an error.
  4. Ensuring that the previously set operator remains unchanged after the invalid operator attempt.

The test enhances the test coverage for operator parameter management and helps maintain the integrity of the functionality by handling both valid and invalid scenarios correctly.

indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts (2)

23-25: LGTM!

The addition of the operatorParams property to the GenesisState interface is consistent with the PR objective of introducing new components related to the megavault functionality. It enhances the configuration capabilities of the vault system by including parameters related to the megavault operator in the genesis state.


44-46: LGTM!

The addition of the operator_params property to the GenesisStateSDKType interface is consistent with the changes made to the GenesisState interface. The property name follows the snake_case convention, which is consistent with the naming convention used for the other properties in the interface.

indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts (2)

94-103: LGTM!

The new OperatorParams and OperatorParamsSDKType interfaces provide a structured way to manage operator-specific data within the megavault parameters. The operator property is appropriately typed as a string to represent the operator's address or identifier.


343-386: Looks good!

The implementation of the encode, decode, and fromPartial methods for the OperatorParams object follows the established protobuf encoding/decoding pattern in the codebase. These methods enhance the handling of operator parameters by allowing for serialization and deserialization, which is crucial for data interchange in applications that utilize these parameters.

indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts (2)

161-166: LGTM!

The MsgUpdateOperatorParams interface is well-structured and aligns with the purpose of updating operator parameters. The authority field represents the authorized account, and the optional params field allows specifying the updated parameters.


169-174: LGTM!

The MsgUpdateOperatorParamsSDKType interface correctly mirrors the structure of MsgUpdateOperatorParams for SDK compatibility. The fields are consistent, and the interface is appropriately named with the SDKType suffix.

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

3939-3939: The addition of operator_params is a reasonable change that enables future extensibility.

Initializing operator_params as an empty object provides a placeholder for storing operator-specific configuration parameters in the future, without impacting the existing codebase. This change allows the configuration structure to be extended gracefully as needed.

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 52bff17 and 1c87fad.

Files ignored due to path filters (3)
  • protocol/x/vault/types/genesis.pb.go is excluded by !**/*.pb.go
  • protocol/x/vault/types/params.pb.go is excluded by !**/*.pb.go
  • protocol/x/vault/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (23)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts (7 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts (2 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.rpc.msg.ts (4 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts (3 hunks)
  • proto/dydxprotocol/vault/genesis.proto (1 hunks)
  • proto/dydxprotocol/vault/params.proto (2 hunks)
  • proto/dydxprotocol/vault/tx.proto (2 hunks)
  • protocol/app/msgs/all_msgs.go (1 hunks)
  • protocol/app/msgs/internal_msgs.go (1 hunks)
  • protocol/app/msgs/internal_msgs_test.go (1 hunks)
  • protocol/app/testdata/default_genesis_state.json (1 hunks)
  • protocol/scripts/genesis/sample_pregenesis.json (1 hunks)
  • protocol/testutil/constants/genesis.go (1 hunks)
  • protocol/x/vault/genesis.go (3 hunks)
  • protocol/x/vault/keeper/msg_server_update_operator_params.go (1 hunks)
  • protocol/x/vault/keeper/msg_server_update_operator_params_test.go (1 hunks)
  • protocol/x/vault/keeper/params.go (1 hunks)
  • protocol/x/vault/keeper/params_test.go (1 hunks)
  • protocol/x/vault/types/errors.go (1 hunks)
  • protocol/x/vault/types/keys.go (1 hunks)
  • protocol/x/vault/types/keys_test.go (1 hunks)
  • protocol/x/vault/types/params.go (1 hunks)
  • protocol/x/vault/types/params_test.go (1 hunks)
Files skipped from review due to trivial changes (2)
  • protocol/scripts/genesis/sample_pregenesis.json
  • protocol/testutil/constants/genesis.go
Files skipped from review as they are similar to previous changes (14)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/genesis.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.rpc.msg.ts
  • proto/dydxprotocol/vault/genesis.proto
  • proto/dydxprotocol/vault/tx.proto
  • protocol/app/testdata/default_genesis_state.json
  • protocol/x/vault/genesis.go
  • protocol/x/vault/keeper/msg_server_update_operator_params.go
  • protocol/x/vault/keeper/msg_server_update_operator_params_test.go
  • protocol/x/vault/keeper/params_test.go
  • protocol/x/vault/types/errors.go
  • protocol/x/vault/types/keys.go
  • protocol/x/vault/types/keys_test.go
  • protocol/x/vault/types/params.go
  • protocol/x/vault/types/params_test.go
Additional context used
buf
proto/dydxprotocol/vault/params.proto

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

(COMPILE)

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

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

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


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

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

Additional comments not posted (13)
proto/dydxprotocol/vault/params.proto (1)

52-55: LGTM!

The introduction of the OperatorParams message type and its operator field is a valuable addition to the protocol. It enhances the management of operator-specific configurations within the vault parameters.

The use of the cosmos.AddressString scalar type for the operator field ensures type safety and validation, preventing invalid Cosmos addresses from being assigned.

Overall, these changes expand the protocol's functionality to accommodate operator-related data effectively.

protocol/x/vault/keeper/params.go (2)

126-136: LGTM!

The function correctly retrieves the OperatorParams from the state using the OperatorParamsKey and unmarshals the data into the params variable. The implementation looks good.


138-153: LGTM!

The function correctly validates the params before marshaling and storing them in the key-value store using the OperatorParamsKey. Returning an error on validation failure ensures data integrity. The implementation looks good.

protocol/app/msgs/internal_msgs_test.go (1)

161-162: LGTM!

The addition of the MsgUpdateOperatorParams and MsgUpdateOperatorParamsResponse message types to the test suite is a positive change. It ensures that the new functionality for updating operator parameters through governance proposals is properly tested and integrated into the application.

This change enhances the flexibility and configurability of the vault system while maintaining the robustness and reliability of the codebase.

protocol/app/msgs/internal_msgs.go (2)

205-205: LGTM!

The addition of the new message type MsgUpdateOperatorParams to the InternalMsgSamplesDydxCustom map is consistent with the existing pattern in the file. The key and value are correctly specified, and the message type is defined in the imported vault package.


206-206: Looks good!

The addition of the response type entry for MsgUpdateOperatorParams follows the established pattern in the file. The key is correctly specified, and setting the value to nil is consistent with the handling of unused response types.

indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/params.ts (2)

94-103: LGTM!

The new OperatorParams interface and its corresponding SDK type are correctly defined with the appropriate property type. The naming convention follows the existing pattern in the file, and the code segment is well-structured and readable.


343-386: LGTM!

The functions associated with the OperatorParams interface are correctly defined and follow the existing pattern in the file. The encode, decode, and fromPartial functions handle the operator property appropriately, ensuring proper serialization and deserialization of OperatorParams instances.

protocol/app/msgs/all_msgs.go (1)

260-261: New message types for updating vault operator parameters

The new message types MsgUpdateOperatorParams and MsgUpdateOperatorParamsResponse follow the established naming conventions and are correctly scoped under the vault module.

The MsgUpdateOperatorParams message type suggests the existence of a corresponding handler function to process updates to operator parameters.

Please verify if the handler function for processing MsgUpdateOperatorParams is implemented and registered correctly. The handler should validate the input, perform necessary state updates, and return an instance of MsgUpdateOperatorParamsResponse.

To verify the existence and correctness of the MsgUpdateOperatorParams handler function:

indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts (4)

161-166: LGTM!

The MsgUpdateOperatorParams interface is well-defined and follows the naming convention for request types. The authority field is mandatory, while the params field is optional, allowing for flexibility in updating operator parameters.


169-174: LGTM!

The MsgUpdateOperatorParamsSDKType interface is well-defined and follows the naming convention for SDK-compatible types. It mirrors the structure of the MsgUpdateOperatorParams interface, ensuring consistency between the request type and its SDK counterpart.


625-630: LGTM!

The createBaseMsgUpdateOperatorParams function correctly initializes a base MsgUpdateOperatorParams object with default values. The authority field is set to an empty string, and the params field is set to undefined, aligning with the optional nature of the params field in the interface.


632-678: LGTM!

The MsgUpdateOperatorParams object provides the necessary encoding, decoding, and partial object creation functionality for the MsgUpdateOperatorParams type. The encode, decode, and fromPartial methods are implemented correctly, handling the authority and params fields as expected.

}
/** MsgUpdateVaultParamsResponse is the Msg/UpdateOperatorParams response type. */

export interface MsgUpdateOperatorParamsResponse {}
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.

The MsgUpdateOperatorParamsResponse interface is currently empty, which provides no type safety. As suggested by the static analysis hint, consider using a type alias instead:

type MsgUpdateOperatorParamsResponse = Record<string, never>;

This provides a clearer intention and better type safety.

Tools
Biome

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

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

export interface MsgUpdateOperatorParamsResponse {}
/** MsgUpdateVaultParamsResponse is the Msg/UpdateOperatorParams response type. */

export interface MsgUpdateOperatorParamsResponseSDKType {}
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.

Similar to the MsgUpdateOperatorParamsResponse interface, the MsgUpdateOperatorParamsResponseSDKType interface is currently empty. Consider using a type alias instead:

type MsgUpdateOperatorParamsResponseSDKType = Record<string, never>;

This provides a clearer intention and better type safety for the SDK-compatible response type.

Tools
Biome

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

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

@@ -3936,6 +3936,9 @@
"spread_buffer_ppm": 1500,
"spread_min_ppm": 3000
},
"operator_params": {
"operator": ""
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: set as gov address?

@@ -40,6 +41,14 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
k.SetMostRecentClientIds(ctx, vault.VaultId, vault.MostRecentClientIds)
k.AddVaultToAddressStore(ctx, vault.VaultId)
}

// Set operator, which defaults to gov module account.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Just set as w/e is in the genesis?

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