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

fix: update swagger script #270

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

MaxMustermann2
Copy link
Contributor

@MaxMustermann2 MaxMustermann2 commented Dec 19, 2024

Run with make proto-swagger-gen

Edits:

  • Fix path for some query.proto files
  • Add all eligible modules to config.json
  • Remove any unused modules from it
  • Include exocore modules in the script

Description


Closes #XXX

Summary by CodeRabbit

  • New Features

    • Project renamed from "Evmos Chain" to "Exocore".
    • Introduction of new API endpoints for "dogfood," "assets," "slash," "oracle," "exomint," and "feedistribution".
  • Improvements

    • Updated API URLs and operation IDs to reflect the new project structure.
    • Enhanced versioning for various RPC methods across multiple services.
  • Bug Fixes

    • Removed outdated API entries related to the "evmos" namespace.
  • Documentation

    • Restructured API documentation to align with the new project name and functionalities.

Run with `make proto-swagger-gen`

Edits:
 - Fix path for some query.proto files
 - Add all eligible modules to config.json
 - Remove any unused modules from it
 - Include `exocore` modules in the script
Copy link
Contributor

coderabbitai bot commented Dec 19, 2024

Walkthrough

This pull request encompasses a comprehensive update to the project's API documentation and gRPC service definitions, transitioning from "Evmos Chain" to "Exocore". The changes primarily involve renaming project references, updating API URLs, and standardizing endpoint paths with version v1 across multiple proto files. The modifications include removing outdated API entries, introducing new endpoints for modules like dogfood, assets, slash, oracle, and exomint, and ensuring consistent versioning in the API structure.

Changes

File Change Summary
client/docs/config.json - Renamed project title from "Evmos Chain" to "Exocore"
- Removed several "evmos" namespace API entries
- Added new API endpoints for exocore modules
proto/exocore/*/v1/query.proto - Updated HTTP endpoint paths to include /v1
- Standardized API method routes
- Consistent versioning across AVS, dogfood, epochs, feedistribution, oracle, reward, and slash modules
scripts/protoc-swagger-gen.sh - Added a step to copy the exocore directory for Swagger generation

Suggested labels

Type: CI

Suggested reviewers

  • TimmyExogenous
  • leonz789
  • cloud8little
  • magj2006
  • adu-web3

Poem

🐰 API paths, once tangled and wild,
Now versioned and neat, no longer riled.
From Evmos to Exocore, we dance and we leap,
Our endpoints now sing, no more secrets to keep!
Hop, hop, hooray for clean code today! 🚀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7bdfe73 and 5959e0b.

⛔ Files ignored due to path filters (4)
  • x/avs/types/query.pb.go is excluded by !**/*.pb.go
  • x/avs/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
  • x/feedistribution/types/query.pb.go is excluded by !**/*.pb.go
  • x/feedistribution/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
📒 Files selected for processing (3)
  • proto/exocore/avs/v1/query.proto (1 hunks)
  • proto/exocore/feedistribution/v1/query.proto (1 hunks)
  • scripts/protoc-swagger-gen.sh (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • proto/exocore/feedistribution/v1/query.proto
  • scripts/protoc-swagger-gen.sh
  • proto/exocore/avs/v1/query.proto

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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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: 3

🧹 Nitpick comments (2)
proto/exocore/slash/v1/query.proto (1)

Line range hint 6-6: Remove scaffolding comment.

The comment // this line is used by starport scaffolding # 1 appears to be an artifact from code generation and should be removed.

-// this line is used by starport scaffolding # 1
client/docs/config.json (1)

Line range hint 1-227: Consider adding API versioning documentation.

While the configuration is well-structured, it would be beneficial to add documentation about API versioning strategy, especially since we're mixing v1 and v1beta1 endpoints.

Consider adding a comment block at the top of the file explaining:

  • The versioning strategy for different modules
  • When to use v1 vs v1beta1
  • Migration guidelines for deprecated endpoints
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6638e9 and 21bdec4.

⛔ Files ignored due to path filters (12)
  • x/avs/types/query.pb.go is excluded by !**/*.pb.go
  • x/avs/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
  • x/epochs/types/query.pb.go is excluded by !**/*.pb.go
  • x/epochs/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
  • x/feedistribution/types/query.pb.go is excluded by !**/*.pb.go
  • x/feedistribution/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
  • x/oracle/types/query.pb.go is excluded by !**/*.pb.go
  • x/oracle/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
  • x/reward/types/query.pb.go is excluded by !**/*.pb.go
  • x/reward/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
  • x/slash/types/query.pb.go is excluded by !**/*.pb.go
  • x/slash/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
📒 Files selected for processing (8)
  • client/docs/config.json (2 hunks)
  • proto/exocore/avs/v1/query.proto (1 hunks)
  • proto/exocore/dogfood/v1/query.proto (1 hunks)
  • proto/exocore/epochs/v1/query.proto (1 hunks)
  • proto/exocore/feedistribution/v1/query.proto (1 hunks)
  • proto/exocore/oracle/v1/query.proto (1 hunks)
  • proto/exocore/reward/v1/query.proto (1 hunks)
  • proto/exocore/slash/v1/query.proto (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • proto/exocore/oracle/v1/query.proto
🔇 Additional comments (10)
proto/exocore/reward/v1/query.proto (1)

13-13: LGTM! Verify consistency with other endpoints.

The updated endpoint path follows RESTful conventions and correctly includes version numbering. The structure /exocore/reward/v1/params aligns with the package name and versioning.

Let's verify the consistency of endpoint paths across the codebase:

✅ Verification successful

LGTM! Endpoint path structure is consistent across the codebase.

The updated endpoint path /exocore/reward/v1/params follows the consistent pattern used throughout the codebase. All exocore module endpoints follow the same structure: /exocore/{module}/v1/{endpoint}, including slash, operator, oracle, reward, and other modules. The version (v1) is correctly placed in the path, matching the package versioning.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for inconsistent API endpoint paths in proto files
# Expected pattern: /exocore/{module}/v1/{endpoint}

# Search for all HTTP endpoint definitions in proto files
rg -t proto 'option \(google\.api\.http\).*= ".*"' 

Length of output: 82


Script:

#!/bin/bash
# Search for all HTTP endpoint definitions in protobuf files
rg 'option \(google\.api\.http\)' --type-add 'proto:*.proto' -t proto

Length of output: 15378

proto/exocore/slash/v1/query.proto (1)

14-14: LGTM! Endpoint structure is consistent.

The updated endpoint path /exocore/slash/v1/params follows the established pattern and correctly includes version numbering.

proto/exocore/epochs/v1/query.proto (2)

17-17: LGTM: Endpoint path correctly updated for EpochInfos

The endpoint path has been properly updated to reflect the epochs module instead of dogfood, maintaining the v1 version prefix.


21-21: LGTM: CurrentEpoch endpoint updated with proper path parameter

The endpoint path has been correctly updated to:

  1. Use the epochs module instead of dogfood
  2. Include the {identifier} path parameter which matches the request message field
proto/exocore/avs/v1/query.proto (1)

79-79: LGTM: Endpoint paths correctly standardized

The following endpoints have been properly updated to include the v1 version:

  • QueryAVSInfo
  • QueryAVSAddrByChainID
  • QuerySubmitTaskResult
  • QueryChallengeInfo

Also applies to: 87-87, 91-91, 95-95

proto/exocore/dogfood/v1/query.proto (1)

16-16: LGTM: All endpoint paths correctly standardized

The following endpoints have been properly updated to include the v1 version while maintaining consistent patterns:

  • Params
  • OptOutsToFinish
  • OperatorOptOutFinishEpoch
  • UndelegationsToMature
  • UndelegationMaturityEpoch
  • QueryValidator

All path parameters correctly match their corresponding request message fields.

Also applies to: 21-21, 26-26, 31-31, 36-36, 41-41

client/docs/config.json (4)

4-4: LGTM: Title update aligns with project rebranding.

The title change from "Evmos Chain" to "Exocore" correctly reflects the project rebranding.


207-227: LGTM: Additional module configurations are properly structured.

The configurations for interchain accounts, consensus, and reward modules follow the established pattern with appropriate operation ID renaming to prevent conflicts.


128-132: Verify the staking API endpoint change.

The staking API endpoint has been changed from staking/v1beta1/query to tx/v1beta1/service. This is a significant change that could affect existing integrations.


199-205: Verify the upgrade API path exclusion.

The exclusion of the upgraded consensus state endpoint needs verification to ensure it doesn't break existing functionality.

✅ Verification successful

Exclusion of upgraded consensus state endpoint is safe

The endpoint /cosmos/upgrade/v1beta1/upgraded_consensus_state/{last_height} is being excluded from the Cosmos upgrade module's swagger documentation, while a different endpoint /ibc/core/client/v1/upgraded_consensus_states remains available. This is safe because:

  1. The excluded endpoint is specific to the Cosmos upgrade module's internal consensus state
  2. The IBC client's upgraded consensus state endpoint remains accessible
  3. No client-side code references were found that depend on the excluded endpoint
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of excluding the upgraded consensus state endpoint

# Check for any direct references to the excluded endpoint
rg -l "upgraded_consensus_state" --type ts --type js --type md

# Check if there are any integration tests using this endpoint
rg -l "upgraded_consensus_state" --type test --type spec

Length of output: 148


Script:

#!/bin/bash
# Let's try a more comprehensive search approach

# Search for any references to upgraded_consensus_state in all files
rg -l "upgraded_consensus_state"

# Check the swagger file content to understand the endpoint usage
cat "./tmp-swagger-gen/cosmos/upgrade/v1beta1/query.swagger.json" || true

# Look for any upgrade-related API usage patterns
rg -l "upgrade.*api|upgrade.*endpoint" --type ts --type js

# Check for test files with different extensions
fd -e test.ts -e test.js -e spec.ts -e spec.js | xargs rg -l "upgraded_consensus_state" || true

Length of output: 466


Script:

#!/bin/bash
# Let's examine the swagger.json file to understand the endpoint context
cat "client/docs/swagger-ui/swagger.json" | grep -A 10 -B 10 "upgraded_consensus_state" || true

# Check the content of config.json to understand the full context
cat "client/docs/config.json" | grep -A 10 -B 10 "upgraded_consensus_state" || true

# Look for any upgrade-related client code
rg "upgrade" --type ts --type js -A 5 -B 5

Length of output: 8374

proto/exocore/feedistribution/v1/query.proto Outdated Show resolved Hide resolved
proto/exocore/avs/v1/query.proto Show resolved Hide resolved
client/docs/config.json Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21bdec4 and 7bdfe73.

⛔ Files ignored due to path filters (2)
  • x/avs/types/query.pb.go is excluded by !**/*.pb.go
  • x/avs/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
📒 Files selected for processing (2)
  • proto/exocore/avs/v1/query.proto (1 hunks)
  • scripts/protoc-swagger-gen.sh (1 hunks)
🔇 Additional comments (2)
scripts/protoc-swagger-gen.sh (1)

15-15: LGTM! Verify proto directory structure

The addition of exocore proto files to the Swagger generation process aligns with the PR objectives.

Let's verify the proto directory structure:

✅ Verification successful

Proto directory structure verified successfully

The proto/exocore directory exists and contains a comprehensive set of proto files organized in modules like appchain, assets, avs, delegation, etc., which confirms the path used in the script is valid.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify proto directory structure exists and contains expected files

# Check if proto/exocore directory exists and contains proto files
if [ -d "./proto/exocore" ]; then
  echo "Directory ./proto/exocore exists"
  find ./proto/exocore -name "*.proto" -type f
else
  echo "Error: Directory ./proto/exocore not found"
  exit 1
fi

Length of output: 2890

proto/exocore/avs/v1/query.proto (1)

83-83: Standardize the endpoint path for QueryAVSTaskInfo

The endpoint path /exocore/avs/v1/GetAVSTaskInfoReq is inconsistent with other endpoints as it uses a request message name instead of an operation name.

Consider updating to:

-    option (google.api.http).get = "/exocore/avs/v1/GetAVSTaskInfoReq";
+    option (google.api.http).get = "/exocore/avs/v1/task_info";

proto/exocore/avs/v1/query.proto Outdated Show resolved Hide resolved
proto/exocore/avs/v1/query.proto Outdated Show resolved Hide resolved
@MaxMustermann2
Copy link
Contributor Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Dec 19, 2024

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants