-
Couldn't load subscription status.
- Fork 2.1k
refactor: cleanup abstractions in multiproofs #19308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| @@ -1,11 +1,7 @@ | |||
| //! Multiproof task related functionality. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module in multiproof.rs is now organised as
//! This module is organized as follows:
//! - 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]
- Introduced `ProofWorkerHandle` for type-safe access to storage and account worker pools. - Replaced `ProofResultContext` with direct senders for improved performance. - Updated worker loops to handle proof tasks more efficiently, including better tracing and error handling. - Added methods for dispatching storage and account multiproof computations, improving interleaved parallelism. - Enhanced metrics tracking for storage and account processing.
|
|
||
| type StorageProofResult = Result<DecodedStorageMultiProof, ParallelStateRootError>; | ||
| type TrieNodeProviderResult = Result<Option<RevealedNode>, SparseTrieError>; | ||
| type AccountMultiproofResult = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed AccountMultiproofResult as it is redundant. Both account and storage results now come as ProofResult, with the account case carried by ProofResult::AccountMultiproof(multiproof, stats).
| /// A pending multiproof task, either [`StorageMultiproofInput`] or [`MultiproofInput`]. | ||
| #[derive(Debug)] | ||
| enum PendingMultiproofTask { | ||
| /// A storage multiproof task input. | ||
| Storage(StorageMultiproofInput), | ||
| /// A regular multiproof task input. | ||
| Regular(MultiproofInput), | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed this
After we removed the old storage/account enum and always pass a single MultiproofInput value into MultiproofManager::dispatch, the alias was redundant.
Removing it lets thecall sites work directly with MultiproofInput, without indirection
…nversion - Updated the `dispatch` method to accept `MultiproofInput` directly, simplifying the handling of proof targets. - Removed the separate handling for `PendingMultiproofTask`, consolidating the dispatch logic. - Introduced `into_multiproof` method in `ProofResult` for converting proof results into `DecodedMultiProof`, enhancing clarity and usability.
- Updated the extraction of storage proofs to directly match against `ProofResult`, improving clarity and reducing unnecessary complexity. - Replaced error handling for mismatched addresses with `debug_assert_eq!` for better debugging during development. - Ensured that unreachable code paths are clearly defined for account multiproof handling, enhancing code safety and maintainability.
|
splitting this up into smaller prs to review :) |
Refactors multiproof computation code to close #19182
Changes
ProofResultenum to eliminate unnecessary allocations when returning storage proofsDecodedMultiProofstructureStorageMultiproofInput(never constructed)PendingMultiproofTask(unnecessary wrapper)AccountMultiproofResult(unused alias)unreachable!()anddebug_assert_eq!()for impossible conditions with storage proofs.proof_task.rsandmultiproof.rsfor logical flow. i.e main types at the startFuture PR
DecodedMultiProof. This is a redudant abstraction that we should remove. tracking:refactor: Eliminate ProofResult Conversion Layer #19309
Testing