-
Notifications
You must be signed in to change notification settings - Fork 21
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: add p2p class sync happy flow test #1942
base: main
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @noamsp-starkware and the rest of your teammates on Graphite |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1942 +/- ##
==========================================
- Coverage 40.10% 33.68% -6.42%
==========================================
Files 26 102 +76
Lines 1895 12396 +10501
Branches 1895 12396 +10501
==========================================
+ Hits 760 4176 +3416
- Misses 1100 7536 +6436
- Partials 35 684 +649 ☔ View full report in Codecov by Sentry. |
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.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @noamsp-starkware)
crates/papyrus_protobuf/src/converters/class.rs
line 285 at r1 (raw file):
}); // This length check and default option is needed for ContractClass test instances that
For next time: IMO this can be a separate preliminary PR
crates/papyrus_p2p_sync/src/client/class_test.rs
line 39 at r1 (raw file):
// Asserting the constants so the test can assume there will be 2 state diff queries for a // single header query and the second will be smaller than the first. const_assert!(STATE_DIFF_QUERY_LENGTH < HEADER_QUERY_LENGTH);
Since we're not testing state diffs, we don't need this assertion
crates/papyrus_p2p_sync/src/client/class_test.rs
line 53 at r1 (raw file):
} = setup(); let block_hashes_and_signatures =
Please extract all common code between this test and the state diff test
You can use this opportunity to also remove code duplication between state diff test and
Suggestion for the function:
pub fn run_state_diff_sync(
header_state_diff_lengths: Vec<usize>,
state_diff_chunks: Vec<usize>
) -> GenericReceiver<ClassTestPayload> {
...
}
crates/papyrus_p2p_sync/src/client/class_test.rs
line 192 at r1 (raw file):
} fn create_random_state_diff_chunk(rng: &mut ChaCha8Rng) -> StateDiffChunk {
Unite these two functions into create_random_state_diff_chunk_with_class
. This way, you'll get rid of the unreachable section
crates/papyrus_p2p_sync/src/client/class_test.rs
line 194 at r1 (raw file):
fn create_random_state_diff_chunk(rng: &mut ChaCha8Rng) -> StateDiffChunk { let class_hash = ClassHash(rng.next_u64().into()); if rng.next_u32() % 2 == 0 {
use rng.gen_bool() instead (from the Rng trait)
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.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @noamsp-starkware)
crates/papyrus_p2p_sync/src/client/class_test.rs
line 53 at r1 (raw file):
Previously, ShahakShama wrote…
Please extract all common code between this test and the state diff test
You can use this opportunity to also remove code duplication between state diff test and
Suggestion for the function:pub fn run_state_diff_sync( header_state_diff_lengths: Vec<usize>, state_diff_chunks: Vec<usize> ) -> GenericReceiver<ClassTestPayload> { ... }
*between state diff positive flow test and negative flow test
No description provided.