near / nearcore

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

feat: Move ChunkEndorsementsInBlockHeader to Nightly #12065

Closed tayfunelmas closed 1 month ago

tayfunelmas commented 1 month ago

We previously excluded ChunkEndorsementsInBlockHeader (which also introduces BlockHeaderV5) from Nightly. In this PR, we move it to the Nightly version.

For this, we fix a bunch of validation checks (which applied incorrect checks) and tests (which did not initialize endorsement signatures correctly). For example, some validation checks are moved from validating-block-body to validating-header since the validator assignments are not available (the assignments are from the height the chunk was created, not included).

We also fix an incorrect use of the bitmap that, when a chunk is old (missing), the endorsement bitmap (and endorsement signatures) must be empty, so we should consider the endorsements expected but not produced (previously it considered endorsements not expected at all).

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 77.14286% with 8 lines in your changes missing coverage. Please review.

Project coverage is 71.59%. Comparing base (4b11f9f) to head (f0b02c4). Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
chain/epoch-manager/src/types.rs 63.63% 4 Missing :warning:
...hain/src/stateless_validation/chunk_endorsement.rs 76.92% 3 Missing :warning:
core/primitives/src/test_utils.rs 88.88% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #12065 +/- ## ========================================== + Coverage 71.44% 71.59% +0.14% ========================================== Files 815 815 Lines 164218 164233 +15 Branches 164218 164233 +15 ========================================== + Hits 117322 117579 +257 + Misses 41765 41522 -243 - Partials 5131 5132 +1 ``` | [Flag](https://app.codecov.io/gh/near/nearcore/pull/12065/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/12065/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%> (-0.01%)` | :arrow_down: | | [db-migration](https://app.codecov.io/gh/near/nearcore/pull/12065/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%> (-0.01%)` | :arrow_down: | | [genesis-check](https://app.codecov.io/gh/near/nearcore/pull/12065/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.26% <0.00%> (-0.01%)` | :arrow_down: | | [integration-tests](https://app.codecov.io/gh/near/nearcore/pull/12065/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `38.68% <71.42%> (+0.14%)` | :arrow_up: | | [linux](https://app.codecov.io/gh/near/nearcore/pull/12065/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `71.22% <37.14%> (-0.02%)` | :arrow_down: | | [linux-nightly](https://app.codecov.io/gh/near/nearcore/pull/12065/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `71.12% <68.57%> (+0.10%)` | :arrow_up: | | [macos](https://app.codecov.io/gh/near/nearcore/pull/12065/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `54.08% <15.15%> (+0.01%)` | :arrow_up: | | [pytests](https://app.codecov.io/gh/near/nearcore/pull/12065/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.53% <0.00%> (-0.01%)` | :arrow_down: | | [sanity-checks](https://app.codecov.io/gh/near/nearcore/pull/12065/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `1.33% <0.00%> (-0.01%)` | :arrow_down: | | [unittests](https://app.codecov.io/gh/near/nearcore/pull/12065/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `65.36% <42.85%> (+0.12%)` | :arrow_up: | | [upgradability](https://app.codecov.io/gh/near/nearcore/pull/12065/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `0.22% <0.00%> (-0.01%)` | :arrow_down: | 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.