Closed Trisfald closed 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 71.76%. Comparing base (
0557fa4
) to head (e2392be
). Report is 4 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@VanBarbascu I added you as reviewer, if you can have a look if the updated test assertions are good.
TL;DR - for state sync to work starting at epoch 4 (height 90) it has to fetch the last block of previous epoch (height 89) and that's why block 89 is not GC'd in this scenario
I suspect this is because block is staying in the cache - and cache is not cleaned up properly, as stated in https://github.com/near/nearcore/blob/9932e95c5c49262189bc4737366ce46bb2b953c8/chain/chain/src/store/mod.rs#L1245-L1259. Should we rather clean up block-related caches for the sake of data consistency?
Had a quick chat with Razvan and ideally the block should have been GC'd as we only care about the last block of the previous epoch for state sync purposes and no other block. So the error is a genuine error.
Thanks, then I'll close this PR since the error is genuine and we should fix it.
Quoting the test description:
After 10 epochs the test checks that the 6 epochs are garbage collected. The problem is: one particular block (89 - the last block of epoch before state sync) is explicitly requested by state sync so it will be returned by the RPC call.
This PR changes the test to expect the presence of block 89. If instead the block shouldn't be there, it's a bug in state sync / GC.