feat(primitives-traits): add try_recover_signers for parallel batch recovery#21103
feat(primitives-traits): add try_recover_signers for parallel batch recovery#21103
Conversation
…ecovery Add try_recover_signers function that combines decoding and signature recovery in a single parallel pass. This is more efficient than sequential recovery for large transaction batches. - Add try_recover_signers to transaction::recover module - Uses rayon for parallel recovery when the feature is enabled - Update testing RPC to use batch recovery instead of sequential
875642a to
ecf2eac
Compare
gakonst
left a comment
There was a problem hiding this comment.
Nice refactor! The new try_recover_signers API is a clean abstraction for combining decode + recovery in a single parallel pass.
Code review:
-
Flat module structure - Good call eliminating the nested
rayon/itermodules. The#[cfg]dispatch at the function level is cleaner. -
Trait bounds - The
TryRecoverItemsandTryRecoverFnhelper traits handle theSyncrequirement for rayon nicely. The blanket impls keep usage ergonomic. -
RPC integration - The testing.rs change demonstrates the API well. Replacing the sequential
recover_raw_transactionloop withtry_recover_signersis a nice win for batch operations. -
Error handling - Using
.or(Err(EthApiError::InvalidTransactionSignature))loses the original error context. Consider using.map_err(|_| ...)to at least log the underlying error, but this is minor for testing endpoints.
LGTM ![]()
* tag 'v1.10.1': (49 commits) chore: bump version to 1.10.1 (paradigmxyz#21188) chore: rename extend_ref methods on sorted data structures (paradigmxyz#21043) fix(flashblocks): Add flashblock ws connection retry period (paradigmxyz#20510) chore(bench): add --disable-tx-gossip to benchmark node args (paradigmxyz#21171) refactor(stages): reuse history index cache buffers in `collect_history_indices` (paradigmxyz#21017) feat(download): resumable snapshot downloads with auto-retry (paradigmxyz#21161) ci: update to tempoxyz (paradigmxyz#21176) chore: apply spelling and typo fixes (paradigmxyz#21182) docs: document minimal storage mode in pruning FAQ (paradigmxyz#21025) chore(deps): weekly `cargo update` (paradigmxyz#21167) feat(execution-types): add receipts_iter helper (paradigmxyz#21162) revert: undo Chain crate, add LazyTrieData to trie-common (paradigmxyz#21155) feat(engine): add new_payload_interval metric (start-to-start) (paradigmxyz#21159) feat(engine): add time_between_new_payloads metric (paradigmxyz#21158) fix(storage-api): gate reth-chain dependency behind std feature perf(storage): batch trie updates across blocks in save_blocks (paradigmxyz#21142) refactor: use ExecutionOutcome::single instead of tuple From (paradigmxyz#21152) chore(chain-state): reorganize deferred_trie.rs impl blocks (paradigmxyz#21151) feat(primitives-traits): add try_recover_signers for parallel batch recovery (paradigmxyz#21103) perf: make Chain use DeferredTrieData (paradigmxyz#21137) ...
Summary
Add
try_recover_signersfunction that combines decoding and signature recovery in a single parallel pass. This is more efficient than sequential recovery for large transaction batches.Changes
try_recover_signerstotransaction::recovermodulerayonfeature is enabledUsage