go-spacemesh
go-spacemesh copied to clipboard
encode activesets with delta
in recent epoch there are many activesets that are slightly different. the root cause of this difference is suboptimal reconciliation of known atxs before the start of the epoch. which should be addressed on its own.
however activesets can be encoded more efficiently as well. instead of generating new active sets smesher can lookup previously generated activeset and extend/remove items from it based on local view.
- builder selected an activeset and ready to publish reference ballot
- pick activeset with the most weight from activesets received in this epoch
- compute added/removed hashes and encode with reference to highest activeset
- broadcast delta-activeset, if peer is missing a reference it should request it, but in most cases it should already have it as it was created earlier
- use new protocol that relies on streaming.
note that peer can request data using previous (non-delta encoding) or a new delta-encoding for backward compatibility. if peer requested non-delta encoding we should re-encode it after loading from database. eventually we will be able to drop non-delta encoded activesets, but we will need to maintain backward compatibility for several epochs.
both this and https://github.com/spacemeshos/go-spacemesh/issues/5306 are aimed to tackle the same problem, but the latter one is more important, and we should do that first, maybe we won't even need to implement this one.
use streams https://github.com/spacemeshos/go-spacemesh/issues/5278