Skip to content

Fix triejournaldirectory wiring#2213

Open
jschnelder wants to merge 1 commit into0xPolygon:developfrom
jschnelder:fix-triejournaldirectory-wiring
Open

Fix triejournaldirectory wiring#2213
jschnelder wants to merge 1 commit into0xPolygon:developfrom
jschnelder:fix-triejournaldirectory-wiring

Conversation

@jschnelder
Copy link
Copy Markdown

Description

This PR fixes a config wiring gap for cache.triejournaldirectory.

CacheConfig.TrieJournalDirectory was exposed in internal/cli/server/config.go (with TOML/HCL tags), but the value was not wired through buildEth() and was effectively ignored because eth/backend.go always used a hardcoded stack.ResolvePath("triedb").

What was done:

  1. Wired c.Cache.TrieJournalDirectory in buildEth() into ethconfig.Config.
  2. Added TrieJournalDirectory to ethconfig.Config.
  3. Updated eth/ethconfig/gen_config.go so TOML marshal/unmarshal includes this field.
  4. Updated eth/backend.go to use config.TrieJournalDirectory when provided, and keep default fallback to DATADIR/triedb when empty.

Result:

  • User-provided cache.triejournaldirectory now works.
  • Existing behavior remains unchanged when config is not set (backward-compatible).

Changes

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • Changes only for a subset of nodes

Nodes audience

This change is backward-compatible for all nodes.
Operational impact is mainly for node operators who explicitly set cache.triejournaldirectory (their configured directory is now respected).

Checklist

  • I have added at least 2 reviewer or the whole pos-v1 team
  • I have added sufficient documentation in code
  • I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply
  • Created a task in Jira and informed the team for implementation in Erigon client (if applicable)
  • Includes RPC methods changes, and the Notion documentation has been updated

Cross repository changes

  • This PR requires changes to heimdall
    • In case link the PR here:
  • This PR requires changes to matic-cli
    • In case link the PR here:

Testing

  • I have added unit tests
  • I have added tests to CI
  • I have tested this code manually on local environment
  • I have tested this code manually on remote devnet using express-cli
  • I have tested this code manually on amoy
  • I have created new e2e tests into express-cli

Manual tests

  1. Set cache.triejournaldirectory in config TOML to a custom relative path and start the node.
  2. Verify trie journal files are written under <DATADIR>/<custom-path>.
  3. Remove the field (or set empty), restart node, and verify fallback path remains <DATADIR>/triedb.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

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.

1 participant