-
Notifications
You must be signed in to change notification settings - Fork 18
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: make gossip portal-interop test auto generate comments for errors #118
Conversation
51ae840
to
3e76fa4
Compare
// wait content_vec.len() seconds for data to propagate, giving more time if more items are propagating | ||
tokio::time::sleep(Duration::from_secs(test_data.len() as u64)).await; | ||
|
||
let (first_header_key, first_header_value) = test_data.get(0).unwrap(); |
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.
Could you elaborate on what is happening here, what the first header and last header are, why we set the first as last, and how this relates to comments?
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.
Curious about this too.
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.
Last header seen. We are setting it here because the rust borrow checker won't allow us to set unassigned variables.
So at the start the last seen header would be the first header, because it is the only one we know about at the start therefore being the last header seen
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.
It's worth adding a docstring to the code for reference
3e76fa4
to
5c53860
Compare
5c53860
to
e14684a
Compare
"7000000 receipt", "15600000 (post-merge) header", "15600000 (post-merge) block body", "15600000 (post-merge) receipt", | ||
"17510000 (post-shanghai) header", "17510000 (post-shanghai) block body", "17510000 (post-shanghai) receipt"]; | ||
|
||
// wait content_vec.len() seconds for data to propagate, giving more time if more items are propagating |
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.
// wait test_data.len() seconds ...
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.
I am not sure what you are trying to imply?
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.
If I'm not mistaken, the comment is incorrect. We are using test_data.len()
in the line below to figure out how long the wait should be, so the comment should be updated with test_data.len()
instead of content_vec.len()
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.
Oh I see what you mean, must have forgot to to copy the commit when I took copy pasted that timeout from trin-bridge tests I will fix that.
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.
fixed it
// wait content_vec.len() seconds for data to propagate, giving more time if more items are propagating | ||
tokio::time::sleep(Duration::from_secs(test_data.len() as u64)).await; | ||
|
||
let (first_header_key, first_header_value) = test_data.get(0).unwrap(); |
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.
It's worth adding a docstring to the code for reference
if let HistoryContentKey::BlockHeaderWithProof(_) = &content_key { | ||
last_header_seen = (content_key.clone(), content_value.clone()); | ||
} | ||
let 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.
nitpick something likecontent_details
might be a more useful var name here
match client_b.rpc.local_content(content_key.clone()).await { | ||
Ok(possible_content) => { | ||
match possible_content { | ||
match possible_content { | ||
PossibleHistoryContentValue::ContentPresent(content) => { | ||
if content != content_value { |
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.
I know you didn't write this code, but could you update these var names to expected_key
/expected_value
and actual_key
/actual_value
. When doing comparisons on tested data, this kind of naming scheme makes it much simpler to figure out what's actually being tested, which var is the test data, etc.
content_type | ||
) | ||
} else { | ||
unreachable!("History test dated is formatted incorrectly") |
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.
Maybe just expand in this comment as to what most likely went wrong and caused the invalid formatting
e77e6b8
to
c59bf1c
Compare
@njgheorghita I attempted to resolve the concerns, I was a little confused. So let me know what you think and hopefully we can get this in! |
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.
🚢
Since we can dynamically add tests over time we also need a way of generating the error comments dynamically