Skip to content

refactor(trie): reorder proof_task.rs for better code organization#19313

Closed
yongkangc wants to merge 3 commits intomainfrom
yk/reorder-proof-task
Closed

refactor(trie): reorder proof_task.rs for better code organization#19313
yongkangc wants to merge 3 commits intomainfrom
yk/reorder-proof-task

Conversation

@yongkangc
Copy link
Member

@yongkangc yongkangc commented Oct 27, 2025

Part of #19182 - Stack of PRs for easier review
Depends on: #19311

Reorganizes proof_task.rs to follow better flow. This module is organized in the order:

  • Main Types: MultiproofManager, MultiProofTask
  • Metrics: MultiProofTaskMetrics
  • Supporting Types: SparseTrieUpdate, MultiProofConfig, MultiProofMessage, StateHookSender
  • Internal Types: ProofSequencer, MultiProofTaskState, MultiproofInput
  • Helper Functions: evm_state_to_hashed_post_state, get_proof_targets

@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Oct 27, 2025
yongkangc added a commit that referenced this pull request Oct 27, 2025
Reorganizes multiproof.rs to follow Rust file organization conventions:
1. Public types first (SparseTrieUpdate, MultiproofInput)
2. MultiproofManager and its implementation
3. MultiProofTask and its implementation
4. Helper functions

No logic changes - pure code organization for improved readability.
Main public types are now at the top, making it easier to understand
the module's interface at a glance.

Part of #19182
Depends on: #19313
@yongkangc yongkangc self-assigned this Oct 27, 2025
@yongkangc yongkangc marked this pull request as ready for review October 27, 2025 10:01
@yongkangc yongkangc requested a review from mattsse October 27, 2025 10:02
Introduces a new ProofResult enum that can represent either:
- Account multiproofs with statistics
- Storage proofs for specific accounts

This eliminates unnecessary wrapping/unwrapping of storage proofs and
removes the redundant PendingMultiproofTask/StorageMultiproofInput abstractions.

Changes:
- Introduced ProofResult enum with AccountMultiproof and StorageProof variants
- Added into_multiproof() helper method for conversion when needed
- Updated ProofResultMessage to use Result<ProofResult, ParallelStateRootError>
- Updated all producers (storage/account workers) to return appropriate variants
- Updated all consumers to match on the enum variants
- Removed unused AccountMultiproofResult type alias
- Used unreachable!() for impossible code paths (type safety guarantees)
- Used debug_assert_eq!() for address validation (checked in debug builds)
- Removed PendingMultiproofTask enum (unnecessary wrapper)
- Removed StorageMultiproofInput struct (never constructed in practice)
- Simplified dispatch() to always take MultiproofInput directly
- Removed dispatch_storage_proof() method

Part of #19182
Reorganizes proof_task.rs to follow Rust file organization conventions:
1. Type aliases at top
2. Public enums and structs (ProofResult, ProofWorkerHandle, etc.)
3. Public functions
4. Private/internal types (StorageWorkerJob, AccountWorkerJob)
5. Private functions (worker loops, helpers)

No logic changes - pure code organization for improved readability.
Files are now structured with main public API at the top, making
it easier to understand the module's interface.

Part of #19182
Depends on: #19311
yongkangc added a commit that referenced this pull request Oct 27, 2025
Reorganizes multiproof.rs to follow Rust file organization conventions:
1. Public types first (SparseTrieUpdate, MultiproofInput)
2. MultiproofManager and its implementation
3. MultiProofTask and its implementation
4. Helper functions

No logic changes - pure code organization for improved readability.
Main public types are now at the top, making it easier to understand
the module's interface at a glance.

Part of #19182
Depends on: #19313
@yongkangc yongkangc force-pushed the yk/introduce-proof-result branch from a20d521 to 2ad0725 Compare October 27, 2025 10:11
@yongkangc yongkangc force-pushed the yk/reorder-proof-task branch from ad1cb0a to 68c6079 Compare October 27, 2025 10:11
Base automatically changed from yk/introduce-proof-result to main October 27, 2025 14:13
@yongkangc yongkangc requested a review from fgimenez as a code owner October 27, 2025 14:13
@yongkangc yongkangc closed this Oct 28, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in Reth Tracker Oct 28, 2025
@jenpaff jenpaff moved this from Done to Out of Scope in Reth Tracker Oct 28, 2025
@mediocregopher mediocregopher deleted the yk/reorder-proof-task branch February 25, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Out of Scope

Development

Successfully merging this pull request may close these issues.

1 participant