Skip to content

stepSize: all tooling to use tx.Debug().StepSize() instead of DefaultStepSize constant#20280

Merged
AskAlexSharov merged 7 commits intorelease/3.4from
alex/tooling_step_size_34
Apr 4, 2026
Merged

stepSize: all tooling to use tx.Debug().StepSize() instead of DefaultStepSize constant#20280
AskAlexSharov merged 7 commits intorelease/3.4from
alex/tooling_step_size_34

Conversation

@AskAlexSharov
Copy link
Copy Markdown
Collaborator

@AskAlexSharov AskAlexSharov commented Apr 2, 2026

  • use tx.Debug().StepSize() instead of DefaultStepSize constant
  • integration print_stages to show each domain history pruning progress (separately for each table)

@AskAlexSharov AskAlexSharov enabled auto-merge (squash) April 2, 2026 03:51
@AskAlexSharov AskAlexSharov requested a review from wmitsuda April 3, 2026 07:54
@AskAlexSharov AskAlexSharov merged commit 48607d6 into release/3.4 Apr 4, 2026
22 checks passed
@AskAlexSharov AskAlexSharov deleted the alex/tooling_step_size_34 branch April 4, 2026 01:47
AskAlexSharov added a commit that referenced this pull request Apr 5, 2026
@AskAlexSharov AskAlexSharov requested a review from Copilot April 6, 2026 00:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates integration tooling to use the configured ErigonDB step size (via tx.Debug().StepSize() / state.ResolveErigonDBSettings) instead of hardcoding config3.DefaultStepSize, and enhances integration print_stages output to show more granular domain history pruning/index progress.

Changes:

  • Update integration commands to derive step size from DB settings / transaction debug info rather than DefaultStepSize.
  • Add helper logic for opening/scanning history with resolved ErigonDB settings.
  • Extend print_stages to print per-domain/per-table index step counts for pruning/progress visibility.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
db/config3/config3.go Clarifies comments around legacy/default step-size constants and encourages reading actual settings from erigondb.toml.
cmd/integration/commands/state_history.go Refactors history tooling to use ResolveErigonDBSettings and step-size derived values (instead of config constants).
cmd/integration/commands/reset_state.go Enhances printStages output to include additional index-step metrics per inverted index table.
cmd/integration/commands/commitment.go Replaces DefaultStepSize usage with tx.Debug().StepSize() for commitment reads/benchmarks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if err != nil {
return nil, nil, fmt.Errorf("init history: %w", err)
}
history.Scan(scanToStep * settings.StepSize)
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

History.Scan returns an error, but the result is currently ignored. This won’t compile (unused return value) and also drops scan failures at runtime. Capture and handle the error (return it from openHistory with context).

Suggested change
history.Scan(scanToStep * settings.StepSize)
if err := history.Scan(scanToStep * settings.StepSize); err != nil {
return nil, nil, fmt.Errorf("scan history: %w", err)
}

Copilot uses AI. Check for mistakes.
Comment on lines +77 to +90
func openHistory(dirs datadir.Dirs, domainName string, scanToStep uint64, logger log.Logger) (*state.History, *state.ErigonDBSettings, error) {
settings, err := state.ResolveErigonDBSettings(dirs, logger, false)
if err != nil {
return nil, nil, fmt.Errorf("resolve erigondb settings: %w", err)
}
domainKV, err := kv.String2Domain(domainName)
if err != nil {
return nil, nil, fmt.Errorf("resolve domain: %w", err)
}
history, err := state.NewHistory(
statecfg.Schema.GetDomainCfg(domainKV).Hist,
settings.StepSize,
settings.StepsInFrozenFile,
dirs,
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

ResolveErigonDBSettings can read values from erigondb.toml without validation; if StepSize or StepsInFrozenFile is 0, this code will later divide by zero (e.g., fromTxNum/stepSize) or loop forever. Add a sanity check in openHistory (e.g., require both > 0) and return a clear error if invalid.

Copilot uses AI. Check for mistakes.
Comment on lines 129 to 132
err = roTx.HistoryDump(
int(fromStep)*config3.DefaultStepSize,
int(toStep)*config3.DefaultStepSize,
int(fromStep)*int(stepSize),
int(toStep)*int(stepSize),
keyToDump,
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

fromStep/toStep are uint64 (default --to is 1e18). Converting to int and multiplying by stepSize can overflow int (and also overflow the uint64 step->txNum conversion earlier), producing negative/incorrect ranges passed to HistoryDump. Consider clamping toStep based on math.MaxInt/stepSize (or using a sentinel like --to=0 meaning “max”) and validating before conversion.

Copilot uses AI. Check for mistakes.
github-merge-queue Bot pushed a commit that referenced this pull request Apr 6, 2026
…x, xsync fix, warmuper fix, logs debug, unused code (#20337)

Cherry-picks from release/3.4 to main:

- integrity: blk-range chk to pre-build "changed keys" index before calc
state root (#20302)
- up gql and grpc (#20304)
- stepSize: all tooling to use `tx.Debug().StepSize()` instead of
`DefaultStepSize` constant (#20280)
- db/state: fix CursorHeap tie-break to prefer RAM over DB over FILE
(#20318)
- xsync deprecated use fix (#20331)
- warmuper.WaitAndClose: cancel work before wait (#20332)
- logs: move some Info logs to Debug level (to simplify logs for Users)
(#20329)
- db: unused code remove (#20334)

---------

Co-authored-by: moskud <sudeepdino008@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.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.

3 participants