-
Notifications
You must be signed in to change notification settings - Fork 221
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
fix: header sync timestamp validation #6799
fix: header sync timestamp validation #6799
Conversation
WalkthroughThe changes update helper functions in the validation module to ensure that the median timestamp is computed correctly. A sorting mechanism is now applied to the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant calc_median_timestamp
Caller->>+calc_median_timestamp: Provide unsorted timestamps slice
calc_median_timestamp->>calc_median_timestamp: Clone timestamps to mutable vector and sort
calc_median_timestamp->>calc_median_timestamp: Compute median value
calc_median_timestamp-->>Caller: Return median timestamp
sequenceDiagram
participant Caller
participant check_header_timestamp_greater_than_median
participant Logger
Caller->>+check_header_timestamp_greater_than_median: Call with header timestamp and median
check_header_timestamp_greater_than_median->>check_header_timestamp_greater_than_median: Compare header timestamp to median
alt Header Timestamp < Median
check_header_timestamp_greater_than_median->>Logger: Log warning with timestamps vector
end
check_header_timestamp_greater_than_median-->>Caller: Return verification result
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (5)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Test Results (CI) 2 files 72 suites 21m 30s ⏱️ For more details on these failures, see this check. Results for commit 3071352. |
3071352
to
d8050ad
Compare
Description
Fixes validation by sorting the timestamps during syncing
Block timestamps are supposed to be after the median of the past 11 blocks. Median is supposed to be ordered, this was not ordered for syncing but was ordered for propagation. This PR makes sure the list is always sorted.
Summary by CodeRabbit