near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.31k stars 605 forks source link

fix(congestion_control) - fix congestion info from wrong block used in catchup #11712

Closed wacban closed 2 weeks ago

wacban commented 2 weeks ago

Since #11381 the congestion info from the current block, not the previous block, should be used when applying chunks. The same logic change needs to be applied in state sync / catchup.

I found this issue while working on a unrelated test loop test for congestion control. I will follow up with the test separately because I would like to get this merged ASAP and the test still requires some work.

Sadly the existing test - state_sync_missing_chunks.py - does not catch this issue despite covering the relevant lines. This is because in this test there is no congestion so it doesn't matter what block is used.

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 70.23%. Comparing base (9a41e3e) to head (14c2282). Report is 1 commits behind head on master.

Files Patch % Lines
chain/chain/src/chain_update.rs 50.00% 0 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #11712 +/- ## ======================================= Coverage 70.23% 70.23% ======================================= Files 791 791 Lines 161937 161937 Branches 161937 161937 ======================================= Hits 113730 113730 - Misses 43245 43247 +2 + Partials 4962 4960 -2 ``` | [Flag](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | Coverage Δ | | |---|---|---| | [backward-compatibility](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.23% <0.00%> (ø)` | | | [db-migration](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.23% <0.00%> (ø)` | | | [genesis-check](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.35% <0.00%> (ø)` | | | [integration-tests](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `37.91% <50.00%> (-0.07%)` | :arrow_down: | | [linux](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `69.97% <50.00%> (-0.01%)` | :arrow_down: | | [linux-nightly](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `69.80% <50.00%> (-0.02%)` | :arrow_down: | | [macos](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `54.49% <0.00%> (-0.05%)` | :arrow_down: | | [pytests](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.58% <0.00%> (ø)` | | | [sanity-checks](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.38% <0.00%> (ø)` | | | [unittests](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `64.52% <0.00%> (+<0.01%)` | :arrow_up: | | [upgradability](https://app.codecov.io/gh/near/nearcore/pull/11712/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.28% <0.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.