55package message
66
77import (
8+ "fmt"
89 "time"
910
1011 "github.com/ava-labs/avalanchego/ids"
@@ -15,56 +16,80 @@ import (
1516
1617var (
1718 disconnected = & Disconnected {}
18- timeout = & Timeout {}
1919 gossipRequest = & GossipRequest {}
20+ timeout = & Timeout {}
2021
22+ _ fmt.Stringer = (* GetStateSummaryFrontierFailed )(nil )
2123 _ chainIDGetter = (* GetStateSummaryFrontierFailed )(nil )
2224 _ requestIDGetter = (* GetStateSummaryFrontierFailed )(nil )
2325
26+ _ fmt.Stringer = (* GetAcceptedStateSummaryFailed )(nil )
2427 _ chainIDGetter = (* GetAcceptedStateSummaryFailed )(nil )
2528 _ requestIDGetter = (* GetAcceptedStateSummaryFailed )(nil )
2629
30+ _ fmt.Stringer = (* GetAcceptedFrontierFailed )(nil )
2731 _ chainIDGetter = (* GetAcceptedFrontierFailed )(nil )
2832 _ requestIDGetter = (* GetAcceptedFrontierFailed )(nil )
2933 _ engineTypeGetter = (* GetAcceptedFrontierFailed )(nil )
3034
35+ _ fmt.Stringer = (* GetAcceptedFailed )(nil )
3136 _ chainIDGetter = (* GetAcceptedFailed )(nil )
3237 _ requestIDGetter = (* GetAcceptedFailed )(nil )
3338 _ engineTypeGetter = (* GetAcceptedFailed )(nil )
3439
40+ _ fmt.Stringer = (* GetAncestorsFailed )(nil )
3541 _ chainIDGetter = (* GetAncestorsFailed )(nil )
3642 _ requestIDGetter = (* GetAncestorsFailed )(nil )
3743 _ engineTypeGetter = (* GetAncestorsFailed )(nil )
3844
45+ _ fmt.Stringer = (* GetFailed )(nil )
3946 _ chainIDGetter = (* GetFailed )(nil )
4047 _ requestIDGetter = (* GetFailed )(nil )
4148 _ engineTypeGetter = (* GetFailed )(nil )
4249
50+ _ fmt.Stringer = (* QueryFailed )(nil )
4351 _ chainIDGetter = (* QueryFailed )(nil )
4452 _ requestIDGetter = (* QueryFailed )(nil )
4553 _ engineTypeGetter = (* QueryFailed )(nil )
4654
55+ _ fmt.Stringer = (* AppRequestFailed )(nil )
4756 _ chainIDGetter = (* AppRequestFailed )(nil )
4857 _ requestIDGetter = (* AppRequestFailed )(nil )
4958
59+ _ fmt.Stringer = (* CrossChainAppRequest )(nil )
5060 _ sourceChainIDGetter = (* CrossChainAppRequest )(nil )
5161 _ chainIDGetter = (* CrossChainAppRequest )(nil )
5262 _ requestIDGetter = (* CrossChainAppRequest )(nil )
5363
64+ _ fmt.Stringer = (* CrossChainAppRequestFailed )(nil )
5465 _ sourceChainIDGetter = (* CrossChainAppRequestFailed )(nil )
5566 _ chainIDGetter = (* CrossChainAppRequestFailed )(nil )
5667 _ requestIDGetter = (* CrossChainAppRequestFailed )(nil )
5768
69+ _ fmt.Stringer = (* CrossChainAppResponse )(nil )
5870 _ sourceChainIDGetter = (* CrossChainAppResponse )(nil )
5971 _ chainIDGetter = (* CrossChainAppResponse )(nil )
6072 _ requestIDGetter = (* CrossChainAppResponse )(nil )
73+
74+ _ fmt.Stringer = (* Disconnected )(nil )
75+
76+ _ fmt.Stringer = (* GossipRequest )(nil )
77+
78+ _ fmt.Stringer = (* Timeout )(nil )
6179)
6280
6381type GetStateSummaryFrontierFailed struct {
6482 ChainID ids.ID `json:"chain_id,omitempty"`
6583 RequestID uint32 `json:"request_id,omitempty"`
6684}
6785
86+ func (m * GetStateSummaryFrontierFailed ) String () string {
87+ return fmt .Sprintf (
88+ "ChainID: %s RequestID: %d" ,
89+ m .ChainID , m .RequestID ,
90+ )
91+ }
92+
6893func (m * GetStateSummaryFrontierFailed ) GetChainId () []byte {
6994 return m .ChainID [:]
7095}
@@ -94,6 +119,13 @@ type GetAcceptedStateSummaryFailed struct {
94119 RequestID uint32 `json:"request_id,omitempty"`
95120}
96121
122+ func (m * GetAcceptedStateSummaryFailed ) String () string {
123+ return fmt .Sprintf (
124+ "ChainID: %s RequestID: %d" ,
125+ m .ChainID , m .RequestID ,
126+ )
127+ }
128+
97129func (m * GetAcceptedStateSummaryFailed ) GetChainId () []byte {
98130 return m .ChainID [:]
99131}
@@ -124,6 +156,13 @@ type GetAcceptedFrontierFailed struct {
124156 EngineType p2p.EngineType `json:"engine_type,omitempty"`
125157}
126158
159+ func (m * GetAcceptedFrontierFailed ) String () string {
160+ return fmt .Sprintf (
161+ "ChainID: %s RequestID: %d EngineType: %s" ,
162+ m .ChainID , m .RequestID , m .EngineType ,
163+ )
164+ }
165+
127166func (m * GetAcceptedFrontierFailed ) GetChainId () []byte {
128167 return m .ChainID [:]
129168}
@@ -160,6 +199,13 @@ type GetAcceptedFailed struct {
160199 EngineType p2p.EngineType `json:"engine_type,omitempty"`
161200}
162201
202+ func (m * GetAcceptedFailed ) String () string {
203+ return fmt .Sprintf (
204+ "ChainID: %s RequestID: %d EngineType: %s" ,
205+ m .ChainID , m .RequestID , m .EngineType ,
206+ )
207+ }
208+
163209func (m * GetAcceptedFailed ) GetChainId () []byte {
164210 return m .ChainID [:]
165211}
@@ -196,6 +242,13 @@ type GetAncestorsFailed struct {
196242 EngineType p2p.EngineType `json:"engine_type,omitempty"`
197243}
198244
245+ func (m * GetAncestorsFailed ) String () string {
246+ return fmt .Sprintf (
247+ "ChainID: %s RequestID: %d EngineType: %s" ,
248+ m .ChainID , m .RequestID , m .EngineType ,
249+ )
250+ }
251+
199252func (m * GetAncestorsFailed ) GetChainId () []byte {
200253 return m .ChainID [:]
201254}
@@ -232,6 +285,13 @@ type GetFailed struct {
232285 EngineType p2p.EngineType `json:"engine_type,omitempty"`
233286}
234287
288+ func (m * GetFailed ) String () string {
289+ return fmt .Sprintf (
290+ "ChainID: %s RequestID: %d EngineType: %s" ,
291+ m .ChainID , m .RequestID , m .EngineType ,
292+ )
293+ }
294+
235295func (m * GetFailed ) GetChainId () []byte {
236296 return m .ChainID [:]
237297}
@@ -268,6 +328,13 @@ type QueryFailed struct {
268328 EngineType p2p.EngineType `json:"engine_type,omitempty"`
269329}
270330
331+ func (m * QueryFailed ) String () string {
332+ return fmt .Sprintf (
333+ "ChainID: %s RequestID: %d EngineType: %s" ,
334+ m .ChainID , m .RequestID , m .EngineType ,
335+ )
336+ }
337+
271338func (m * QueryFailed ) GetChainId () []byte {
272339 return m .ChainID [:]
273340}
@@ -303,6 +370,13 @@ type AppRequestFailed struct {
303370 RequestID uint32 `json:"request_id,omitempty"`
304371}
305372
373+ func (m * AppRequestFailed ) String () string {
374+ return fmt .Sprintf (
375+ "ChainID: %s RequestID: %d" ,
376+ m .ChainID , m .RequestID ,
377+ )
378+ }
379+
306380func (m * AppRequestFailed ) GetChainId () []byte {
307381 return m .ChainID [:]
308382}
@@ -334,6 +408,13 @@ type CrossChainAppRequest struct {
334408 Message []byte `json:"message,omitempty"`
335409}
336410
411+ func (m * CrossChainAppRequest ) String () string {
412+ return fmt .Sprintf (
413+ "SourceChainID: %s DestinationChainID: %s RequestID: %d Message: 0x%x" ,
414+ m .SourceChainID , m .DestinationChainID , m .RequestID , m .Message ,
415+ )
416+ }
417+
337418func (m * CrossChainAppRequest ) GetSourceChainID () ids.ID {
338419 return m .SourceChainID
339420}
@@ -373,6 +454,13 @@ type CrossChainAppRequestFailed struct {
373454 RequestID uint32 `json:"request_id,omitempty"`
374455}
375456
457+ func (m * CrossChainAppRequestFailed ) String () string {
458+ return fmt .Sprintf (
459+ "SourceChainID: %s DestinationChainID: %s RequestID: %d" ,
460+ m .SourceChainID , m .DestinationChainID , m .RequestID ,
461+ )
462+ }
463+
376464func (m * CrossChainAppRequestFailed ) GetSourceChainID () ids.ID {
377465 return m .SourceChainID
378466}
@@ -410,6 +498,13 @@ type CrossChainAppResponse struct {
410498 Message []byte `json:"message,omitempty"`
411499}
412500
501+ func (m * CrossChainAppResponse ) String () string {
502+ return fmt .Sprintf (
503+ "SourceChainID: %s DestinationChainID: %s RequestID: %d Message: 0x%x" ,
504+ m .SourceChainID , m .DestinationChainID , m .RequestID , m .Message ,
505+ )
506+ }
507+
413508func (m * CrossChainAppResponse ) GetSourceChainID () ids.ID {
414509 return m .SourceChainID
415510}
@@ -446,6 +541,13 @@ type Connected struct {
446541 NodeVersion * version.Application `json:"node_version,omitempty"`
447542}
448543
544+ func (m * Connected ) String () string {
545+ return fmt .Sprintf (
546+ "NodeVersion: %s" ,
547+ m .NodeVersion ,
548+ )
549+ }
550+
449551func InternalConnected (nodeID ids.NodeID , nodeVersion * version.Application ) InboundMessage {
450552 return & inboundMessage {
451553 nodeID : nodeID ,
@@ -463,6 +565,13 @@ type ConnectedSubnet struct {
463565 SubnetID ids.ID `json:"subnet_id,omitempty"`
464566}
465567
568+ func (m * ConnectedSubnet ) String () string {
569+ return fmt .Sprintf (
570+ "SubnetID: %s" ,
571+ m .SubnetID ,
572+ )
573+ }
574+
466575// InternalConnectedSubnet returns a message that indicates the node with [nodeID] is
467576// connected to the subnet with the given [subnetID].
468577func InternalConnectedSubnet (nodeID ids.NodeID , subnetID ids.ID ) InboundMessage {
@@ -478,6 +587,10 @@ func InternalConnectedSubnet(nodeID ids.NodeID, subnetID ids.ID) InboundMessage
478587
479588type Disconnected struct {}
480589
590+ func (Disconnected ) String () string {
591+ return ""
592+ }
593+
481594func InternalDisconnected (nodeID ids.NodeID ) InboundMessage {
482595 return & inboundMessage {
483596 nodeID : nodeID ,
@@ -491,6 +604,13 @@ type VMMessage struct {
491604 Notification uint32 `json:"notification,omitempty"`
492605}
493606
607+ func (m * VMMessage ) String () string {
608+ return fmt .Sprintf (
609+ "Notification: %d" ,
610+ m .Notification ,
611+ )
612+ }
613+
494614func InternalVMMessage (
495615 nodeID ids.NodeID ,
496616 notification uint32 ,
@@ -507,6 +627,10 @@ func InternalVMMessage(
507627
508628type GossipRequest struct {}
509629
630+ func (GossipRequest ) String () string {
631+ return ""
632+ }
633+
510634func InternalGossipRequest (
511635 nodeID ids.NodeID ,
512636) InboundMessage {
@@ -520,6 +644,10 @@ func InternalGossipRequest(
520644
521645type Timeout struct {}
522646
647+ func (Timeout ) String () string {
648+ return ""
649+ }
650+
523651func InternalTimeout (nodeID ids.NodeID ) InboundMessage {
524652 return & inboundMessage {
525653 nodeID : nodeID ,
0 commit comments