Skip to content

all: remove dead code and empty files#19665

Merged
anacrolix merged 1 commit into
mainfrom
yperbasis/rm1
Mar 6, 2026
Merged

all: remove dead code and empty files#19665
anacrolix merged 1 commit into
mainfrom
yperbasis/rm1

Conversation

@yperbasis

Copy link
Copy Markdown
Member

Remove unreachable functions, unused types, and dead code identified by whole-program analysis across the entire codebase. Also remove 12 files that became empty (license + package declaration only) and drop the now-unused protolambda/ztyp dependency.

125 files changed, ~5700 lines removed.

Remove unreachable functions, unused types, and dead code identified
by whole-program analysis across the entire codebase. Also remove
12 files that became empty (license + package declaration only)
and drop the now-unused protolambda/ztyp dependency.

125 files changed, ~5700 lines removed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@anacrolix anacrolix merged commit e0460f1 into main Mar 6, 2026
25 checks passed
@anacrolix anacrolix deleted the yperbasis/rm1 branch March 6, 2026 02:55
@anacrolix

Copy link
Copy Markdown
Contributor

I've done this on a few personal projects, sometimes there's reason to keep code, and there's a certain pattern to it, like if someConst, or if false && for feature flagging. If anyone has their code removed and has a pattern to feature flag things, we should include that in AGENTS.md or similar to instruct it to avoid removing these. I didn't see any in my quick scan.

yperbasis added a commit that referenced this pull request Mar 26, 2026
Replace common.Append (removed in #19665) with append(common.Copy(prev), ...)
to fix the build.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
yperbasis added a commit that referenced this pull request May 18, 2026
Remove 11 Go files and 1 readme that contain only a license header and
package declaration, only commented-out code, or document a package that
no longer exists. Follow-up to #19665.

- cl/transition/impl/funcmap/impl.go - entire Impl struct/methods in a
  block comment; only file in the package; no external references.
- cl/utils/time_test.go - both test bodies commented out.
- cmd/rpcdaemon/graphql/graph/model/test.go - just `package model`.
- cmd/sentinel/sentinelcli/flags/{flags,defaultFlags}.go - the whole
  package was empty (only these two files, neither imported anywhere).
- common/log/skip.go - just `package log`.
- db/integrity/receipts_no_duplicates_test.go - just `package integrity`.
- db/kv/temporal/historyv2/{changeset.go,readme.md} - the package was
  intentionally removed in #19665 but was accidentally re-introduced by
  a rebase artifact in #21124 (whose commit message is entirely about
  state-test fixes and never mentions historyv2); the codebase has zero
  references to it.
- db/state/reconst.go - orphan `package state` declaration in a 66-file
  package.
- execution/tracing/tracers/tracer.go - just `package tracers`; the
  sibling `tracers.go` is the real file.
- execution/tracing/tracers/logger/logger2_test.go - test body fully
  commented out.

Intentionally kept: doc.go files (godoc), gen.go/mockgen.go/abi.go
(//go:generate hosts), node/interfaces/*/keep.go (sub-module package
markers), and execution/commitment/bin_patricia_hashed{,_test}.go
(commented-out reference implementation worth preserving).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@yperbasis yperbasis mentioned this pull request May 18, 2026
3 tasks
nivanovvv pushed a commit to nivanovvv/erigon that referenced this pull request May 18, 2026
## Summary

Remove 11 Go files and 1 readme that contain only a license header and
package declaration, only commented-out code, or document a package that
no longer exists. Follow-up to erigontech#19665.

### Removed

- `cl/transition/impl/funcmap/impl.go` — entire `Impl` struct/methods in
a block comment; only file in the package; no external references.
- `cl/utils/time_test.go` — both test bodies commented out.
- `cmd/rpcdaemon/graphql/graph/model/test.go` — just `package model`.
- `cmd/sentinel/sentinelcli/flags/{flags,defaultFlags}.go` — the whole
package was empty (only these two files, neither imported anywhere).
- `common/log/skip.go` — just `package log`.
- `db/integrity/receipts_no_duplicates_test.go` — just `package
integrity`.
- `db/kv/temporal/historyv2/{changeset.go,readme.md}` — the package was
intentionally removed in erigontech#19665 but was accidentally re-introduced by a
rebase artifact in erigontech#21124 (whose commit message is entirely about
state-test fixes and never mentions historyv2); the codebase has zero
references to it.
- `db/state/reconst.go` — orphan `package state` declaration in a
66-file package.
- `execution/tracing/tracers/tracer.go` — just `package tracers`; the
sibling `tracers.go` is the real file.
- `execution/tracing/tracers/logger/logger2_test.go` — test body fully
commented out.

### Intentionally kept

Several other files matched "empty-except-package-and-comments" but
serve real purposes and were left alone:

- `doc.go` files in `common/log/v3/{,term/}`, `execution/rlp/`,
`execution/vm/{,runtime/}`, `p2p/dnsdisc/`, `node/{,app/workerpool/}`,
`rpc/` — godoc package documentation.
- `gen.go` / `mockgen.go` / `abi.go` files in `cmd/pics/contracts/`,
`txnprovider/shutter/internal/contracts/`, `execution/tests/contracts/`,
`execution/state/contracts/`, `rpc/jsonrpc/contracts/`,
`execution/protocol/rules/aura/auraabi/`,
`node/gointerfaces/{sentryproto,remoteproto,downloaderproto}/` —
`//go:generate` hosts.
-
`node/interfaces/{,p2psentinel/,types/,web3/,downloader/,txpool/,execution/,p2psentry/,remote/}keep.go`
— package markers for the `.proto`-only sub-module rooted at
`node/interfaces/` (has its own `go.mod`).
- `execution/commitment/bin_patricia_hashed{,_test}.go` — commented-out
reference implementation worth preserving for future work.

## Test plan

- [x] `make erigon integration` — clean build.
- [x] `make lint` — `0 issues.`
- [ ] CI green.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants