Skip to content

Conversation

@aarmoa
Copy link
Collaborator

@aarmoa aarmoa commented May 29, 2025

  • added logic in Makefile to generate a list of all chain messages (with fully qualified name) every time the proto definitions are updated

Summary by CodeRabbit

  • New Features

    • Added a comprehensive JSON file listing all recognized blockchain message types for Injective Protocol.
    • Introduced an automated process to extract and update the list of message types after copying chain types.
  • Chores

    • Updated build scripts to include the new extraction and listing process for message types.

…s (with fully qualified name) every time the proto definitions are updated
@coderabbitai
Copy link

coderabbitai bot commented May 29, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

A new Makefile target, extract-message-names, was introduced to automate the extraction of registered protobuf message type names from specific files and output them as a JSON array. This target is now invoked at the end of the copy-chain-types process. Additionally, a new JSON file listing these message types was added.

Changes

File(s) Change Summary
Makefile Added extract-message-names target, updated .PHONY, and modified copy-chain-types to invoke it
injective_data/chain_messages_list.json Added new JSON file containing an array of registered chain message type identifiers

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Makefile
    participant FileSystem

    User->>Makefile: make copy-chain-types
    Makefile->>Makefile: Run copy-chain-types steps
    Makefile->>Makefile: Invoke extract-message-names
    Makefile->>FileSystem: Search for tx.pb.go files in ./chain
    Makefile->>FileSystem: Extract proto.RegisterType lines
    Makefile->>FileSystem: Parse and filter message names
    Makefile->>FileSystem: Write JSON array to injective_data/chain_messages_list.json
    Makefile->>User: Print extraction summary
Loading

Poem

In the warren of code, a new path appears,
Message names gathered, dispelling old fears.
With Makefile’s magic, the list grows anew,
JSON array shining, precise and true.
Now rabbits can hop, with messages in sight—
Chain types extracted, all through the night!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b77d838 and 78016d6.

📒 Files selected for processing (1)
  • Makefile (2 hunks)

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

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

@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

🧹 Nitpick comments (2)
Makefile (2)

153-154: Use $(MAKE) for recursive Make invocations to inherit flags

Replace the hardcoded call to make extract-message-names with $(MAKE) extract-message-names so that any flags, parallel jobs (-j), or environment variables passed to the top‐level Make are propagated to the recursive invocation.


161-163: Add explicit check for jq dependency

The target relies on jq to format and count messages. If jq is missing, the Make target will fail. Consider adding a check at the top of the target:

@command -v jq >/dev/null || { echo "Error: jq is required but not installed."; exit 1; }

This fails fast with a clear error.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a0a621 and b77d838.

📒 Files selected for processing (2)
  • Makefile (2 hunks)
  • injective_data/chain_messages_list.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: run-tests
  • GitHub Check: lint
🔇 Additional comments (1)
injective_data/chain_messages_list.json (1)

1-152: Skip review: generated file

This JSON file is auto-generated by the Makefile’s extract-message-names target. Manual edits are not recommended; it should be updated through the automation.

Makefile Outdated
@echo "Extracting message names from tx.pb.go files..."
@find ./chain -name "tx.pb.go" -exec grep -h "proto\.RegisterType" {} \; | \
sed -n 's/.*proto\.RegisterType([^"]*"\([^"]*\)".*/\1/p' | \
grep -v "Response$$" | \
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix grep pattern to correctly exclude Response messages

In the pipeline, grep -v "Response$$" is incorrect because in double quotes $$ expands to the shell PID. To exclude lines ending with Response, use a literal regex anchor, for example:

-		grep -v "Response$$" | \
+		grep -v 'Response$' | \

This ensures only message types ending with Response are filtered out.

📝 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
grep -v "Response$$" | \
- grep -v "Response$$" | \
+ grep -v 'Response$' | \
🤖 Prompt for AI Agents
In the Makefile at line 159, the grep pattern `grep -v "Response$$"` incorrectly
uses double quotes causing `$$` to expand to the shell PID instead of matching
the end of line. To fix this, replace the double quotes with single quotes and
use `grep -v 'Response$'` so that the pattern correctly excludes lines ending
with "Response".

@aarmoa aarmoa merged commit 678af51 into dev May 29, 2025
5 of 6 checks passed
@aarmoa aarmoa deleted the feat/add_chain_messages_list branch May 29, 2025 14:26
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