near / nearcore

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

fix: Add setters for BlockHeader and move BlockHeaderV5 to nighly by #12043

Closed tayfunelmas closed 1 month ago

tayfunelmas commented 1 month ago

In https://github.com/near/nearcore/pull/12024, we introduced BlockHeaderV5 but could not move it to Nightly because some tests were relying on using only a single header version. In other words, it was not possible to have two different header versions in stable and nightly builds.

To address that, we remove the get_mut function (which returns BlockHeaderV4 only) and add a bunch of setter functions, one per field, which chooses the right header version to mutate.

Then we move the feature enabling the BlockHeaderV5 to Nightly.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 50.58140% with 85 lines in your changes missing coverage. Please review.

Project coverage is 71.39%. Comparing base (e8fa073) to head (c6f8ad9).

Files with missing lines Patch % Lines
core/primitives/src/test_utils.rs 50.00% 85 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #12043 +/- ## =========================================== + Coverage 0 71.39% +71.39% =========================================== Files 0 814 +814 Lines 0 164890 +164890 Branches 0 164890 +164890 =========================================== + Hits 0 117721 +117721 - Misses 0 41997 +41997 - Partials 0 5172 +5172 ``` | [Flag](https://app.codecov.io/gh/near/nearcore/pull/12043/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/12043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.17% <0.00%> (?)` | | | [db-migration](https://app.codecov.io/gh/near/nearcore/pull/12043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.17% <0.00%> (?)` | | | [genesis-check](https://app.codecov.io/gh/near/nearcore/pull/12043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.27% <0.00%> (?)` | | | [integration-tests](https://app.codecov.io/gh/near/nearcore/pull/12043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `38.57% <47.67%> (?)` | | | [linux](https://app.codecov.io/gh/near/nearcore/pull/12043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `71.19% <50.58%> (?)` | | | [linux-nightly](https://app.codecov.io/gh/near/nearcore/pull/12043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `71.00% <50.58%> (?)` | | | [macos](https://app.codecov.io/gh/near/nearcore/pull/12043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `54.04% <20.34%> (?)` | | | [pytests](https://app.codecov.io/gh/near/nearcore/pull/12043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.54% <0.00%> (?)` | | | [sanity-checks](https://app.codecov.io/gh/near/nearcore/pull/12043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.34% <0.00%> (?)` | | | [unittests](https://app.codecov.io/gh/near/nearcore/pull/12043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `65.20% <20.34%> (?)` | | | [upgradability](https://app.codecov.io/gh/near/nearcore/pull/12043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.21% <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.

wacban commented 1 month ago

@tayfunelmas I think you forgot to bump the nightly protocol version. Upping it to 145 makes a bunch of tests to fail.

tayfunelmas commented 1 month ago

@tayfunelmas I think you forgot to bump the nightly protocol version. Upping it to 145 makes a bunch of tests to fail.

Oh right, the nightly proto version did not change. I will prepare a separate PR dedicated to that and fix the tests.