near / nearcore

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

Merge validation efforts between chunk endorsement and partial witness #11514

Open shreyan-gupta opened 5 months ago

shreyan-gupta commented 5 months ago

After taking a more detailed look at the chunk endorsement tracker module, it turns out a lot of the validation required for chunk endorsements is similar to what we need to partial witness.

This is a complex and sensitive enough topic that it makes sense to share the code between these two modules so that the checks for one can be directly applied to the other.

Current set of checks include things like valid range for "height_created", correct epoch_id, signature validation, etc. These set of checks ensure that a node doesn't get spammed by old or invalid partial witnesses (and in future chunk endorsements).

Right now we rely on having the chunk header before validation of the chunk endorsement that adds a layer of complexity as we may not always have the chunk header while receiving the chunk endorsement.

cc @pugachAG @Longarithm @tayfunelmas

shreyan-gupta commented 5 months ago

This PR description has a few more details: https://github.com/near/nearcore/pull/11513