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

chore: update mempool defaults #4284

Merged
merged 5 commits into from
Feb 4, 2025
Merged

Conversation

evan-forbes
Copy link
Member

updates the default mempool values

@evan-forbes evan-forbes added backport:v3.x PR will be backported automatically to the v3.x branch upon merging defaults labels Feb 3, 2025
@evan-forbes evan-forbes self-assigned this Feb 3, 2025
@evan-forbes evan-forbes requested a review from a team as a code owner February 3, 2025 13:34
@evan-forbes evan-forbes requested review from cmwaters and ninabarbakadze and removed request for a team February 3, 2025 13:34
Comment on lines 266 to 272
cfg.Mempool.MaxTxBytes = 7_897_088
cfg.Mempool.MaxTxsBytes = 39_485_440
cfg.Mempool.Version = "v1" // prioritized mempool
cfg.Mempool.MaxTxBytes = 2 * mebibyte
cfg.Mempool.MaxTxsBytes = 80 * mebibyte
cfg.Mempool.Version = "v2" // prioritized mempool
Copy link
Member Author

Choose a reason for hiding this comment

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

It shouldn't be a breaking change to set the default to 2MiB since that should already be checked by the antihandler, but there's no reason to keep this at 8

the throughput was quadrupled, and the block times were halved, so the mempool's size was increased

Copy link
Contributor

coderabbitai bot commented Feb 3, 2025

Warning

Rate limit exceeded

@evan-forbes has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 23 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

Reviewing files that changed from the base of the PR and between 2aad5ed and 056869e.

📒 Files selected for processing (2)
  • app/default_overrides.go (2 hunks)
  • app/default_overrides_test.go (1 hunks)
📝 Walkthrough

Walkthrough

This pull request introduces a new constant, mebibyte (with a value of 1048576), to the default overrides file. It updates the mempool configuration parameters in the DefaultConsensusConfig function—adjusting TTLNumBlocks, TTLDuration, MaxTxBytes, MaxTxsBytes, and Version (from "v1" to "v2")—to use this constant instead of hardcoded numbers. The test file is similarly updated so that its assertions match the new configuration values.

Changes

File(s) Change Summary
app/default_overrides.go Added const mebibyte = 1048576. Updated DefaultConsensusConfig mempool settings: TTLNumBlocks from 12 to 24, TTLDuration from 75s to 150s, MaxTxBytes from 7,897,088 to 2 * mebibyte, MaxTxsBytes from 39,485,440 to 80 * mebibyte, and Version from "v1" to "v2". Moved the declaration of mebibyte from within the function to the top of the file.
app/default_overrides_test.go Modified TestDefaultConsensusConfig to verify that the mempool settings now use the updated values expressed with mebibyte and new timing and version parameters.

Possibly related PRs

Suggested labels

chore, WS: V3 3️⃣

Suggested reviewers

  • cmwaters
  • staheri14
  • rach-id
  • ninabarbakadze
  • rootulp

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 bot commented Feb 3, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a new constant mebibyte (value 1048576) to replace hardcoded byte values in configuration files. In app/default_overrides.go, it updates the MaxTxBytes, MaxTxsBytes, and the mempool Version (from "v1" to "v2"). In app/default_overrides_test.go, test parameters are adjusted with increased TTLDuration and TTLNumBlocks, and the redundant mebibyte declaration is removed for clarity.

Changes

File Summary of Changes
app/default_overrides.go Added constant mebibyte = 1048576; updated MaxTxBytes from 7_897_088 to 2 * mebibyte and MaxTxsBytes from 39_485_440 to 80 * mebibyte; updated mempool Version from "v1" to "v2"; removed redundant declaration.
app/default_overrides_test.go Updated test values: TTLDuration from 75 * time.Second to 150 * time.Second and TTLNumBlocks from 12 to 24; updated mempool Version from "v1" to "v2"; removed duplicate mebibyte declaration.

Possibly related PRs

Suggested labels

chore, WS: V3 3️⃣

Suggested reviewers

  • staheri14
  • cmwaters
  • rach-id
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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: 1

🔭 Outside diff range comments (2)
app/default_overrides.go (1)

301-301: Remove duplicate constant declaration.

The mebibyte constant is already declared at the package level (line 40). This local declaration is redundant.

-	const mebibyte = 1048576
app/default_overrides_test.go (1)

95-95: Remove duplicate constant declaration.

The mebibyte constant is already declared at the package level in default_overrides.go. This local declaration is redundant.

-		const mebibyte = 1048576
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d43ec72 and 46deee3.

📒 Files selected for processing (2)
  • app/default_overrides.go (2 hunks)
  • app/default_overrides_test.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: test / test-race
  • GitHub Check: test / test-fuzz
  • GitHub Check: test / test
  • GitHub Check: Summary
🔇 Additional comments (2)
app/default_overrides.go (2)

39-41: LGTM! Good use of a named constant.

The introduction of the mebibyte constant improves code readability by replacing magic numbers with a meaningful name.


270-272: Verify the impact of increased mempool limits and version change.

The changes:

  1. Increase MaxTxBytes to 2 MiB (from ~7.5 MiB)
  2. Increase MaxTxsBytes to 80 MiB (from ~37.7 MiB)
  3. Switch to prioritized mempool (v2)

These modifications could significantly impact memory usage and transaction processing behavior.

app/default_overrides_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

coderabbitai bot commented Feb 3, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a new constant mebibyte (1048576 bytes) in the app/default_overrides.go file and refactors the configuration of mempool parameters. The maximum transaction sizes are recalculated using this constant, and the mempool version is updated from "v1" to "v2". In the corresponding test file, the TTL duration and block count values are also increased, and the version identifier is similarly updated.

Changes

File Change Summary
app/default_overrides.go Introduced const mebibyte = 1048576; updated MaxTxBytes from 7,897,088 to 2 * mebibyte, MaxTxsBytes from 39,485,440 to 80 * mebibyte, and changed mempool Version from "v1" to "v2". Removed redundant constant declaration.
app/default_overrides_test.go Modified TestDefaultConsensusConfig by increasing TTLDuration from 75 * time.Second to 150 * time.Second, changing TTLNumBlocks from 12 to 24, and updating Version from "v1" to "v2".

Possibly related PRs

Suggested labels

chore

Suggested reviewers

  • staheri14
  • cmwaters
  • rootulp
  • rach-id
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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: 1

🔭 Outside diff range comments (1)
app/default_overrides.go (1)

301-301: Remove duplicate mebibyte constant.

The mebibyte constant is already defined at the package level (line 40). Having a duplicate declaration here is redundant.

-const mebibyte = 1048576
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d43ec72 and 46deee3.

📒 Files selected for processing (2)
  • app/default_overrides.go (2 hunks)
  • app/default_overrides_test.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test / test
  • GitHub Check: Summary
🔇 Additional comments (2)
app/default_overrides.go (2)

281-282: LGTM! P2P rate limits are well-balanced.

The P2P SendRate and RecvRate are appropriately set to 10MB/s, which aligns well with the increased mempool sizes.


270-272: Verify impact of increased mempool size limits.

The changes significantly increase the mempool limits:

  • MaxTxBytes increased to ~2MB
  • MaxTxsBytes increased to ~80MB
  • Version upgraded to prioritized mempool (v2)

These changes could impact memory usage and transaction processing behavior.

✅ Verification successful

Mempool configuration changes are consistent across the tests.

The updated values (2 × mebibyte for MaxTxBytes, 80 × mebibyte for MaxTxsBytes, and version set to "v2") are present in the main configuration file, and multiple test files (integration, benchmark, unit, and e2e) include references to mempool configurations. Although some tests compute effective mempool sizes (showing values different from the straightforward multiplication), this is expected if additional adjustments to the raw constants are applied during configuration processing.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any memory-related configurations or constraints in the codebase
rg -A 2 "MaxTxBytes|MaxTxsBytes|mebibyte" --type go

# Look for any performance test files that might need updating
fd -e go -e yaml -e json "perf|benchmark|test" --exec grep -l "mempool"

Length of output: 6446

app/default_overrides_test.go Outdated Show resolved Hide resolved
rootulp
rootulp previously approved these changes Feb 3, 2025
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

[optional] in a FLUP we can add a make command that makes it easy for node operators to modify their config in-place.

app/default_overrides.go Outdated Show resolved Hide resolved
rootulp
rootulp previously approved these changes Feb 3, 2025
Comment on lines 268 to 269
cfg.Mempool.TTLNumBlocks = 24
cfg.Mempool.TTLDuration = 150 * time.Second
Copy link
Collaborator

Choose a reason for hiding this comment

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

FWIW we already bumped these to account for 6 second blocks.

Ref: #3959 (comment)

Any particular reason to bump them again? I'm not opposed, just curious.

Copy link
Member Author

Choose a reason for hiding this comment

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

ahhh good catch

sorry I was just doubling everything will revert these

@evan-forbes evan-forbes merged commit abad811 into main Feb 4, 2025
28 checks passed
@evan-forbes evan-forbes deleted the evan/update-mempool-defaults branch February 4, 2025 17:59
mergify bot pushed a commit that referenced this pull request Feb 4, 2025
updates the default mempool values

---------

Co-authored-by: Rootul P <[email protected]>
(cherry picked from commit abad811)
evan-forbes added a commit that referenced this pull request Feb 4, 2025
updates the default mempool values
<hr>This is an automatic backport of pull request #4284 done by
[Mergify](https://mergify.com).

Co-authored-by: Evan Forbes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:v3.x PR will be backported automatically to the v3.x branch upon merging defaults
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants