Skip to content

Commit cb5b2d4

Browse files
authored
Merge branch 'dev' into remove-tx-mempool-verifier
2 parents 1fc6eb7 + f3561f4 commit cb5b2d4

File tree

7 files changed

+23
-216
lines changed

7 files changed

+23
-216
lines changed

config/config.go

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,34 @@ const (
5858
ipcDeprecationMsg = "IPC API is deprecated"
5959
keystoreDeprecationMsg = "keystore API is deprecated"
6060
acceptedFrontierGossipDeprecationMsg = "push-based accepted frontier gossip is deprecated"
61+
peerListPushGossipDeprecationMsg = "push-based peer list gossip is deprecated"
6162
)
6263

6364
var (
6465
// Deprecated key --> deprecation message (i.e. which key replaces it)
6566
// TODO: deprecate "BootstrapIDsKey" and "BootstrapIPsKey"
66-
deprecatedKeys = map[string]string{
67-
IpcAPIEnabledKey: ipcDeprecationMsg,
68-
IpcsChainIDsKey: ipcDeprecationMsg,
69-
IpcsPathKey: ipcDeprecationMsg,
67+
commitThresholdDeprecationMsg = fmt.Sprintf("use --%s instead", SnowCommitThresholdKey)
68+
deprecatedKeys = map[string]string{
69+
IpcAPIEnabledKey: ipcDeprecationMsg,
70+
IpcsChainIDsKey: ipcDeprecationMsg,
71+
IpcsPathKey: ipcDeprecationMsg,
72+
7073
KeystoreAPIEnabledKey: keystoreDeprecationMsg,
74+
7175
ConsensusGossipAcceptedFrontierValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
7276
ConsensusGossipAcceptedFrontierNonValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
7377
ConsensusGossipAcceptedFrontierPeerSizeKey: acceptedFrontierGossipDeprecationMsg,
7478
ConsensusGossipOnAcceptValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
7579
ConsensusGossipOnAcceptNonValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
7680
ConsensusGossipOnAcceptPeerSizeKey: acceptedFrontierGossipDeprecationMsg,
7781

78-
SnowRogueCommitThresholdKey: fmt.Sprintf("use --%s instead", SnowCommitThresholdKey),
79-
SnowVirtuousCommitThresholdKey: fmt.Sprintf("use --%s instead", SnowCommitThresholdKey),
82+
NetworkPeerListValidatorGossipSizeKey: peerListPushGossipDeprecationMsg,
83+
NetworkPeerListNonValidatorGossipSizeKey: peerListPushGossipDeprecationMsg,
84+
NetworkPeerListPeersGossipSizeKey: peerListPushGossipDeprecationMsg,
85+
NetworkPeerListGossipFreqKey: peerListPushGossipDeprecationMsg,
86+
87+
SnowRogueCommitThresholdKey: commitThresholdDeprecationMsg,
88+
SnowVirtuousCommitThresholdKey: commitThresholdDeprecationMsg,
8089
}
8190

8291
errConflictingACPOpinion = errors.New("supporting and objecting to the same ACP")
@@ -100,6 +109,7 @@ var (
100109
errCannotReadDirectory = errors.New("cannot read directory")
101110
errUnmarshalling = errors.New("unmarshalling failed")
102111
errFileDoesNotExist = errors.New("file does not exist")
112+
errGzipDeprecatedMsg = errors.New("gzip compression is not supported, use zstd or no compression")
103113
)
104114

105115
func getConsensusConfig(v *viper.Viper) snowball.Parameters {
@@ -337,6 +347,9 @@ func getNetworkConfig(
337347
if err != nil {
338348
return network.Config{}, err
339349
}
350+
if compressionType == compression.TypeGzip {
351+
return network.Config{}, errGzipDeprecatedMsg
352+
}
340353

341354
allowPrivateIPs := !constants.ProductionNetworkIDs.Contains(networkID)
342355
if v.IsSet(NetworkAllowPrivateIPsKey) {

config/flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func addNodeFlags(fs *pflag.FlagSet) {
157157
fs.Duration(NetworkPingTimeoutKey, constants.DefaultPingPongTimeout, "Timeout value for Ping-Pong with a peer")
158158
fs.Duration(NetworkPingFrequencyKey, constants.DefaultPingFrequency, "Frequency of pinging other peers")
159159

160-
fs.String(NetworkCompressionTypeKey, constants.DefaultNetworkCompressionType.String(), fmt.Sprintf("Compression type for outbound messages. Must be one of [%s, %s, %s]", compression.TypeGzip, compression.TypeZstd, compression.TypeNone))
160+
fs.String(NetworkCompressionTypeKey, constants.DefaultNetworkCompressionType.String(), fmt.Sprintf("Compression type for outbound messages. Must be one of [%s, %s]", compression.TypeZstd, compression.TypeNone))
161161

162162
fs.Duration(NetworkMaxClockDifferenceKey, constants.DefaultNetworkMaxClockDifference, "Max allowed clock difference value between this node and peers")
163163
// Note: The default value is set to false here because the default

message/messages.go

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ func (m *outboundMessage) BytesSavedCompression() int {
134134
type msgBuilder struct {
135135
log logging.Logger
136136

137+
// TODO: Remove gzip once v1.11.x is out.
137138
gzipCompressor compression.Compressor
138-
gzipCompressTimeMetrics map[Op]metric.Averager
139139
gzipDecompressTimeMetrics map[Op]metric.Averager
140140

141141
zstdCompressor compression.Compressor
@@ -164,7 +164,6 @@ func newMsgBuilder(
164164
log: log,
165165

166166
gzipCompressor: gzipCompressor,
167-
gzipCompressTimeMetrics: make(map[Op]metric.Averager, len(ExternalOps)),
168167
gzipDecompressTimeMetrics: make(map[Op]metric.Averager, len(ExternalOps)),
169168

170169
zstdCompressor: zstdCompressor,
@@ -176,13 +175,6 @@ func newMsgBuilder(
176175

177176
errs := wrappers.Errs{}
178177
for _, op := range ExternalOps {
179-
mb.gzipCompressTimeMetrics[op] = metric.NewAveragerWithErrs(
180-
namespace,
181-
fmt.Sprintf("gzip_%s_compress_time", op),
182-
fmt.Sprintf("time (in ns) to compress %s messages with gzip", op),
183-
metrics,
184-
&errs,
185-
)
186178
mb.gzipDecompressTimeMetrics[op] = metric.NewAveragerWithErrs(
187179
namespace,
188180
fmt.Sprintf("gzip_%s_decompress_time", op),
@@ -236,17 +228,6 @@ func (mb *msgBuilder) marshal(
236228
switch compressionType {
237229
case compression.TypeNone:
238230
return uncompressedMsgBytes, 0, op, nil
239-
case compression.TypeGzip:
240-
compressedBytes, err := mb.gzipCompressor.Compress(uncompressedMsgBytes)
241-
if err != nil {
242-
return nil, 0, 0, err
243-
}
244-
compressedMsg = p2p.Message{
245-
Message: &p2p.Message_CompressedGzip{
246-
CompressedGzip: compressedBytes,
247-
},
248-
}
249-
opToCompressTimeMetrics = mb.gzipCompressTimeMetrics
250231
case compression.TypeZstd:
251232
compressedBytes, err := mb.zstdCompressor.Compress(uncompressedMsgBytes)
252233
if err != nil {

message/messages_test.go

Lines changed: 0 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -159,23 +159,6 @@ func TestMessage(t *testing.T) {
159159
bypassThrottling: false,
160160
bytesSaved: false,
161161
},
162-
{
163-
desc: "get_peer_list message with gzip compression",
164-
op: GetPeerListOp,
165-
msg: &p2p.Message{
166-
Message: &p2p.Message_GetPeerList{
167-
GetPeerList: &p2p.GetPeerList{
168-
KnownPeers: &p2p.BloomFilter{
169-
Filter: make([]byte, 2048),
170-
Salt: make([]byte, 32),
171-
},
172-
},
173-
},
174-
},
175-
compressionType: compression.TypeGzip,
176-
bypassThrottling: false,
177-
bytesSaved: true,
178-
},
179162
{
180163
desc: "get_peer_list message with zstd compression",
181164
op: GetPeerListOp,
@@ -215,28 +198,6 @@ func TestMessage(t *testing.T) {
215198
bypassThrottling: true,
216199
bytesSaved: false,
217200
},
218-
{
219-
desc: "peer_list message with gzip compression",
220-
op: PeerListOp,
221-
msg: &p2p.Message{
222-
Message: &p2p.Message_PeerList_{
223-
PeerList_: &p2p.PeerList{
224-
ClaimedIpPorts: []*p2p.ClaimedIpPort{
225-
{
226-
X509Certificate: testTLSCert.Certificate[0],
227-
IpAddr: []byte(net.IPv6zero),
228-
IpPort: 9651,
229-
Timestamp: uint64(nowUnix),
230-
Signature: compressibleContainers[0],
231-
},
232-
},
233-
},
234-
},
235-
},
236-
compressionType: compression.TypeGzip,
237-
bypassThrottling: true,
238-
bytesSaved: true,
239-
},
240201
{
241202
desc: "peer_list message with zstd compression",
242203
op: PeerListOp,
@@ -291,22 +252,6 @@ func TestMessage(t *testing.T) {
291252
bypassThrottling: true,
292253
bytesSaved: false,
293254
},
294-
{
295-
desc: "state_summary_frontier message with gzip compression",
296-
op: StateSummaryFrontierOp,
297-
msg: &p2p.Message{
298-
Message: &p2p.Message_StateSummaryFrontier_{
299-
StateSummaryFrontier_: &p2p.StateSummaryFrontier{
300-
ChainId: testID[:],
301-
RequestId: 1,
302-
Summary: compressibleContainers[0],
303-
},
304-
},
305-
},
306-
compressionType: compression.TypeGzip,
307-
bypassThrottling: true,
308-
bytesSaved: true,
309-
},
310255
{
311256
desc: "state_summary_frontier message with zstd compression",
312257
op: StateSummaryFrontierOp,
@@ -340,23 +285,6 @@ func TestMessage(t *testing.T) {
340285
bypassThrottling: true,
341286
bytesSaved: false,
342287
},
343-
{
344-
desc: "get_accepted_state_summary message with gzip compression",
345-
op: GetAcceptedStateSummaryOp,
346-
msg: &p2p.Message{
347-
Message: &p2p.Message_GetAcceptedStateSummary{
348-
GetAcceptedStateSummary: &p2p.GetAcceptedStateSummary{
349-
ChainId: testID[:],
350-
RequestId: 1,
351-
Deadline: 1,
352-
Heights: []uint64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
353-
},
354-
},
355-
},
356-
compressionType: compression.TypeGzip,
357-
bypassThrottling: true,
358-
bytesSaved: false,
359-
},
360288
{
361289
desc: "get_accepted_state_summary message with zstd compression",
362290
op: GetAcceptedStateSummaryOp,
@@ -390,22 +318,6 @@ func TestMessage(t *testing.T) {
390318
bypassThrottling: true,
391319
bytesSaved: false,
392320
},
393-
{
394-
desc: "accepted_state_summary message with gzip compression",
395-
op: AcceptedStateSummaryOp,
396-
msg: &p2p.Message{
397-
Message: &p2p.Message_AcceptedStateSummary_{
398-
AcceptedStateSummary_: &p2p.AcceptedStateSummary{
399-
ChainId: testID[:],
400-
RequestId: 1,
401-
SummaryIds: [][]byte{testID[:], testID[:], testID[:], testID[:], testID[:], testID[:], testID[:], testID[:], testID[:]},
402-
},
403-
},
404-
},
405-
compressionType: compression.TypeGzip,
406-
bypassThrottling: true,
407-
bytesSaved: true,
408-
},
409321
{
410322
desc: "accepted_state_summary message with zstd compression",
411323
op: AcceptedStateSummaryOp,
@@ -523,22 +435,6 @@ func TestMessage(t *testing.T) {
523435
bypassThrottling: true,
524436
bytesSaved: false,
525437
},
526-
{
527-
desc: "ancestors message with gzip compression",
528-
op: AncestorsOp,
529-
msg: &p2p.Message{
530-
Message: &p2p.Message_Ancestors_{
531-
Ancestors_: &p2p.Ancestors{
532-
ChainId: testID[:],
533-
RequestId: 12345,
534-
Containers: compressibleContainers,
535-
},
536-
},
537-
},
538-
compressionType: compression.TypeGzip,
539-
bypassThrottling: true,
540-
bytesSaved: true,
541-
},
542438
{
543439
desc: "ancestors message with zstd compression",
544440
op: AncestorsOp,
@@ -590,23 +486,6 @@ func TestMessage(t *testing.T) {
590486
bypassThrottling: true,
591487
bytesSaved: false,
592488
},
593-
{
594-
desc: "put message with gzip compression",
595-
op: PutOp,
596-
msg: &p2p.Message{
597-
Message: &p2p.Message_Put{
598-
Put: &p2p.Put{
599-
ChainId: testID[:],
600-
RequestId: 1,
601-
Container: compressibleContainers[0],
602-
EngineType: p2p.EngineType_ENGINE_TYPE_AVALANCHE,
603-
},
604-
},
605-
},
606-
compressionType: compression.TypeGzip,
607-
bypassThrottling: true,
608-
bytesSaved: true,
609-
},
610489
{
611490
desc: "put message with zstd compression",
612491
op: PutOp,
@@ -642,24 +521,6 @@ func TestMessage(t *testing.T) {
642521
bypassThrottling: true,
643522
bytesSaved: false,
644523
},
645-
{
646-
desc: "push_query message with gzip compression",
647-
op: PushQueryOp,
648-
msg: &p2p.Message{
649-
Message: &p2p.Message_PushQuery{
650-
PushQuery: &p2p.PushQuery{
651-
ChainId: testID[:],
652-
RequestId: 1,
653-
Deadline: 1,
654-
Container: compressibleContainers[0],
655-
EngineType: p2p.EngineType_ENGINE_TYPE_AVALANCHE,
656-
},
657-
},
658-
},
659-
compressionType: compression.TypeGzip,
660-
bypassThrottling: true,
661-
bytesSaved: true,
662-
},
663524
{
664525
desc: "push_query message with zstd compression",
665526
op: PushQueryOp,
@@ -729,23 +590,6 @@ func TestMessage(t *testing.T) {
729590
bypassThrottling: true,
730591
bytesSaved: false,
731592
},
732-
{
733-
desc: "app_request message with gzip compression",
734-
op: AppRequestOp,
735-
msg: &p2p.Message{
736-
Message: &p2p.Message_AppRequest{
737-
AppRequest: &p2p.AppRequest{
738-
ChainId: testID[:],
739-
RequestId: 1,
740-
Deadline: 1,
741-
AppBytes: compressibleContainers[0],
742-
},
743-
},
744-
},
745-
compressionType: compression.TypeGzip,
746-
bypassThrottling: true,
747-
bytesSaved: true,
748-
},
749593
{
750594
desc: "app_request message with zstd compression",
751595
op: AppRequestOp,
@@ -779,22 +623,6 @@ func TestMessage(t *testing.T) {
779623
bypassThrottling: true,
780624
bytesSaved: false,
781625
},
782-
{
783-
desc: "app_response message with gzip compression",
784-
op: AppResponseOp,
785-
msg: &p2p.Message{
786-
Message: &p2p.Message_AppResponse{
787-
AppResponse: &p2p.AppResponse{
788-
ChainId: testID[:],
789-
RequestId: 1,
790-
AppBytes: compressibleContainers[0],
791-
},
792-
},
793-
},
794-
compressionType: compression.TypeGzip,
795-
bypassThrottling: true,
796-
bytesSaved: true,
797-
},
798626
{
799627
desc: "app_response message with zstd compression",
800628
op: AppResponseOp,
@@ -826,21 +654,6 @@ func TestMessage(t *testing.T) {
826654
bypassThrottling: true,
827655
bytesSaved: false,
828656
},
829-
{
830-
desc: "app_gossip message with gzip compression",
831-
op: AppGossipOp,
832-
msg: &p2p.Message{
833-
Message: &p2p.Message_AppGossip{
834-
AppGossip: &p2p.AppGossip{
835-
ChainId: testID[:],
836-
AppBytes: compressibleContainers[0],
837-
},
838-
},
839-
},
840-
compressionType: compression.TypeGzip,
841-
bypassThrottling: true,
842-
bytesSaved: true,
843-
},
844657
{
845658
desc: "app_gossip message with zstd compression",
846659
op: AppGossipOp,

message/outbound_msg_builder_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ func Test_newOutboundBuilder(t *testing.T) {
2929

3030
for _, compressionType := range []compression.Type{
3131
compression.TypeNone,
32-
compression.TypeGzip,
3332
compression.TypeZstd,
3433
} {
3534
t.Run(compressionType.String(), func(t *testing.T) {

utils/compression/gzip_compressor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var (
2121
ErrMsgTooLarge = errors.New("msg too large to be compressed")
2222
)
2323

24+
// TODO: Remove once v1.11.x is out.
2425
type gzipCompressor struct {
2526
maxSize int64
2627
gzipWriterPool sync.Pool

0 commit comments

Comments
 (0)