-
Notifications
You must be signed in to change notification settings - Fork 4
fix: support multi-network segment chains #1722
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
base: main
Are you sure you want to change the base?
Conversation
d6ed284 to
0e2b31f
Compare
LNSD
left a comment
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.
LGTM ✅
There are some implementation details, but in general, LGTM.
| /// Multi-network canonical chain not supported with start block | ||
| #[error("multi-network datasets with start_block are not supported")] | ||
| MultiNetworkWithStartBlock, |
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.
Does this mean that multi-chain joins need to sync the whole history?
| // Invariant: this function only works for single-network segments (raw datasets) | ||
| if let Some(first_segment) = segments.first() { | ||
| assert_eq!(first_segment.ranges.len(), 1); | ||
| } |
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.
Would it be possible that we bake these invariants into the typesystem?
I'm not asking to do it as part of this PR, just asking if it is possible.
| // remove overlapping ranges from each segment | ||
| for segment in &segments { | ||
| let segment_range = segment.range.numbers.clone(); | ||
| assert_eq!(segment.ranges.len(), 1); |
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.
Are we running through this assertion in all the segments? Spooky! 😨
Why don't we just tracing::error and skip the segment?
This extends the segment selection algorithm to support multi-network segments. Call sites will continue to depend on there only being single-network segments for now.