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

Scaffolding x/govplus module #1011

Merged
merged 1 commit into from
Jan 25, 2024
Merged

Scaffolding x/govplus module #1011

merged 1 commit into from
Jan 25, 2024

Conversation

roy-dydx
Copy link
Contributor

Changelist

  • Add govplus module
  • Initialize store in v4.0.0 upgrade handler

Test Plan

  • Pass existing tests

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
Contributor

coderabbitai bot commented Jan 23, 2024

Walkthrough

The overall changes suggest a significant update to the dydxprotocol, particularly with the introduction of a new govplus module. This update includes the setup of genesis state, query services, transaction services, and error handling for governance-related functionalities. The refactoring also involves reorganizing import statements, updating namespaces, and enhancing the module structure. Additionally, there's an evident focus on testing and integration with the Cosmos SDK, indicating a robust development cycle aimed at expanding the protocol's capabilities.

Changes

File Path Change Summary
.../codegen/dydxprotocol/bundle.ts Refactored import statements and updated exported namespaces.
.../codegen/dydxprotocol/govplus/genesis.ts, proto/dydxprotocol/govplus/genesis.proto Introduced GenesisState interfaces and related functions; defined initial state for govplus module.
.../codegen/dydxprotocol/govplus/query.rpc.Query.ts, .../codegen/dydxprotocol/govplus/query.ts, proto/dydxprotocol/govplus/query.proto Added functionality for gRPC querier service client and query interface for govplus module.
.../codegen/dydxprotocol/govplus/tx.ts, proto/dydxprotocol/govplus/tx.proto Created files for transaction functionality in govplus module.
.../codegen/dydxprotocol/rpc.query.ts Added govplus RPC query extension.
.../codegen/gogoproto/bundle.ts, .../codegen/google/bundle.ts Renamed and reordered imports; updated namespace structures.
protocol/app/app.go, protocol/app/app_test.go Added GovPlus module and its registration in tests.
protocol/app/upgrades/v4.0.0/constants.go Included govplustypes.StoreKey in the upgrade struct for v4.0.0.
protocol/testutil/constants/genesis.go Added an empty "govplus" object to the GenesisState constant.
protocol/x/govplus/client/cli/query.go, protocol/x/govplus/client/cli/tx.go Provided CLI query and transaction commands for govplus module.
protocol/x/govplus/genesis.go, protocol/x/govplus/keeper/keeper.go, protocol/x/govplus/keeper/msg_server.go, protocol/x/govplus/module.go Implemented functions and types for module state initialization, management, and integration.
protocol/x/govplus/keeper/keeper_test.go, protocol/x/govplus/keeper/msg_server_test.go, protocol/x/govplus/types/genesis_test.go, protocol/x/govplus/types/keys_test.go Added test functions and setup for various govplus module functionalities.
protocol/x/govplus/types/... Defined codec, errors, interfaces, keys, and parameters for govplus module.

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.

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.

Review Status

Actionable comments generated: 21

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5ee11ed and fcf2489.
Files ignored due to path filters (7)
  • protocol/app/testdata/default_genesis_state.json is excluded by: !**/*.json
  • protocol/scripts/genesis/sample_pregenesis.json is excluded by: !**/*.json
  • protocol/x/govplus/types/capacity.pb.go is excluded by: !**/*.pb.go
  • protocol/x/govplus/types/genesis.pb.go is excluded by: !**/*.pb.go
  • protocol/x/govplus/types/limit_params.pb.go is excluded by: !**/*.pb.go
  • protocol/x/govplus/types/query.pb.go is excluded by: !**/*.pb.go
  • protocol/x/govplus/types/tx.pb.go is excluded by: !**/*.pb.go
Files selected for processing (34)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (3 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/genesis.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/query.rpc.Query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.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)
  • proto/dydxprotocol/govplus/genesis.proto (1 hunks)
  • proto/dydxprotocol/govplus/query.proto (1 hunks)
  • proto/dydxprotocol/govplus/tx.proto (1 hunks)
  • protocol/app/app.go (10 hunks)
  • protocol/app/app_test.go (2 hunks)
  • protocol/app/upgrades/v4.0.0/constants.go (2 hunks)
  • protocol/testutil/constants/genesis.go (1 hunks)
  • protocol/x/feetiers/keeper/msg_server.go (1 hunks)
  • protocol/x/feetiers/keeper/msg_server_test.go (1 hunks)
  • protocol/x/feetiers/module.go (1 hunks)
  • protocol/x/govplus/client/cli/query.go (1 hunks)
  • protocol/x/govplus/client/cli/tx.go (1 hunks)
  • protocol/x/govplus/genesis.go (1 hunks)
  • protocol/x/govplus/keeper/keeper.go (1 hunks)
  • protocol/x/govplus/keeper/keeper_test.go (1 hunks)
  • protocol/x/govplus/keeper/msg_server.go (1 hunks)
  • protocol/x/govplus/keeper/msg_server_test.go (1 hunks)
  • protocol/x/govplus/module.go (1 hunks)
  • protocol/x/govplus/types/codec.go (1 hunks)
  • protocol/x/govplus/types/errors.go (1 hunks)
  • protocol/x/govplus/types/expected_keepers.go (1 hunks)
  • protocol/x/govplus/types/genesis.go (1 hunks)
  • protocol/x/govplus/types/genesis_test.go (1 hunks)
  • protocol/x/govplus/types/keys.go (1 hunks)
  • protocol/x/govplus/types/keys_test.go (1 hunks)
  • protocol/x/govplus/types/params.go (1 hunks)
Files skipped from review due to trivial changes (8)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/query.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/tx.ts
  • protocol/testutil/constants/genesis.go
  • protocol/x/feetiers/keeper/msg_server_test.go
  • protocol/x/feetiers/module.go
  • protocol/x/govplus/types/genesis.go
  • protocol/x/govplus/types/keys.go
  • protocol/x/govplus/types/keys_test.go
Additional comments: 28
protocol/x/govplus/keeper/msg_server.go (1)
  • 11-15: Redundant type assertion.

The type assertion var _ types.MsgServer = msgServer{} is not necessary but does not harm. It's a common practice in Go to ensure that the struct implements the interface at compile time.

indexer/packages/v4-protos/src/codegen/google/bundle.ts (1)
  • 1-14: Namespace restructuring and import reordering.

The changes reflect a reordering and renaming of imports and an update to the structure of the google namespace. This is likely part of a refactoring effort and seems correct as long as it aligns with the intended use cases and dependencies.

protocol/x/govplus/types/errors.go (1)
  • 9-23: Error registration with hardcoded module name.

The error registration uses hardcoded module names and error codes, which is a standard practice in Cosmos SDK modules. Ensure that the error codes are unique within the module.

protocol/x/govplus/keeper/msg_server_test.go (1)
  • 13-26: Test setup function without assertions.

The setupMsgServer function is a helper function for setting up the test environment. It is correctly returning the necessary components for testing the MsgServer. Ensure that actual tests using this setup function are implemented.

protocol/app/upgrades/v4.0.0/constants.go (1)
  • 19-19: Addition of govplustypes.StoreKey to the upgrade constants.

The addition of govplustypes.StoreKey to the Added list in the Upgrade struct is a necessary step for registering the new store key as part of the upgrade process. This change is correct and follows the upgrade pattern.

protocol/x/govplus/keeper/keeper.go (3)
  • 22-31: The NewKeeper function is initializing the authorities map correctly.

The use of lib.UniqueSliceToSet to convert a slice of strings to a set is a good practice to ensure that there are no duplicates in the authorities map.

  • 34-37: The HasAuthority method is implemented correctly.

The HasAuthority method is a straightforward check for the existence of an authority in the map, which is a standard and efficient way to handle such checks.

  • 39-41: The Logger method is implemented correctly.

The Logger method is correctly creating a logger with the module name, which is a common pattern in Cosmos SDK modules for logging purposes.

indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/genesis.ts (1)
  • 5-42: The GenesisState codec functions are implemented correctly.

The codec functions for GenesisState are standard boilerplate code for encoding and decoding the genesis state, even though the GenesisState is currently empty.

indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts (1)
  • 19-19: Addition of govplus to the RPC query client.

The addition of govplus as a new RPC query extension in the createRPCQueryClient function is correct and follows the pattern for adding new modules to the query client.

protocol/x/govplus/module.go (5)
  • 23-31: The AppModule and AppModuleBasic structs are implemented correctly.

The AppModule and AppModuleBasic structs are standard Cosmos SDK module structures and are implemented correctly with the necessary interface methods stubbed out.

  • 53-57: The RegisterLegacyAminoCodec function is implemented correctly.

The RegisterLegacyAminoCodec function is correctly registering the module's types with the legacy Amino codec, which is necessary for backward compatibility.

  • 59-62: The RegisterInterfaces function is implemented correctly.

The RegisterInterfaces function is correctly registering the module's interface types with the interface registry, which is necessary for the module's types to be recognized by the Cosmos SDK.

  • 79-91: The DefaultGenesis and ValidateGenesis functions are implemented correctly.

The DefaultGenesis and ValidateGenesis functions are standard Cosmos SDK functions for handling the module's genesis state and are implemented correctly.

  • 122-125: The RegisterServices function is implemented correctly.

The RegisterServices function is correctly registering the module's message and query services, which is necessary for the module's functionality to be available to clients.

protocol/app/app_test.go (1)
  • 41-41: The addition of govplusmodule in the test suite.

The addition of govplusmodule to the test suite is correct and ensures that the new module is included in the tests.

indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (1)
  • 42-167: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-309]

Refactoring of import statements and namespace restructuring.

The refactoring of import statements and namespace restructuring in bundle.ts is extensive but appears to be correct, assuming it aligns with the new module structure and dependencies.

protocol/x/govplus/keeper/keeper_test.go (3)
  • 29-63: The test TestSetGetDenomCapacity checks the setting and getting of DenomCapacity. It also tests the deletion of a DenomCapacity by setting an empty CapacityList. The logic seems correct, and the assertions are appropriate.
  • 66-273: The test TestSetGetLimitParams_Success is well-structured with table-driven tests covering various scenarios. It checks the setting and getting of LimitParams and the initialization of DenomCapacity. The test cases are comprehensive and the assertions are correctly checking the expected outcomes.
  • 276-847: The test TestUpdateAllCapacitiesEndBlocker is also table-driven and tests the UpdateAllCapacitiesEndBlocker function. It covers a variety of scenarios, including different balances, limit parameters, and block times. The test ensures that the capacities are updated correctly based on the time elapsed and the limit parameters. The test cases are thorough and the assertions are correctly validating the expected results.
protocol/app/app.go (8)
  • 148-150: The addition of the govplus module imports is correct and aligns with the PR objectives.
  • 258-258: The GovPlusKeeper has been added to the App struct. Ensure that it is properly initialized and used wherever necessary.
Verification successful

The GovPlusKeeper has been successfully added and initialized in the New function of the App struct within app.go. It is also referenced in other parts of the application, including the msg_server_test.go file in the govplus module, indicating that it is being utilized as intended.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that GovPlusKeeper is initialized correctly in the New function.
ast-grep --lang go --pattern $'func New($_, $_, $_, $_, $_, $_) *App {
  $$$
  app.GovPlusKeeper = *govplusmodulekeeper.NewKeeper($_, $_, $_)
  $$$
}'
# Verify that GovPlusKeeper is used in other parts of the application.
rg 'GovPlusKeeper' --files-with-matches

Length of output: 61779

* 991-991: The `govPlusModule` is correctly instantiated and added to the `ModuleManager`. This is consistent with the PR objectives. * 1055-1055: The `govPlusModule` is added to the `ModuleManager`. Ensure that the order of module execution is correct and does not introduce any dependency issues.
Verification successful

---

<!--Monologue:
The new context provided from the `rg` command output shows references to `delayMsgModule` and `epochsModule`. The snippet from `acknowledge_bridges.go` indicates that `delayMsgModule` is used within the bridge module's keeper logic, but there is no direct indication of a dependency on `govPlusModule`. The instantiation of `epochsModule` and `delayMsgModule` in `app.go` does not provide any information on dependencies with `govPlusModule` either. The output does not show any explicit dependencies between `govPlusModule` and the modules initialized after it in the ModuleManager. Based on this information, it seems that the order of module execution with `govPlusModule` being added before `delayMsgModule` and `epochsModule` does not introduce any dependency issues. Therefore, the review comment appears to be verified as correct.
-->



</details>

<details>
<summary>Scripts Executed</summary>

The following scripts were executed for the analysis:



---

Script:
```shell
#!/bin/bash
# Verify that the govPlusModule does not have any dependencies that require it to be initialized in a specific order.
ast-grep --lang go --pattern $'app.ModuleManager = module.NewManager($$$, govPlusModule, $$$)'

Length of output: 3538



Script:

#!/bin/bash
# Search for any explicit dependencies of govPlusModule on other modules or vice versa.
rg "govPlusModule" -A 3 -B 3

Length of output: 577



Script:

#!/bin/bash
# Check if delayMsgModule or epochsModule have any dependency on govPlusModule.
rg -e "delayMsgModule" -e "epochsModule" -A 3 -B 3

Length of output: 2079

* 1099-1099: The `govplusmoduletypes.ModuleName` is added to the `SetOrderBeginBlockers`. Confirm that the `govplus` module requires processing during the `BeginBlock` and that the order is correct. * 1138-1138: The `govplusmoduletypes.ModuleName` is added to the `SetOrderEndBlockers`. Confirm that the `govplus` module requires processing during the `EndBlock` and that the order is correct.
Verification successful

The search for filenames associated with the govplus module and containing EndBlock has produced output indicating that there is indeed an EndBlock method defined in module.go within the govplus module. This confirms that the govplus module requires processing during the EndBlock, which justifies its inclusion in the SetOrderEndBlockers list.

Based on the output, the review comment is verified as correct.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the govplus module requires processing during EndBlock.
ast-grep --lang go --pattern $'func (m *ModuleManager) EndBlock($_, $_) $$$ {
  $$$
  govplusmoduletypes.ModuleName
  $$$
}'

Length of output: 125



Script:

#!/bin/bash
# Search for an EndBlock method within the govplus module.
ast-grep --lang go --pattern $'func ($_ *$_) EndBlock($_, $_) $$$'

Length of output: 67



Script:

#!/bin/bash
# Search for filenames that could be associated with the govplus module.
fd 'govplus' --exec rg 'EndBlock'

Length of output: 523

* 1180-1180: The `govplusmoduletypes.ModuleName` is added to the `SetOrderInitGenesis`. Confirm that the `govplus` module requires initialization during the genesis and that the order is correct.
Verification successful

The rg command has successfully found occurrences of govplusmoduletypes.ModuleName in protocol/app/app.go, indicating that the module name is indeed referenced in the application code. Additionally, the search for an InitGenesis function within the govplus module has yielded two results: one in protocol/x/govplus/module.go and another in protocol/x/govplus/genesis.go. This confirms that the govplus module has an InitGenesis function and suggests that it should be initialized during the genesis process.

Based on the output provided, it can be concluded that the govplus module requires initialization during the genesis and that the order of initialization, which includes govplusmoduletypes.ModuleName, is likely correct as it is referenced multiple times in the application code.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the govplus module requires initialization during genesis.
ast-grep --lang go --pattern $'func (m *ModuleManager) InitGenesis($_, $_, $_) $$$ {
  $$$
  govplusmoduletypes.ModuleName
  $$$
}'

Length of output: 132



Script:

#!/bin/bash
# Search for the usage of govplusmoduletypes.ModuleName in Go files to confirm its context.
rg 'govplusmoduletypes.ModuleName' --type go

# Verify that the govplus module has an InitGenesis function.
rg 'func .*InitGenesis' --type go | grep 'govplus'

Length of output: 541

* 1218-1218: The `govplusmoduletypes.ModuleName` is added to the `SetOrderMigrations`. Confirm that the `govplus` module requires migration logic and that the order is correct.
Verification successful

The output from the latest script provides a snippet of the SetOrderMigrations method call in protocol/app/app.go, listing several module names. However, govplusmoduletypes.ModuleName is not among the listed modules in the provided output. This could mean that the govplus module is not part of the migration order in this snippet, or it could be listed further down the order, beyond the 10 lines of context provided by the rg command.

To fully verify the review comment, I need to ensure that govplusmoduletypes.ModuleName is indeed part of the SetOrderMigrations method call and to understand its position in the migration order. I will generate a new script to extract more lines following the SetOrderMigrations method call to find the complete list of modules, including the position of govplusmoduletypes.ModuleName.


The extended output from the rg command still does not show govplusmoduletypes.ModuleName within the 20 lines following the SetOrderMigrations method call in protocol/app/app.go. This suggests that either govplusmoduletypes.ModuleName is not part of the migration order in this section of the code or it is listed even further down.

To conclusively verify the review comment, I need to capture the entire SetOrderMigrations method call to see if govplusmoduletypes.ModuleName is included and to determine its order among the migrations. I will generate a new script to capture the full context of the SetOrderMigrations method call.


The output from the script now includes a more extensive list of module names within the SetOrderMigrations method call in protocol/app/app.go. However, govplusmoduletypes.ModuleName is still not present in the output provided. This could indicate that the module name is not part of the migration order in this section of the code, or it could be that the list is still incomplete.

Given the repeated attempts to capture the full context without success, it is possible that the govplusmoduletypes.ModuleName is not included in the migration order within the visible range of the rg command output. To ensure a thorough verification, I will attempt one final script to capture the entire SetOrderMigrations method call without line limitations.


The output from the script has successfully captured the SetOrderMigrations method call in protocol/app/app.go and it includes govplusmoduletypes.ModuleName in the migration order. This confirms that the govplus module is indeed part of the migration logic and is placed after sendingmoduletypes.ModuleName and before delaymsgmoduletypes.ModuleName.

Based on this information, the review comment regarding the addition of govplusmoduletypes.ModuleName to the SetOrderMigrations and the confirmation that the govplus module requires migration logic is verified. The order is also confirmed to be correct as per the output provided.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the govplus module requires migration logic.
ast-grep --lang go --pattern $'func (m *ModuleManager) Migrate($_, $_) $$$ {
  $$$
  govplusmoduletypes.ModuleName
  $$$
}'

Length of output: 124



Script:

#!/bin/bash
# Search for any migration-related methods or references to govplusmoduletypes.ModuleName in the codebase.
rg "govplusmoduletypes.ModuleName" -t go

Length of output: 252


Script:

#!/bin/bash
# Verify if the SetOrderMigrations method exists and references any modules for migration.
ast-grep --lang go --pattern $'func (m *ModuleManager) SetOrderMigrations($_, $_) $$$ {
  $$$
}'

Length of output: 97



Script:

#!/bin/bash
# Search for the SetOrderMigrations method to confirm its existence and examine its contents.
rg "SetOrderMigrations" -t go

Length of output: 88



Script:

#!/bin/bash
# Extract the contents of the SetOrderMigrations method to verify the order of migrations.
rg -A 10 "SetOrderMigrations" protocol/app/app.go

Length of output: 356



Script:

#!/bin/bash
# Extract more lines following the SetOrderMigrations method call to find the complete list of modules.
rg -A 20 "SetOrderMigrations" protocol/app/app.go

Length of output: 647



Script:

#!/bin/bash
# Capture the full context of the SetOrderMigrations method call to see if govplusmoduletypes.ModuleName is included.
rg -A 30 "SetOrderMigrations" protocol/app/app.go

Length of output: 963



Script:

#!/bin/bash
# Capture the entire SetOrderMigrations method call without line limitations.
rg "SetOrderMigrations" -A 50 protocol/app/app.go

Length of output: 1558

protocol/app/app.go Outdated Show resolved Hide resolved
protocol/x/govplus/types/genesis_test.go Outdated Show resolved Hide resolved
protocol/x/govplus/types/params.go Outdated Show resolved Hide resolved
protocol/x/govplus/keeper/keeper.go Show resolved Hide resolved
protocol/x/govplus/module.go Show resolved Hide resolved
protocol/x/govplus/module.go Show resolved Hide resolved
protocol/x/govplus/module.go Show resolved Hide resolved
protocol/x/govplus/module.go 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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5ee11ed and 7e7cbfe.
Files ignored due to path filters (5)
  • protocol/app/testdata/default_genesis_state.json is excluded by: !**/*.json
  • protocol/scripts/genesis/sample_pregenesis.json is excluded by: !**/*.json
  • protocol/x/govplus/types/genesis.pb.go is excluded by: !**/*.pb.go
  • protocol/x/govplus/types/query.pb.go is excluded by: !**/*.pb.go
  • protocol/x/govplus/types/tx.pb.go is excluded by: !**/*.pb.go
Files selected for processing (27)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (3 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/genesis.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/query.rpc.Query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.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)
  • proto/dydxprotocol/govplus/genesis.proto (1 hunks)
  • proto/dydxprotocol/govplus/query.proto (1 hunks)
  • proto/dydxprotocol/govplus/tx.proto (1 hunks)
  • protocol/app/app.go (10 hunks)
  • protocol/app/app_test.go (2 hunks)
  • protocol/app/upgrades/v4.0.0/constants.go (2 hunks)
  • protocol/testutil/constants/genesis.go (1 hunks)
  • protocol/x/govplus/client/cli/query.go (1 hunks)
  • protocol/x/govplus/client/cli/tx.go (1 hunks)
  • protocol/x/govplus/genesis.go (1 hunks)
  • protocol/x/govplus/keeper/keeper.go (1 hunks)
  • protocol/x/govplus/keeper/keeper_test.go (1 hunks)
  • protocol/x/govplus/keeper/msg_server.go (1 hunks)
  • protocol/x/govplus/keeper/msg_server_test.go (1 hunks)
  • protocol/x/govplus/module.go (1 hunks)
  • protocol/x/govplus/types/codec.go (1 hunks)
  • protocol/x/govplus/types/genesis.go (1 hunks)
  • protocol/x/govplus/types/keys.go (1 hunks)
  • protocol/x/govplus/types/keys_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (26)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/genesis.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/query.rpc.Query.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/query.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus/tx.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts
  • proto/dydxprotocol/govplus/genesis.proto
  • proto/dydxprotocol/govplus/query.proto
  • proto/dydxprotocol/govplus/tx.proto
  • protocol/app/app.go
  • protocol/app/app_test.go
  • protocol/app/upgrades/v4.0.0/constants.go
  • protocol/testutil/constants/genesis.go
  • protocol/x/govplus/client/cli/query.go
  • protocol/x/govplus/client/cli/tx.go
  • protocol/x/govplus/genesis.go
  • protocol/x/govplus/keeper/keeper.go
  • protocol/x/govplus/keeper/keeper_test.go
  • protocol/x/govplus/keeper/msg_server.go
  • protocol/x/govplus/keeper/msg_server_test.go
  • protocol/x/govplus/module.go
  • protocol/x/govplus/types/codec.go
  • protocol/x/govplus/types/genesis.go
  • protocol/x/govplus/types/keys.go
  • protocol/x/govplus/types/keys_test.go
Additional comments: 5
indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (5)
  • 45-51: The import statements for the govplus module have been added. Ensure that these new imports are used correctly in the namespace exports and that the corresponding files exist and are correctly placed within the directory structure.
Verification successful

The files genesis.ts, query.ts, and tx.ts within the govplus directory have been successfully located, confirming that the import statements in bundle.ts are referencing existing files.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the govplus genesis, query, and tx files exist.
fd 'genesis.ts' 'indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus'
fd 'query.ts' 'indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus'
fd 'tx.ts' 'indexer/packages/v4-protos/src/codegen/dydxprotocol/govplus'

Length of output: 505

* 94-146: The renumbering of imports and their usage in namespace exports suggests a refactoring that could impact the entire codebase. Verify that all references to these imports throughout the codebase have been updated to reflect the new numbering. * 144-146: The namespace `assets` has been updated with new import references. Confirm that the changes in the namespace structure are consistent with the intended functionality and that all references to this namespace are updated accordingly.
Verification successful

The references to the assets namespace in rpc.query.ts and lcd.ts are consistent with the updated structure in bundle.ts. The export of the assets namespace in bundle.ts is correct and aligns with the intended functionality. All references to this namespace appear to be updated accordingly.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Check for references to the assets namespace and ensure they are consistent with the new structure.
rg --type ts 'assets' 'indexer/packages/v4-protos/src'

Length of output: 2652



Script:

#!/bin/bash
# Verify that the files referencing the 'assets' namespace are using the updated structure from 'bundle.ts'.
# Check the usage in 'rpc.query.ts' and 'lcd.ts' to ensure the query functionalities are correct.
# Ensure that the aggregation in 'bundle.ts' is correct and complete.

# Check the usage of 'assets' in 'rpc.query.ts'
rg --type ts 'assets' 'indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts'

# Check the usage of 'assets' in 'lcd.ts'
rg --type ts 'assets' 'indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts'

# Ensure the aggregation in 'bundle.ts' is correct and complete
rg --type ts 'export const assets' 'indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts'

Length of output: 461

* 152-154: Similar to the `assets` namespace, the `blocktime` namespace has been updated. Verify that these changes are reflected wherever the `blocktime` namespace is used and that the functionality remains consistent.
Verification successful
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Check for references to the blocktime namespace and ensure they are consistent with the new structure.
rg --type ts 'blocktime' 'indexer/packages/v4-protos/src'

Length of output: 2886



Script:

#!/bin/bash
# Check the specific files that import and use the `blocktime` namespace to ensure they are using the updated structure correctly.

# Check the bundle.ts file for the structure of the blocktime namespace
cat indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts

# Check a couple of files that use the blocktime namespace to see if they are consistent with the new structure
cat indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts
cat indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts

Length of output: 11914



Script:

#!/bin/bash
# Check the files within the blocktime directory to verify that their structure matches the imports and usage.

# Check the structure of the blocktime namespace in query.rpc.Query
cat indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/query.rpc.Query.ts

# Check the structure of the blocktime namespace in tx.rpc.msg
cat indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/tx.rpc.msg.ts

# Check the structure of the blocktime namespace in query.lcd
cat indexer/packages/v4-protos/src/codegen/dydxprotocol/blocktime/query.lcd.ts

Length of output: 5230

* 215-218: The `govplus` namespace has been added. Ensure that this new namespace is integrated correctly and that any new functionality it introduces is properly tested.

@roy-dydx roy-dydx merged commit 40b58ab into main Jan 25, 2024
33 checks passed
@roy-dydx roy-dydx deleted the roy/govplus branch January 25, 2024 00:17
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