-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
test: improve slow tests #3487
test: improve slow tests #3487
Changes from 6 commits
b28498f
d994cb3
3b069ff
79dc023
b3938b9
5aef2f4
9b7b0e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,11 +68,17 @@ impl From<Vec<H256>> for GetBlockBodies { | |
|
||
/// The response to [`GetBlockBodies`], containing the block bodies that the peer knows about if | ||
/// any were found. | ||
#[derive_arbitrary(rlp, 1)] | ||
#[derive_arbitrary(rlp, 16)] | ||
#[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub struct BlockBodies( | ||
/// The requested block bodies, each of which should correspond to a hash in the request. | ||
#[cfg_attr( | ||
any(test, feature = "arbitrary"), | ||
proptest( | ||
strategy = "proptest::collection::vec(proptest::arbitrary::any::<BlockBody>(), 0..=20)" | ||
) | ||
)] | ||
Comment on lines
+76
to
+81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really understand how proptest works, this looks a bit weird at first but I don't really care as long as this speeds up tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the issue is that we are deriving proptest::Arbitrary instead of specifying how it should create these types, so it's very opaque. by default, all vecs have a range of 0..100, so this type in particular by default will have 0..100 block bodies, each with 0..100 ommers, 0..100 transactions (which can have 0..100 access list items, which can have 0..100 storage slots in each item) and so on. as you can see, this quickly explodes. since the test is auto-generated, we can't configure this in there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a bit ugly :(, but necessary |
||
pub Vec<BlockBody>, | ||
); | ||
|
||
|
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.
what does the number represent in this derive macro?
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.
the number of test cases, default is 256, but we set it to 1 previously because it was expensive. with these changes we can bump it to 16, and while still relatively costly, this is manageable. imo better to have more test cases than a single large test case