near / nearcore

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

fix: make TestnetFewerBlockProducers only apply to testnet #11626

Closed bowenwang1996 closed 1 month ago

bowenwang1996 commented 1 month ago

Make TestnetFewerBlockProducers only apply to testnet to avoid breaking other testing network due to the hardcoded change of block producers. Specifically, increasing the number of block producers will make things break due to num_total_parts computation that only looks at what is in genesis and if genesis protocol version is between the protocol version of TestnetFewerBlockProducers and NoChunkOnlyProducers, it will forcefully set the number of block producer seats to 20, regardless of what is set in genesis. Even worse, any attempt to increase that later in the code won't work.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 71.47%. Comparing base (60480be) to head (cfb38ba).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #11626 +/- ## ========================================== - Coverage 71.48% 71.47% -0.02% ========================================== Files 788 788 Lines 160835 160835 Branches 160835 160835 ========================================== - Hits 114974 114949 -25 - Misses 40840 40867 +27 + Partials 5021 5019 -2 ``` | [Flag](https://app.codecov.io/gh/near/nearcore/pull/11626/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/11626/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/11626/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/11626/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.36% <0.00%> (ø)` | | | [integration-tests](https://app.codecov.io/gh/near/nearcore/pull/11626/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `37.68% <100.00%> (+<0.01%)` | :arrow_up: | | [linux](https://app.codecov.io/gh/near/nearcore/pull/11626/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `68.89% <100.00%> (-0.02%)` | :arrow_down: | | [linux-nightly](https://app.codecov.io/gh/near/nearcore/pull/11626/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `70.94% <100.00%> (-0.03%)` | :arrow_down: | | [macos](https://app.codecov.io/gh/near/nearcore/pull/11626/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `52.57% <100.00%> (-0.01%)` | :arrow_down: | | [pytests](https://app.codecov.io/gh/near/nearcore/pull/11626/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.59% <0.00%> (ø)` | | | [sanity-checks](https://app.codecov.io/gh/near/nearcore/pull/11626/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/11626/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `66.13% <100.00%> (-0.02%)` | :arrow_down: | | [upgradability](https://app.codecov.io/gh/near/nearcore/pull/11626/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.