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: replace any ttl-num-blocks value #4026

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

kinrokinro
Copy link
Contributor

Overview

On one of our node I found the default ttl-num-blocks value as 10 instead of 5, so the default approach will not work in this case and it should be fixed with this commit.

@kinrokinro kinrokinro requested a review from a team as a code owner November 7, 2024 13:58
@kinrokinro kinrokinro requested review from rootulp and cmwaters and removed request for a team November 7, 2024 13:58
@celestia-bot celestia-bot requested a review from a team November 7, 2024 13:58
@kinrokinro kinrokinro changed the title Makefile: replace any ttl-num-blocks value fix: replace any ttl-num-blocks value Nov 7, 2024
Copy link
Contributor

coderabbitai bot commented Nov 7, 2024

📝 Walkthrough

Walkthrough

The changes in the pull request focus on the Makefile, specifically the configure-v3 target. The modifications involve updating the sed commands to enhance the flexibility of the ttl-num-blocks configuration parameter. Instead of explicitly replacing the value 5 with 12, the new command employs a more general pattern that matches any preceding value. This adjustment ensures consistent behavior across macOS and Linux environments. Additionally, a minor formatting update is included, which adds a newline at the end of the file.

Changes

File Change Summary
Makefile Updated sed commands in configure-v3 to use a general pattern for ttl-num-blocks; added a newline at the end of the file.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Makefile
    participant ConfigFile

    User->>Makefile: Run configure-v3
    Makefile->>ConfigFile: Update ttl-num-blocks using sed
    ConfigFile-->>Makefile: Return updated configuration
    Makefile-->>User: Configuration updated successfully
Loading

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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

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

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: 0

🧹 Outside diff range and nitpick comments (1)
Makefile (1)

312-312: Consider documenting the ttl-num-blocks value change

The sed commands now correctly handle replacing any existing ttl-num-blocks value with 12. However, it would be helpful to:

  1. Document why 12 was chosen as the new value
  2. Consider making this value configurable via an environment variable like SEND_RECV_RATE

Example implementation:

 CONFIG_FILE ?= ${HOME}/.celestia-app/config/config.toml
 SEND_RECV_RATE ?= 10485760  # 10 MiB
+TTL_NUM_BLOCKS ?= 12  # Number of blocks before a message times out
 
 configure-v3:
 	@echo "Using config file at: $(CONFIG_FILE)"; \
 	if [[ "$$(uname)" == "Darwin" ]]; then \
 		sed -i '' "s/^recv_rate = .*/recv_rate = $(SEND_RECV_RATE)/" $(CONFIG_FILE); \
 		sed -i '' "s/^send_rate = .*/send_rate = $(SEND_RECV_RATE)/" $(CONFIG_FILE); \
-		sed -i '' "s/ttl-num-blocks = .*/ttl-num-blocks = 12/" $(CONFIG_FILE); \
+		sed -i '' "s/ttl-num-blocks = .*/ttl-num-blocks = $(TTL_NUM_BLOCKS)/" $(CONFIG_FILE); \
 	else \
 		sed -i "s/^recv_rate = .*/recv_rate = $(SEND_RECV_RATE)/" $(CONFIG_FILE); \
 		sed -i "s/^send_rate = .*/send_rate = $(SEND_RECV_RATE)/" $(CONFIG_FILE); \
-		sed -i "s/ttl-num-blocks = .*/ttl-num-blocks = 12/" $(CONFIG_FILE); \
+		sed -i "s/ttl-num-blocks = .*/ttl-num-blocks = $(TTL_NUM_BLOCKS)/" $(CONFIG_FILE); \
 	fi

Also applies to: 316-316

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5d6c695 and b87950b.

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

327-327: LGTM!

Adding a newline at the end of the file follows good Unix file format conventions.

@kinrokinro
Copy link
Contributor Author

I also found ttl-num-blocks = 0 and ttl-num-blocks = 15 on our RPC nodes (these have been around since the mocha-2 genesis I guess so that's probably the reason)

Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

utack

@evan-forbes
Copy link
Member

thanks @kinrokinro !!

Copy link
Member

@ninabarbakadze ninabarbakadze left a comment

Choose a reason for hiding this comment

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

utAck

@evan-forbes evan-forbes merged commit ceac540 into celestiaorg:main Nov 8, 2024
30 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants