Skip to content

core/vm,cmd: review the remaining unmetered removal candidates (beacon, bugcmd, browser, ethash) #2930

Open

Description

@gzliudan

Summary

About 3750 lines of cleanup candidates remain after the privacy package. They are not all the same kind, and they cannot be deleted as one batch.

Not wired at all (806 lines remain of the original 957):

  • beacon/ -- still 806 lines. geth's PoS light client, never wired; the whole tree (Makefile / cicd / build / internal / tests) has zero references, and XDPoSChain/beacon/... is imported only from within beacon/ itself.
  • DONE: cmd/XDC/bugcmd.go (was 105 lines) and cmd/internal/browser/ (was 46 lines) -- deleted by PR refactor(cmd,consensus,core,eth,internal,XDCx,contracts): clear the unused linter debt #2896 (commit 4d5f019b7b); no references remain anywhere in the tree.

The remaining item can go independently.

Still wired (needs a decision and rewiring):

  • consensus/ethash/ -- 684 lines. Four production references: eth/backend.go:535 (NewFaker fallback for non-XDPoS configs), miner/remote_agent.go:120 (SeedHash), ethclient/simulated/backend.go:230, and the reward constants in cmd/puppeth/genesis.go. tests/ adds two non-test helper files (tests/difficulty_test_util.go:25,59, tests/block_test_util.go:31,115). Delete only after those call sites are rewritten.

Already tracked elsewhere:

  • Privacy precompiles 0x1e/0x28 and core/vm/privacy/ are tracked in core/vm: remove unused privacy precompiles and the privacy package #2895 (PR refactor(core/vm): remove unused privacy precompiles and the privacy package, close #2895 #2898). They are historical consensus code, not dead code: they were active precompiles on mainnet from block 4 to 80,369,999 and on testnet from block 4 to 61,289,999. Removing them needs a historical replay from the Byzantium block, so that work is deliberately separate. Current shape: the package is 2795 lines (bulletproof.go 1372 + ringct.go 621 + 802 of tests); 0x1e/0x28 are written as common.BytesToAddress([]byte{30}) / ([]byte{40}) and registered only in the Byzantium (core/vm/contracts.go:72-73) and Istanbul (:90-91) tables -- the XDCv2, EIP1559, Prague and Osaka buckets do not contain them, and activePrecompiledContracts (:223-240) has no London branch.
  • core/vm/XDCx_price.go (79 lines) is not a removal candidate: 0x29/0x2a are registered and wired (core/vm/contracts.go:74-75,92-93, :276-279 calls SetTradingState) with four tests (contracts_test.go:74-75,688-712).

Suggested fix

Delete beacon/ in one PR (bugcmd.go and cmd/internal/browser/ are already gone via PR #2896). Treat ethash separately with its call-site rewrites. Keep the privacy decision with #2895.

Impact if unfixed

About 800 lines of unreachable code keep getting read, reviewed and maintained.


Audit item 18 (Nice to have); line numbers are on dev-upgrade at 1f445511fc (re-verified 2026-11-04).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageMaintainer needs to evaluate this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions