Skip to content

Conversation

@cce
Copy link
Contributor

@cce cce commented Oct 17, 2025

Summary

This follows #6351 by integrating it with the WebsocketNetwork implementation, using a new VP message tag.

Test Plan

New tests added to exercise table size negotiation & failure scenarios. Still need to run some large-scale performance tests.

Comment on lines 239 to 241
filtered := allTags[:0]
for _, tag := range allTags {
if _, ok := ignored[tag]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it really work? append below modifies allTags' backing array while iterating

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should work because it's filtering and so the append is always writing alltags[i] back to the slice or to an earlier position but it is too complex and should just use the slices package, will update

// Announce our maximum supported dynamic table size
// Both sides will independently calculate min(ourSize, theirSize)
// Only advertise dynamic features if stateless compression is enabled
switch dtSize := uint32(meta.Config().VoteCompressionDynamicTableSize); {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since only these values are supported, shouldn't config run some prevalidation? Or at least log a warning here saying it is disabled b/c of unsupported table value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added prevalidation


// PeerFeatureVoteVpackDynamic* are values for PeerFeaturesHeader indicating peer
// supports specific dynamic table sizes for vpack compression
const PeerFeatureVoteVpackDynamic1024 = "avvpack1024"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like can be unexported

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, updating

ctx: context.Background(),
}

return wp.sendControlMessage(sm)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

control message but data VP tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes — maybe I should just call it sendHighPrioMessage or something — I was trying to generalize the code used for MOI messages to send the VP abort message

Co-authored-by: Pavel Zbitskiy <[email protected]>
@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

❌ Patch coverage is 71.95946% with 83 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.24%. Comparing base (1625da7) to head (9e9af5a).
⚠️ Report is 3 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
network/msgCompressor.go 66.30% 25 Missing and 6 partials ⚠️
network/wsPeer.go 72.22% 27 Missing and 3 partials ⚠️
config/config.go 0.00% 22 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6466      +/-   ##
==========================================
- Coverage   51.13%   46.24%   -4.90%     
==========================================
  Files         668      661       -7     
  Lines      112101   112249     +148     
==========================================
- Hits        57327    51912    -5415     
- Misses      51907    57578    +5671     
+ Partials     2867     2759     -108     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

algorandskiy
algorandskiy previously approved these changes Oct 21, 2025
// Initialize stateful compression negotiation details if both nodes support it
// Stateful compression requires stateless compression to be available since VP messages
// decompress in two stages: VP → stateless-compressed → raw vote
if wp.enableVoteCompression && wp.voteCompressionDynamicTableSize > 0 &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these conditions be behind a dedicated function for checking them?

return !peerBtoA.msgCodec.statefulVoteEncEnabled.Load()
}, 2*time.Second, 50*time.Millisecond, "VP encoding not disabled on B->A after receiving abort message")

// Verify connection is still up after abort
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth sending a non-compressed message to finish test?

networkP2PReceivedUncompressedBytesByTag.Add(string(tag[:]), uint64(len(msg.Data)+2))
networkP2PReceivedUncompressedBytesByTag.Add(string(msg.Tag), uint64(len(msg.Data)+2))
}
if originalTag == protocol.VotePackedTag {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants