diff --git a/Makefile b/Makefile index 13e51985ad..07037315e4 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ XDRS = $(DOWNLOADABLE_XDRS) xdr/Stellar-lighthorizon.x \ XDRGEN_COMMIT=e2cac557162d99b12ae73b846cf3d5bfe16636de -XDR_COMMIT=1a04392432dacc0092caaeae22a600ea1af3c6a5 +XDR_COMMIT=70180d5e8d9caee9e8645ed8a38c36a8cf403cd9 .PHONY: xdr xdr-clean xdr-update diff --git a/gxdr/xdr_generated.go b/gxdr/xdr_generated.go index e7c8f3ed58..7265cb5a71 100644 --- a/gxdr/xdr_generated.go +++ b/gxdr/xdr_generated.go @@ -1224,6 +1224,8 @@ type DiagnosticEvent struct { Event ContractEvent } +type DiagnosticEvents = []DiagnosticEvent + type SorobanTransactionMetaExtV1 struct { Ext ExtensionPoint // Total amount (in stroops) that has been charged for non-refundable @@ -1482,13 +1484,17 @@ const ( SCP_MESSAGE MessageType = 11 GET_SCP_STATE MessageType = 12 // new messages - HELLO MessageType = 13 - SURVEY_REQUEST MessageType = 14 - SURVEY_RESPONSE MessageType = 15 - SEND_MORE MessageType = 16 - SEND_MORE_EXTENDED MessageType = 20 - FLOOD_ADVERT MessageType = 18 - FLOOD_DEMAND MessageType = 19 + HELLO MessageType = 13 + SURVEY_REQUEST MessageType = 14 + SURVEY_RESPONSE MessageType = 15 + SEND_MORE MessageType = 16 + SEND_MORE_EXTENDED MessageType = 20 + FLOOD_ADVERT MessageType = 18 + FLOOD_DEMAND MessageType = 19 + TIME_SLICED_SURVEY_REQUEST MessageType = 21 + TIME_SLICED_SURVEY_RESPONSE MessageType = 22 + TIME_SLICED_SURVEY_START_COLLECTING MessageType = 23 + TIME_SLICED_SURVEY_STOP_COLLECTING MessageType = 24 ) type DontHave struct { @@ -1499,7 +1505,8 @@ type DontHave struct { type SurveyMessageCommandType int32 const ( - SURVEY_TOPOLOGY SurveyMessageCommandType = 0 + SURVEY_TOPOLOGY SurveyMessageCommandType = 0 + TIME_SLICED_SURVEY_TOPOLOGY SurveyMessageCommandType = 1 ) type SurveyMessageResponseType int32 @@ -1507,8 +1514,31 @@ type SurveyMessageResponseType int32 const ( SURVEY_TOPOLOGY_RESPONSE_V0 SurveyMessageResponseType = 0 SURVEY_TOPOLOGY_RESPONSE_V1 SurveyMessageResponseType = 1 + SURVEY_TOPOLOGY_RESPONSE_V2 SurveyMessageResponseType = 2 ) +type TimeSlicedSurveyStartCollectingMessage struct { + SurveyorID NodeID + Nonce Uint32 + LedgerNum Uint32 +} + +type SignedTimeSlicedSurveyStartCollectingMessage struct { + Signature Signature + StartCollecting TimeSlicedSurveyStartCollectingMessage +} + +type TimeSlicedSurveyStopCollectingMessage struct { + SurveyorID NodeID + Nonce Uint32 + LedgerNum Uint32 +} + +type SignedTimeSlicedSurveyStopCollectingMessage struct { + Signature Signature + StopCollecting TimeSlicedSurveyStopCollectingMessage +} + type SurveyRequestMessage struct { SurveyorPeerID NodeID SurveyedPeerID NodeID @@ -1517,11 +1547,23 @@ type SurveyRequestMessage struct { CommandType SurveyMessageCommandType } +type TimeSlicedSurveyRequestMessage struct { + Request SurveyRequestMessage + Nonce Uint32 + InboundPeersIndex Uint32 + OutboundPeersIndex Uint32 +} + type SignedSurveyRequestMessage struct { RequestSignature Signature Request SurveyRequestMessage } +type SignedTimeSlicedSurveyRequestMessage struct { + RequestSignature Signature + Request TimeSlicedSurveyRequestMessage +} + type EncryptedBody = []byte // bound 64000 type SurveyResponseMessage struct { @@ -1532,11 +1574,21 @@ type SurveyResponseMessage struct { EncryptedBody EncryptedBody } +type TimeSlicedSurveyResponseMessage struct { + Response SurveyResponseMessage + Nonce Uint32 +} + type SignedSurveyResponseMessage struct { ResponseSignature Signature Response SurveyResponseMessage } +type SignedTimeSlicedSurveyResponseMessage struct { + ResponseSignature Signature + Response TimeSlicedSurveyResponseMessage +} + type PeerStats struct { Id NodeID VersionStr string // bound 100 @@ -1557,6 +1609,29 @@ type PeerStats struct { type PeerStatList = []PeerStats // bound 25 +type TimeSlicedNodeData struct { + AddedAuthenticatedPeers Uint32 + DroppedAuthenticatedPeers Uint32 + TotalInboundPeerCount Uint32 + TotalOutboundPeerCount Uint32 + // SCP stats + P75SCPFirstToSelfLatencyMs Uint32 + P75SCPSelfToOtherLatencyMs Uint32 + // How many times the node lost sync in the time slice + LostSyncCount Uint32 + // Config data + IsValidator bool + MaxInboundPeerCount Uint32 + MaxOutboundPeerCount Uint32 +} + +type TimeSlicedPeerData struct { + PeerStats PeerStats + AverageLatencyMs Uint32 +} + +type TimeSlicedPeerDataList = []TimeSlicedPeerData // bound 25 + type TopologyResponseBodyV0 struct { InboundPeers PeerStatList OutboundPeers PeerStatList @@ -1573,12 +1648,20 @@ type TopologyResponseBodyV1 struct { MaxOutboundPeerCount Uint32 } +type TopologyResponseBodyV2 struct { + InboundPeers TimeSlicedPeerDataList + OutboundPeers TimeSlicedPeerDataList + NodeData TimeSlicedNodeData +} + type SurveyResponseBody struct { // The union discriminant Type selects among the following arms: // SURVEY_TOPOLOGY_RESPONSE_V0: // TopologyResponseBodyV0() *TopologyResponseBodyV0 // SURVEY_TOPOLOGY_RESPONSE_V1: // TopologyResponseBodyV1() *TopologyResponseBodyV1 + // SURVEY_TOPOLOGY_RESPONSE_V2: + // TopologyResponseBodyV2() *TopologyResponseBodyV2 Type SurveyMessageResponseType _u interface{} } @@ -1625,6 +1708,14 @@ type StellarMessage struct { // SignedSurveyRequestMessage() *SignedSurveyRequestMessage // SURVEY_RESPONSE: // SignedSurveyResponseMessage() *SignedSurveyResponseMessage + // TIME_SLICED_SURVEY_REQUEST: + // SignedTimeSlicedSurveyRequestMessage() *SignedTimeSlicedSurveyRequestMessage + // TIME_SLICED_SURVEY_RESPONSE: + // SignedTimeSlicedSurveyResponseMessage() *SignedTimeSlicedSurveyResponseMessage + // TIME_SLICED_SURVEY_START_COLLECTING: + // SignedTimeSlicedSurveyStartCollectingMessage() *SignedTimeSlicedSurveyStartCollectingMessage + // TIME_SLICED_SURVEY_STOP_COLLECTING: + // SignedTimeSlicedSurveyStopCollectingMessage() *SignedTimeSlicedSurveyStopCollectingMessage // GET_SCP_QUORUMSET: // QSetHash() *Uint256 // SCP_QUORUMSET: @@ -12018,6 +12109,73 @@ func (v *DiagnosticEvent) XdrRecurse(x XDR, name string) { } func XDR_DiagnosticEvent(v *DiagnosticEvent) *DiagnosticEvent { return v } +type _XdrVec_unbounded_DiagnosticEvent []DiagnosticEvent + +func (_XdrVec_unbounded_DiagnosticEvent) XdrBound() uint32 { + const bound uint32 = 4294967295 // Force error if not const or doesn't fit + return bound +} +func (_XdrVec_unbounded_DiagnosticEvent) XdrCheckLen(length uint32) { + if length > uint32(4294967295) { + XdrPanic("_XdrVec_unbounded_DiagnosticEvent length %d exceeds bound 4294967295", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_unbounded_DiagnosticEvent length %d exceeds max int", length) + } +} +func (v _XdrVec_unbounded_DiagnosticEvent) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_unbounded_DiagnosticEvent) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] + } + return + } + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(4294967295); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) + } + nv := make([]DiagnosticEvent, int(length), newcap) + copy(nv, *v) + *v = nv +} +func (v *_XdrVec_unbounded_DiagnosticEvent) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_DiagnosticEvent(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] + } +} +func (v *_XdrVec_unbounded_DiagnosticEvent) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) +} +func (_XdrVec_unbounded_DiagnosticEvent) XdrTypeName() string { return "DiagnosticEvent<>" } +func (v *_XdrVec_unbounded_DiagnosticEvent) XdrPointer() interface{} { return (*[]DiagnosticEvent)(v) } +func (v _XdrVec_unbounded_DiagnosticEvent) XdrValue() interface{} { return ([]DiagnosticEvent)(v) } +func (v *_XdrVec_unbounded_DiagnosticEvent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_DiagnosticEvents struct { + *_XdrVec_unbounded_DiagnosticEvent +} + +func XDR_DiagnosticEvents(v *DiagnosticEvents) XdrType_DiagnosticEvents { + return XdrType_DiagnosticEvents{(*_XdrVec_unbounded_DiagnosticEvent)(v)} +} +func (XdrType_DiagnosticEvents) XdrTypeName() string { return "DiagnosticEvents" } +func (v XdrType_DiagnosticEvents) XdrUnwrap() XdrType { return v._XdrVec_unbounded_DiagnosticEvent } + type XdrType_SorobanTransactionMetaExtV1 = *SorobanTransactionMetaExtV1 func (v *SorobanTransactionMetaExtV1) XdrPointer() interface{} { return v } @@ -12171,63 +12329,6 @@ func (v *_XdrVec_unbounded_ContractEvent) XdrPointer() interface{} { retur func (v _XdrVec_unbounded_ContractEvent) XdrValue() interface{} { return ([]ContractEvent)(v) } func (v *_XdrVec_unbounded_ContractEvent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } -type _XdrVec_unbounded_DiagnosticEvent []DiagnosticEvent - -func (_XdrVec_unbounded_DiagnosticEvent) XdrBound() uint32 { - const bound uint32 = 4294967295 // Force error if not const or doesn't fit - return bound -} -func (_XdrVec_unbounded_DiagnosticEvent) XdrCheckLen(length uint32) { - if length > uint32(4294967295) { - XdrPanic("_XdrVec_unbounded_DiagnosticEvent length %d exceeds bound 4294967295", length) - } else if int(length) < 0 { - XdrPanic("_XdrVec_unbounded_DiagnosticEvent length %d exceeds max int", length) - } -} -func (v _XdrVec_unbounded_DiagnosticEvent) GetVecLen() uint32 { return uint32(len(v)) } -func (v *_XdrVec_unbounded_DiagnosticEvent) SetVecLen(length uint32) { - v.XdrCheckLen(length) - if int(length) <= cap(*v) { - if int(length) != len(*v) { - *v = (*v)[:int(length)] - } - return - } - newcap := 2 * cap(*v) - if newcap < int(length) { // also catches overflow where 2*cap < 0 - newcap = int(length) - } else if bound := uint(4294967295); uint(newcap) > bound { - if int(bound) < 0 { - bound = ^uint(0) >> 1 - } - newcap = int(bound) - } - nv := make([]DiagnosticEvent, int(length), newcap) - copy(nv, *v) - *v = nv -} -func (v *_XdrVec_unbounded_DiagnosticEvent) XdrMarshalN(x XDR, name string, n uint32) { - v.XdrCheckLen(n) - for i := 0; i < int(n); i++ { - if i >= len(*v) { - v.SetVecLen(uint32(i + 1)) - } - XDR_DiagnosticEvent(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) - } - if int(n) < len(*v) { - *v = (*v)[:int(n)] - } -} -func (v *_XdrVec_unbounded_DiagnosticEvent) XdrRecurse(x XDR, name string) { - size := XdrSize{Size: uint32(len(*v)), Bound: 4294967295} - x.Marshal(name, &size) - v.XdrMarshalN(x, name, size.Size) -} -func (_XdrVec_unbounded_DiagnosticEvent) XdrTypeName() string { return "DiagnosticEvent<>" } -func (v *_XdrVec_unbounded_DiagnosticEvent) XdrPointer() interface{} { return (*[]DiagnosticEvent)(v) } -func (v _XdrVec_unbounded_DiagnosticEvent) XdrValue() interface{} { return ([]DiagnosticEvent)(v) } -func (v *_XdrVec_unbounded_DiagnosticEvent) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } - type XdrType_SorobanTransactionMeta = *SorobanTransactionMeta func (v *SorobanTransactionMeta) XdrPointer() interface{} { return v } @@ -13371,48 +13472,56 @@ func (v *PeerAddress) XdrRecurse(x XDR, name string) { func XDR_PeerAddress(v *PeerAddress) *PeerAddress { return v } var _XdrNames_MessageType = map[int32]string{ - int32(ERROR_MSG): "ERROR_MSG", - int32(AUTH): "AUTH", - int32(DONT_HAVE): "DONT_HAVE", - int32(GET_PEERS): "GET_PEERS", - int32(PEERS): "PEERS", - int32(GET_TX_SET): "GET_TX_SET", - int32(TX_SET): "TX_SET", - int32(GENERALIZED_TX_SET): "GENERALIZED_TX_SET", - int32(TRANSACTION): "TRANSACTION", - int32(GET_SCP_QUORUMSET): "GET_SCP_QUORUMSET", - int32(SCP_QUORUMSET): "SCP_QUORUMSET", - int32(SCP_MESSAGE): "SCP_MESSAGE", - int32(GET_SCP_STATE): "GET_SCP_STATE", - int32(HELLO): "HELLO", - int32(SURVEY_REQUEST): "SURVEY_REQUEST", - int32(SURVEY_RESPONSE): "SURVEY_RESPONSE", - int32(SEND_MORE): "SEND_MORE", - int32(SEND_MORE_EXTENDED): "SEND_MORE_EXTENDED", - int32(FLOOD_ADVERT): "FLOOD_ADVERT", - int32(FLOOD_DEMAND): "FLOOD_DEMAND", + int32(ERROR_MSG): "ERROR_MSG", + int32(AUTH): "AUTH", + int32(DONT_HAVE): "DONT_HAVE", + int32(GET_PEERS): "GET_PEERS", + int32(PEERS): "PEERS", + int32(GET_TX_SET): "GET_TX_SET", + int32(TX_SET): "TX_SET", + int32(GENERALIZED_TX_SET): "GENERALIZED_TX_SET", + int32(TRANSACTION): "TRANSACTION", + int32(GET_SCP_QUORUMSET): "GET_SCP_QUORUMSET", + int32(SCP_QUORUMSET): "SCP_QUORUMSET", + int32(SCP_MESSAGE): "SCP_MESSAGE", + int32(GET_SCP_STATE): "GET_SCP_STATE", + int32(HELLO): "HELLO", + int32(SURVEY_REQUEST): "SURVEY_REQUEST", + int32(SURVEY_RESPONSE): "SURVEY_RESPONSE", + int32(SEND_MORE): "SEND_MORE", + int32(SEND_MORE_EXTENDED): "SEND_MORE_EXTENDED", + int32(FLOOD_ADVERT): "FLOOD_ADVERT", + int32(FLOOD_DEMAND): "FLOOD_DEMAND", + int32(TIME_SLICED_SURVEY_REQUEST): "TIME_SLICED_SURVEY_REQUEST", + int32(TIME_SLICED_SURVEY_RESPONSE): "TIME_SLICED_SURVEY_RESPONSE", + int32(TIME_SLICED_SURVEY_START_COLLECTING): "TIME_SLICED_SURVEY_START_COLLECTING", + int32(TIME_SLICED_SURVEY_STOP_COLLECTING): "TIME_SLICED_SURVEY_STOP_COLLECTING", } var _XdrValues_MessageType = map[string]int32{ - "ERROR_MSG": int32(ERROR_MSG), - "AUTH": int32(AUTH), - "DONT_HAVE": int32(DONT_HAVE), - "GET_PEERS": int32(GET_PEERS), - "PEERS": int32(PEERS), - "GET_TX_SET": int32(GET_TX_SET), - "TX_SET": int32(TX_SET), - "GENERALIZED_TX_SET": int32(GENERALIZED_TX_SET), - "TRANSACTION": int32(TRANSACTION), - "GET_SCP_QUORUMSET": int32(GET_SCP_QUORUMSET), - "SCP_QUORUMSET": int32(SCP_QUORUMSET), - "SCP_MESSAGE": int32(SCP_MESSAGE), - "GET_SCP_STATE": int32(GET_SCP_STATE), - "HELLO": int32(HELLO), - "SURVEY_REQUEST": int32(SURVEY_REQUEST), - "SURVEY_RESPONSE": int32(SURVEY_RESPONSE), - "SEND_MORE": int32(SEND_MORE), - "SEND_MORE_EXTENDED": int32(SEND_MORE_EXTENDED), - "FLOOD_ADVERT": int32(FLOOD_ADVERT), - "FLOOD_DEMAND": int32(FLOOD_DEMAND), + "ERROR_MSG": int32(ERROR_MSG), + "AUTH": int32(AUTH), + "DONT_HAVE": int32(DONT_HAVE), + "GET_PEERS": int32(GET_PEERS), + "PEERS": int32(PEERS), + "GET_TX_SET": int32(GET_TX_SET), + "TX_SET": int32(TX_SET), + "GENERALIZED_TX_SET": int32(GENERALIZED_TX_SET), + "TRANSACTION": int32(TRANSACTION), + "GET_SCP_QUORUMSET": int32(GET_SCP_QUORUMSET), + "SCP_QUORUMSET": int32(SCP_QUORUMSET), + "SCP_MESSAGE": int32(SCP_MESSAGE), + "GET_SCP_STATE": int32(GET_SCP_STATE), + "HELLO": int32(HELLO), + "SURVEY_REQUEST": int32(SURVEY_REQUEST), + "SURVEY_RESPONSE": int32(SURVEY_RESPONSE), + "SEND_MORE": int32(SEND_MORE), + "SEND_MORE_EXTENDED": int32(SEND_MORE_EXTENDED), + "FLOOD_ADVERT": int32(FLOOD_ADVERT), + "FLOOD_DEMAND": int32(FLOOD_DEMAND), + "TIME_SLICED_SURVEY_REQUEST": int32(TIME_SLICED_SURVEY_REQUEST), + "TIME_SLICED_SURVEY_RESPONSE": int32(TIME_SLICED_SURVEY_RESPONSE), + "TIME_SLICED_SURVEY_START_COLLECTING": int32(TIME_SLICED_SURVEY_START_COLLECTING), + "TIME_SLICED_SURVEY_STOP_COLLECTING": int32(TIME_SLICED_SURVEY_STOP_COLLECTING), } func (MessageType) XdrEnumNames() map[int32]string { @@ -13479,10 +13588,12 @@ func (v *DontHave) XdrRecurse(x XDR, name string) { func XDR_DontHave(v *DontHave) *DontHave { return v } var _XdrNames_SurveyMessageCommandType = map[int32]string{ - int32(SURVEY_TOPOLOGY): "SURVEY_TOPOLOGY", + int32(SURVEY_TOPOLOGY): "SURVEY_TOPOLOGY", + int32(TIME_SLICED_SURVEY_TOPOLOGY): "TIME_SLICED_SURVEY_TOPOLOGY", } var _XdrValues_SurveyMessageCommandType = map[string]int32{ - "SURVEY_TOPOLOGY": int32(SURVEY_TOPOLOGY), + "SURVEY_TOPOLOGY": int32(SURVEY_TOPOLOGY), + "TIME_SLICED_SURVEY_TOPOLOGY": int32(TIME_SLICED_SURVEY_TOPOLOGY), } func (SurveyMessageCommandType) XdrEnumNames() map[int32]string { @@ -13524,10 +13635,12 @@ func XDR_SurveyMessageCommandType(v *SurveyMessageCommandType) *SurveyMessageCom var _XdrNames_SurveyMessageResponseType = map[int32]string{ int32(SURVEY_TOPOLOGY_RESPONSE_V0): "SURVEY_TOPOLOGY_RESPONSE_V0", int32(SURVEY_TOPOLOGY_RESPONSE_V1): "SURVEY_TOPOLOGY_RESPONSE_V1", + int32(SURVEY_TOPOLOGY_RESPONSE_V2): "SURVEY_TOPOLOGY_RESPONSE_V2", } var _XdrValues_SurveyMessageResponseType = map[string]int32{ "SURVEY_TOPOLOGY_RESPONSE_V0": int32(SURVEY_TOPOLOGY_RESPONSE_V0), "SURVEY_TOPOLOGY_RESPONSE_V1": int32(SURVEY_TOPOLOGY_RESPONSE_V1), + "SURVEY_TOPOLOGY_RESPONSE_V2": int32(SURVEY_TOPOLOGY_RESPONSE_V2), } func (SurveyMessageResponseType) XdrEnumNames() map[int32]string { @@ -13566,6 +13679,88 @@ type XdrType_SurveyMessageResponseType = *SurveyMessageResponseType func XDR_SurveyMessageResponseType(v *SurveyMessageResponseType) *SurveyMessageResponseType { return v } +type XdrType_TimeSlicedSurveyStartCollectingMessage = *TimeSlicedSurveyStartCollectingMessage + +func (v *TimeSlicedSurveyStartCollectingMessage) XdrPointer() interface{} { return v } +func (TimeSlicedSurveyStartCollectingMessage) XdrTypeName() string { + return "TimeSlicedSurveyStartCollectingMessage" +} +func (v TimeSlicedSurveyStartCollectingMessage) XdrValue() interface{} { return v } +func (v *TimeSlicedSurveyStartCollectingMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedSurveyStartCollectingMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%ssurveyorID", name), XDR_NodeID(&v.SurveyorID)) + x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) + x.Marshal(x.Sprintf("%sledgerNum", name), XDR_Uint32(&v.LedgerNum)) +} +func XDR_TimeSlicedSurveyStartCollectingMessage(v *TimeSlicedSurveyStartCollectingMessage) *TimeSlicedSurveyStartCollectingMessage { + return v +} + +type XdrType_SignedTimeSlicedSurveyStartCollectingMessage = *SignedTimeSlicedSurveyStartCollectingMessage + +func (v *SignedTimeSlicedSurveyStartCollectingMessage) XdrPointer() interface{} { return v } +func (SignedTimeSlicedSurveyStartCollectingMessage) XdrTypeName() string { + return "SignedTimeSlicedSurveyStartCollectingMessage" +} +func (v SignedTimeSlicedSurveyStartCollectingMessage) XdrValue() interface{} { return v } +func (v *SignedTimeSlicedSurveyStartCollectingMessage) XdrMarshal(x XDR, name string) { + x.Marshal(name, v) +} +func (v *SignedTimeSlicedSurveyStartCollectingMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%ssignature", name), XDR_Signature(&v.Signature)) + x.Marshal(x.Sprintf("%sstartCollecting", name), XDR_TimeSlicedSurveyStartCollectingMessage(&v.StartCollecting)) +} +func XDR_SignedTimeSlicedSurveyStartCollectingMessage(v *SignedTimeSlicedSurveyStartCollectingMessage) *SignedTimeSlicedSurveyStartCollectingMessage { + return v +} + +type XdrType_TimeSlicedSurveyStopCollectingMessage = *TimeSlicedSurveyStopCollectingMessage + +func (v *TimeSlicedSurveyStopCollectingMessage) XdrPointer() interface{} { return v } +func (TimeSlicedSurveyStopCollectingMessage) XdrTypeName() string { + return "TimeSlicedSurveyStopCollectingMessage" +} +func (v TimeSlicedSurveyStopCollectingMessage) XdrValue() interface{} { return v } +func (v *TimeSlicedSurveyStopCollectingMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedSurveyStopCollectingMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%ssurveyorID", name), XDR_NodeID(&v.SurveyorID)) + x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) + x.Marshal(x.Sprintf("%sledgerNum", name), XDR_Uint32(&v.LedgerNum)) +} +func XDR_TimeSlicedSurveyStopCollectingMessage(v *TimeSlicedSurveyStopCollectingMessage) *TimeSlicedSurveyStopCollectingMessage { + return v +} + +type XdrType_SignedTimeSlicedSurveyStopCollectingMessage = *SignedTimeSlicedSurveyStopCollectingMessage + +func (v *SignedTimeSlicedSurveyStopCollectingMessage) XdrPointer() interface{} { return v } +func (SignedTimeSlicedSurveyStopCollectingMessage) XdrTypeName() string { + return "SignedTimeSlicedSurveyStopCollectingMessage" +} +func (v SignedTimeSlicedSurveyStopCollectingMessage) XdrValue() interface{} { return v } +func (v *SignedTimeSlicedSurveyStopCollectingMessage) XdrMarshal(x XDR, name string) { + x.Marshal(name, v) +} +func (v *SignedTimeSlicedSurveyStopCollectingMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%ssignature", name), XDR_Signature(&v.Signature)) + x.Marshal(x.Sprintf("%sstopCollecting", name), XDR_TimeSlicedSurveyStopCollectingMessage(&v.StopCollecting)) +} +func XDR_SignedTimeSlicedSurveyStopCollectingMessage(v *SignedTimeSlicedSurveyStopCollectingMessage) *SignedTimeSlicedSurveyStopCollectingMessage { + return v +} + type XdrType_SurveyRequestMessage = *SurveyRequestMessage func (v *SurveyRequestMessage) XdrPointer() interface{} { return v } @@ -13584,6 +13779,25 @@ func (v *SurveyRequestMessage) XdrRecurse(x XDR, name string) { } func XDR_SurveyRequestMessage(v *SurveyRequestMessage) *SurveyRequestMessage { return v } +type XdrType_TimeSlicedSurveyRequestMessage = *TimeSlicedSurveyRequestMessage + +func (v *TimeSlicedSurveyRequestMessage) XdrPointer() interface{} { return v } +func (TimeSlicedSurveyRequestMessage) XdrTypeName() string { return "TimeSlicedSurveyRequestMessage" } +func (v TimeSlicedSurveyRequestMessage) XdrValue() interface{} { return v } +func (v *TimeSlicedSurveyRequestMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedSurveyRequestMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%srequest", name), XDR_SurveyRequestMessage(&v.Request)) + x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) + x.Marshal(x.Sprintf("%sinboundPeersIndex", name), XDR_Uint32(&v.InboundPeersIndex)) + x.Marshal(x.Sprintf("%soutboundPeersIndex", name), XDR_Uint32(&v.OutboundPeersIndex)) +} +func XDR_TimeSlicedSurveyRequestMessage(v *TimeSlicedSurveyRequestMessage) *TimeSlicedSurveyRequestMessage { + return v +} + type XdrType_SignedSurveyRequestMessage = *SignedSurveyRequestMessage func (v *SignedSurveyRequestMessage) XdrPointer() interface{} { return v } @@ -13601,6 +13815,25 @@ func XDR_SignedSurveyRequestMessage(v *SignedSurveyRequestMessage) *SignedSurvey return v } +type XdrType_SignedTimeSlicedSurveyRequestMessage = *SignedTimeSlicedSurveyRequestMessage + +func (v *SignedTimeSlicedSurveyRequestMessage) XdrPointer() interface{} { return v } +func (SignedTimeSlicedSurveyRequestMessage) XdrTypeName() string { + return "SignedTimeSlicedSurveyRequestMessage" +} +func (v SignedTimeSlicedSurveyRequestMessage) XdrValue() interface{} { return v } +func (v *SignedTimeSlicedSurveyRequestMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SignedTimeSlicedSurveyRequestMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%srequestSignature", name), XDR_Signature(&v.RequestSignature)) + x.Marshal(x.Sprintf("%srequest", name), XDR_TimeSlicedSurveyRequestMessage(&v.Request)) +} +func XDR_SignedTimeSlicedSurveyRequestMessage(v *SignedTimeSlicedSurveyRequestMessage) *SignedTimeSlicedSurveyRequestMessage { + return v +} + type XdrType_EncryptedBody struct { XdrVecOpaque } @@ -13629,6 +13862,23 @@ func (v *SurveyResponseMessage) XdrRecurse(x XDR, name string) { } func XDR_SurveyResponseMessage(v *SurveyResponseMessage) *SurveyResponseMessage { return v } +type XdrType_TimeSlicedSurveyResponseMessage = *TimeSlicedSurveyResponseMessage + +func (v *TimeSlicedSurveyResponseMessage) XdrPointer() interface{} { return v } +func (TimeSlicedSurveyResponseMessage) XdrTypeName() string { return "TimeSlicedSurveyResponseMessage" } +func (v TimeSlicedSurveyResponseMessage) XdrValue() interface{} { return v } +func (v *TimeSlicedSurveyResponseMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedSurveyResponseMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sresponse", name), XDR_SurveyResponseMessage(&v.Response)) + x.Marshal(x.Sprintf("%snonce", name), XDR_Uint32(&v.Nonce)) +} +func XDR_TimeSlicedSurveyResponseMessage(v *TimeSlicedSurveyResponseMessage) *TimeSlicedSurveyResponseMessage { + return v +} + type XdrType_SignedSurveyResponseMessage = *SignedSurveyResponseMessage func (v *SignedSurveyResponseMessage) XdrPointer() interface{} { return v } @@ -13646,6 +13896,25 @@ func XDR_SignedSurveyResponseMessage(v *SignedSurveyResponseMessage) *SignedSurv return v } +type XdrType_SignedTimeSlicedSurveyResponseMessage = *SignedTimeSlicedSurveyResponseMessage + +func (v *SignedTimeSlicedSurveyResponseMessage) XdrPointer() interface{} { return v } +func (SignedTimeSlicedSurveyResponseMessage) XdrTypeName() string { + return "SignedTimeSlicedSurveyResponseMessage" +} +func (v SignedTimeSlicedSurveyResponseMessage) XdrValue() interface{} { return v } +func (v *SignedTimeSlicedSurveyResponseMessage) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SignedTimeSlicedSurveyResponseMessage) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sresponseSignature", name), XDR_Signature(&v.ResponseSignature)) + x.Marshal(x.Sprintf("%sresponse", name), XDR_TimeSlicedSurveyResponseMessage(&v.Response)) +} +func XDR_SignedTimeSlicedSurveyResponseMessage(v *SignedTimeSlicedSurveyResponseMessage) *SignedTimeSlicedSurveyResponseMessage { + return v +} + type XdrType_PeerStats = *PeerStats func (v *PeerStats) XdrPointer() interface{} { return v } @@ -13741,6 +14010,111 @@ func XDR_PeerStatList(v *PeerStatList) XdrType_PeerStatList { func (XdrType_PeerStatList) XdrTypeName() string { return "PeerStatList" } func (v XdrType_PeerStatList) XdrUnwrap() XdrType { return v._XdrVec_25_PeerStats } +type XdrType_TimeSlicedNodeData = *TimeSlicedNodeData + +func (v *TimeSlicedNodeData) XdrPointer() interface{} { return v } +func (TimeSlicedNodeData) XdrTypeName() string { return "TimeSlicedNodeData" } +func (v TimeSlicedNodeData) XdrValue() interface{} { return v } +func (v *TimeSlicedNodeData) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedNodeData) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%saddedAuthenticatedPeers", name), XDR_Uint32(&v.AddedAuthenticatedPeers)) + x.Marshal(x.Sprintf("%sdroppedAuthenticatedPeers", name), XDR_Uint32(&v.DroppedAuthenticatedPeers)) + x.Marshal(x.Sprintf("%stotalInboundPeerCount", name), XDR_Uint32(&v.TotalInboundPeerCount)) + x.Marshal(x.Sprintf("%stotalOutboundPeerCount", name), XDR_Uint32(&v.TotalOutboundPeerCount)) + x.Marshal(x.Sprintf("%sp75SCPFirstToSelfLatencyMs", name), XDR_Uint32(&v.P75SCPFirstToSelfLatencyMs)) + x.Marshal(x.Sprintf("%sp75SCPSelfToOtherLatencyMs", name), XDR_Uint32(&v.P75SCPSelfToOtherLatencyMs)) + x.Marshal(x.Sprintf("%slostSyncCount", name), XDR_Uint32(&v.LostSyncCount)) + x.Marshal(x.Sprintf("%sisValidator", name), XDR_bool(&v.IsValidator)) + x.Marshal(x.Sprintf("%smaxInboundPeerCount", name), XDR_Uint32(&v.MaxInboundPeerCount)) + x.Marshal(x.Sprintf("%smaxOutboundPeerCount", name), XDR_Uint32(&v.MaxOutboundPeerCount)) +} +func XDR_TimeSlicedNodeData(v *TimeSlicedNodeData) *TimeSlicedNodeData { return v } + +type XdrType_TimeSlicedPeerData = *TimeSlicedPeerData + +func (v *TimeSlicedPeerData) XdrPointer() interface{} { return v } +func (TimeSlicedPeerData) XdrTypeName() string { return "TimeSlicedPeerData" } +func (v TimeSlicedPeerData) XdrValue() interface{} { return v } +func (v *TimeSlicedPeerData) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TimeSlicedPeerData) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%speerStats", name), XDR_PeerStats(&v.PeerStats)) + x.Marshal(x.Sprintf("%saverageLatencyMs", name), XDR_Uint32(&v.AverageLatencyMs)) +} +func XDR_TimeSlicedPeerData(v *TimeSlicedPeerData) *TimeSlicedPeerData { return v } + +type _XdrVec_25_TimeSlicedPeerData []TimeSlicedPeerData + +func (_XdrVec_25_TimeSlicedPeerData) XdrBound() uint32 { + const bound uint32 = 25 // Force error if not const or doesn't fit + return bound +} +func (_XdrVec_25_TimeSlicedPeerData) XdrCheckLen(length uint32) { + if length > uint32(25) { + XdrPanic("_XdrVec_25_TimeSlicedPeerData length %d exceeds bound 25", length) + } else if int(length) < 0 { + XdrPanic("_XdrVec_25_TimeSlicedPeerData length %d exceeds max int", length) + } +} +func (v _XdrVec_25_TimeSlicedPeerData) GetVecLen() uint32 { return uint32(len(v)) } +func (v *_XdrVec_25_TimeSlicedPeerData) SetVecLen(length uint32) { + v.XdrCheckLen(length) + if int(length) <= cap(*v) { + if int(length) != len(*v) { + *v = (*v)[:int(length)] + } + return + } + newcap := 2 * cap(*v) + if newcap < int(length) { // also catches overflow where 2*cap < 0 + newcap = int(length) + } else if bound := uint(25); uint(newcap) > bound { + if int(bound) < 0 { + bound = ^uint(0) >> 1 + } + newcap = int(bound) + } + nv := make([]TimeSlicedPeerData, int(length), newcap) + copy(nv, *v) + *v = nv +} +func (v *_XdrVec_25_TimeSlicedPeerData) XdrMarshalN(x XDR, name string, n uint32) { + v.XdrCheckLen(n) + for i := 0; i < int(n); i++ { + if i >= len(*v) { + v.SetVecLen(uint32(i + 1)) + } + XDR_TimeSlicedPeerData(&(*v)[i]).XdrMarshal(x, x.Sprintf("%s[%d]", name, i)) + } + if int(n) < len(*v) { + *v = (*v)[:int(n)] + } +} +func (v *_XdrVec_25_TimeSlicedPeerData) XdrRecurse(x XDR, name string) { + size := XdrSize{Size: uint32(len(*v)), Bound: 25} + x.Marshal(name, &size) + v.XdrMarshalN(x, name, size.Size) +} +func (_XdrVec_25_TimeSlicedPeerData) XdrTypeName() string { return "TimeSlicedPeerData<>" } +func (v *_XdrVec_25_TimeSlicedPeerData) XdrPointer() interface{} { return (*[]TimeSlicedPeerData)(v) } +func (v _XdrVec_25_TimeSlicedPeerData) XdrValue() interface{} { return ([]TimeSlicedPeerData)(v) } +func (v *_XdrVec_25_TimeSlicedPeerData) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } + +type XdrType_TimeSlicedPeerDataList struct { + *_XdrVec_25_TimeSlicedPeerData +} + +func XDR_TimeSlicedPeerDataList(v *TimeSlicedPeerDataList) XdrType_TimeSlicedPeerDataList { + return XdrType_TimeSlicedPeerDataList{(*_XdrVec_25_TimeSlicedPeerData)(v)} +} +func (XdrType_TimeSlicedPeerDataList) XdrTypeName() string { return "TimeSlicedPeerDataList" } +func (v XdrType_TimeSlicedPeerDataList) XdrUnwrap() XdrType { return v._XdrVec_25_TimeSlicedPeerData } + type XdrType_TopologyResponseBodyV0 = *TopologyResponseBodyV0 func (v *TopologyResponseBodyV0) XdrPointer() interface{} { return v } @@ -13777,9 +14151,26 @@ func (v *TopologyResponseBodyV1) XdrRecurse(x XDR, name string) { } func XDR_TopologyResponseBodyV1(v *TopologyResponseBodyV1) *TopologyResponseBodyV1 { return v } +type XdrType_TopologyResponseBodyV2 = *TopologyResponseBodyV2 + +func (v *TopologyResponseBodyV2) XdrPointer() interface{} { return v } +func (TopologyResponseBodyV2) XdrTypeName() string { return "TopologyResponseBodyV2" } +func (v TopologyResponseBodyV2) XdrValue() interface{} { return v } +func (v *TopologyResponseBodyV2) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *TopologyResponseBodyV2) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sinboundPeers", name), XDR_TimeSlicedPeerDataList(&v.InboundPeers)) + x.Marshal(x.Sprintf("%soutboundPeers", name), XDR_TimeSlicedPeerDataList(&v.OutboundPeers)) + x.Marshal(x.Sprintf("%snodeData", name), XDR_TimeSlicedNodeData(&v.NodeData)) +} +func XDR_TopologyResponseBodyV2(v *TopologyResponseBodyV2) *TopologyResponseBodyV2 { return v } + var _XdrTags_SurveyResponseBody = map[int32]bool{ XdrToI32(SURVEY_TOPOLOGY_RESPONSE_V0): true, XdrToI32(SURVEY_TOPOLOGY_RESPONSE_V1): true, + XdrToI32(SURVEY_TOPOLOGY_RESPONSE_V2): true, } func (_ SurveyResponseBody) XdrValidTags() map[int32]bool { @@ -13815,9 +14206,24 @@ func (u *SurveyResponseBody) TopologyResponseBodyV1() *TopologyResponseBodyV1 { return nil } } +func (u *SurveyResponseBody) TopologyResponseBodyV2() *TopologyResponseBodyV2 { + switch u.Type { + case SURVEY_TOPOLOGY_RESPONSE_V2: + if v, ok := u._u.(*TopologyResponseBodyV2); ok { + return v + } else { + var zero TopologyResponseBodyV2 + u._u = &zero + return &zero + } + default: + XdrPanic("SurveyResponseBody.TopologyResponseBodyV2 accessed when Type == %v", u.Type) + return nil + } +} func (u SurveyResponseBody) XdrValid() bool { switch u.Type { - case SURVEY_TOPOLOGY_RESPONSE_V0, SURVEY_TOPOLOGY_RESPONSE_V1: + case SURVEY_TOPOLOGY_RESPONSE_V0, SURVEY_TOPOLOGY_RESPONSE_V1, SURVEY_TOPOLOGY_RESPONSE_V2: return true } return false @@ -13834,6 +14240,8 @@ func (u *SurveyResponseBody) XdrUnionBody() XdrType { return XDR_TopologyResponseBodyV0(u.TopologyResponseBodyV0()) case SURVEY_TOPOLOGY_RESPONSE_V1: return XDR_TopologyResponseBodyV1(u.TopologyResponseBodyV1()) + case SURVEY_TOPOLOGY_RESPONSE_V2: + return XDR_TopologyResponseBodyV2(u.TopologyResponseBodyV2()) } return nil } @@ -13843,6 +14251,8 @@ func (u *SurveyResponseBody) XdrUnionBodyName() string { return "TopologyResponseBodyV0" case SURVEY_TOPOLOGY_RESPONSE_V1: return "TopologyResponseBodyV1" + case SURVEY_TOPOLOGY_RESPONSE_V2: + return "TopologyResponseBodyV2" } return "" } @@ -13865,6 +14275,9 @@ func (u *SurveyResponseBody) XdrRecurse(x XDR, name string) { case SURVEY_TOPOLOGY_RESPONSE_V1: x.Marshal(x.Sprintf("%stopologyResponseBodyV1", name), XDR_TopologyResponseBodyV1(u.TopologyResponseBodyV1())) return + case SURVEY_TOPOLOGY_RESPONSE_V2: + x.Marshal(x.Sprintf("%stopologyResponseBodyV2", name), XDR_TopologyResponseBodyV2(u.TopologyResponseBodyV2())) + return } XdrPanic("invalid Type (%v) in SurveyResponseBody", u.Type) } @@ -14033,26 +14446,30 @@ func (v _XdrVec_100_PeerAddress) XdrValue() interface{} { return ([]Pee func (v *_XdrVec_100_PeerAddress) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } var _XdrTags_StellarMessage = map[int32]bool{ - XdrToI32(ERROR_MSG): true, - XdrToI32(HELLO): true, - XdrToI32(AUTH): true, - XdrToI32(DONT_HAVE): true, - XdrToI32(GET_PEERS): true, - XdrToI32(PEERS): true, - XdrToI32(GET_TX_SET): true, - XdrToI32(TX_SET): true, - XdrToI32(GENERALIZED_TX_SET): true, - XdrToI32(TRANSACTION): true, - XdrToI32(SURVEY_REQUEST): true, - XdrToI32(SURVEY_RESPONSE): true, - XdrToI32(GET_SCP_QUORUMSET): true, - XdrToI32(SCP_QUORUMSET): true, - XdrToI32(SCP_MESSAGE): true, - XdrToI32(GET_SCP_STATE): true, - XdrToI32(SEND_MORE): true, - XdrToI32(SEND_MORE_EXTENDED): true, - XdrToI32(FLOOD_ADVERT): true, - XdrToI32(FLOOD_DEMAND): true, + XdrToI32(ERROR_MSG): true, + XdrToI32(HELLO): true, + XdrToI32(AUTH): true, + XdrToI32(DONT_HAVE): true, + XdrToI32(GET_PEERS): true, + XdrToI32(PEERS): true, + XdrToI32(GET_TX_SET): true, + XdrToI32(TX_SET): true, + XdrToI32(GENERALIZED_TX_SET): true, + XdrToI32(TRANSACTION): true, + XdrToI32(SURVEY_REQUEST): true, + XdrToI32(SURVEY_RESPONSE): true, + XdrToI32(TIME_SLICED_SURVEY_REQUEST): true, + XdrToI32(TIME_SLICED_SURVEY_RESPONSE): true, + XdrToI32(TIME_SLICED_SURVEY_START_COLLECTING): true, + XdrToI32(TIME_SLICED_SURVEY_STOP_COLLECTING): true, + XdrToI32(GET_SCP_QUORUMSET): true, + XdrToI32(SCP_QUORUMSET): true, + XdrToI32(SCP_MESSAGE): true, + XdrToI32(GET_SCP_STATE): true, + XdrToI32(SEND_MORE): true, + XdrToI32(SEND_MORE_EXTENDED): true, + XdrToI32(FLOOD_ADVERT): true, + XdrToI32(FLOOD_DEMAND): true, } func (_ StellarMessage) XdrValidTags() map[int32]bool { @@ -14223,6 +14640,66 @@ func (u *StellarMessage) SignedSurveyResponseMessage() *SignedSurveyResponseMess return nil } } +func (u *StellarMessage) SignedTimeSlicedSurveyRequestMessage() *SignedTimeSlicedSurveyRequestMessage { + switch u.Type { + case TIME_SLICED_SURVEY_REQUEST: + if v, ok := u._u.(*SignedTimeSlicedSurveyRequestMessage); ok { + return v + } else { + var zero SignedTimeSlicedSurveyRequestMessage + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.SignedTimeSlicedSurveyRequestMessage accessed when Type == %v", u.Type) + return nil + } +} +func (u *StellarMessage) SignedTimeSlicedSurveyResponseMessage() *SignedTimeSlicedSurveyResponseMessage { + switch u.Type { + case TIME_SLICED_SURVEY_RESPONSE: + if v, ok := u._u.(*SignedTimeSlicedSurveyResponseMessage); ok { + return v + } else { + var zero SignedTimeSlicedSurveyResponseMessage + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.SignedTimeSlicedSurveyResponseMessage accessed when Type == %v", u.Type) + return nil + } +} +func (u *StellarMessage) SignedTimeSlicedSurveyStartCollectingMessage() *SignedTimeSlicedSurveyStartCollectingMessage { + switch u.Type { + case TIME_SLICED_SURVEY_START_COLLECTING: + if v, ok := u._u.(*SignedTimeSlicedSurveyStartCollectingMessage); ok { + return v + } else { + var zero SignedTimeSlicedSurveyStartCollectingMessage + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.SignedTimeSlicedSurveyStartCollectingMessage accessed when Type == %v", u.Type) + return nil + } +} +func (u *StellarMessage) SignedTimeSlicedSurveyStopCollectingMessage() *SignedTimeSlicedSurveyStopCollectingMessage { + switch u.Type { + case TIME_SLICED_SURVEY_STOP_COLLECTING: + if v, ok := u._u.(*SignedTimeSlicedSurveyStopCollectingMessage); ok { + return v + } else { + var zero SignedTimeSlicedSurveyStopCollectingMessage + u._u = &zero + return &zero + } + default: + XdrPanic("StellarMessage.SignedTimeSlicedSurveyStopCollectingMessage accessed when Type == %v", u.Type) + return nil + } +} func (u *StellarMessage) QSetHash() *Uint256 { switch u.Type { case GET_SCP_QUORUMSET: @@ -14347,7 +14824,7 @@ func (u *StellarMessage) FloodDemand() *FloodDemand { } func (u StellarMessage) XdrValid() bool { switch u.Type { - case ERROR_MSG, HELLO, AUTH, DONT_HAVE, GET_PEERS, PEERS, GET_TX_SET, TX_SET, GENERALIZED_TX_SET, TRANSACTION, SURVEY_REQUEST, SURVEY_RESPONSE, GET_SCP_QUORUMSET, SCP_QUORUMSET, SCP_MESSAGE, GET_SCP_STATE, SEND_MORE, SEND_MORE_EXTENDED, FLOOD_ADVERT, FLOOD_DEMAND: + case ERROR_MSG, HELLO, AUTH, DONT_HAVE, GET_PEERS, PEERS, GET_TX_SET, TX_SET, GENERALIZED_TX_SET, TRANSACTION, SURVEY_REQUEST, SURVEY_RESPONSE, TIME_SLICED_SURVEY_REQUEST, TIME_SLICED_SURVEY_RESPONSE, TIME_SLICED_SURVEY_START_COLLECTING, TIME_SLICED_SURVEY_STOP_COLLECTING, GET_SCP_QUORUMSET, SCP_QUORUMSET, SCP_MESSAGE, GET_SCP_STATE, SEND_MORE, SEND_MORE_EXTENDED, FLOOD_ADVERT, FLOOD_DEMAND: return true } return false @@ -14384,6 +14861,14 @@ func (u *StellarMessage) XdrUnionBody() XdrType { return XDR_SignedSurveyRequestMessage(u.SignedSurveyRequestMessage()) case SURVEY_RESPONSE: return XDR_SignedSurveyResponseMessage(u.SignedSurveyResponseMessage()) + case TIME_SLICED_SURVEY_REQUEST: + return XDR_SignedTimeSlicedSurveyRequestMessage(u.SignedTimeSlicedSurveyRequestMessage()) + case TIME_SLICED_SURVEY_RESPONSE: + return XDR_SignedTimeSlicedSurveyResponseMessage(u.SignedTimeSlicedSurveyResponseMessage()) + case TIME_SLICED_SURVEY_START_COLLECTING: + return XDR_SignedTimeSlicedSurveyStartCollectingMessage(u.SignedTimeSlicedSurveyStartCollectingMessage()) + case TIME_SLICED_SURVEY_STOP_COLLECTING: + return XDR_SignedTimeSlicedSurveyStopCollectingMessage(u.SignedTimeSlicedSurveyStopCollectingMessage()) case GET_SCP_QUORUMSET: return XDR_Uint256(u.QSetHash()) case SCP_QUORUMSET: @@ -14429,6 +14914,14 @@ func (u *StellarMessage) XdrUnionBodyName() string { return "SignedSurveyRequestMessage" case SURVEY_RESPONSE: return "SignedSurveyResponseMessage" + case TIME_SLICED_SURVEY_REQUEST: + return "SignedTimeSlicedSurveyRequestMessage" + case TIME_SLICED_SURVEY_RESPONSE: + return "SignedTimeSlicedSurveyResponseMessage" + case TIME_SLICED_SURVEY_START_COLLECTING: + return "SignedTimeSlicedSurveyStartCollectingMessage" + case TIME_SLICED_SURVEY_STOP_COLLECTING: + return "SignedTimeSlicedSurveyStopCollectingMessage" case GET_SCP_QUORUMSET: return "QSetHash" case SCP_QUORUMSET: @@ -14496,6 +14989,18 @@ func (u *StellarMessage) XdrRecurse(x XDR, name string) { case SURVEY_RESPONSE: x.Marshal(x.Sprintf("%ssignedSurveyResponseMessage", name), XDR_SignedSurveyResponseMessage(u.SignedSurveyResponseMessage())) return + case TIME_SLICED_SURVEY_REQUEST: + x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyRequestMessage", name), XDR_SignedTimeSlicedSurveyRequestMessage(u.SignedTimeSlicedSurveyRequestMessage())) + return + case TIME_SLICED_SURVEY_RESPONSE: + x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyResponseMessage", name), XDR_SignedTimeSlicedSurveyResponseMessage(u.SignedTimeSlicedSurveyResponseMessage())) + return + case TIME_SLICED_SURVEY_START_COLLECTING: + x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyStartCollectingMessage", name), XDR_SignedTimeSlicedSurveyStartCollectingMessage(u.SignedTimeSlicedSurveyStartCollectingMessage())) + return + case TIME_SLICED_SURVEY_STOP_COLLECTING: + x.Marshal(x.Sprintf("%ssignedTimeSlicedSurveyStopCollectingMessage", name), XDR_SignedTimeSlicedSurveyStopCollectingMessage(u.SignedTimeSlicedSurveyStopCollectingMessage())) + return case GET_SCP_QUORUMSET: x.Marshal(x.Sprintf("%sqSetHash", name), XDR_Uint256(u.QSetHash())) return diff --git a/xdr/Stellar-ledger.x b/xdr/Stellar-ledger.x index dd58ae8d9e..d19462aa18 100644 --- a/xdr/Stellar-ledger.x +++ b/xdr/Stellar-ledger.x @@ -400,6 +400,8 @@ struct DiagnosticEvent ContractEvent event; }; +typedef DiagnosticEvent DiagnosticEvents<>; + struct SorobanTransactionMetaExtV1 { ExtensionPoint ext; diff --git a/xdr/Stellar-overlay.x b/xdr/Stellar-overlay.x index 4c964736dc..b398f883d2 100644 --- a/xdr/Stellar-overlay.x +++ b/xdr/Stellar-overlay.x @@ -119,7 +119,12 @@ enum MessageType SEND_MORE_EXTENDED = 20, FLOOD_ADVERT = 18, - FLOOD_DEMAND = 19 + FLOOD_DEMAND = 19, + + TIME_SLICED_SURVEY_REQUEST = 21, + TIME_SLICED_SURVEY_RESPONSE = 22, + TIME_SLICED_SURVEY_START_COLLECTING = 23, + TIME_SLICED_SURVEY_STOP_COLLECTING = 24 }; struct DontHave @@ -130,13 +135,41 @@ struct DontHave enum SurveyMessageCommandType { - SURVEY_TOPOLOGY = 0 + SURVEY_TOPOLOGY = 0, + TIME_SLICED_SURVEY_TOPOLOGY = 1 }; enum SurveyMessageResponseType { SURVEY_TOPOLOGY_RESPONSE_V0 = 0, - SURVEY_TOPOLOGY_RESPONSE_V1 = 1 + SURVEY_TOPOLOGY_RESPONSE_V1 = 1, + SURVEY_TOPOLOGY_RESPONSE_V2 = 2 +}; + +struct TimeSlicedSurveyStartCollectingMessage +{ + NodeID surveyorID; + uint32 nonce; + uint32 ledgerNum; +}; + +struct SignedTimeSlicedSurveyStartCollectingMessage +{ + Signature signature; + TimeSlicedSurveyStartCollectingMessage startCollecting; +}; + +struct TimeSlicedSurveyStopCollectingMessage +{ + NodeID surveyorID; + uint32 nonce; + uint32 ledgerNum; +}; + +struct SignedTimeSlicedSurveyStopCollectingMessage +{ + Signature signature; + TimeSlicedSurveyStopCollectingMessage stopCollecting; }; struct SurveyRequestMessage @@ -148,12 +181,26 @@ struct SurveyRequestMessage SurveyMessageCommandType commandType; }; +struct TimeSlicedSurveyRequestMessage +{ + SurveyRequestMessage request; + uint32 nonce; + uint32 inboundPeersIndex; + uint32 outboundPeersIndex; +}; + struct SignedSurveyRequestMessage { Signature requestSignature; SurveyRequestMessage request; }; +struct SignedTimeSlicedSurveyRequestMessage +{ + Signature requestSignature; + TimeSlicedSurveyRequestMessage request; +}; + typedef opaque EncryptedBody<64000>; struct SurveyResponseMessage { @@ -164,12 +211,24 @@ struct SurveyResponseMessage EncryptedBody encryptedBody; }; +struct TimeSlicedSurveyResponseMessage +{ + SurveyResponseMessage response; + uint32 nonce; +}; + struct SignedSurveyResponseMessage { Signature responseSignature; SurveyResponseMessage response; }; +struct SignedTimeSlicedSurveyResponseMessage +{ + Signature responseSignature; + TimeSlicedSurveyResponseMessage response; +}; + struct PeerStats { NodeID id; @@ -193,6 +252,34 @@ struct PeerStats typedef PeerStats PeerStatList<25>; +struct TimeSlicedNodeData +{ + uint32 addedAuthenticatedPeers; + uint32 droppedAuthenticatedPeers; + uint32 totalInboundPeerCount; + uint32 totalOutboundPeerCount; + + // SCP stats + uint32 p75SCPFirstToSelfLatencyMs; + uint32 p75SCPSelfToOtherLatencyMs; + + // How many times the node lost sync in the time slice + uint32 lostSyncCount; + + // Config data + bool isValidator; + uint32 maxInboundPeerCount; + uint32 maxOutboundPeerCount; +}; + +struct TimeSlicedPeerData +{ + PeerStats peerStats; + uint32 averageLatencyMs; +}; + +typedef TimeSlicedPeerData TimeSlicedPeerDataList<25>; + struct TopologyResponseBodyV0 { PeerStatList inboundPeers; @@ -214,12 +301,21 @@ struct TopologyResponseBodyV1 uint32 maxOutboundPeerCount; }; +struct TopologyResponseBodyV2 +{ + TimeSlicedPeerDataList inboundPeers; + TimeSlicedPeerDataList outboundPeers; + TimeSlicedNodeData nodeData; +}; + union SurveyResponseBody switch (SurveyMessageResponseType type) { case SURVEY_TOPOLOGY_RESPONSE_V0: TopologyResponseBodyV0 topologyResponseBodyV0; case SURVEY_TOPOLOGY_RESPONSE_V1: TopologyResponseBodyV1 topologyResponseBodyV1; +case SURVEY_TOPOLOGY_RESPONSE_V2: + TopologyResponseBodyV2 topologyResponseBodyV2; }; const TX_ADVERT_VECTOR_MAX_SIZE = 1000; @@ -269,6 +365,20 @@ case SURVEY_REQUEST: case SURVEY_RESPONSE: SignedSurveyResponseMessage signedSurveyResponseMessage; +case TIME_SLICED_SURVEY_REQUEST: + SignedTimeSlicedSurveyRequestMessage signedTimeSlicedSurveyRequestMessage; + +case TIME_SLICED_SURVEY_RESPONSE: + SignedTimeSlicedSurveyResponseMessage signedTimeSlicedSurveyResponseMessage; + +case TIME_SLICED_SURVEY_START_COLLECTING: + SignedTimeSlicedSurveyStartCollectingMessage + signedTimeSlicedSurveyStartCollectingMessage; + +case TIME_SLICED_SURVEY_STOP_COLLECTING: + SignedTimeSlicedSurveyStopCollectingMessage + signedTimeSlicedSurveyStopCollectingMessage; + // SCP case GET_SCP_QUORUMSET: uint256 qSetHash; diff --git a/xdr/xdr_commit_generated.txt b/xdr/xdr_commit_generated.txt index 52f66572f6..793097adeb 100644 --- a/xdr/xdr_commit_generated.txt +++ b/xdr/xdr_commit_generated.txt @@ -1 +1 @@ -1a04392432dacc0092caaeae22a600ea1af3c6a5 \ No newline at end of file +70180d5e8d9caee9e8645ed8a38c36a8cf403cd9 \ No newline at end of file diff --git a/xdr/xdr_generated.go b/xdr/xdr_generated.go index b336714562..c47ab760c9 100644 --- a/xdr/xdr_generated.go +++ b/xdr/xdr_generated.go @@ -42,9 +42,9 @@ var XdrFilesSHA256 = map[string]string{ "xdr/Stellar-exporter.x": "a00c83d02e8c8382e06f79a191f1fb5abd097a4bbcab8481c67467e3270e0529", "xdr/Stellar-internal.x": "227835866c1b2122d1eaf28839ba85ea7289d1cb681dda4ca619c2da3d71fe00", "xdr/Stellar-ledger-entries.x": "77dc7062ae6d0812136333e12e35b2294d7c2896a536be9c811eb0ed2abbbccb", - "xdr/Stellar-ledger.x": "888152fb940b79a01ac00a5218ca91360cb0f01af7acc030d5805ebfec280203", + "xdr/Stellar-ledger.x": "46c1c55972750b97650ff00788a2be4764975b787ef51c8fa931c56e2028a3c4", "xdr/Stellar-lighthorizon.x": "1aac09eaeda224154f653a0c95f02167be0c110fc295bb41b756a080eb8c06df", - "xdr/Stellar-overlay.x": "de3957c58b96ae07968b3d3aebea84f83603e95322d1fa336360e13e3aba737a", + "xdr/Stellar-overlay.x": "8c73b7c3ad974e7fc4aa4fdf34f7ad50053406254efbd7406c96657cf41691d3", "xdr/Stellar-transaction.x": "0d2b35a331a540b48643925d0869857236eb2487c02d340ea32e365e784ea2b8", "xdr/Stellar-types.x": "6e3b13f0d3e360b09fa5e2b0e55d43f4d974a769df66afb34e8aecbb329d3f15", } @@ -16754,6 +16754,86 @@ func (s DiagnosticEvent) xdrType() {} var _ xdrType = (*DiagnosticEvent)(nil) +// DiagnosticEvents is an XDR Typedef defines as: +// +// typedef DiagnosticEvent DiagnosticEvents<>; +type DiagnosticEvents []DiagnosticEvent + +// EncodeTo encodes this value using the Encoder. +func (s DiagnosticEvents) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeUint(uint32(len(s))); err != nil { + return err + } + for i := 0; i < len(s); i++ { + if err = s[i].EncodeTo(e); err != nil { + return err + } + } + return nil +} + +var _ decoderFrom = (*DiagnosticEvents)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *DiagnosticEvents) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding DiagnosticEvents: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + var l uint32 + l, nTmp, err = d.DecodeUint() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding DiagnosticEvent: %w", err) + } + (*s) = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding DiagnosticEvent: length (%d) exceeds remaining input length (%d)", l, il) + } + (*s) = make([]DiagnosticEvent, l) + for i := uint32(0); i < l; i++ { + nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding DiagnosticEvent: %w", err) + } + } + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s DiagnosticEvents) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *DiagnosticEvents) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*DiagnosticEvents)(nil) + _ encoding.BinaryUnmarshaler = (*DiagnosticEvents)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s DiagnosticEvents) xdrType() {} + +var _ xdrType = (*DiagnosticEvents)(nil) + // SorobanTransactionMetaExtV1 is an XDR Struct defines as: // // struct SorobanTransactionMetaExtV1 @@ -19739,31 +19819,40 @@ var _ xdrType = (*PeerAddress)(nil) // SEND_MORE_EXTENDED = 20, // // FLOOD_ADVERT = 18, -// FLOOD_DEMAND = 19 +// FLOOD_DEMAND = 19, +// +// TIME_SLICED_SURVEY_REQUEST = 21, +// TIME_SLICED_SURVEY_RESPONSE = 22, +// TIME_SLICED_SURVEY_START_COLLECTING = 23, +// TIME_SLICED_SURVEY_STOP_COLLECTING = 24 // }; type MessageType int32 const ( - MessageTypeErrorMsg MessageType = 0 - MessageTypeAuth MessageType = 2 - MessageTypeDontHave MessageType = 3 - MessageTypeGetPeers MessageType = 4 - MessageTypePeers MessageType = 5 - MessageTypeGetTxSet MessageType = 6 - MessageTypeTxSet MessageType = 7 - MessageTypeGeneralizedTxSet MessageType = 17 - MessageTypeTransaction MessageType = 8 - MessageTypeGetScpQuorumset MessageType = 9 - MessageTypeScpQuorumset MessageType = 10 - MessageTypeScpMessage MessageType = 11 - MessageTypeGetScpState MessageType = 12 - MessageTypeHello MessageType = 13 - MessageTypeSurveyRequest MessageType = 14 - MessageTypeSurveyResponse MessageType = 15 - MessageTypeSendMore MessageType = 16 - MessageTypeSendMoreExtended MessageType = 20 - MessageTypeFloodAdvert MessageType = 18 - MessageTypeFloodDemand MessageType = 19 + MessageTypeErrorMsg MessageType = 0 + MessageTypeAuth MessageType = 2 + MessageTypeDontHave MessageType = 3 + MessageTypeGetPeers MessageType = 4 + MessageTypePeers MessageType = 5 + MessageTypeGetTxSet MessageType = 6 + MessageTypeTxSet MessageType = 7 + MessageTypeGeneralizedTxSet MessageType = 17 + MessageTypeTransaction MessageType = 8 + MessageTypeGetScpQuorumset MessageType = 9 + MessageTypeScpQuorumset MessageType = 10 + MessageTypeScpMessage MessageType = 11 + MessageTypeGetScpState MessageType = 12 + MessageTypeHello MessageType = 13 + MessageTypeSurveyRequest MessageType = 14 + MessageTypeSurveyResponse MessageType = 15 + MessageTypeSendMore MessageType = 16 + MessageTypeSendMoreExtended MessageType = 20 + MessageTypeFloodAdvert MessageType = 18 + MessageTypeFloodDemand MessageType = 19 + MessageTypeTimeSlicedSurveyRequest MessageType = 21 + MessageTypeTimeSlicedSurveyResponse MessageType = 22 + MessageTypeTimeSlicedSurveyStartCollecting MessageType = 23 + MessageTypeTimeSlicedSurveyStopCollecting MessageType = 24 ) var messageTypeMap = map[int32]string{ @@ -19787,6 +19876,10 @@ var messageTypeMap = map[int32]string{ 20: "MessageTypeSendMoreExtended", 18: "MessageTypeFloodAdvert", 19: "MessageTypeFloodDemand", + 21: "MessageTypeTimeSlicedSurveyRequest", + 22: "MessageTypeTimeSlicedSurveyResponse", + 23: "MessageTypeTimeSlicedSurveyStartCollecting", + 24: "MessageTypeTimeSlicedSurveyStopCollecting", } // ValidEnum validates a proposed value for this enum. Implements @@ -19937,16 +20030,19 @@ var _ xdrType = (*DontHave)(nil) // // enum SurveyMessageCommandType // { -// SURVEY_TOPOLOGY = 0 +// SURVEY_TOPOLOGY = 0, +// TIME_SLICED_SURVEY_TOPOLOGY = 1 // }; type SurveyMessageCommandType int32 const ( - SurveyMessageCommandTypeSurveyTopology SurveyMessageCommandType = 0 + SurveyMessageCommandTypeSurveyTopology SurveyMessageCommandType = 0 + SurveyMessageCommandTypeTimeSlicedSurveyTopology SurveyMessageCommandType = 1 ) var surveyMessageCommandTypeMap = map[int32]string{ 0: "SurveyMessageCommandTypeSurveyTopology", + 1: "SurveyMessageCommandTypeTimeSlicedSurveyTopology", } // ValidEnum validates a proposed value for this enum. Implements @@ -20023,18 +20119,21 @@ var _ xdrType = (*SurveyMessageCommandType)(nil) // enum SurveyMessageResponseType // { // SURVEY_TOPOLOGY_RESPONSE_V0 = 0, -// SURVEY_TOPOLOGY_RESPONSE_V1 = 1 +// SURVEY_TOPOLOGY_RESPONSE_V1 = 1, +// SURVEY_TOPOLOGY_RESPONSE_V2 = 2 // }; type SurveyMessageResponseType int32 const ( SurveyMessageResponseTypeSurveyTopologyResponseV0 SurveyMessageResponseType = 0 SurveyMessageResponseTypeSurveyTopologyResponseV1 SurveyMessageResponseType = 1 + SurveyMessageResponseTypeSurveyTopologyResponseV2 SurveyMessageResponseType = 2 ) var surveyMessageResponseTypeMap = map[int32]string{ 0: "SurveyMessageResponseTypeSurveyTopologyResponseV0", 1: "SurveyMessageResponseTypeSurveyTopologyResponseV1", + 2: "SurveyMessageResponseTypeSurveyTopologyResponseV2", } // ValidEnum validates a proposed value for this enum. Implements @@ -20106,85 +20205,140 @@ func (s SurveyMessageResponseType) xdrType() {} var _ xdrType = (*SurveyMessageResponseType)(nil) -// SurveyRequestMessage is an XDR Struct defines as: +// TimeSlicedSurveyStartCollectingMessage is an XDR Struct defines as: // -// struct SurveyRequestMessage +// struct TimeSlicedSurveyStartCollectingMessage // { -// NodeID surveyorPeerID; -// NodeID surveyedPeerID; +// NodeID surveyorID; +// uint32 nonce; // uint32 ledgerNum; -// Curve25519Public encryptionKey; -// SurveyMessageCommandType commandType; // }; -type SurveyRequestMessage struct { - SurveyorPeerId NodeId - SurveyedPeerId NodeId - LedgerNum Uint32 - EncryptionKey Curve25519Public - CommandType SurveyMessageCommandType +type TimeSlicedSurveyStartCollectingMessage struct { + SurveyorId NodeId + Nonce Uint32 + LedgerNum Uint32 } // EncodeTo encodes this value using the Encoder. -func (s *SurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { +func (s *TimeSlicedSurveyStartCollectingMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.SurveyorPeerId.EncodeTo(e); err != nil { + if err = s.SurveyorId.EncodeTo(e); err != nil { return err } - if err = s.SurveyedPeerId.EncodeTo(e); err != nil { + if err = s.Nonce.EncodeTo(e); err != nil { return err } if err = s.LedgerNum.EncodeTo(e); err != nil { return err } - if err = s.EncryptionKey.EncodeTo(e); err != nil { - return err - } - if err = s.CommandType.EncodeTo(e); err != nil { - return err - } return nil } -var _ decoderFrom = (*SurveyRequestMessage)(nil) +var _ decoderFrom = (*TimeSlicedSurveyStartCollectingMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TimeSlicedSurveyStartCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SurveyRequestMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TimeSlicedSurveyStartCollectingMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.SurveyorPeerId.DecodeFrom(d, maxDepth) + nTmp, err = s.SurveyorId.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding NodeId: %w", err) } - nTmp, err = s.SurveyedPeerId.DecodeFrom(d, maxDepth) + nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding NodeId: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } nTmp, err = s.LedgerNum.DecodeFrom(d, maxDepth) n += nTmp if err != nil { return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.EncryptionKey.DecodeFrom(d, maxDepth) + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TimeSlicedSurveyStartCollectingMessage) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TimeSlicedSurveyStartCollectingMessage) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TimeSlicedSurveyStartCollectingMessage)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyStartCollectingMessage)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TimeSlicedSurveyStartCollectingMessage) xdrType() {} + +var _ xdrType = (*TimeSlicedSurveyStartCollectingMessage)(nil) + +// SignedTimeSlicedSurveyStartCollectingMessage is an XDR Struct defines as: +// +// struct SignedTimeSlicedSurveyStartCollectingMessage +// { +// Signature signature; +// TimeSlicedSurveyStartCollectingMessage startCollecting; +// }; +type SignedTimeSlicedSurveyStartCollectingMessage struct { + Signature Signature + StartCollecting TimeSlicedSurveyStartCollectingMessage +} + +// EncodeTo encodes this value using the Encoder. +func (s *SignedTimeSlicedSurveyStartCollectingMessage) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Signature.EncodeTo(e); err != nil { + return err + } + if err = s.StartCollecting.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *SignedTimeSlicedSurveyStartCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyStartCollectingMessage: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Signature.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Curve25519Public: %w", err) + return n, fmt.Errorf("decoding Signature: %w", err) } - nTmp, err = s.CommandType.DecodeFrom(d, maxDepth) + nTmp, err = s.StartCollecting.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding SurveyMessageCommandType: %w", err) + return n, fmt.Errorf("decoding TimeSlicedSurveyStartCollectingMessage: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SurveyRequestMessage) MarshalBinary() ([]byte, error) { +func (s SignedTimeSlicedSurveyStartCollectingMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20192,7 +20346,7 @@ func (s SurveyRequestMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SurveyRequestMessage) UnmarshalBinary(inp []byte) error { +func (s *SignedTimeSlicedSurveyStartCollectingMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20202,64 +20356,74 @@ func (s *SurveyRequestMessage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SurveyRequestMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SurveyRequestMessage)(nil) + _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SurveyRequestMessage) xdrType() {} +func (s SignedTimeSlicedSurveyStartCollectingMessage) xdrType() {} -var _ xdrType = (*SurveyRequestMessage)(nil) +var _ xdrType = (*SignedTimeSlicedSurveyStartCollectingMessage)(nil) -// SignedSurveyRequestMessage is an XDR Struct defines as: +// TimeSlicedSurveyStopCollectingMessage is an XDR Struct defines as: // -// struct SignedSurveyRequestMessage +// struct TimeSlicedSurveyStopCollectingMessage // { -// Signature requestSignature; -// SurveyRequestMessage request; +// NodeID surveyorID; +// uint32 nonce; +// uint32 ledgerNum; // }; -type SignedSurveyRequestMessage struct { - RequestSignature Signature - Request SurveyRequestMessage +type TimeSlicedSurveyStopCollectingMessage struct { + SurveyorId NodeId + Nonce Uint32 + LedgerNum Uint32 } // EncodeTo encodes this value using the Encoder. -func (s *SignedSurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { +func (s *TimeSlicedSurveyStopCollectingMessage) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.RequestSignature.EncodeTo(e); err != nil { + if err = s.SurveyorId.EncodeTo(e); err != nil { return err } - if err = s.Request.EncodeTo(e); err != nil { + if err = s.Nonce.EncodeTo(e); err != nil { + return err + } + if err = s.LedgerNum.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*SignedSurveyRequestMessage)(nil) +var _ decoderFrom = (*TimeSlicedSurveyStopCollectingMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SignedSurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TimeSlicedSurveyStopCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SignedSurveyRequestMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TimeSlicedSurveyStopCollectingMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.RequestSignature.DecodeFrom(d, maxDepth) + nTmp, err = s.SurveyorId.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Signature: %w", err) + return n, fmt.Errorf("decoding NodeId: %w", err) } - nTmp, err = s.Request.DecodeFrom(d, maxDepth) + nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding SurveyRequestMessage: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.LedgerNum.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SignedSurveyRequestMessage) MarshalBinary() ([]byte, error) { +func (s TimeSlicedSurveyStopCollectingMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20267,7 +20431,7 @@ func (s SignedSurveyRequestMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SignedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { +func (s *TimeSlicedSurveyStopCollectingMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20277,54 +20441,64 @@ func (s *SignedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SignedSurveyRequestMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SignedSurveyRequestMessage)(nil) + _ encoding.BinaryMarshaler = (*TimeSlicedSurveyStopCollectingMessage)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyStopCollectingMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SignedSurveyRequestMessage) xdrType() {} +func (s TimeSlicedSurveyStopCollectingMessage) xdrType() {} -var _ xdrType = (*SignedSurveyRequestMessage)(nil) +var _ xdrType = (*TimeSlicedSurveyStopCollectingMessage)(nil) -// EncryptedBody is an XDR Typedef defines as: +// SignedTimeSlicedSurveyStopCollectingMessage is an XDR Struct defines as: // -// typedef opaque EncryptedBody<64000>; -type EncryptedBody []byte - -// XDRMaxSize implements the Sized interface for EncryptedBody -func (e EncryptedBody) XDRMaxSize() int { - return 64000 +// struct SignedTimeSlicedSurveyStopCollectingMessage +// { +// Signature signature; +// TimeSlicedSurveyStopCollectingMessage stopCollecting; +// }; +type SignedTimeSlicedSurveyStopCollectingMessage struct { + Signature Signature + StopCollecting TimeSlicedSurveyStopCollectingMessage } // EncodeTo encodes this value using the Encoder. -func (s EncryptedBody) EncodeTo(e *xdr.Encoder) error { +func (s *SignedTimeSlicedSurveyStopCollectingMessage) EncodeTo(e *xdr.Encoder) error { var err error - if _, err = e.EncodeOpaque(s[:]); err != nil { + if err = s.Signature.EncodeTo(e); err != nil { + return err + } + if err = s.StopCollecting.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*EncryptedBody)(nil) +var _ decoderFrom = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *EncryptedBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SignedTimeSlicedSurveyStopCollectingMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding EncryptedBody: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyStopCollectingMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - (*s), nTmp, err = d.DecodeOpaque(64000) + nTmp, err = s.Signature.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding EncryptedBody: %w", err) + return n, fmt.Errorf("decoding Signature: %w", err) + } + nTmp, err = s.StopCollecting.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedSurveyStopCollectingMessage: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s EncryptedBody) MarshalBinary() ([]byte, error) { +func (s SignedTimeSlicedSurveyStopCollectingMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20332,7 +20506,7 @@ func (s EncryptedBody) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *EncryptedBody) UnmarshalBinary(inp []byte) error { +func (s *SignedTimeSlicedSurveyStopCollectingMessage) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20342,35 +20516,35 @@ func (s *EncryptedBody) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*EncryptedBody)(nil) - _ encoding.BinaryUnmarshaler = (*EncryptedBody)(nil) + _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s EncryptedBody) xdrType() {} +func (s SignedTimeSlicedSurveyStopCollectingMessage) xdrType() {} -var _ xdrType = (*EncryptedBody)(nil) +var _ xdrType = (*SignedTimeSlicedSurveyStopCollectingMessage)(nil) -// SurveyResponseMessage is an XDR Struct defines as: +// SurveyRequestMessage is an XDR Struct defines as: // -// struct SurveyResponseMessage +// struct SurveyRequestMessage // { // NodeID surveyorPeerID; // NodeID surveyedPeerID; // uint32 ledgerNum; +// Curve25519Public encryptionKey; // SurveyMessageCommandType commandType; -// EncryptedBody encryptedBody; // }; -type SurveyResponseMessage struct { +type SurveyRequestMessage struct { SurveyorPeerId NodeId SurveyedPeerId NodeId LedgerNum Uint32 + EncryptionKey Curve25519Public CommandType SurveyMessageCommandType - EncryptedBody EncryptedBody } // EncodeTo encodes this value using the Encoder. -func (s *SurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { +func (s *SurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { var err error if err = s.SurveyorPeerId.EncodeTo(e); err != nil { return err @@ -20381,21 +20555,21 @@ func (s *SurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { if err = s.LedgerNum.EncodeTo(e); err != nil { return err } - if err = s.CommandType.EncodeTo(e); err != nil { + if err = s.EncryptionKey.EncodeTo(e); err != nil { return err } - if err = s.EncryptedBody.EncodeTo(e); err != nil { + if err = s.CommandType.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*SurveyResponseMessage)(nil) +var _ decoderFrom = (*SurveyRequestMessage)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *SurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SurveyResponseMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding SurveyRequestMessage: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -20415,21 +20589,436 @@ func (s *SurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, if err != nil { return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.CommandType.DecodeFrom(d, maxDepth) + nTmp, err = s.EncryptionKey.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding SurveyMessageCommandType: %w", err) + return n, fmt.Errorf("decoding Curve25519Public: %w", err) } - nTmp, err = s.EncryptedBody.DecodeFrom(d, maxDepth) + nTmp, err = s.CommandType.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding EncryptedBody: %w", err) + return n, fmt.Errorf("decoding SurveyMessageCommandType: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SurveyResponseMessage) MarshalBinary() ([]byte, error) { +func (s SurveyRequestMessage) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *SurveyRequestMessage) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*SurveyRequestMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SurveyRequestMessage)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SurveyRequestMessage) xdrType() {} + +var _ xdrType = (*SurveyRequestMessage)(nil) + +// TimeSlicedSurveyRequestMessage is an XDR Struct defines as: +// +// struct TimeSlicedSurveyRequestMessage +// { +// SurveyRequestMessage request; +// uint32 nonce; +// uint32 inboundPeersIndex; +// uint32 outboundPeersIndex; +// }; +type TimeSlicedSurveyRequestMessage struct { + Request SurveyRequestMessage + Nonce Uint32 + InboundPeersIndex Uint32 + OutboundPeersIndex Uint32 +} + +// EncodeTo encodes this value using the Encoder. +func (s *TimeSlicedSurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Request.EncodeTo(e); err != nil { + return err + } + if err = s.Nonce.EncodeTo(e); err != nil { + return err + } + if err = s.InboundPeersIndex.EncodeTo(e); err != nil { + return err + } + if err = s.OutboundPeersIndex.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*TimeSlicedSurveyRequestMessage)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TimeSlicedSurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TimeSlicedSurveyRequestMessage: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Request.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SurveyRequestMessage: %w", err) + } + nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.InboundPeersIndex.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.OutboundPeersIndex.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TimeSlicedSurveyRequestMessage) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TimeSlicedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TimeSlicedSurveyRequestMessage)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyRequestMessage)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TimeSlicedSurveyRequestMessage) xdrType() {} + +var _ xdrType = (*TimeSlicedSurveyRequestMessage)(nil) + +// SignedSurveyRequestMessage is an XDR Struct defines as: +// +// struct SignedSurveyRequestMessage +// { +// Signature requestSignature; +// SurveyRequestMessage request; +// }; +type SignedSurveyRequestMessage struct { + RequestSignature Signature + Request SurveyRequestMessage +} + +// EncodeTo encodes this value using the Encoder. +func (s *SignedSurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.RequestSignature.EncodeTo(e); err != nil { + return err + } + if err = s.Request.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*SignedSurveyRequestMessage)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *SignedSurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding SignedSurveyRequestMessage: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.RequestSignature.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Signature: %w", err) + } + nTmp, err = s.Request.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SurveyRequestMessage: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s SignedSurveyRequestMessage) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *SignedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*SignedSurveyRequestMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedSurveyRequestMessage)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SignedSurveyRequestMessage) xdrType() {} + +var _ xdrType = (*SignedSurveyRequestMessage)(nil) + +// SignedTimeSlicedSurveyRequestMessage is an XDR Struct defines as: +// +// struct SignedTimeSlicedSurveyRequestMessage +// { +// Signature requestSignature; +// TimeSlicedSurveyRequestMessage request; +// }; +type SignedTimeSlicedSurveyRequestMessage struct { + RequestSignature Signature + Request TimeSlicedSurveyRequestMessage +} + +// EncodeTo encodes this value using the Encoder. +func (s *SignedTimeSlicedSurveyRequestMessage) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.RequestSignature.EncodeTo(e); err != nil { + return err + } + if err = s.Request.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*SignedTimeSlicedSurveyRequestMessage)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *SignedTimeSlicedSurveyRequestMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyRequestMessage: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.RequestSignature.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Signature: %w", err) + } + nTmp, err = s.Request.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedSurveyRequestMessage: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s SignedTimeSlicedSurveyRequestMessage) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *SignedTimeSlicedSurveyRequestMessage) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyRequestMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyRequestMessage)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SignedTimeSlicedSurveyRequestMessage) xdrType() {} + +var _ xdrType = (*SignedTimeSlicedSurveyRequestMessage)(nil) + +// EncryptedBody is an XDR Typedef defines as: +// +// typedef opaque EncryptedBody<64000>; +type EncryptedBody []byte + +// XDRMaxSize implements the Sized interface for EncryptedBody +func (e EncryptedBody) XDRMaxSize() int { + return 64000 +} + +// EncodeTo encodes this value using the Encoder. +func (s EncryptedBody) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeOpaque(s[:]); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*EncryptedBody)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *EncryptedBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding EncryptedBody: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + (*s), nTmp, err = d.DecodeOpaque(64000) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding EncryptedBody: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s EncryptedBody) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *EncryptedBody) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*EncryptedBody)(nil) + _ encoding.BinaryUnmarshaler = (*EncryptedBody)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s EncryptedBody) xdrType() {} + +var _ xdrType = (*EncryptedBody)(nil) + +// SurveyResponseMessage is an XDR Struct defines as: +// +// struct SurveyResponseMessage +// { +// NodeID surveyorPeerID; +// NodeID surveyedPeerID; +// uint32 ledgerNum; +// SurveyMessageCommandType commandType; +// EncryptedBody encryptedBody; +// }; +type SurveyResponseMessage struct { + SurveyorPeerId NodeId + SurveyedPeerId NodeId + LedgerNum Uint32 + CommandType SurveyMessageCommandType + EncryptedBody EncryptedBody +} + +// EncodeTo encodes this value using the Encoder. +func (s *SurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.SurveyorPeerId.EncodeTo(e); err != nil { + return err + } + if err = s.SurveyedPeerId.EncodeTo(e); err != nil { + return err + } + if err = s.LedgerNum.EncodeTo(e); err != nil { + return err + } + if err = s.CommandType.EncodeTo(e); err != nil { + return err + } + if err = s.EncryptedBody.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*SurveyResponseMessage)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *SurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding SurveyResponseMessage: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.SurveyorPeerId.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding NodeId: %w", err) + } + nTmp, err = s.SurveyedPeerId.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding NodeId: %w", err) + } + nTmp, err = s.LedgerNum.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.CommandType.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SurveyMessageCommandType: %w", err) + } + nTmp, err = s.EncryptedBody.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding EncryptedBody: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s SurveyResponseMessage) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20447,64 +21036,509 @@ func (s *SurveyResponseMessage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SurveyResponseMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SurveyResponseMessage)(nil) + _ encoding.BinaryMarshaler = (*SurveyResponseMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SurveyResponseMessage)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SurveyResponseMessage) xdrType() {} + +var _ xdrType = (*SurveyResponseMessage)(nil) + +// TimeSlicedSurveyResponseMessage is an XDR Struct defines as: +// +// struct TimeSlicedSurveyResponseMessage +// { +// SurveyResponseMessage response; +// uint32 nonce; +// }; +type TimeSlicedSurveyResponseMessage struct { + Response SurveyResponseMessage + Nonce Uint32 +} + +// EncodeTo encodes this value using the Encoder. +func (s *TimeSlicedSurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Response.EncodeTo(e); err != nil { + return err + } + if err = s.Nonce.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*TimeSlicedSurveyResponseMessage)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TimeSlicedSurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TimeSlicedSurveyResponseMessage: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Response.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SurveyResponseMessage: %w", err) + } + nTmp, err = s.Nonce.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TimeSlicedSurveyResponseMessage) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TimeSlicedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TimeSlicedSurveyResponseMessage)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedSurveyResponseMessage)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TimeSlicedSurveyResponseMessage) xdrType() {} + +var _ xdrType = (*TimeSlicedSurveyResponseMessage)(nil) + +// SignedSurveyResponseMessage is an XDR Struct defines as: +// +// struct SignedSurveyResponseMessage +// { +// Signature responseSignature; +// SurveyResponseMessage response; +// }; +type SignedSurveyResponseMessage struct { + ResponseSignature Signature + Response SurveyResponseMessage +} + +// EncodeTo encodes this value using the Encoder. +func (s *SignedSurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.ResponseSignature.EncodeTo(e); err != nil { + return err + } + if err = s.Response.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*SignedSurveyResponseMessage)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *SignedSurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding SignedSurveyResponseMessage: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.ResponseSignature.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Signature: %w", err) + } + nTmp, err = s.Response.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SurveyResponseMessage: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s SignedSurveyResponseMessage) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *SignedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*SignedSurveyResponseMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedSurveyResponseMessage)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SignedSurveyResponseMessage) xdrType() {} + +var _ xdrType = (*SignedSurveyResponseMessage)(nil) + +// SignedTimeSlicedSurveyResponseMessage is an XDR Struct defines as: +// +// struct SignedTimeSlicedSurveyResponseMessage +// { +// Signature responseSignature; +// TimeSlicedSurveyResponseMessage response; +// }; +type SignedTimeSlicedSurveyResponseMessage struct { + ResponseSignature Signature + Response TimeSlicedSurveyResponseMessage +} + +// EncodeTo encodes this value using the Encoder. +func (s *SignedTimeSlicedSurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.ResponseSignature.EncodeTo(e); err != nil { + return err + } + if err = s.Response.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*SignedTimeSlicedSurveyResponseMessage)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *SignedTimeSlicedSurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding SignedTimeSlicedSurveyResponseMessage: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.ResponseSignature.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Signature: %w", err) + } + nTmp, err = s.Response.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedSurveyResponseMessage: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s SignedTimeSlicedSurveyResponseMessage) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *SignedTimeSlicedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*SignedTimeSlicedSurveyResponseMessage)(nil) + _ encoding.BinaryUnmarshaler = (*SignedTimeSlicedSurveyResponseMessage)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SignedTimeSlicedSurveyResponseMessage) xdrType() {} + +var _ xdrType = (*SignedTimeSlicedSurveyResponseMessage)(nil) + +// PeerStats is an XDR Struct defines as: +// +// struct PeerStats +// { +// NodeID id; +// string versionStr<100>; +// uint64 messagesRead; +// uint64 messagesWritten; +// uint64 bytesRead; +// uint64 bytesWritten; +// uint64 secondsConnected; +// +// uint64 uniqueFloodBytesRecv; +// uint64 duplicateFloodBytesRecv; +// uint64 uniqueFetchBytesRecv; +// uint64 duplicateFetchBytesRecv; +// +// uint64 uniqueFloodMessageRecv; +// uint64 duplicateFloodMessageRecv; +// uint64 uniqueFetchMessageRecv; +// uint64 duplicateFetchMessageRecv; +// }; +type PeerStats struct { + Id NodeId + VersionStr string `xdrmaxsize:"100"` + MessagesRead Uint64 + MessagesWritten Uint64 + BytesRead Uint64 + BytesWritten Uint64 + SecondsConnected Uint64 + UniqueFloodBytesRecv Uint64 + DuplicateFloodBytesRecv Uint64 + UniqueFetchBytesRecv Uint64 + DuplicateFetchBytesRecv Uint64 + UniqueFloodMessageRecv Uint64 + DuplicateFloodMessageRecv Uint64 + UniqueFetchMessageRecv Uint64 + DuplicateFetchMessageRecv Uint64 +} + +// EncodeTo encodes this value using the Encoder. +func (s *PeerStats) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Id.EncodeTo(e); err != nil { + return err + } + if _, err = e.EncodeString(string(s.VersionStr)); err != nil { + return err + } + if err = s.MessagesRead.EncodeTo(e); err != nil { + return err + } + if err = s.MessagesWritten.EncodeTo(e); err != nil { + return err + } + if err = s.BytesRead.EncodeTo(e); err != nil { + return err + } + if err = s.BytesWritten.EncodeTo(e); err != nil { + return err + } + if err = s.SecondsConnected.EncodeTo(e); err != nil { + return err + } + if err = s.UniqueFloodBytesRecv.EncodeTo(e); err != nil { + return err + } + if err = s.DuplicateFloodBytesRecv.EncodeTo(e); err != nil { + return err + } + if err = s.UniqueFetchBytesRecv.EncodeTo(e); err != nil { + return err + } + if err = s.DuplicateFetchBytesRecv.EncodeTo(e); err != nil { + return err + } + if err = s.UniqueFloodMessageRecv.EncodeTo(e); err != nil { + return err + } + if err = s.DuplicateFloodMessageRecv.EncodeTo(e); err != nil { + return err + } + if err = s.UniqueFetchMessageRecv.EncodeTo(e); err != nil { + return err + } + if err = s.DuplicateFetchMessageRecv.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*PeerStats)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *PeerStats) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding PeerStats: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Id.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding NodeId: %w", err) + } + s.VersionStr, nTmp, err = d.DecodeString(100) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding VersionStr: %w", err) + } + nTmp, err = s.MessagesRead.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.MessagesWritten.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.BytesRead.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.BytesWritten.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.SecondsConnected.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.UniqueFloodBytesRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.DuplicateFloodBytesRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.UniqueFetchBytesRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.DuplicateFetchBytesRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.UniqueFloodMessageRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.DuplicateFloodMessageRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.UniqueFetchMessageRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + nTmp, err = s.DuplicateFetchMessageRecv.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint64: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s PeerStats) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *PeerStats) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*PeerStats)(nil) + _ encoding.BinaryUnmarshaler = (*PeerStats)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SurveyResponseMessage) xdrType() {} +func (s PeerStats) xdrType() {} -var _ xdrType = (*SurveyResponseMessage)(nil) +var _ xdrType = (*PeerStats)(nil) -// SignedSurveyResponseMessage is an XDR Struct defines as: +// PeerStatList is an XDR Typedef defines as: // -// struct SignedSurveyResponseMessage -// { -// Signature responseSignature; -// SurveyResponseMessage response; -// }; -type SignedSurveyResponseMessage struct { - ResponseSignature Signature - Response SurveyResponseMessage +// typedef PeerStats PeerStatList<25>; +type PeerStatList []PeerStats + +// XDRMaxSize implements the Sized interface for PeerStatList +func (e PeerStatList) XDRMaxSize() int { + return 25 } // EncodeTo encodes this value using the Encoder. -func (s *SignedSurveyResponseMessage) EncodeTo(e *xdr.Encoder) error { +func (s PeerStatList) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.ResponseSignature.EncodeTo(e); err != nil { + if _, err = e.EncodeUint(uint32(len(s))); err != nil { return err } - if err = s.Response.EncodeTo(e); err != nil { - return err + for i := 0; i < len(s); i++ { + if err = s[i].EncodeTo(e); err != nil { + return err + } } return nil } -var _ decoderFrom = (*SignedSurveyResponseMessage)(nil) +var _ decoderFrom = (*PeerStatList)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *SignedSurveyResponseMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *PeerStatList) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding SignedSurveyResponseMessage: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding PeerStatList: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.ResponseSignature.DecodeFrom(d, maxDepth) + var l uint32 + l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding Signature: %w", err) + return n, fmt.Errorf("decoding PeerStats: %w", err) } - nTmp, err = s.Response.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding SurveyResponseMessage: %w", err) + if l > 25 { + return n, fmt.Errorf("decoding PeerStats: data size (%d) exceeds size limit (25)", l) + } + (*s) = nil + if l > 0 { + if il, ok := d.InputLen(); ok && uint(il) < uint(l) { + return n, fmt.Errorf("decoding PeerStats: length (%d) exceeds remaining input length (%d)", l, il) + } + (*s) = make([]PeerStats, l) + for i := uint32(0); i < l; i++ { + nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding PeerStats: %w", err) + } + } } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s SignedSurveyResponseMessage) MarshalBinary() ([]byte, error) { +func (s PeerStatList) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20512,7 +21546,7 @@ func (s SignedSurveyResponseMessage) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *SignedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { +func (s *PeerStatList) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20522,196 +21556,225 @@ func (s *SignedSurveyResponseMessage) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*SignedSurveyResponseMessage)(nil) - _ encoding.BinaryUnmarshaler = (*SignedSurveyResponseMessage)(nil) + _ encoding.BinaryMarshaler = (*PeerStatList)(nil) + _ encoding.BinaryUnmarshaler = (*PeerStatList)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s SignedSurveyResponseMessage) xdrType() {} +func (s PeerStatList) xdrType() {} -var _ xdrType = (*SignedSurveyResponseMessage)(nil) +var _ xdrType = (*PeerStatList)(nil) -// PeerStats is an XDR Struct defines as: +// TimeSlicedNodeData is an XDR Struct defines as: // -// struct PeerStats +// struct TimeSlicedNodeData // { -// NodeID id; -// string versionStr<100>; -// uint64 messagesRead; -// uint64 messagesWritten; -// uint64 bytesRead; -// uint64 bytesWritten; -// uint64 secondsConnected; +// uint32 addedAuthenticatedPeers; +// uint32 droppedAuthenticatedPeers; +// uint32 totalInboundPeerCount; +// uint32 totalOutboundPeerCount; // -// uint64 uniqueFloodBytesRecv; -// uint64 duplicateFloodBytesRecv; -// uint64 uniqueFetchBytesRecv; -// uint64 duplicateFetchBytesRecv; +// // SCP stats +// uint32 p75SCPFirstToSelfLatencyMs; +// uint32 p75SCPSelfToOtherLatencyMs; // -// uint64 uniqueFloodMessageRecv; -// uint64 duplicateFloodMessageRecv; -// uint64 uniqueFetchMessageRecv; -// uint64 duplicateFetchMessageRecv; +// // How many times the node lost sync in the time slice +// uint32 lostSyncCount; +// +// // Config data +// bool isValidator; +// uint32 maxInboundPeerCount; +// uint32 maxOutboundPeerCount; // }; -type PeerStats struct { - Id NodeId - VersionStr string `xdrmaxsize:"100"` - MessagesRead Uint64 - MessagesWritten Uint64 - BytesRead Uint64 - BytesWritten Uint64 - SecondsConnected Uint64 - UniqueFloodBytesRecv Uint64 - DuplicateFloodBytesRecv Uint64 - UniqueFetchBytesRecv Uint64 - DuplicateFetchBytesRecv Uint64 - UniqueFloodMessageRecv Uint64 - DuplicateFloodMessageRecv Uint64 - UniqueFetchMessageRecv Uint64 - DuplicateFetchMessageRecv Uint64 +type TimeSlicedNodeData struct { + AddedAuthenticatedPeers Uint32 + DroppedAuthenticatedPeers Uint32 + TotalInboundPeerCount Uint32 + TotalOutboundPeerCount Uint32 + P75ScpFirstToSelfLatencyMs Uint32 + P75ScpSelfToOtherLatencyMs Uint32 + LostSyncCount Uint32 + IsValidator bool + MaxInboundPeerCount Uint32 + MaxOutboundPeerCount Uint32 } // EncodeTo encodes this value using the Encoder. -func (s *PeerStats) EncodeTo(e *xdr.Encoder) error { +func (s *TimeSlicedNodeData) EncodeTo(e *xdr.Encoder) error { var err error - if err = s.Id.EncodeTo(e); err != nil { + if err = s.AddedAuthenticatedPeers.EncodeTo(e); err != nil { return err } - if _, err = e.EncodeString(string(s.VersionStr)); err != nil { - return err - } - if err = s.MessagesRead.EncodeTo(e); err != nil { - return err - } - if err = s.MessagesWritten.EncodeTo(e); err != nil { - return err - } - if err = s.BytesRead.EncodeTo(e); err != nil { - return err - } - if err = s.BytesWritten.EncodeTo(e); err != nil { - return err - } - if err = s.SecondsConnected.EncodeTo(e); err != nil { + if err = s.DroppedAuthenticatedPeers.EncodeTo(e); err != nil { return err } - if err = s.UniqueFloodBytesRecv.EncodeTo(e); err != nil { + if err = s.TotalInboundPeerCount.EncodeTo(e); err != nil { return err } - if err = s.DuplicateFloodBytesRecv.EncodeTo(e); err != nil { + if err = s.TotalOutboundPeerCount.EncodeTo(e); err != nil { return err } - if err = s.UniqueFetchBytesRecv.EncodeTo(e); err != nil { + if err = s.P75ScpFirstToSelfLatencyMs.EncodeTo(e); err != nil { return err } - if err = s.DuplicateFetchBytesRecv.EncodeTo(e); err != nil { + if err = s.P75ScpSelfToOtherLatencyMs.EncodeTo(e); err != nil { return err } - if err = s.UniqueFloodMessageRecv.EncodeTo(e); err != nil { + if err = s.LostSyncCount.EncodeTo(e); err != nil { return err } - if err = s.DuplicateFloodMessageRecv.EncodeTo(e); err != nil { + if _, err = e.EncodeBool(bool(s.IsValidator)); err != nil { return err } - if err = s.UniqueFetchMessageRecv.EncodeTo(e); err != nil { + if err = s.MaxInboundPeerCount.EncodeTo(e); err != nil { return err } - if err = s.DuplicateFetchMessageRecv.EncodeTo(e); err != nil { + if err = s.MaxOutboundPeerCount.EncodeTo(e); err != nil { return err } return nil } -var _ decoderFrom = (*PeerStats)(nil) +var _ decoderFrom = (*TimeSlicedNodeData)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *PeerStats) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TimeSlicedNodeData) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding PeerStats: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TimeSlicedNodeData: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error var n, nTmp int - nTmp, err = s.Id.DecodeFrom(d, maxDepth) + nTmp, err = s.AddedAuthenticatedPeers.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding NodeId: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - s.VersionStr, nTmp, err = d.DecodeString(100) + nTmp, err = s.DroppedAuthenticatedPeers.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding VersionStr: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.MessagesRead.DecodeFrom(d, maxDepth) + nTmp, err = s.TotalInboundPeerCount.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.MessagesWritten.DecodeFrom(d, maxDepth) + nTmp, err = s.TotalOutboundPeerCount.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.BytesRead.DecodeFrom(d, maxDepth) + nTmp, err = s.P75ScpFirstToSelfLatencyMs.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.BytesWritten.DecodeFrom(d, maxDepth) + nTmp, err = s.P75ScpSelfToOtherLatencyMs.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.SecondsConnected.DecodeFrom(d, maxDepth) + nTmp, err = s.LostSyncCount.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.UniqueFloodBytesRecv.DecodeFrom(d, maxDepth) + s.IsValidator, nTmp, err = d.DecodeBool() n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Bool: %w", err) } - nTmp, err = s.DuplicateFloodBytesRecv.DecodeFrom(d, maxDepth) + nTmp, err = s.MaxInboundPeerCount.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.UniqueFetchBytesRecv.DecodeFrom(d, maxDepth) + nTmp, err = s.MaxOutboundPeerCount.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } - nTmp, err = s.DuplicateFetchBytesRecv.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TimeSlicedNodeData) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TimeSlicedNodeData) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TimeSlicedNodeData)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedNodeData)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TimeSlicedNodeData) xdrType() {} + +var _ xdrType = (*TimeSlicedNodeData)(nil) + +// TimeSlicedPeerData is an XDR Struct defines as: +// +// struct TimeSlicedPeerData +// { +// PeerStats peerStats; +// uint32 averageLatencyMs; +// }; +type TimeSlicedPeerData struct { + PeerStats PeerStats + AverageLatencyMs Uint32 +} + +// EncodeTo encodes this value using the Encoder. +func (s *TimeSlicedPeerData) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.PeerStats.EncodeTo(e); err != nil { + return err } - nTmp, err = s.UniqueFloodMessageRecv.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + if err = s.AverageLatencyMs.EncodeTo(e); err != nil { + return err } - nTmp, err = s.DuplicateFloodMessageRecv.DecodeFrom(d, maxDepth) - n += nTmp - if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return nil +} + +var _ decoderFrom = (*TimeSlicedPeerData)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TimeSlicedPeerData) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TimeSlicedPeerData: %w", ErrMaxDecodingDepthReached) } - nTmp, err = s.UniqueFetchMessageRecv.DecodeFrom(d, maxDepth) + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.PeerStats.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding PeerStats: %w", err) } - nTmp, err = s.DuplicateFetchMessageRecv.DecodeFrom(d, maxDepth) + nTmp, err = s.AverageLatencyMs.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding Uint32: %w", err) } return n, nil } // MarshalBinary implements encoding.BinaryMarshaler. -func (s PeerStats) MarshalBinary() ([]byte, error) { +func (s TimeSlicedPeerData) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20719,7 +21782,7 @@ func (s PeerStats) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *PeerStats) UnmarshalBinary(inp []byte) error { +func (s *TimeSlicedPeerData) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20729,27 +21792,27 @@ func (s *PeerStats) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*PeerStats)(nil) - _ encoding.BinaryUnmarshaler = (*PeerStats)(nil) + _ encoding.BinaryMarshaler = (*TimeSlicedPeerData)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedPeerData)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s PeerStats) xdrType() {} +func (s TimeSlicedPeerData) xdrType() {} -var _ xdrType = (*PeerStats)(nil) +var _ xdrType = (*TimeSlicedPeerData)(nil) -// PeerStatList is an XDR Typedef defines as: +// TimeSlicedPeerDataList is an XDR Typedef defines as: // -// typedef PeerStats PeerStatList<25>; -type PeerStatList []PeerStats +// typedef TimeSlicedPeerData TimeSlicedPeerDataList<25>; +type TimeSlicedPeerDataList []TimeSlicedPeerData -// XDRMaxSize implements the Sized interface for PeerStatList -func (e PeerStatList) XDRMaxSize() int { +// XDRMaxSize implements the Sized interface for TimeSlicedPeerDataList +func (e TimeSlicedPeerDataList) XDRMaxSize() int { return 25 } // EncodeTo encodes this value using the Encoder. -func (s PeerStatList) EncodeTo(e *xdr.Encoder) error { +func (s TimeSlicedPeerDataList) EncodeTo(e *xdr.Encoder) error { var err error if _, err = e.EncodeUint(uint32(len(s))); err != nil { return err @@ -20762,12 +21825,12 @@ func (s PeerStatList) EncodeTo(e *xdr.Encoder) error { return nil } -var _ decoderFrom = (*PeerStatList)(nil) +var _ decoderFrom = (*TimeSlicedPeerDataList)(nil) // DecodeFrom decodes this value using the Decoder. -func (s *PeerStatList) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { +func (s *TimeSlicedPeerDataList) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { if maxDepth == 0 { - return 0, fmt.Errorf("decoding PeerStatList: %w", ErrMaxDecodingDepthReached) + return 0, fmt.Errorf("decoding TimeSlicedPeerDataList: %w", ErrMaxDecodingDepthReached) } maxDepth -= 1 var err error @@ -20776,22 +21839,22 @@ func (s *PeerStatList) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { l, nTmp, err = d.DecodeUint() n += nTmp if err != nil { - return n, fmt.Errorf("decoding PeerStats: %w", err) + return n, fmt.Errorf("decoding TimeSlicedPeerData: %w", err) } if l > 25 { - return n, fmt.Errorf("decoding PeerStats: data size (%d) exceeds size limit (25)", l) + return n, fmt.Errorf("decoding TimeSlicedPeerData: data size (%d) exceeds size limit (25)", l) } (*s) = nil if l > 0 { if il, ok := d.InputLen(); ok && uint(il) < uint(l) { - return n, fmt.Errorf("decoding PeerStats: length (%d) exceeds remaining input length (%d)", l, il) + return n, fmt.Errorf("decoding TimeSlicedPeerData: length (%d) exceeds remaining input length (%d)", l, il) } - (*s) = make([]PeerStats, l) + (*s) = make([]TimeSlicedPeerData, l) for i := uint32(0); i < l; i++ { nTmp, err = (*s)[i].DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding PeerStats: %w", err) + return n, fmt.Errorf("decoding TimeSlicedPeerData: %w", err) } } } @@ -20799,7 +21862,7 @@ func (s *PeerStatList) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { } // MarshalBinary implements encoding.BinaryMarshaler. -func (s PeerStatList) MarshalBinary() ([]byte, error) { +func (s TimeSlicedPeerDataList) MarshalBinary() ([]byte, error) { b := bytes.Buffer{} e := xdr.NewEncoder(&b) err := s.EncodeTo(e) @@ -20807,7 +21870,7 @@ func (s PeerStatList) MarshalBinary() ([]byte, error) { } // UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (s *PeerStatList) UnmarshalBinary(inp []byte) error { +func (s *TimeSlicedPeerDataList) UnmarshalBinary(inp []byte) error { r := bytes.NewReader(inp) o := xdr.DefaultDecodeOptions o.MaxInputLen = len(inp) @@ -20817,14 +21880,14 @@ func (s *PeerStatList) UnmarshalBinary(inp []byte) error { } var ( - _ encoding.BinaryMarshaler = (*PeerStatList)(nil) - _ encoding.BinaryUnmarshaler = (*PeerStatList)(nil) + _ encoding.BinaryMarshaler = (*TimeSlicedPeerDataList)(nil) + _ encoding.BinaryUnmarshaler = (*TimeSlicedPeerDataList)(nil) ) // xdrType signals that this type represents XDR values defined by this package. -func (s PeerStatList) xdrType() {} +func (s TimeSlicedPeerDataList) xdrType() {} -var _ xdrType = (*PeerStatList)(nil) +var _ xdrType = (*TimeSlicedPeerDataList)(nil) // TopologyResponseBodyV0 is an XDR Struct defines as: // @@ -21039,6 +22102,91 @@ func (s TopologyResponseBodyV1) xdrType() {} var _ xdrType = (*TopologyResponseBodyV1)(nil) +// TopologyResponseBodyV2 is an XDR Struct defines as: +// +// struct TopologyResponseBodyV2 +// { +// TimeSlicedPeerDataList inboundPeers; +// TimeSlicedPeerDataList outboundPeers; +// TimeSlicedNodeData nodeData; +// }; +type TopologyResponseBodyV2 struct { + InboundPeers TimeSlicedPeerDataList + OutboundPeers TimeSlicedPeerDataList + NodeData TimeSlicedNodeData +} + +// EncodeTo encodes this value using the Encoder. +func (s *TopologyResponseBodyV2) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.InboundPeers.EncodeTo(e); err != nil { + return err + } + if err = s.OutboundPeers.EncodeTo(e); err != nil { + return err + } + if err = s.NodeData.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*TopologyResponseBodyV2)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *TopologyResponseBodyV2) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding TopologyResponseBodyV2: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.InboundPeers.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedPeerDataList: %w", err) + } + nTmp, err = s.OutboundPeers.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedPeerDataList: %w", err) + } + nTmp, err = s.NodeData.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TimeSlicedNodeData: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s TopologyResponseBodyV2) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *TopologyResponseBodyV2) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*TopologyResponseBodyV2)(nil) + _ encoding.BinaryUnmarshaler = (*TopologyResponseBodyV2)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s TopologyResponseBodyV2) xdrType() {} + +var _ xdrType = (*TopologyResponseBodyV2)(nil) + // SurveyResponseBody is an XDR Union defines as: // // union SurveyResponseBody switch (SurveyMessageResponseType type) @@ -21047,11 +22195,14 @@ var _ xdrType = (*TopologyResponseBodyV1)(nil) // TopologyResponseBodyV0 topologyResponseBodyV0; // case SURVEY_TOPOLOGY_RESPONSE_V1: // TopologyResponseBodyV1 topologyResponseBodyV1; +// case SURVEY_TOPOLOGY_RESPONSE_V2: +// TopologyResponseBodyV2 topologyResponseBodyV2; // }; type SurveyResponseBody struct { Type SurveyMessageResponseType TopologyResponseBodyV0 *TopologyResponseBodyV0 TopologyResponseBodyV1 *TopologyResponseBodyV1 + TopologyResponseBodyV2 *TopologyResponseBodyV2 } // SwitchFieldName returns the field name in which this union's @@ -21068,6 +22219,8 @@ func (u SurveyResponseBody) ArmForSwitch(sw int32) (string, bool) { return "TopologyResponseBodyV0", true case SurveyMessageResponseTypeSurveyTopologyResponseV1: return "TopologyResponseBodyV1", true + case SurveyMessageResponseTypeSurveyTopologyResponseV2: + return "TopologyResponseBodyV2", true } return "-", false } @@ -21090,6 +22243,13 @@ func NewSurveyResponseBody(aType SurveyMessageResponseType, value interface{}) ( return } result.TopologyResponseBodyV1 = &tv + case SurveyMessageResponseTypeSurveyTopologyResponseV2: + tv, ok := value.(TopologyResponseBodyV2) + if !ok { + err = errors.New("invalid value, must be TopologyResponseBodyV2") + return + } + result.TopologyResponseBodyV2 = &tv } return } @@ -21144,6 +22304,31 @@ func (u SurveyResponseBody) GetTopologyResponseBodyV1() (result TopologyResponse return } +// MustTopologyResponseBodyV2 retrieves the TopologyResponseBodyV2 value from the union, +// panicing if the value is not set. +func (u SurveyResponseBody) MustTopologyResponseBodyV2() TopologyResponseBodyV2 { + val, ok := u.GetTopologyResponseBodyV2() + + if !ok { + panic("arm TopologyResponseBodyV2 is not set") + } + + return val +} + +// GetTopologyResponseBodyV2 retrieves the TopologyResponseBodyV2 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u SurveyResponseBody) GetTopologyResponseBodyV2() (result TopologyResponseBodyV2, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "TopologyResponseBodyV2" { + result = *u.TopologyResponseBodyV2 + ok = true + } + + return +} + // EncodeTo encodes this value using the Encoder. func (u SurveyResponseBody) EncodeTo(e *xdr.Encoder) error { var err error @@ -21161,6 +22346,11 @@ func (u SurveyResponseBody) EncodeTo(e *xdr.Encoder) error { return err } return nil + case SurveyMessageResponseTypeSurveyTopologyResponseV2: + if err = (*u.TopologyResponseBodyV2).EncodeTo(e); err != nil { + return err + } + return nil } return fmt.Errorf("Type (SurveyMessageResponseType) switch value '%d' is not valid for union SurveyResponseBody", u.Type) } @@ -21197,6 +22387,14 @@ func (u *SurveyResponseBody) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, err return n, fmt.Errorf("decoding TopologyResponseBodyV1: %w", err) } return n, nil + case SurveyMessageResponseTypeSurveyTopologyResponseV2: + u.TopologyResponseBodyV2 = new(TopologyResponseBodyV2) + nTmp, err = (*u.TopologyResponseBodyV2).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding TopologyResponseBodyV2: %w", err) + } + return n, nil } return n, fmt.Errorf("union SurveyResponseBody has invalid Type (SurveyMessageResponseType) switch value '%d'", u.Type) } @@ -21578,6 +22776,20 @@ var _ xdrType = (*FloodDemand)(nil) // case SURVEY_RESPONSE: // SignedSurveyResponseMessage signedSurveyResponseMessage; // +// case TIME_SLICED_SURVEY_REQUEST: +// SignedTimeSlicedSurveyRequestMessage signedTimeSlicedSurveyRequestMessage; +// +// case TIME_SLICED_SURVEY_RESPONSE: +// SignedTimeSlicedSurveyResponseMessage signedTimeSlicedSurveyResponseMessage; +// +// case TIME_SLICED_SURVEY_START_COLLECTING: +// SignedTimeSlicedSurveyStartCollectingMessage +// signedTimeSlicedSurveyStartCollectingMessage; +// +// case TIME_SLICED_SURVEY_STOP_COLLECTING: +// SignedTimeSlicedSurveyStopCollectingMessage +// signedTimeSlicedSurveyStopCollectingMessage; +// // // SCP // case GET_SCP_QUORUMSET: // uint256 qSetHash; @@ -21598,26 +22810,30 @@ var _ xdrType = (*FloodDemand)(nil) // FloodDemand floodDemand; // }; type StellarMessage struct { - Type MessageType - Error *Error - Hello *Hello - Auth *Auth - DontHave *DontHave - Peers *[]PeerAddress `xdrmaxsize:"100"` - TxSetHash *Uint256 - TxSet *TransactionSet - GeneralizedTxSet *GeneralizedTransactionSet - Transaction *TransactionEnvelope - SignedSurveyRequestMessage *SignedSurveyRequestMessage - SignedSurveyResponseMessage *SignedSurveyResponseMessage - QSetHash *Uint256 - QSet *ScpQuorumSet - Envelope *ScpEnvelope - GetScpLedgerSeq *Uint32 - SendMoreMessage *SendMore - SendMoreExtendedMessage *SendMoreExtended - FloodAdvert *FloodAdvert - FloodDemand *FloodDemand + Type MessageType + Error *Error + Hello *Hello + Auth *Auth + DontHave *DontHave + Peers *[]PeerAddress `xdrmaxsize:"100"` + TxSetHash *Uint256 + TxSet *TransactionSet + GeneralizedTxSet *GeneralizedTransactionSet + Transaction *TransactionEnvelope + SignedSurveyRequestMessage *SignedSurveyRequestMessage + SignedSurveyResponseMessage *SignedSurveyResponseMessage + SignedTimeSlicedSurveyRequestMessage *SignedTimeSlicedSurveyRequestMessage + SignedTimeSlicedSurveyResponseMessage *SignedTimeSlicedSurveyResponseMessage + SignedTimeSlicedSurveyStartCollectingMessage *SignedTimeSlicedSurveyStartCollectingMessage + SignedTimeSlicedSurveyStopCollectingMessage *SignedTimeSlicedSurveyStopCollectingMessage + QSetHash *Uint256 + QSet *ScpQuorumSet + Envelope *ScpEnvelope + GetScpLedgerSeq *Uint32 + SendMoreMessage *SendMore + SendMoreExtendedMessage *SendMoreExtended + FloodAdvert *FloodAdvert + FloodDemand *FloodDemand } // SwitchFieldName returns the field name in which this union's @@ -21654,6 +22870,14 @@ func (u StellarMessage) ArmForSwitch(sw int32) (string, bool) { return "SignedSurveyRequestMessage", true case MessageTypeSurveyResponse: return "SignedSurveyResponseMessage", true + case MessageTypeTimeSlicedSurveyRequest: + return "SignedTimeSlicedSurveyRequestMessage", true + case MessageTypeTimeSlicedSurveyResponse: + return "SignedTimeSlicedSurveyResponseMessage", true + case MessageTypeTimeSlicedSurveyStartCollecting: + return "SignedTimeSlicedSurveyStartCollectingMessage", true + case MessageTypeTimeSlicedSurveyStopCollecting: + return "SignedTimeSlicedSurveyStopCollectingMessage", true case MessageTypeGetScpQuorumset: return "QSetHash", true case MessageTypeScpQuorumset: @@ -21757,6 +22981,34 @@ func NewStellarMessage(aType MessageType, value interface{}) (result StellarMess return } result.SignedSurveyResponseMessage = &tv + case MessageTypeTimeSlicedSurveyRequest: + tv, ok := value.(SignedTimeSlicedSurveyRequestMessage) + if !ok { + err = errors.New("invalid value, must be SignedTimeSlicedSurveyRequestMessage") + return + } + result.SignedTimeSlicedSurveyRequestMessage = &tv + case MessageTypeTimeSlicedSurveyResponse: + tv, ok := value.(SignedTimeSlicedSurveyResponseMessage) + if !ok { + err = errors.New("invalid value, must be SignedTimeSlicedSurveyResponseMessage") + return + } + result.SignedTimeSlicedSurveyResponseMessage = &tv + case MessageTypeTimeSlicedSurveyStartCollecting: + tv, ok := value.(SignedTimeSlicedSurveyStartCollectingMessage) + if !ok { + err = errors.New("invalid value, must be SignedTimeSlicedSurveyStartCollectingMessage") + return + } + result.SignedTimeSlicedSurveyStartCollectingMessage = &tv + case MessageTypeTimeSlicedSurveyStopCollecting: + tv, ok := value.(SignedTimeSlicedSurveyStopCollectingMessage) + if !ok { + err = errors.New("invalid value, must be SignedTimeSlicedSurveyStopCollectingMessage") + return + } + result.SignedTimeSlicedSurveyStopCollectingMessage = &tv case MessageTypeGetScpQuorumset: tv, ok := value.(Uint256) if !ok { @@ -22092,6 +23344,106 @@ func (u StellarMessage) GetSignedSurveyResponseMessage() (result SignedSurveyRes return } +// MustSignedTimeSlicedSurveyRequestMessage retrieves the SignedTimeSlicedSurveyRequestMessage value from the union, +// panicing if the value is not set. +func (u StellarMessage) MustSignedTimeSlicedSurveyRequestMessage() SignedTimeSlicedSurveyRequestMessage { + val, ok := u.GetSignedTimeSlicedSurveyRequestMessage() + + if !ok { + panic("arm SignedTimeSlicedSurveyRequestMessage is not set") + } + + return val +} + +// GetSignedTimeSlicedSurveyRequestMessage retrieves the SignedTimeSlicedSurveyRequestMessage value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u StellarMessage) GetSignedTimeSlicedSurveyRequestMessage() (result SignedTimeSlicedSurveyRequestMessage, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "SignedTimeSlicedSurveyRequestMessage" { + result = *u.SignedTimeSlicedSurveyRequestMessage + ok = true + } + + return +} + +// MustSignedTimeSlicedSurveyResponseMessage retrieves the SignedTimeSlicedSurveyResponseMessage value from the union, +// panicing if the value is not set. +func (u StellarMessage) MustSignedTimeSlicedSurveyResponseMessage() SignedTimeSlicedSurveyResponseMessage { + val, ok := u.GetSignedTimeSlicedSurveyResponseMessage() + + if !ok { + panic("arm SignedTimeSlicedSurveyResponseMessage is not set") + } + + return val +} + +// GetSignedTimeSlicedSurveyResponseMessage retrieves the SignedTimeSlicedSurveyResponseMessage value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u StellarMessage) GetSignedTimeSlicedSurveyResponseMessage() (result SignedTimeSlicedSurveyResponseMessage, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "SignedTimeSlicedSurveyResponseMessage" { + result = *u.SignedTimeSlicedSurveyResponseMessage + ok = true + } + + return +} + +// MustSignedTimeSlicedSurveyStartCollectingMessage retrieves the SignedTimeSlicedSurveyStartCollectingMessage value from the union, +// panicing if the value is not set. +func (u StellarMessage) MustSignedTimeSlicedSurveyStartCollectingMessage() SignedTimeSlicedSurveyStartCollectingMessage { + val, ok := u.GetSignedTimeSlicedSurveyStartCollectingMessage() + + if !ok { + panic("arm SignedTimeSlicedSurveyStartCollectingMessage is not set") + } + + return val +} + +// GetSignedTimeSlicedSurveyStartCollectingMessage retrieves the SignedTimeSlicedSurveyStartCollectingMessage value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u StellarMessage) GetSignedTimeSlicedSurveyStartCollectingMessage() (result SignedTimeSlicedSurveyStartCollectingMessage, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "SignedTimeSlicedSurveyStartCollectingMessage" { + result = *u.SignedTimeSlicedSurveyStartCollectingMessage + ok = true + } + + return +} + +// MustSignedTimeSlicedSurveyStopCollectingMessage retrieves the SignedTimeSlicedSurveyStopCollectingMessage value from the union, +// panicing if the value is not set. +func (u StellarMessage) MustSignedTimeSlicedSurveyStopCollectingMessage() SignedTimeSlicedSurveyStopCollectingMessage { + val, ok := u.GetSignedTimeSlicedSurveyStopCollectingMessage() + + if !ok { + panic("arm SignedTimeSlicedSurveyStopCollectingMessage is not set") + } + + return val +} + +// GetSignedTimeSlicedSurveyStopCollectingMessage retrieves the SignedTimeSlicedSurveyStopCollectingMessage value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u StellarMessage) GetSignedTimeSlicedSurveyStopCollectingMessage() (result SignedTimeSlicedSurveyStopCollectingMessage, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.Type)) + + if armName == "SignedTimeSlicedSurveyStopCollectingMessage" { + result = *u.SignedTimeSlicedSurveyStopCollectingMessage + ok = true + } + + return +} + // MustQSetHash retrieves the QSetHash value from the union, // panicing if the value is not set. func (u StellarMessage) MustQSetHash() Uint256 { @@ -22362,6 +23714,26 @@ func (u StellarMessage) EncodeTo(e *xdr.Encoder) error { return err } return nil + case MessageTypeTimeSlicedSurveyRequest: + if err = (*u.SignedTimeSlicedSurveyRequestMessage).EncodeTo(e); err != nil { + return err + } + return nil + case MessageTypeTimeSlicedSurveyResponse: + if err = (*u.SignedTimeSlicedSurveyResponseMessage).EncodeTo(e); err != nil { + return err + } + return nil + case MessageTypeTimeSlicedSurveyStartCollecting: + if err = (*u.SignedTimeSlicedSurveyStartCollectingMessage).EncodeTo(e); err != nil { + return err + } + return nil + case MessageTypeTimeSlicedSurveyStopCollecting: + if err = (*u.SignedTimeSlicedSurveyStopCollectingMessage).EncodeTo(e); err != nil { + return err + } + return nil case MessageTypeGetScpQuorumset: if err = (*u.QSetHash).EncodeTo(e); err != nil { return err @@ -22531,6 +23903,38 @@ func (u *StellarMessage) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) return n, fmt.Errorf("decoding SignedSurveyResponseMessage: %w", err) } return n, nil + case MessageTypeTimeSlicedSurveyRequest: + u.SignedTimeSlicedSurveyRequestMessage = new(SignedTimeSlicedSurveyRequestMessage) + nTmp, err = (*u.SignedTimeSlicedSurveyRequestMessage).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SignedTimeSlicedSurveyRequestMessage: %w", err) + } + return n, nil + case MessageTypeTimeSlicedSurveyResponse: + u.SignedTimeSlicedSurveyResponseMessage = new(SignedTimeSlicedSurveyResponseMessage) + nTmp, err = (*u.SignedTimeSlicedSurveyResponseMessage).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SignedTimeSlicedSurveyResponseMessage: %w", err) + } + return n, nil + case MessageTypeTimeSlicedSurveyStartCollecting: + u.SignedTimeSlicedSurveyStartCollectingMessage = new(SignedTimeSlicedSurveyStartCollectingMessage) + nTmp, err = (*u.SignedTimeSlicedSurveyStartCollectingMessage).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SignedTimeSlicedSurveyStartCollectingMessage: %w", err) + } + return n, nil + case MessageTypeTimeSlicedSurveyStopCollecting: + u.SignedTimeSlicedSurveyStopCollectingMessage = new(SignedTimeSlicedSurveyStopCollectingMessage) + nTmp, err = (*u.SignedTimeSlicedSurveyStopCollectingMessage).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SignedTimeSlicedSurveyStopCollectingMessage: %w", err) + } + return n, nil case MessageTypeGetScpQuorumset: u.QSetHash = new(Uint256) nTmp, err = (*u.QSetHash).DecodeFrom(d, maxDepth)