Skip to content

debug_executionWitness: follow up#20345

Merged
AskAlexSharov merged 3 commits into
mainfrom
alex/witn_35
Apr 7, 2026
Merged

debug_executionWitness: follow up#20345
AskAlexSharov merged 3 commits into
mainfrom
alex/witn_35

Conversation

@AskAlexSharov

Copy link
Copy Markdown
Collaborator

address CodeReview comments in #20205

@Giulio2002 Giulio2002 added this pull request to the merge queue Apr 6, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 6, 2026
@AskAlexSharov AskAlexSharov requested a review from Copilot April 7, 2026 09:11

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.

Pull request overview

Follow-up improvements to the debug_executionWitness RPC implementation (from #20205), focusing on determinism, safer context propagation, reduced debug noise, and test/global-state hygiene.

Changes:

  • Make witness output more deterministic by sorting Keys and de-duplicating/sorting Codes.
  • Propagate request ctx to commitment seeking and tighten/adjust witness verification behavior (optionally disable via env var).
  • Reduce debug prints in commitment/witness code and fix test/global-state side effects and minor test-chain cleanup.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rpc/jsonrpc/debug_execution_witness.go Deterministic ordering for keys/codes; ctx propagation to commitment seeking; optional stateless verification; stricter header handling; remove stray debug print.
rpc/jsonrpc/debug_api_test.go Avoid leaking global statecfg.Schema changes across tests; adjust one modified-accounts assertion.
execution/commitment/hex_patricia_hashed.go Gate witness root-node trace output behind hph.trace and route to logger.
execution/commitment/commitment.go Prevent empty hashed key from being collected (avoids panics / invalid indexing).
cmd/rpcdaemon/rpcdaemontest/test_util.go Remove unused token contract address/path computation in chain generator.

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

return nil, fmt.Errorf("failed to load header for accessed block number %d: %w", bn, err)
}
if blockHeader == nil {
return nil, fmt.Errorf("missing header for accessed block number %d", bn)

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

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

ExecutionWitness now errors out when an accessed BLOCKHASH header is missing (blockHeader == nil). However the EVM GetHash provider used during execution returns a zero hash when the header is nil, and the stateless verifier does the same when a header isn't present in the witness. To avoid turning a previously-valid execution path into an RPC failure, consider skipping nil headers (or only recording headers when GetHash returned a non-zero hash) while still returning on actual DB errors.

Suggested change
return nil, fmt.Errorf("missing header for accessed block number %d", bn)
// Missing historical headers are treated as unavailable by the EVM GetHash
// provider and by stateless verification, so do not fail witness generation.
continue

Copilot uses AI. Check for mistakes.
Comment on lines 484 to +487
n2 = rpc.BlockNumber(12)
_, err = api.GetModifiedAccountsByNumber(m.Ctx, rpc.BlockNumber(11), &n2)
result, err = api.GetModifiedAccountsByNumber(m.Ctx, rpc.BlockNumber(11), &n2)
require.NoError(t, err)
require.Len(t, result, 3)
require.NotEmpty(t, result)

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

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

This test assertion was weakened from an exact expected length to only require.NotEmpty, which can hide regressions in GetModifiedAccountsByNumber. If the exact count is no longer stable, consider asserting a deterministic subset instead (e.g., that specific known addresses are present for the 11→12 range), or keep the deployed Token address from the chain generator so you can assert it is included.

Copilot uses AI. Check for mistakes.
@AskAlexSharov AskAlexSharov added this pull request to the merge queue Apr 7, 2026
Merged via the queue into main with commit 9b3aeb6 Apr 7, 2026
39 checks passed
@AskAlexSharov AskAlexSharov deleted the alex/witn_35 branch April 7, 2026 13:58
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