near / near-one-project-tracking

A repository for tracking work items that NEAR One is working on.
0 stars 0 forks source link

[stateless validation]: Implement state witness distribution by parts #67

Closed saketh-are closed 4 months ago

saketh-are commented 5 months ago

Currently the chunk producer has to send the state witness V times, where V is the number of chunk validators. Delivery of the state witness is latency sensitive as it is necessary for block production.

In a case with a sizable state witness (say, 8 MB) and 50 chunk validators, it means that the chunk producer needs to urgently send a burst of 400 MB, which overwhelms the local capabilities of the node.

By implementing a distribution mechanism based on splitting the witness into parts and relying on other validators to forward parts, we can spread the work among all of the chunk validators. It is similar to what is done in mainnet today for chunk distribution.

We plan to:

We expect the latency of this 2-hop approach to be acceptable because it works well in production today for chunk distribution via PartialEncodedChunks.

After this change, each node will only need to send an amount of data equal to the size of the state witness, plus a 50% overhead from Reed-Solomon encoding. As an added benefit of the erasure coding, each validator only needs to receive 2/3 of the parts before the state witness can be decoded.

shreyan-gupta commented 5 months ago

Some PRs for the task https://github.com/near/nearcore/pull/11079 https://github.com/near/nearcore/pull/11080 https://github.com/near/nearcore/pull/11089 https://github.com/near/nearcore/pull/11090 https://github.com/near/nearcore/pull/11091

shreyan-gupta commented 5 months ago

https://github.com/near/nearcore/pull/11115

walnut-the-cat commented 4 months ago

are we done with this work?