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

[TRA-414] Add x/revshare module skeleton #1719

Merged
merged 6 commits into from
Jun 18, 2024
Merged

[TRA-414] Add x/revshare module skeleton #1719

merged 6 commits into from
Jun 18, 2024

Conversation

shrenujb
Copy link
Contributor

@shrenujb shrenujb commented Jun 18, 2024

Changelist

Add the skeleton for the x/revshare module which will hold all logic and state related to trading fee revenue sharing

Test Plan

None

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

    • Added functionality for the revshare module to support revenue sharing.
    • Introduced CLI query commands for the revshare module.
    • Added support for initializing and exporting state for the revshare module.
  • Chores

    • Updated import paths and module structures for better organization and clarity.
    • Added empty revshare objects to various genesis and test data JSON files.
    • Enhanced application struct and module manager to integrate the revshare module.
  • Tests

    • Introduced new test functions for the MsgServer implementation in the revshare module.

Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
Copy link

linear bot commented Jun 18, 2024

Copy link
Contributor

coderabbitai bot commented Jun 18, 2024

Warning

Rate limit exceeded

@shrenujb has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 5 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 92776db and bec9f2b.

Walkthrough

This update introduces a new module for revenue sharing (revshare) within the dydxprotocol ecosystem. The additions include new Protobuf definitions, RPC queries, CLI commands, genesis state handling, and various other integrations into the existing architecture. It also features reorganization and renaming in several packages, aligning the structure and ensuring consistency across the codebase.

Changes

Files/Location Change Summary
indexer/.../dydxprotocol/bundle.ts Reorganized and renamed modules within the dydxprotocol namespace. Updated import paths and reordered entities.
indexer/.../dydxprotocol/rpc.query.ts Added new revshare RPC query extension to the createRPCQueryClient function.
indexer/.../gogoproto/bundle.ts Updated import statement and reassigned the gogoproto constant accordingly.
indexer/.../google/bundle.ts Reordered and renamed imports within the google namespace. Updated references to various modules.
proto/dydxprotocol/revshare/genesis.proto Introduced a new Protobuf file defining the GenesisState message for revshare.
protocol/app/app.go Added revsharemodule to the application, initialized RevShareKeeper, and integrated it into the module manager for block processing.
protocol/app/app_test.go Imported revsharemodule and added its AppModuleBasic{} to the list of app modules in TestModuleBasics function.
protocol/app/basic_manager/basic_manager.go Added revsharemodule to the list of AppModuleBasic instances.
protocol/app/testdata/default_genesis_state.json Added a new empty object revshare to the JSON structure.
protocol/app/upgrades/v6.0.0/constants.go Added revsharetypes.StoreKey to the StoreUpgrades struct in the Upgrade variable.
protocol/scripts/genesis/sample_pregenesis.json Added a new empty object revshare to the JSON structure.
protocol/testing/containertest/preupgrade_genesis.json Added a new empty object revshare to the JSON structure.
protocol/testutil/constants/genesis.go Added a new empty object revshare within the GenesisState constant.
protocol/x/listing/keeper/keeper.go Changed import path from x/vault/types to x/listing/types.
protocol/x/listing/keeper/msg_server_test.go Updated import paths from vault to listing. Updated assignment from VaultKeeper to ListingKeeper in setupMsgServer function.
protocol/x/revshare/client/cli/query.go Introduced GetQueryCmd function to return CLI query commands for the revshare module.
protocol/x/revshare/genesis.go Added functions to initialize (InitGenesis) and export (ExportGenesis) the revshare module's state.
protocol/x/revshare/keeper/grpc_query.go Set up interface implementation for types.QueryServer using Keeper struct.
protocol/x/revshare/keeper/msg_server_test.go Introduced test functions for the MsgServer implementation in the revshare module.
protocol/x/revshare/types/errors.go Added a placeholder for revshare specific errors.

Sequence Diagrams

sequenceDiagram
    participant User
    participant CLI
    participant RPCServer
    participant RevShareKeeper

    User->>CLI: Execute Query Command
    CLI->>RPCServer: Send GRPC Query
    RPCServer->>RevShareKeeper: Handle Query
    RevShareKeeper->>RPCServer: Return Result
    RPCServer->>CLI: Send Response
    CLI->>User: Display Query Result
Loading

Poem

In code where logic intertwines,
A rabbit dances through the lines.
From revshare modules bound to shape,
To genesis states we now escape.
A protocol reborn anew,
With structured paths and visions true.
🐇✨ In these changes, dreams ensue.


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

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.
  • 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: 3

Outside diff range and nitpick comments (4)
protocol/x/revshare/types/errors.go (1)

1-5: The error variable block is currently empty. Consider adding a TODO or FIXME to ensure that specific errors related to the revshare module are defined in the future.

protocol/testutil/constants/genesis.go (1)

Line range hint 342-342: Detected a potential security issue with a generic API key. Please verify if this is a real API key or a placeholder, and if real, consider removing it from the codebase or using more secure handling methods like environment variables or secure vaults.

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

Line range hint 538-538: Potential security issue detected: Generic API Key exposure. Please verify if this is a legitimate key and ensure it's not hardcoded in the codebase. If this is a valid key, consider using environment variables or secure vault solutions to manage it securely.

protocol/testing/containertest/preupgrade_genesis.json (1)

Line range hint 675-675: Potential security risk: Detected a Generic API Key.

This line appears to contain a generic API key, which could expose sensitive operations if leaked or mishandled. Consider removing or rotating this key, and ensure that sensitive credentials are managed securely, possibly using environment variables or a secure vault solution.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0643a90 and 24f2a89.

Files ignored due to path filters (3)
  • protocol/x/revshare/types/genesis.pb.go is excluded by !**/*.pb.go
  • protocol/x/revshare/types/query.pb.go is excluded by !**/*.pb.go
  • protocol/x/revshare/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (29)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (4 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/revshare/genesis.proto (1 hunks)
  • proto/dydxprotocol/revshare/query.proto (1 hunks)
  • proto/dydxprotocol/revshare/tx.proto (1 hunks)
  • protocol/app/app.go (9 hunks)
  • protocol/app/app_test.go (2 hunks)
  • protocol/app/basic_manager/basic_manager.go (2 hunks)
  • protocol/app/testdata/default_genesis_state.json (1 hunks)
  • protocol/app/upgrades/v6.0.0/constants.go (2 hunks)
  • protocol/scripts/genesis/sample_pregenesis.json (1 hunks)
  • protocol/testing/containertest/preupgrade_genesis.json (1 hunks)
  • protocol/testutil/constants/genesis.go (1 hunks)
  • protocol/x/revshare/client/cli/query.go (1 hunks)
  • protocol/x/revshare/client/cli/tx.go (1 hunks)
  • protocol/x/revshare/genesis.go (1 hunks)
  • protocol/x/revshare/keeper/grpc_query.go (1 hunks)
  • protocol/x/revshare/keeper/keeper.go (1 hunks)
  • protocol/x/revshare/keeper/keeper_test.go (1 hunks)
  • protocol/x/revshare/keeper/msg_server.go (1 hunks)
  • protocol/x/revshare/keeper/msg_server_test.go (1 hunks)
  • protocol/x/revshare/module.go (1 hunks)
  • protocol/x/revshare/types/codec.go (1 hunks)
  • protocol/x/revshare/types/errors.go (1 hunks)
  • protocol/x/revshare/types/expected_keepers.go (1 hunks)
  • protocol/x/revshare/types/genesis.go (1 hunks)
  • protocol/x/revshare/types/keys.go (1 hunks)
Files skipped from review due to trivial changes (6)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts
  • proto/dydxprotocol/revshare/genesis.proto
  • proto/dydxprotocol/revshare/query.proto
  • protocol/x/revshare/keeper/msg_server_test.go
  • protocol/x/revshare/types/expected_keepers.go
  • protocol/x/revshare/types/keys.go
Additional context used
Gitleaks
protocol/testutil/constants/genesis.go

342-342: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)

protocol/scripts/genesis/sample_pregenesis.json

538-538: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)

protocol/testing/containertest/preupgrade_genesis.json

675-675: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)

Additional comments not posted (31)
indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts (2)

1-1: The import statement appears correctly updated to match the new file structure.


2-2: The export statement correctly re-exports all bindings from the imported module.

proto/dydxprotocol/revshare/tx.proto (1)

1-7: The Protocol Buffers definition for the revshare module is correctly set up with appropriate syntax, package declaration, and an empty service definition for initial setup.

protocol/x/revshare/types/genesis.go (1)

3-6: The DefaultGenesis function correctly initializes an empty genesis state.

protocol/x/revshare/keeper/keeper_test.go (1)

10-16: The TestLogger function is well-implemented and correctly verifies the non-nullity of the logger.

protocol/x/revshare/keeper/msg_server.go (2)

7-9: The msgServer struct is correctly defined as a simple wrapper around Keeper.


11-15: The NewMsgServerImpl function is correctly implemented to set up a new message server.

indexer/packages/v4-protos/src/codegen/google/bundle.ts (1)

1-14: The imports and exports are correctly structured for the Google-related protobuf modules. The use of spread syntax in namespaces is well-applied.

protocol/app/upgrades/v6.0.0/constants.go (1)

7-7: The addition of revsharetypes.StoreKey to the StoreUpgrades struct is correctly implemented.

Also applies to: 19-19

protocol/x/revshare/types/codec.go (1)

12-14: Proper implementation of codec registration and interface registration for the revshare module.

Also applies to: 18-18

protocol/x/revshare/genesis.go (1)

9-11: Structural setup of genesis functions is correct, but ensure to implement the actual logic in future iterations.

Also applies to: 14-16

protocol/x/revshare/client/cli/tx.go (1)

13-22: Correct implementation of CLI transaction commands for the revshare module. Good use of dynamic naming with types.ModuleName.

protocol/x/revshare/client/cli/query.go (1)

12-23: The CLI setup for the revshare module is correctly implemented.

protocol/x/revshare/keeper/keeper.go (1)

14-32: The Keeper struct and its constructor are correctly implemented, ensuring proper initialization and management of authorities.

protocol/app/basic_manager/basic_manager.go (1)

Line range hint 35-97: The integration of the revshare module into the ModuleBasics manager is correctly executed.

protocol/x/revshare/module.go (1)

32-143: Both AppModuleBasic and AppModule structures along with their methods are correctly implemented, covering all necessary module functionalities and integrations.

protocol/app/app_test.go (1)

221-221: LGTM! Ensure comprehensive testing for the revsharemodule in the application context.

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

76-82: LGTM! Ensure all references and dependencies for the revshare module are correctly updated across the project.

Also applies to: 293-296

protocol/app/testdata/default_genesis_state.json (1)

412-412: LGTM! Ensure that the revshare object is correctly initialized during the genesis and does not conflict with other modules.

Verification successful

The search results indicate that the revshare module is referenced in multiple files, including genesis initialization files (protocol/x/revshare/genesis.go), test files, and the main application files. This suggests that the revshare module is integrated into the genesis state and is being initialized.

Key files where revshare is referenced:

  • protocol/x/revshare/genesis.go
  • protocol/app/app.go
  • protocol/app/testdata/default_genesis_state.json
  • Various test files

The presence of revshare in these files indicates that it is being correctly initialized during genesis and is part of the application module setup.

  • protocol/x/revshare/genesis.go: Handles the genesis state for the revshare module.
  • protocol/app/app.go: Integrates the revshare module into the main application.
  • protocol/app/testdata/default_genesis_state.json: Contains the genesis state with the revshare entry.

Given this information, it appears that the revshare module is correctly initialized and integrated into the genesis state.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the initialization of `revshare` in the genesis state.

# Test: Search for the `revshare` initialization in the genesis tests. Expect: Correct initialization without conflicts.
rg --type json 'revshare' protocol/app/testdata/

Length of output: 115



Script:

#!/bin/bash
# Description: Verify the initialization of `revshare` in the genesis state.

# Search for `revshare` in the genesis initialization code.
ast-grep --lang go --pattern '$_ = $_ {
  "revshare": $_,
  $$$
}' 

# Search for tests that validate `revshare` initialization.
rg 'revshare' --type go --type json

Length of output: 4022

protocol/testutil/constants/genesis.go (1)

1360-1360: The addition of the empty revshare object in the genesis state is appropriate as it prepares the ground for future enhancements specific to the revshare module.

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

1763-1763: The addition of the empty revshare object is noted. Please ensure that this module is correctly initialized in subsequent updates to start functioning as expected.

protocol/app/app.go (9)

172-174: The imports for the revsharemodule, revsharemodulekeeper, and revsharemoduletypes are correctly added to integrate the new module.


316-317: The RevShareKeeper is appropriately declared within the App struct. This is necessary for the new module's keeper to be accessible throughout the application.


439-439: The revsharemoduletypes.StoreKey is correctly added to the list of KV store keys. This is crucial for the revshare module to have its own dedicated storage space within the app's multistore.


1122-1129: The instantiation of RevShareKeeper using revsharemodulekeeper.NewKeeper is correctly implemented. The parameters passed including appCodec, keys[revsharemoduletypes.StoreKey], and the authority list are as expected for initializing the keeper.


1200-1200: The revShareModule is correctly added to the ModuleManager. This ensures that the revshare module is included in the app's lifecycle, including genesis initialization and transaction processing.


1249-1249: The revsharemoduletypes.ModuleName is added to the SetOrderBeginBlockers method. This ensures that the revshare module's begin blocker logic is executed at the correct time in the block lifecycle.


1291-1291: The revsharemoduletypes.ModuleName is added to the SetOrderEndBlockers method. This is crucial for ensuring that the revshare module's end blocker logic is executed, which might include important cleanup or final state updates at the end of each block.


1337-1337: The revsharemoduletypes.ModuleName is correctly included in the SetOrderInitGenesis method. This inclusion is essential for the revshare module to participate in the app's initial chain setup and genesis state configuration.


1379-1379: The inclusion of revsharemoduletypes.ModuleName in the SetOrderMigrations method is appropriate. This setup is necessary for handling state migrations, which are critical during upgrades or when the blockchain's state format changes.

protocol/testing/containertest/preupgrade_genesis.json (1)

2190-2190: Added an empty revshare object to the genesis state.

This change aligns with the PR's objective to integrate the revshare module into the system. Ensure that this module is correctly initialized elsewhere in the codebase to handle its expected functionality.

@@ -44,6 +44,7 @@ import (
perpetualsmodule "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals"
pricesmodule "github.com/dydxprotocol/v4-chain/protocol/x/prices"
ratelimitmodule "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit"
revsharemodule "github.com/dydxprotocol/v4-chain/protocol/x/revshare"
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM! Ensure proper integration and testing of the new revsharemodule.

Would you like me to assist in creating integration tests for the revsharemodule?

Comment on lines +8 to +12
// Validate performs basic genesis state validation returning an error upon any
// failure.
func (gs GenesisState) Validate() error {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The Validate function currently does not perform any validation. Consider implementing actual validation logic based on expected constraints in future updates.

Comment on lines 3 to 7
import (
"github.com/dydxprotocol/v4-chain/protocol/x/listing/types"
)

var _ types.QueryServer = Keeper{}
Copy link
Contributor

Choose a reason for hiding this comment

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

The import path appears incorrect. It should likely import from protocol/x/revshare/types instead of protocol/x/listing/types to match the module context.

- import "github.com/dydxprotocol/v4-chain/protocol/x/listing/types"
+ import "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types"
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
import (
"github.com/dydxprotocol/v4-chain/protocol/x/listing/types"
)
var _ types.QueryServer = Keeper{}
import (
"github.com/dydxprotocol/v4-chain/protocol/x/revshare/types"
)
var _ types.QueryServer = Keeper{}

Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
Comment on lines +8 to +9
"github.com/dydxprotocol/v4-chain/protocol/x/listing/keeper"
"github.com/dydxprotocol/v4-chain/protocol/x/listing/types"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Part of a separate PR perhaps?

@@ -8,7 +8,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/dydxprotocol/v4-chain/protocol/lib"
"github.com/dydxprotocol/v4-chain/protocol/x/vault/types"
"github.com/dydxprotocol/v4-chain/protocol/x/listing/types"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Part of a separate PR?

Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
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 (3)
protocol/testutil/constants/genesis.go (1)

Line range hint 342-342: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Please ensure that this API key is either removed or securely managed if it's necessary for the operation. Consider using secrets management solutions or environment variables.

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

Line range hint 538-538: Potential security risk detected: Generic API Key.

Please verify if the detected 'Generic API Key' is a placeholder or test data. If it's sensitive, consider removing or securing it.

protocol/testing/containertest/preupgrade_genesis.json (1)

Line range hint 675-675: Potential exposure of a Generic API Key.

It appears that an API key might be embedded within the configuration or data fields. Exposing API keys in public repositories or configurations can lead to unauthorized access to services. It is recommended to remove the key from the codebase and rotate it if it has been committed previously. Consider using environment variables or secure vault solutions to manage sensitive keys.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 24f2a89 and 92776db.

Files selected for processing (15)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/genesis.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.rpc.Query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/tx.ts (1 hunks)
  • proto/dydxprotocol/revshare/genesis.proto (1 hunks)
  • protocol/app/testdata/default_genesis_state.json (1 hunks)
  • protocol/scripts/genesis/sample_pregenesis.json (1 hunks)
  • protocol/testing/containertest/preupgrade_genesis.json (1 hunks)
  • protocol/testutil/constants/genesis.go (1 hunks)
  • protocol/x/listing/keeper/keeper.go (1 hunks)
  • protocol/x/listing/keeper/msg_server_test.go (1 hunks)
  • protocol/x/revshare/client/cli/query.go (1 hunks)
  • protocol/x/revshare/keeper/grpc_query.go (1 hunks)
  • protocol/x/revshare/keeper/msg_server_test.go (1 hunks)
  • protocol/x/revshare/types/errors.go (1 hunks)
Files skipped from review due to trivial changes (3)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/tx.ts
  • protocol/x/listing/keeper/keeper.go
Files skipped from review as they are similar to previous changes (6)
  • proto/dydxprotocol/revshare/genesis.proto
  • protocol/app/testdata/default_genesis_state.json
  • protocol/x/revshare/client/cli/query.go
  • protocol/x/revshare/keeper/grpc_query.go
  • protocol/x/revshare/keeper/msg_server_test.go
  • protocol/x/revshare/types/errors.go
Additional context used
Biome
indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.rpc.Query.ts

[error] 5-5: An empty interface is equivalent to {}. (lint/suspicious/noEmptyInterface)

Safe fix: Use a type alias instead.

indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/genesis.ts

[error] 5-5: An empty interface is equivalent to {}. (lint/suspicious/noEmptyInterface)

Safe fix: Use a type alias instead.


[error] 8-8: An empty interface is equivalent to {}. (lint/suspicious/noEmptyInterface)

Safe fix: Use a type alias instead.

Gitleaks
protocol/testutil/constants/genesis.go

342-342: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)

protocol/scripts/genesis/sample_pregenesis.json

538-538: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)

protocol/testing/containertest/preupgrade_genesis.json

675-675: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)

Additional comments not posted (6)
indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.rpc.Query.ts (1)

14-18: Ensure that the createRpcQueryExtension function returns the expected value. Currently, it returns an empty object, which might not be the intended functionality.

Please verify if the empty return object is intentional and aligns with the expected behavior.

protocol/x/listing/keeper/msg_server_test.go (2)

8-9: The import changes reflect the updated module structure and are correctly adjusted.


16-16: Initialization of ListingKeeper is correctly done in the test setup function.

protocol/testutil/constants/genesis.go (1)

1351-1351: Added an empty revshare object to GenesisState.

This change aligns with the PR's objective to initialize the revshare module. It's crucial to ensure that this module is properly integrated and tested in all relevant environments.

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

1754-1754: Initialization of the revshare module with an empty object is correct as per the PR objectives.

protocol/testing/containertest/preupgrade_genesis.json (1)

2181-2181: Initialization of revshare module in the genesis state.

The addition of an empty revshare object ensures that the new module is recognized and initialized properly during the genesis state setup. This change aligns with the PR objectives to integrate the revshare module into the system. Please ensure that the corresponding module logic and handlers are implemented to handle this new state.

import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate";
/** Query defines the gRPC querier service. */

export interface Query {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace the empty interface with a type alias for better clarity and to adhere to best practices.

- export interface Query {}
+ export type Query = any;  // Consider specifying a more appropriate type if available.
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 Query {}
export type Query = any; // Consider specifying a more appropriate type if available.
Tools
Biome

[error] 5-5: An empty interface is equivalent to {}. (lint/suspicious/noEmptyInterface)

Safe fix: Use a type alias instead.

import { DeepPartial } from "../../helpers";
/** GenesisState defines `x/revshare`'s genesis state. */

export interface GenesisState {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace the empty interfaces with type aliases to adhere to best practices and improve code clarity.

- export interface GenesisState {}
- export interface GenesisStateSDKType {}
+ export type GenesisState = any;  // Consider specifying a more appropriate type if available.
+ export type GenesisStateSDKType = any;  // Consider specifying a more appropriate type if available.

Also applies to: 8-8

Tools
Biome

[error] 5-5: An empty interface is equivalent to {}. (lint/suspicious/noEmptyInterface)

Safe fix: Use a type alias instead.

Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
@shrenujb shrenujb merged commit e09241b into main Jun 18, 2024
34 checks passed
@shrenujb shrenujb deleted the tra414 branch June 18, 2024 23:06
adamfraser pushed a commit that referenced this pull request Jun 24, 2024
Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
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