Skip to content

feat(core): increase memory holding state trie - #2501

Open
wgr523 wants to merge 1 commit into
dev-upgradefrom
expand-tries-in-memory
Open

feat(core): increase memory holding state trie#2501
wgr523 wants to merge 1 commit into
dev-upgradefrom
expand-tries-in-memory

Conversation

@wgr523

@wgr523 wgr523 commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Proposed changes

increase memory holding state trie.

Memory increase from 1024MB to 3072MB.

As for purpose, only "cache memory allowance to use for trie pruning" is increased. Other purpose is kept the same memory.

Tested on a mainnet node with fast sync from scratch. Memory usage is only 10% of the server.

Types of changes

What types of changes does your code introduce to XDC network?
Put an in the boxes that apply

  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Changes that don't change source code or tests
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • revert: Revert something
  • style: Changes that do not affect the meaning of the code
  • test: Adding missing tests or correcting existing tests

Impacted Components

Which parts of the codebase does this PR touch?
Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Tested on a private network from the genesis block and monitored the chain operating correctly for multiple epochs.
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f54e8f1c-20d6-4e50-babc-362aeef05b0a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR increases default in-process memory settings related to state trie handling, primarily by raising the default cache budget and reallocating the cache split to give trie pruning (dirty trie) substantially more headroom.

Changes:

  • Increase default --cache from 1024MB to 3072MB.
  • Adjust default cache split percentages for database IO, trie clean cache, and trie pruning (GC).
  • Increase core.TriesInMemory from 128 to 1024 (affects trie retention/commit behavior).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
core/blockchain.go Raises TriesInMemory, changing how many historical tries are retained/used in commit/GC logic.
cmd/utils/flags.go Raises default cache size and changes default cache split percentages for DB/trie clean/trie GC; updates needed to keep CLI help accurate.
Suppressed comments (1)

cmd/utils/flags.go:320

  • The --cache-gc flag help text still states the default is 25% (full) / 0% (archive), but the default Value was changed to 34. This makes the CLI documentation misleading for operators.
		Aliases:  []string{"cache.gc"},
		Usage:    "Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode)",
		Value:    34,

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread core/blockchain.go
Comment on lines 102 to 106
receiptsCacheLimit = 32
maxFutureBlocks = 256
maxTimeFutureBlocks = 30
TriesInMemory = 128
TriesInMemory = 1024

Comment thread cmd/utils/flags.go
Comment on lines 311 to +313
Aliases: []string{"cache.trie"},
Usage: "Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode)",
Value: 15,
Value: 5,
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.

3 participants