Skip to content

feat(sae): Log state-sync updates - #5932

Open
StephenButtolph wants to merge 2 commits into
masterfrom
StephenButtolph/add-state-sync-logs
Open

feat(sae): Log state-sync updates#5932
StephenButtolph wants to merge 2 commits into
masterfrom
StephenButtolph/add-state-sync-logs

Conversation

@StephenButtolph

Copy link
Copy Markdown
Contributor

Why this should be merged

Currently state-syncing is totally silent.

How this works

  1. Adds logs (to say what is being synced)
  2. Uses the avalanchego logger rather than the libevm logger in the state syncer

How this was tested

Locally.

Need to be documented in RELEASES.md?

No.

Copilot AI lite review requested due to automatic review settings September 4, 2026 22:31
@StephenButtolph
StephenButtolph requested a review from a team as a code owner September 4, 2026 22:31
@StephenButtolph StephenButtolph self-assigned this Sep 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes are isolated to logging/plumbing, all in-repo call sites and tests are updated for the new syncer signature, and no functional issues were found in the modified code paths.

Pull request overview

This PR improves observability during SAEVM state sync by adding structured progress logs and by routing EVM state-sync logging through AvalancheGo’s logger instead of libevm’s global logger.

Changes:

  • Added high-level state-sync progress logs (block sync, snapshot wipe, EVM state sync, cross-chain state sync) with relevant context fields.
  • Refactored evmstate.NewSyncer/trie sync internals to use an injected logging.Logger and zap fields instead of libevm/log.
  • Updated call sites, tests, and build/module dependencies to account for the new logger plumbing.
File summaries
File Description
vms/saevm/statesync/syncer.go Adds structured logs for block sync, snapshot wipe, and EVM state sync phases.
vms/saevm/cchain/statesync/acceptor.go Adds structured logs around cross-chain state sync.
graft/evm/sync/evmstate/trie_sync_tasks.go Replaces libevm global logging with injected AvalancheGo logger (zap fields).
graft/evm/sync/evmstate/trie_sync_stats.go Injects logger into trie sync stats and logs ETA/progress via AvalancheGo logger.
graft/evm/sync/evmstate/trie_sync_stats_test.go Updates stats test to provide a no-op logger field.
graft/evm/sync/evmstate/trie_segments.go Routes segment progress debug logs through the injected logger.
graft/evm/sync/evmstate/sync_test.go Updates tests to pass a logger into evmstate.NewSyncer.
graft/evm/sync/evmstate/state_syncer.go Adds logger plumbing to StateSync and improves finalize error context.
graft/evm/sync/evmstate/BUILD.bazel Updates deps to include //utils/logging and zap; removes libevm/log.
graft/evm/sync/engine/client.go Updates syncer construction to pass AvalancheGo logger into evmstate.NewSyncer.
graft/evm/go.mod Promotes zap to a direct dependency for the graft/evm module.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

// The snapshot MUST either be empty or match the requested root.
// It will be regenerated anyway, so we can always wipe it.
// TODO(powerslider): Push into EVM syncer.
s.snowCtx.Log.Info("wiping snapshot before syncing state")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe put this above the comment? so the comment is still placed right above the relevant line?

}
s.snowCtx.Log.Info("finished wiping snapshot")

// TODO(powerslider): Remove dependency on graft.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here?

Comment on lines +107 to +111
s.snowCtx.Log.Info("syncing blocks",
zap.Stringer("acceptedHash", summary.AcceptedHash),
zap.Uint64("acceptedHeight", summary.AcceptedHeight),
zap.Uint64("numToFetch", numBlocksToFetch),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not put this log in vms/evm/sync/block? like command click on the blockSyncer.Sync. I feel like all the logs should go as close as possible to the real source just like we do with comments.

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