-
Notifications
You must be signed in to change notification settings - Fork 112
[marshal] Use a Single Resolver #1340
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
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.
This is a bug in main
| + Debug | ||
| + Hash | ||
| + Display | ||
| + AsRef<[u8]> |
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.
In practice, not requiring Span to readily provide a [u8] representation makes it much easier to work with (particularly enums because we must serve an as_ref() -> requires a struct).
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.
Pull Request Overview
This PR refactors the marshal resolver system to use a single unified resolver instead of multiple specialized resolvers. The change simplifies the architecture by consolidating three separate resolvers (for blocks by digest, finalizations by height, and notarizations by view) into one resolver that handles all request types.
- Replaced
Arraytrait withSpantrait across resolver components - Introduced a unified
Request<B: Block>enum to handle different types of backfill requests - Consolidated three separate resolver instances into a single resolver in the marshal actor
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| utils/src/sequence/mod.rs | Moved AsRef<[u8]> and Deref<Target = [u8]> bounds from Span to Array trait |
| resolver/src/p2p/wire.rs | Changed generic bounds from Array to Span and updated encoding logic |
| resolver/src/p2p/ingress.rs | Updated trait bounds from Array to Span |
| resolver/src/p2p/fetcher.rs | Updated trait bounds from Array to Span |
| resolver/src/p2p/engine.rs | Updated trait bounds from Array to Span |
| resolver/src/p2p/config.rs | Updated trait bounds from Array to Span |
| consensus/src/marshal/mod.rs | Enhanced test structure with better parametrization and test organization |
| consensus/src/marshal/ingress/handler.rs | Added new Request<B: Block> enum with comprehensive trait implementations and tests |
| consensus/src/marshal/actor.rs | Refactored to use single resolver with Request enum instead of three separate resolvers |
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.
Ended up leaving a ton of Array littered over resolver 🤦
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #1340 +/- ##
==========================================
+ Coverage 91.22% 91.24% +0.02%
==========================================
Files 262 262
Lines 65073 65280 +207
==========================================
+ Hits 59361 59565 +204
- Misses 5712 5715 +3
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
With a single resolver, it is much easier to reason about rate limits.
This pull request refactors the resolver logic in the
consensus/src/marshal/actor.rsfile to simplify the handling of backfill requests and improve code maintainability. It also updates the test suite inconsensus/src/marshal/mod.rsto enhance test coverage and flexibility by introducing parameterized link configurations.Refactoring of Resolver Logic:
Unified Resolver Handling:
backfill_by_digest,backfill_by_height,backfill_by_view) into a singlebackfillresolver, simplifying the code and reducing duplication. [1] [2]Requesttype for all backfill operations.Streamlined Request Handling:
notarization_resolver_by_view.fetch) with generalizedresolver.fetchandresolver.retaincalls using theRequesttype. [1] [2] [3]Simplified Message Processing:
Test Suite Enhancements:
Parameterized Link Configurations:
Linkconfiguration for latency, jitter, and success rate to test scenarios with varying network conditions. [1] [2]test_finalize_good_linksandtest_finalize_bad_linksto validate behavior under different link conditions. [1] [2]Improved Test Determinism: