near / nearcore

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

[Epoch Sync] Compress the EpochSyncProof over the network. #12058

Closed robin-near closed 1 month ago

robin-near commented 1 month ago

Closes #11933

This compresses the EpochSyncProof similar to how we compressed ChunkStateWitness. In fact, the code is refactored out to a CompressedData trait so we don't duplicate this code.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 86.95652% with 12 lines in your changes missing coverage. Please review.

Project coverage is 71.44%. Comparing base (b3851ac) to head (0a7dfcd). Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
chain/client/src/sync/epoch.rs 37.50% 5 Missing :warning:
core/primitives/src/utils/compression.rs 94.36% 0 Missing and 4 partials :warning:
core/primitives/src/epoch_sync.rs 77.77% 2 Missing :warning:
chain/network/src/network_protocol/mod.rs 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #12058 +/- ## ======================================= Coverage 71.44% 71.44% ======================================= Files 814 815 +1 Lines 164205 164201 -4 Branches 164205 164201 -4 ======================================= Hits 117315 117315 - Misses 41757 41758 +1 + Partials 5133 5128 -5 ``` | [Flag](https://app.codecov.io/gh/near/nearcore/pull/12058/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/12058/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/12058/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/12058/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%> (-0.01%)` | :arrow_down: | | [integration-tests](https://app.codecov.io/gh/near/nearcore/pull/12058/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `38.52% <44.56%> (-0.01%)` | :arrow_down: | | [linux](https://app.codecov.io/gh/near/nearcore/pull/12058/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `71.23% <86.95%> (+0.01%)` | :arrow_up: | | [linux-nightly](https://app.codecov.io/gh/near/nearcore/pull/12058/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `71.03% <86.95%> (+<0.01%)` | :arrow_up: | | [macos](https://app.codecov.io/gh/near/nearcore/pull/12058/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `52.86% <76.08%> (-1.25%)` | :arrow_down: | | [pytests](https://app.codecov.io/gh/near/nearcore/pull/12058/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/12058/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/12058/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=near) | `65.24% <76.08%> (-0.01%)` | :arrow_down: | | [upgradability](https://app.codecov.io/gh/near/nearcore/pull/12058/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.

robin-near commented 1 month ago

@Longarithm Protocol schema check is really awesome! I have a question for it: why don't we include the whole schemas in the protocol_schema.toml file, rather than just hashes? For this change I know I'm changing PeerMessage, but how do I know that I'm changing it in the way I'm intending to?