Skip to content

Commit 6e1eeae

Browse files
committed
last CR fixes
1 parent f77ca3b commit 6e1eeae

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

config/localTemplate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ func (cfg *Local) TracksCatchpoints() bool {
10701070
return false
10711071
}
10721072

1073-
// NormalizedVoteCompressionTableSize validates and normalizes the VoteCompressionDynamicTableSize config value.
1073+
// NormalizedVoteCompressionTableSize validates and normalizes the StatefulVoteCompressionTableSize config value.
10741074
// Supported values are powers of 2 in the range [16, 2048].
10751075
// Values >= 2048 clamp to 2048.
10761076
// Values 1-15 are below the minimum and return 0 (disabled).
@@ -1091,7 +1091,7 @@ func (cfg Local) NormalizedVoteCompressionTableSize(log logger) uint {
10911091
for _, size := range supportedSizes {
10921092
if configured >= size {
10931093
if configured != size {
1094-
log.Infof("VoteCompressionDynamicTableSize configured as %d, using nearest supported value: %d", configured, size)
1094+
log.Infof("StatefulVoteCompressionTableSize configured as %d, using nearest supported value: %d", configured, size)
10951095
}
10961096
return size
10971097
}

network/wsPeer.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ func (wp *wsPeer) readLoop() {
581581
networkP2PReceivedBytesByTag.Add(string(tag[:]), uint64(len(msg.Data)+2))
582582
networkP2PMessageReceivedByTag.Add(string(tag[:]), 1)
583583
}
584-
originalTag := msg.Tag
585584
msg.Data, err = wp.msgCodec.decompress(msg.Tag, msg.Data)
586585
if err != nil {
587586
// Handle VP errors by sending abort message and continuing
@@ -607,7 +606,7 @@ func (wp *wsPeer) readLoop() {
607606
} else {
608607
networkP2PReceivedUncompressedBytesByTag.Add(string(msg.Tag), uint64(len(msg.Data)+2))
609608
}
610-
if originalTag == protocol.VotePackedTag {
609+
if msg.Tag == protocol.VotePackedTag { // re-tag decompressed VP as AV
611610
msg.Tag = protocol.AgreementVoteTag
612611
}
613612
msg.Sender = wp
@@ -1148,12 +1147,6 @@ func (wp *wsPeer) vpackStatefulCompressionSupported() bool {
11481147
// getBestVpackTableSize returns the negotiated table size.
11491148
// This calculates the minimum between our max size and the peer's advertised max size.
11501149
func (wp *wsPeer) getBestVpackTableSize() uint {
1151-
// Get our max size
1152-
ourMaxSize := wp.voteCompressionTableSize
1153-
if ourMaxSize == 0 {
1154-
return 0
1155-
}
1156-
11571150
// Get peer's max size from their features
11581151
var peerMaxSize uint
11591152
switch {
@@ -1174,10 +1167,11 @@ func (wp *wsPeer) getBestVpackTableSize() uint {
11741167
case wp.features&pfCompressedVoteVpackStateful16 != 0:
11751168
peerMaxSize = 16
11761169
default:
1177-
return 0 // Peer doesn't support stateful vote compression
1170+
peerMaxSize = 0 // Peer doesn't support stateful vote compression
11781171
}
11791172

1180-
return min(ourMaxSize, peerMaxSize)
1173+
// Return the minimum between our max size and peer's max size
1174+
return min(wp.voteCompressionTableSize, peerMaxSize)
11811175
}
11821176

11831177
//msgp:ignore peerFeatureFlag

0 commit comments

Comments
 (0)