cp: integrity blk-range, up gql/grpc, stepSize tooling, CursorHeap fix, xsync fix, warmuper fix, logs debug, unused code#20337
Merged
AskAlexSharov merged 19 commits intomainfrom Apr 6, 2026
Merged
Conversation
…c state root (#20302) 10_000x faster `check-commitment-hist-at-blk-range` in-mem index of "changed keys per each block" built once per 10K blocks Problem: each `HistoryKeyTxNumRange()` call it's full-scan of `.ef` file - and now it happening per-block. Solution: call it once per 10K blocks and process results into "blockNum -> changedKeys" idx
…ultStepSize` constant (#20280)
…FILE (#20318) - When `DomainDelPrefix` iterates storage keys during account deletion, it merges RAM, DB, and FILE cursors via a min-heap - RAM and DB cursors both used `endTxNum: math.MaxUint64`, so when the same key existed in both, heap order was undefined - If DB won the tie, the old value was used as `prevVal` in the history entry instead of the current uncommitted RAM value - This caused corrupted history values that propagated to commitment root mismatches Fix: add tie-breaker in `CursorHeap.Less` — when `endTxNum` is equal, prefer `RAM_CURSOR > DB_CURSOR > FILE_CURSOR` **Safety**: `CursorHeap` is used in 3 contexts: - `merge.go` / `deduplicate.go`: only `FILE_CURSOR` — tie-break is a no-op (same type, returns false) - `DomainLatestIterFile` (DB + FILE): DB `endTxNum = step * stepSize` always differs from FILE `endTxNum = item.endTxNum - 1`, so tie-break rarely fires. If it does, DB correctly wins over FILE - `debugIteratePrefixLatest` (RAM + DB + FILE): the bug fix — RAM now correctly wins over DB when both use `MaxUint64` Fixes #20246
before: - seems we never close Warmuper - because WaitAndClose switching atomic. - seems we wait-first and then cancel/close work channel - it's wrong because `WaitAndClose()` called when warmup not needed anymore (commitment calc finished): ``` warmuper.Start() defer warmuper.WaitAndClose() ``` PR: canceling first and then wait gorouines to finish
Contributor
There was a problem hiding this comment.
Pull request overview
Cherry-pick bundle from release/3.4 to main, primarily improving integrity/state-history verification performance and aligning tooling with configurable step-size, plus several correctness fixes (CursorHeap ordering, warmuper shutdown) and dependency/log-level updates.
Changes:
- Add an in-memory “changed keys per block” index to accelerate
check-commitment-hist-at-blk-range, and refactor commitment-history checks to reuse prebuilt indices. - Update tooling to use dynamic step size (
tx.Debug().StepSize()/ erigondb.toml settings) instead ofDefaultStepSize. - Fix CursorHeap tie-break ordering (RAM > DB > FILE), adjust warmuper shutdown ordering, reduce log verbosity, and remove unused code.
Reviewed changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod | Bumps gqlgen/grpc/x/* and other deps; adds indirect go-yaml; updates erigon-snapshot revision |
| go.sum | Syncs sums to dependency updates |
| execution/types/receipt_test.go | Removes unused helpers/imports from receipt tests |
| execution/stagedsync/exec3_serial.go | Reuses state cache per loop; adjusts when stats are printed/reset |
| execution/execmodule/exec_module.go | Always passes state cache; actual enablement gated inside SharedDomains |
| execution/commitment/warmuper.go | Replaces WaitAndClose with CloseAndWait (cancel/close before waiting) |
| execution/commitment/hex_patricia_hashed.go | Switches deferred shutdown to CloseAndWait() |
| execution/commitment/commitmentdb/commitment_context.go | Alters commitment processing debug logging behavior (currently commented out) |
| execution/cache/state_cache.go | Makes PrintStatsAndReset() safe on nil receiver |
| db/state/inverted_index.go | Removes unused ef path mask helper |
| db/state/history.go | Removes unused path mask helpers and deprecated file getter |
| db/state/execctx/domain_shared.go | SetStateCache now respects dbg.UseStateCache; removes unused const |
| db/state/domain.go | Removes unused file mask helpers and unused buffer field |
| db/state/domain_stream.go | Fixes CursorHeap tie-break to prefer RAM over DB over FILE when endTxNum ties |
| db/state/domain_stream_test.go | Adds tests covering the new CursorHeap tie-break rules |
| db/state/aggregator.go | Downgrades some snapshot merge logs from Info to Debug |
| db/snapcfg/util.go | Adjusts embedded snapshot hash/webseed registry entries (removes some chains) |
| db/rawdb/rawdbhelpers/rawdbhelpers.go | Adds helper to estimate step-range present in an arbitrary DupSort txNum-keyed table |
| db/integrity/deref_cache.go | Removes unused cache-entry encoder helper |
| db/integrity/commitment_integrity.go | Refactors commitment-history checks to build/reuse changed-keys indices; changes blk-range checking strategy and concurrency model |
| db/integrity/changed_keys_per_block.go | New: builds per-domain changed-keys-per-block in-memory index + TxNum→Block mapper |
| db/integrity/changed_keys_per_block_test.go | New: unit tests for changed-keys-per-block indexing and TxNum→Block mapping |
| db/config3/config3.go | Clarifies comments: prefer settings from erigondb.toml / tx.Debug().StepSize() |
| common/maphash/maphash.go | Updates xsync usage from deprecated MapOf API to Map API |
| cmd/utils/app/snapshots_cmd.go | Updates integrity command call sites to new commitment-history API signature |
| cmd/rpcdaemon/graphql/graph/schema.resolvers.go | Regenerated header comment for gqlgen version bump |
| cmd/rpcdaemon/graphql/graph/generated.go | Large gqlgen-generated update (generic config/state, concurrency helpers, nil-input handling) |
| cmd/integration/commands/state_history.go | Uses resolved erigondb settings for step size/frozen-file steps when reading history |
| cmd/integration/commands/reset_state.go | Extends print_stages output; uses tx.Debug().StepSize() and new DB progress helpers |
| cmd/integration/commands/commitment.go | Uses tx.Debug().StepSize() for commitment reads/benchmarks |
| cl/transition/impl/eth2/operations.go | Removes unused deposit signature validation helper |
| .github/workflows/manifest.yml | Updates webseed URLs from erigon31-v1 to erigon34-v1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- changed_keys_per_block: cast windowLen to int for make/range loop - commitment_integrity: create sampler per-goroutine (Sampler.rng not goroutine-safe); limit concurrency to GOMAXPROCS/4 for memory-heavy windows - rawdbhelpers: guard len>=8 before BigEndian.Uint64 in IdxStepsInDB - warmuper: route Wait() through Close() to use atomic guard, preventing double-close panic - commitment_context: remove dead _ = logPrefix and commented-out log block Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
18b6d0c to
5e17249
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 31 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- commitment_integrity: remove unused db param from checkCommitmentHistAtBlkWithIdx - aggregator: remove commented-out log lines Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
04768cf to
43d2a9a
Compare
sudeepdino008
approved these changes
Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picks from release/3.4 to main:
tx.Debug().StepSize()instead ofDefaultStepSizeconstant (stepSize: all tooling to usetx.Debug().StepSize()instead ofDefaultStepSizeconstant #20280)