Skip to content

chore: remove triedb (rust-eth-triedb/pathdb) state backend#202

Open
chee-chyuan wants to merge 3 commits into
developfrom
remove_triedb
Open

chore: remove triedb (rust-eth-triedb/pathdb) state backend#202
chee-chyuan wants to merge 3 commits into
developfrom
remove_triedb

Conversation

@chee-chyuan

Copy link
Copy Markdown
Contributor

Removes all triedb-related code paths, keeping only the MDBX-based state backend. Eliminates the conditional is_triedb_active() branching across the engine, execution, storage, RPC, and node builder layers.

🤖 Generated with Claude Code

Removes all triedb-related code paths, keeping only the MDBX-based
state backend. This eliminates the conditional `is_triedb_active()`
branching throughout the engine, execution, storage, RPC, and node
builder layers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hashdit-bot

hashdit-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

Pull Request Review

This PR removes the TrieDB/pathdb backend entirely and standardizes the codebase on MDBX-only state handling. It deletes triedb-specific dependencies, config/CLI flags, startup alignment logic, trie prefetcher code paths, and conditional branching (is_triedb_active) across engine, storage, RPC, and node builder layers. It also updates related features/deps (e.g., enabling rocksdb multi-threaded-cf) and simplifies persistence/state-root/trie update flows to a single backend path.

Sensitive Content

No sensitive content detected.

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

@hashdit-bot

hashdit-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

Pull Request Review

This PR removes all TrieDB (rust-eth-triedb / pathdb) support across the Rust Ethereum client and standardizes the codebase on MDBX-only state handling. It deletes state-db CLI/config options (--statedb.triedb, StateDbConfig), strips triedb-specific execution/persistence/validation/prefetch logic, and removes triedb dependencies and patches from Cargo manifests/lockfile. It also updates related pipeline, RPC, storage, and docs codepaths to eliminate conditional backend branching and consistently compute/store trie data via MDBX.

Sensitive Content

No sensitive content detected.

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

chee-chyuan added a commit to bnb-chain/reth-bsc that referenced this pull request Jun 16, 2026
Drops all triedb code paths and the four rust-eth-triedb* git deps so the
downstream reth-bsc crate compiles against the upstream Reth tree where
PR bnb-chain/reth#202 has removed the same backend. After this change
the only state backend is MDBX.

Pinned `bnb-chain/reth` to rev 6dcb09c0090e046eea6440fbeb58cce5db0476b2
(PR 202 head) and aligned the bsc-ef-tests crate to the same rev.

- evm/builder.rs: collapsed `is_triedb_active()` + finish_with_difflayer
  override into `fn finish`, keeping the sparse-trie precomputed-root
  fast path and the MDBX `state_root_with_updates` fallback. Removed
  the `request_difflayer` helper.
- evm/{mod,config}.rs: removed `MinerTrieDbPrefetcher` type alias,
  `parent_difflayers` / `triedb_prefetcher` fields on
  `BscNextBlockEnvAttributes` + `BscBlockExecutionCtx`, and the
  `create_block_builder` workaround that scrubbed them.
- engine.rs: dropped the `!is_triedb_active()` gate on the sparse-trie
  spawner; `BscBuiltPayload::executed_block` no longer carries a
  difflayer (upstream `ExecutedBlock.difflayer` field deleted).
- miner/payload.rs: removed `parent_difflayers` from
  `BscBuildArguments`, the `fetch_triedb_difflayers` helper, the
  prefetcher state-hook closures, the pathdb safety guard, and the
  `executed_block.difflayer` assignments.
- miner/bid_simulator.rs: removed the triedb branch from
  `bid_simulate` and its `parent_difflayers` parameter.
- miner/bsc_miner.rs: deleted `fetch_parent_difflayers_for_bid` and
  its caller.
- Removed the now-unused `task_executor` field from
  `BscPayloadBuilder`, `BidSimulator`, and `MainWorkWorker` (it
  existed only to spawn the triedb prefetcher).
- README.md / CLAUDE.md / main.rs / miner/config.rs: purged
  `--statedb.triedb` references.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chee-chyuan added a commit to bnb-chain/reth-bsc that referenced this pull request Jun 24, 2026
* chore: reth dep (#366)

Co-authored-by: joey <10592664+joey0612@users.noreply.github.com>
Co-authored-by: cbh876 <3930922419@qq.com>
Co-authored-by: cbh876 <30834644+constbh@users.noreply.github.com>

* chore: remove triedb (rust-eth-triedb/pathdb) state backend

Drops all triedb code paths and the four rust-eth-triedb* git deps so the
downstream reth-bsc crate compiles against the upstream Reth tree where
PR bnb-chain/reth#202 has removed the same backend. After this change
the only state backend is MDBX.

Pinned `bnb-chain/reth` to rev 6dcb09c0090e046eea6440fbeb58cce5db0476b2
(PR 202 head) and aligned the bsc-ef-tests crate to the same rev.

- evm/builder.rs: collapsed `is_triedb_active()` + finish_with_difflayer
  override into `fn finish`, keeping the sparse-trie precomputed-root
  fast path and the MDBX `state_root_with_updates` fallback. Removed
  the `request_difflayer` helper.
- evm/{mod,config}.rs: removed `MinerTrieDbPrefetcher` type alias,
  `parent_difflayers` / `triedb_prefetcher` fields on
  `BscNextBlockEnvAttributes` + `BscBlockExecutionCtx`, and the
  `create_block_builder` workaround that scrubbed them.
- engine.rs: dropped the `!is_triedb_active()` gate on the sparse-trie
  spawner; `BscBuiltPayload::executed_block` no longer carries a
  difflayer (upstream `ExecutedBlock.difflayer` field deleted).
- miner/payload.rs: removed `parent_difflayers` from
  `BscBuildArguments`, the `fetch_triedb_difflayers` helper, the
  prefetcher state-hook closures, the pathdb safety guard, and the
  `executed_block.difflayer` assignments.
- miner/bid_simulator.rs: removed the triedb branch from
  `bid_simulate` and its `parent_difflayers` parameter.
- miner/bsc_miner.rs: deleted `fetch_parent_difflayers_for_bid` and
  its caller.
- Removed the now-unused `task_executor` field from
  `BscPayloadBuilder`, `BidSimulator`, and `MainWorkWorker` (it
  existed only to spawn the triedb prefetcher).
- README.md / CLAUDE.md / main.rs / miner/config.rs: purged
  `--statedb.triedb` references.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: const <122766871+constwz@users.noreply.github.com>
Co-authored-by: joey <10592664+joey0612@users.noreply.github.com>
Co-authored-by: cbh876 <3930922419@qq.com>
Co-authored-by: cbh876 <30834644+constbh@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chee-chyuan chee-chyuan marked this pull request as ready for review June 24, 2026 04:18
@chee-chyuan chee-chyuan requested a review from joey0612 as a code owner June 24, 2026 04:18
@hashdit-bot

hashdit-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

Pull Request Review

This PR removes all TrieDB-related functionality and dependencies from a Rust Ethereum client codebase, standardizing state handling on the MDBX backend across engine, storage, pipeline, RPC, CLI, and node-launch paths. It deletes triedb-specific config/CLI flags, prefetchers, alignment/unwind logic, diff-layer plumbing, and conditional runtime branches, while simplifying many call sites (e.g., save_blocks now returns () and always writes hashed state/trie updates to MDBX). It also introduces targeted safety/perf updates around overlay/changeset handling under concurrency and adjusts some dependency/features configuration (e.g., RocksDB multi-threaded-cf feature).

Sensitive Content

No sensitive content detected.

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

joey0612 added a commit to bnb-chain/reth-bsc that referenced this pull request Jul 8, 2026
* Merge pull request #375 from bnb-chain/feat/pasteur-fork-definition

feat(hardforks): define Pasteur hardfork

* feat(evm/precompiles): add Pasteur precompile set + dedup utilities (#376)

Introduce a dedicated Pasteur precompile set (build_pasteur_precompiles /
pasteur_traced / pasteur()) wired into the dispatcher, currently identical to
the Mendel set. Add a shared dedup module (DuplicateTracker + is_zero_bytes,
ported from bnb-chain/bsc lightclient/v2) that later PRs use to reject duplicate
validator identities and signer pubkeys.

Enabler only — no behavior change yet.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(evm/precompiles): reject duplicate validators in cometBFT 0x67 at Pasteur (#377)

Add the Pasteur cometBFT light-block precompile (0x67), which rejects validator
sets containing duplicate identities. require_unique_validators is threaded
through the decode path and validate_unique_validator_set checks uniqueness of
address, consensus pubkey, BLS key and relayer address across both the trusted
consensus state and the incoming light-block validator set. Unset (zero/empty)
bridge fields are exempt. Pre-Pasteur behavior is unchanged.

Ports bnb-chain/bsc #3623 (cometBFT light-block path).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(evm/precompiles): suspend legacy v1 Tendermint precompiles + reprice 0x67 at Pasteur (#379)

From Pasteur, the legacy v1 Tendermint header (0x64) and IAVL proof (0x65)
precompiles are deprecated and return an error for any input, and the cometBFT
light-block precompile (0x67) is repriced with per-input-byte gas
(base 3000 + 16/byte) so cost scales with the validator/signature count.
Pre-Pasteur behavior (live 0x64/0x65, flat 3000 for 0x67) is unchanged.

Ports bnb-chain/bsc #3726.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(system-contracts): Pasteur StakeHub + Governor upgrade (#380)

* feat(system-contracts): Pasteur StakeHub + Governor upgrade

Add the Pasteur system-contract upgrade: StakeHub (0x2002) and Governor (0x2004)
are swapped to genesis-contract v1.2.6 bytecode at the Pasteur transition on
mainnet/chapel/rialto. Adds the per-network bytecode, registers `pasteur` in
build.rs (which regenerates embedded_contracts.rs), and wires Pasteur into
hardfork_to_dir_name, hardforks_with_system_contracts, and
get_upgrade_system_contracts.

Ports bnb-chain/bsc #3721 + #3727.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test(system-contracts): cover Pasteur upgrade at the transition boundary

Add a test driving get_upgrade_system_contracts across the Pasteur transition:
the upgrade fires only when the parent is pre-Pasteur and the block is at/after
it, swapping exactly StakeHub and Governor; blocks fully before or after the fork
emit no Pasteur upgrade.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: remove triedb (rust-eth-triedb/pathdb) state backend (#371)

* chore: reth dep (#366)

Co-authored-by: joey <10592664+joey0612@users.noreply.github.com>
Co-authored-by: cbh876 <3930922419@qq.com>
Co-authored-by: cbh876 <30834644+constbh@users.noreply.github.com>

* chore: remove triedb (rust-eth-triedb/pathdb) state backend

Drops all triedb code paths and the four rust-eth-triedb* git deps so the
downstream reth-bsc crate compiles against the upstream Reth tree where
PR bnb-chain/reth#202 has removed the same backend. After this change
the only state backend is MDBX.

Pinned `bnb-chain/reth` to rev 6dcb09c0090e046eea6440fbeb58cce5db0476b2
(PR 202 head) and aligned the bsc-ef-tests crate to the same rev.

- evm/builder.rs: collapsed `is_triedb_active()` + finish_with_difflayer
  override into `fn finish`, keeping the sparse-trie precomputed-root
  fast path and the MDBX `state_root_with_updates` fallback. Removed
  the `request_difflayer` helper.
- evm/{mod,config}.rs: removed `MinerTrieDbPrefetcher` type alias,
  `parent_difflayers` / `triedb_prefetcher` fields on
  `BscNextBlockEnvAttributes` + `BscBlockExecutionCtx`, and the
  `create_block_builder` workaround that scrubbed them.
- engine.rs: dropped the `!is_triedb_active()` gate on the sparse-trie
  spawner; `BscBuiltPayload::executed_block` no longer carries a
  difflayer (upstream `ExecutedBlock.difflayer` field deleted).
- miner/payload.rs: removed `parent_difflayers` from
  `BscBuildArguments`, the `fetch_triedb_difflayers` helper, the
  prefetcher state-hook closures, the pathdb safety guard, and the
  `executed_block.difflayer` assignments.
- miner/bid_simulator.rs: removed the triedb branch from
  `bid_simulate` and its `parent_difflayers` parameter.
- miner/bsc_miner.rs: deleted `fetch_parent_difflayers_for_bid` and
  its caller.
- Removed the now-unused `task_executor` field from
  `BscPayloadBuilder`, `BidSimulator`, and `MainWorkWorker` (it
  existed only to spawn the triedb prefetcher).
- README.md / CLAUDE.md / main.rs / miner/config.rs: purged
  `--statedb.triedb` references.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: const <122766871+constwz@users.noreply.github.com>
Co-authored-by: joey <10592664+joey0612@users.noreply.github.com>
Co-authored-by: cbh876 <3930922419@qq.com>
Co-authored-by: cbh876 <30834644+constbh@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: bump reth dep to latest remove_triedb (PR #202) commit 0dea17d2

Picks up reth#204 "persist target clamp finalized" on top of the
remove_triedb branch (was 6dcb09c).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* perf(miner): adaptive root-reserve + per-attempt sparse-trie sink (ported to develop-hardfork-pasteur) (#418)

* chore: update pasteur time in qa env

* test: fix Pasteur dormancy test after qanet activation scheduled

qanet now schedules Pasteur at a real timestamp, so the test must assert
its concrete activation instead of dormancy. Mainnet/testnet remain dormant.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(rpc/eth_config): return null blobSchedule to match go-bsc (#422)

go-bsc's eth_config (EIP-7910) returns `blobSchedule: null` for forks whose
ChainConfig.BlobConfig(LatestFork(t)) yields nil (e.g. Mendel, Pasteur), while
reth returned a populated object — diverging from the reference client.

reth's eth_config uses alloy's EthConfig, whose EthForkConfig.blob_schedule is a
required (non-optional) BlobParams that always serializes, so it cannot emit
null. Introduce a BSC-specific eth_config RPC (BscEthConfigApi) that returns a
raw JSON value, then null `blobSchedule` on current/next/last per go-bsc's
per-fork logic: keep it only for Cancun/Fermi/Maxwell/Lorentz/Osaka; null for
all others (incl. Mendel/Pasteur). Each snapshot's fork is resolved from its
activationTime via revm_spec_by_timestamp_and_block_number.

RPC introspection only — no consensus impact (both clients enforce the same
blob params in block validation).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: qanet hf time

* test: expect Pasteur dormant on qanet after activation reverted

The qanet Pasteur activation was reverted to unscheduled (u64::MAX) in
cf8d5d1, but the dormancy test still expected the old concrete
timestamp. Fold qanet into the dormant-schedule assertion loop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: const <122766871+constwz@users.noreply.github.com>
Co-authored-by: joey <10592664+joey0612@users.noreply.github.com>
Co-authored-by: cbh876 <3930922419@qq.com>
Co-authored-by: cbh876 <30834644+constbh@users.noreply.github.com>
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