network: stateful vote compression#6351
Merged
cce merged 18 commits intoalgorand:masterfrom Oct 16, 2025
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6351 +/- ##
==========================================
- Coverage 51.82% 50.65% -1.17%
==========================================
Files 652 656 +4
Lines 87425 110899 +23474
==========================================
+ Hits 45307 56177 +10870
- Misses 39249 51858 +12609
+ Partials 2869 2864 -5 ☔ View full report in Codecov by Sentry. |
algorandskiy
reviewed
Jun 2, 2025
algorandskiy
previously approved these changes
Aug 6, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces dynamic vote compression functionality using StatefulEncoder and StatefulDecoder components that implement HPACK-style references to values from previous votes, providing over 50% compression efficiency with different table sizes.
- Adds StatefulEncoder/StatefulDecoder with LRU tables for caching commonly used values (addresses, public key/signature pairs)
- Implements a proposal window using HPACK-style indexing for proposal bundle compression
- Introduces delta encoding for round numbers and reference-based compression for repeated values
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| network/vpack/vpack.go | Updates header comment and refactors varuint parsing logic into a shared helper function |
| network/vpack/msgp.go | Adds msgpVaruintRemaining helper function and refactors readUintBytes to use it |
| network/vpack/dynamic_vpack.go | Core implementation of StatefulEncoder/StatefulDecoder with compression logic |
| network/vpack/lru_table.go | Implements 2-way set-associative LRU hash table for value caching |
| network/vpack/proposal_window.go | Implements HPACK-style sliding window for proposal bundle references |
| network/vpack/dynamic_vpack_test.go | Comprehensive tests for stateful encoding/decoding functionality |
| network/vpack/lru_table_test.go | Tests for LRU table operations including eviction and consistency |
| network/vpack/proposal_window_test.go | Tests for proposal window HPACK-style behavior |
gmalouf
previously approved these changes
Aug 15, 2025
jannotti
reviewed
Aug 21, 2025
gmalouf
approved these changes
Oct 9, 2025
algorandskiy
approved these changes
Oct 15, 2025
This was referenced Oct 17, 2025
cce
added a commit
that referenced
this pull request
Nov 3, 2025
This follows #6351 by integrating it with the WebsocketNetwork implementation, using a new VP message tag. Co-authored-by: Pavel Zbitskiy <65323360+algorandskiy@users.noreply.github.com> Co-authored-by: John Jannotti <jannotti@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds to #6276 a StatefulEncoder and StatefulDecoder, that compress votes using HPACK-style references to values from previous votes. It provides better than 50% compression given different table sizes.
Notes on memory vs bandwidth tradeoff and effectiveness of stateful vote compression are here: #6467
Test Plan