-
Notifications
You must be signed in to change notification settings - Fork 618
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
Improve the memtrie integration test to include a state sync base case. #10592
Conversation
_ => panic!("Wrong return value"), | ||
|
||
for i in 0..self.clients.len() { | ||
let tracks_shard = client |
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.
This should be self.clients[i]
not client
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 doesn't actually matter, because I'm querying using epoch_manager which would give the same result on every client. If I had used the ShardTracker then it would take local tracking config into account.
@@ -251,6 +280,20 @@ fn get_block_producer(env: &TestEnv, head: &Tip, height_offset: u64) -> AccountI | |||
block_producer | |||
} | |||
|
|||
fn check_block_does_not_have_missing_chunks(env: &TestEnv, block: &Block) { | |||
if block.header().prev_hash() != env.clients[0].chain.genesis_block().hash() { |
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.
Can't we use chunk.height_included
and block.height
here? Why do we need to fetch the prev_block?
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.
Also nit: can pass just client into function instead of TestEnv and can incorporate early return for block after genesis.
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.
+1, we recently introduced ShardChunkHeader::is_new_chunk
for 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.
Haha I was still not confident in my ability to correctly use the heights to compare, that was why :P
} | ||
|
||
trait TestEnvBuilderExt { | ||
fn maybe_track_all_shards(self, track_all_shards: bool) -> Self; |
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.
Why is this only for the in_memory_tries
test? Eventually single shard tracking related tests should hopefully be more common?
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.
Ah yeah, I guess I should move that in there.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #10592 +/- ##
==========================================
- Coverage 72.19% 72.16% -0.03%
==========================================
Files 726 726
Lines 147700 147719 +19
Branches 147700 147719 +19
==========================================
- Hits 106630 106608 -22
- Misses 36273 36301 +28
- Partials 4797 4810 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
It turns out that even setting up a e2e test case for single-shard tracking is tricky, so this PR does that. It makes a few fixes to the test framework as well as the memtrie test code, so that