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

feat: add oracle miss counters and ibc inflows grpc api #2352

Merged
merged 9 commits into from
Dec 12, 2023

Conversation

gsk967
Copy link
Collaborator

@gsk967 gsk967 commented Dec 7, 2023

Description

closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • added appropriate labels to the PR
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

Summary by CodeRabbit

  • New Features

    • Introduced a new query method for tracking oracle vote miss counts by validators.
    • Expanded gRPC service capabilities to include queries for IBC inflow information and quota expiration times.
  • Bug Fixes

    • Improved the MissCounters function to handle specific validator queries and return accurate miss counts.
  • Documentation

    • Updated service definitions and comments to reflect new query functionalities.
  • Refactor

    • Enhanced existing query functions to support new inflow and outflow data retrieval requirements.

Copy link
Contributor

coderabbitai bot commented Dec 7, 2023

Walkthrough

The updates involve enhancing gRPC services and query handlers for an oracle and IBC (Inter-Blockchain Communication) module. New functionalities include querying miss counters for validators in the oracle module and inflow quotas for IBC transfers. The changes allow for more granular queries, such as retrieving data for a specific validator or denom, and add commands for users to interact with these new features.

Changes

File Path Change Summary
proto/umee/oracle/v1/query.proto Added MissCounters RPC method with related message types.
x/oracle/keeper/grpc_query.go Updated MissCounters function to handle new Validator field and return miss counters.
proto/umee/uibc/v1/query.proto Introduced new RPC methods for querying IBC inflows and quota expiration.
x/uibc/client/cli/query.go Added new CLI commands for querying IBC inflows and quota expiration times.
x/uibc/quota/grpc_query.go Added functions to Querier for handling new IBC inflow and quota expiration queries.

Poem

🐇 In the code where logic threads,
🌟 New queries bloom, and data spreads.
Validators' counts, and IBC flows,
🚀 Through gRPC, the knowledge grows.

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 X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment from CodeRabbit.
  • You can also chat with CodeRabbit bot directly around the specific lines of code or files in the PR by tagging @coderabbitai in a new comment.
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase.

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

Copy link

codecov bot commented Dec 7, 2023

Codecov Report

Merging #2352 (5fc2d6b) into main (7f05ad4) will decrease coverage by 5.60%.
Report is 317 commits behind head on main.
The diff coverage is 66.08%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2352      +/-   ##
==========================================
- Coverage   75.38%   69.79%   -5.60%     
==========================================
  Files         100      171      +71     
  Lines        8025    12713    +4688     
==========================================
+ Hits         6050     8873    +2823     
- Misses       1589     3235    +1646     
- Partials      386      605     +219     
Files Coverage Δ
ante/ante.go 66.66% <100.00%> (+18.45%) ⬆️
ante/fee.go 80.00% <100.00%> (+1.64%) ⬆️
ante/spam_prevention.go 75.92% <ø> (ø)
app/inflation/inflation.go 100.00% <100.00%> (ø)
app/upgradev3/migrations.go 84.21% <ø> (+5.94%) ⬆️
util/coin/utoken.go 100.00% <100.00%> (ø)
util/ibc/ibc.go 58.82% <ø> (ø)
util/sdkutil/events.go 0.00% <ø> (ø)
util/store/store.go 52.06% <ø> (+10.65%) ⬆️
util/store/unmarshal.go 42.85% <ø> (ø)
... and 40 more

... and 110 files with indirect coverage changes

@gsk967 gsk967 marked this pull request as ready for review December 7, 2023 17:05
@gsk967 gsk967 requested review from a team as code owners December 7, 2023 17:05
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: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 64e559f and df1dc01.
Files ignored due to filter (4)
  • x/oracle/types/query.pb.go
  • x/oracle/types/query.pb.gw.go
  • x/uibc/query.pb.go
  • x/uibc/query.pb.gw.go
Files selected for processing (5)
  • proto/umee/oracle/v1/query.proto (1 hunks)
  • proto/umee/uibc/v1/query.proto (1 hunks)
  • x/oracle/keeper/grpc_query.go (1 hunks)
  • x/uibc/client/cli/query.go (1 hunks)
  • x/uibc/quota/grpc_query.go (1 hunks)
Additional comments: 10
proto/umee/oracle/v1/query.proto (1)
  • 109-141: The addition of the MissCounters RPC method and related message types QueryMissCounters, QueryMissCountersResponse, and PriceMissCounter are correctly implemented according to the Protocol Buffers syntax and the PR objectives. These changes will enable querying of oracle miss counters for validators, which is a new feature for the Umee network's codebase.
proto/umee/uibc/v1/query.proto (5)
  • 32-41: The addition of the Inflows and AllInflows RPC methods with their respective request and response types is correctly implemented and aligns with the PR objectives to enhance the gRPC API for querying IBC inflows.

  • 44-46: The QueryAllInflows message type correctly includes a denom field, which is consistent with the PR objectives and the summary provided.

  • 50-54: The QueryAllInflowsResponse message type correctly includes a repeated field inflows of type cosmos.base.v1beta1.DecCoin, which is consistent with the PR objectives and the summary provided.

  • 62-68: The QueryInflowsResponse message type correctly includes an amount field with the appropriate annotations, which is consistent with the PR objectives and the summary provided.

  • 44-46: The QueryAllInflows message type should not include a denom field as it is intended to query all inflows without specifying a denom. This is inconsistent with the PR objectives and the summary provided.

message QueryAllInflows {
-  string denom = 1;
}
x/oracle/keeper/grpc_query.go (1)
  • 366-398: The changes to the MissCounters function correctly implement the handling of the req.Validator field. If a validator is specified, it retrieves the miss counter for that validator; otherwise, it iterates over all validators to collect their miss counters. The function then returns a QueryMissCountersResponse with the collected data.
x/uibc/client/cli/query.go (1)
  • 33-87: The addition of GetAllInflows and GetInflows functions aligns with the PR's objective to enhance the Umee network's IBC functionality. These functions are correctly implemented as Cobra commands and include proper error handling and query logic.
x/uibc/quota/grpc_query.go (2)
  • 61-79: The implementation of the AllInflows function correctly handles both cases: querying for a specific denom and querying for all inflows. The use of len(req.Denom) != 0 to check for a specific denom is a standard approach in Go.

  • 82-93: The Inflows function also correctly handles the case for a specific denom and the case for the sum of all registered inflows. The logic to differentiate between these cases is consistent with the AllInflows function.

x/uibc/client/cli/query.go Outdated Show resolved Hide resolved
x/oracle/keeper/grpc_query.go Outdated Show resolved Hide resolved
x/oracle/keeper/grpc_query.go Show resolved Hide resolved
x/uibc/quota/grpc_query.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 4825aba and e3f95b9.
Files ignored due to filter (2)
  • x/uibc/query.pb.go
  • x/uibc/query.pb.gw.go
Files selected for processing (3)
  • proto/umee/uibc/v1/query.proto (2 hunks)
  • x/uibc/client/cli/query.go (2 hunks)
  • x/uibc/quota/grpc_query.go (1 hunks)
Additional comments: 11
proto/umee/uibc/v1/query.proto (4)
  • 5-9: The import of "google/protobuf/timestamp.proto" is correctly added to support the new QueryQuotaExpiresResponse message type that uses google.protobuf.Timestamp.

  • 33-42: The addition of the Inflows and QuotaExpires RPC methods to the Query service is correctly implemented, following the protobuf conventions for service definitions.

  • 45-74: The new message types QueryQuotaExpires, QueryQuotaExpiresResponse, QueryInflows, and QueryInflowsResponse are correctly defined and follow protobuf conventions.

  • 33-74: The summary mentions the addition of three new RPC methods, but only two (Inflows and QuotaExpires) are present in the hunk. The MissCounters method is not shown, which may indicate an inconsistency between the summary and the provided code.

x/uibc/client/cli/query.go (4)
  • 23-30: The addition of GetInflows and GetQuotaEndTime commands to GetQueryCmd is correctly implemented, ensuring these new functionalities are integrated into the CLI.

  • 33-53: The GetQuotaEndTime function is well implemented, with appropriate error handling and use of the QueryQuotaExpires request to fetch the quota end time.

  • 56-81: The GetInflows function correctly handles an optional denom argument and queries the inflow data accordingly. Error handling and client context setup are properly done.

  • 119-125: The hunk does not show any modifications to the GetOutflows function, contrary to what the summary suggests. This could be an inconsistency in the summary or the changes might be located in a different part of the file not included in the hunk.

x/uibc/quota/grpc_query.go (3)
  • 61-77: The implementation of the Inflows function correctly handles both specific denom queries and all inflows, in line with the previous discussion between reviewers. The response structure appears to be consistent with the agreed-upon design.

  • 80-90: The QuotaExpires function is implemented correctly to return the current IBC quota end time, with proper error handling.

  • 61-90: The summary accurately reflects the changes made in the hunks, with the addition of Inflows and QuotaExpires functions to the Querier type.

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 e3f95b9 and 7eb137e.
Files selected for processing (3)
  • x/oracle/keeper/grpc_query.go (1 hunks)
  • x/uibc/client/cli/query.go (2 hunks)
  • x/uibc/quota/grpc_query.go (1 hunks)
Additional comments: 9
x/oracle/keeper/grpc_query.go (2)
  • 366-395: The new MissCounters method has been added correctly, following the described functionality. It handles both individual validator queries and all validators when the Validator field is empty. The use of IterateMissCounters for the latter case aligns with the previous comment from robert-zaremba about using a helper function to load all values.

  • 362-395: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [289-308]

The summary mentions a signature change for the MissCounter method, but the provided hunk and the rest of the file do not show any changes to this method's signature. If the signature was indeed changed, it should be reflected in the code provided.

x/uibc/client/cli/query.go (4)
  • 23-32: The addition of GetInflows and GetQuotaExpireTime commands to the GetQueryCmd function aligns with the PR objectives and the AI-generated summary. These commands extend the CLI functionality to support querying new IBC-related information.

  • 33-53: The implementation of GetQuotaExpireTime is consistent with the PR objectives, providing a CLI command to query the current IBC quota expire time. The function is well-documented and follows the established pattern for CLI commands in the codebase.

  • 56-81: The implementation of GetInflows is consistent with the PR objectives, providing a CLI command to query the total IBC inflow sum of registered tokens. The optional argument for specifying a denomination is handled correctly.

  • 119-125: The output from the shell scripts indicates that the GetOutflows function is indeed mentioned in the context of documentation and tests. Specifically, the query.go file contains comments that describe the use of the denom argument for both the GetInflows and GetOutflows functions. Additionally, the query_test.go file in the x/uibc/client/tests directory contains references to tests that seem to be related to the functionality of querying ibc-transfer quotas, which may include tests for the GetOutflows function.

However, the output does not explicitly confirm the presence of tests for the GetOutflows function with the new denom argument. To ensure that the change is properly tested, we need to verify that there are tests that specifically cover the new functionality introduced by the optional denom argument in the GetOutflows function.

Let's run a more targeted search to check for the presence of tests that specifically invoke the GetOutflows function with the denom argument.

x/uibc/quota/grpc_query.go (3)
  • 61-77: The implementation of the Inflows function correctly reflects the agreed-upon changes from the previous discussion, providing both individual and total inflows based on the req.Denom field.

  • 80-91: The QuotaExpires function has been added to return the current IBC quota expire time, which appears to be a straightforward addition without any issues.

  • 61-91: Ensure that the new functions Inflows and QuotaExpires are documented according to the project's standards, as per the PR objectives.

@gsk967 gsk967 added this pull request to the merge queue Dec 12, 2023
Merged via the queue into main with commit 75b0a6c Dec 12, 2023
26 of 28 checks passed
@gsk967 gsk967 deleted the sai/add_miss_counters branch December 12, 2023 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants