Skip to content

refactor(synccommittee): Use execution.StateDB instead of custom vm.StateDB#510

Merged
x-mass merged 1 commit intomainfrom
tracer-hash
Mar 26, 2025
Merged

refactor(synccommittee): Use execution.StateDB instead of custom vm.StateDB#510
x-mass merged 1 commit intomainfrom
tracer-hash

Conversation

@x-mass
Copy link
Copy Markdown
Contributor

@x-mass x-mass commented Mar 8, 2025

Refactored the tracer to use execution.StateDB instead of a custom vm.StateDB implementation. This change enables comparison between the original block hash and the traced block hash, ensuring all operations remain consistent.

Key changes:

  • Introduced OnTxStart and OnTxEnd hooks in the tracing package, moving all per-transaction tracer calls into these hooks.
  • Modified the GetContract method in the debug API to include proof of absence when a contract does not exist. This proof is either the longest matched path with the queried contract path or the root node if no path matches at all. This ensures we can prove the absence of even the beginning of such a path in the trie. Includes adjustment to mpt.BuildProof function.
  • Refactored the ZKEVM tracer to avoid relying on values unavailable in the EVM tracing hook context. To fetch the current code when needed, added a Code() method to tracing.OpContext.
  • Significantly changed the MPT tracer: it now computes differences between tries by traversing a trie with the initial root and comparing it against a trie with the current root. This eliminates the need to track changed values during tracing—only the initial and current roots are required, along with the underlying database storing all accessed values.

@x-mass x-mass requested a review from akokoshn March 8, 2025 17:47
@x-mass x-mass changed the title refactor(synccommittee): Use execution.StateDB instead of custom on… refactor(synccommittee): Use execution.StateDB instead of custom vm.StateDB Mar 10, 2025
@x-mass x-mass self-assigned this Mar 10, 2025
@x-mass x-mass marked this pull request as ready for review March 10, 2025 13:40
@olegrok olegrok requested a review from shermike March 17, 2025 08:57
Copy link
Copy Markdown
Contributor

@shermike shermike left a comment

Choose a reason for hiding this comment

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

I'm not sure about all these changes in state.go that transform one-line code to multiline. Could you please elaborate the purpose of these changes?

Copy link
Copy Markdown
Contributor

@shermike shermike left a comment

Choose a reason for hiding this comment

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

Execution part LGTM.

…e in tracer

Refactored the tracer to use `execution.StateDB` instead of a custom `vm.StateDB` implementation. This change enables comparison between the original block hash and the traced block hash, ensuring all operations remain consistent.

Key changes:
- Introduced `OnTxStart` and `OnTxEnd` hooks in the tracing package, moving all per-transaction tracer calls into these hooks.
- Modified the `GetContract` method in the debug API to include proof of absence when a contract does not exist. This proof is either the longest matched path with the queried contract path or the root node if no path matches at all. This ensures we can prove the absence of even the beginning of such a path in the trie. Includes adjustment to `mpt.BuildProof` function.
- Refactored the ZKEVM tracer to avoid relying on values unavailable in the EVM tracing hook context. To fetch the current code when needed, added a `Code()` method to `tracing.OpContext`.
- Significantly changed the MPT tracer: it now computes differences between tries by traversing a trie with the initial root and comparing it against a trie with the current root. This eliminates the need to track changed values during tracing—only the initial and current roots are required, along with the underlying database storing all accessed values.
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.

5 participants