massa
massa copied to clipboard
Internal Audit: Massa-PoS-Worker
- [x] The functions feed_cycle and perform_draws in massa-pos-worker need to better explain the design choices.
Function feed_cycle
It is a non-blocking function where the worker is separate, so the feed is queued and not applied immediately and that's done to avoid blocking while drawing. This is because the drawing is heavy (~70k long sequence) and may get even heavier (~400k+) when the requirements of super majority w.r.t. endorsements
kick in.
Function perform_draws
It uses BTreeMap to store the address <->rolls
mapping. Although not efficient as a hashmap, it still is the best choice since the order has to be maintained.
PR to include the above details: #3689
- [ ] It seems that the Test Suit/Unit Tests are missing for Massa-Pos-Worker.
If they are implemented somewhere else, we can move them here so that we are coherent w.r.t. other modules.
Further possible improvements (with inputs from @damip)
- [ ] warning in case of time mismatch
- [ ] crossbeam for better perf
- [ ] crossbeam to alert in case of channel congestion
- [ ] checking timestamp instead of the draw cycles to see if we have the right draw cycle to return
@AurelienFT @Eitu33 I will create a PR and add those changes soon.