From 586b68f8702a1723bf20b7826377b99c673f5a5c Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Thu, 3 Feb 2022 14:13:39 +0530 Subject: [PATCH 01/19] wire/protobuf: Add proto definitions for wire msgs Signed-off-by: Manoranjith --- wire/protobuf/wire.proto | 246 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 246 insertions(+) create mode 100644 wire/protobuf/wire.proto diff --git a/wire/protobuf/wire.proto b/wire/protobuf/wire.proto new file mode 100644 index 00000000..1d5d450d --- /dev/null +++ b/wire/protobuf/wire.proto @@ -0,0 +1,246 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file contains protocol buffer definitions for perun wire messages. + +syntax = "proto3"; + +package perunwire; + +option go_package = "../protobuf"; + +// Envelope encapsulates a message with the routing information. That is the +// the sender and the intended receiver. +message Envelope { + // sender of the message. + bytes sender = 1; + // intended recipient of the message. + bytes recipient = 2; + // msg should contain on the valid message types. + oneof msg { + PingMsg ping_msg = 3; + PongMsg pong_msg = 4; + ShutdownMsg shutdown_msg = 5; + AuthResponseMsg auth_response_msg = 6; + LedgerChannelProposalMsg ledger_channel_proposal_msg = 7; + LedgerChannelProposalAccMsg ledger_channel_proposal_acc_msg = 8; + SubChannelProposalMsg sub_channel_proposal_msg = 9; + SubChannelProposalAccMsg sub_channel_proposal_acc_msg = 10; + VirtualChannelProposalMsg virtual_channel_proposal_msg = 11; + VirtualChannelProposalAccMsg virtual_channel_proposal_acc_msg = 12; + ChannelProposalRejMsg channel_proposal_rej_msg = 13; + ChannelUpdateMsg channel_update_msg = 14; + VirtualChannelFundingProposalMsg virtual_channel_funding_proposal_msg = 15; + VirtualChannelSettlementProposalMsg virtual_channel_settlement_proposal_msg = 16; + ChannelUpdateAccMsg channel_update_acc_msg = 17; + ChannelUpdateRejMsg channel_update_rej_msg = 18; + ChannelSyncMsg channel_sync_msg = 19; + } +} + +// Balance represents the balance of a single asset, for all the channel +// participants. +message Balance { + repeated bytes balance = 1; +} + +// Balances represents the balance of all the assets, for all the channel +// participants. +message Balances { + repeated Balance balances = 1; +} + +// IndexMap represents the mapping of a participant indices in a sub allocation +// or a virtual channel funding proposal to the corresponding indices in the +// parent channel. +message IndexMap { + repeated uint32 index_map = 1; +} + +// SubAlloc represts a sub allocation. +message SubAlloc { + bytes id = 1; + Balance bals = 2; + IndexMap index_map = 3; +} + +// Allocation represents channel.Allocation. +message Allocation { + repeated bytes assets = 1; + Balances balances = 2; + repeated SubAlloc locked = 3; +} + +// BaseChannelProposal represents client.BaseChannelProposal. +message BaseChannelProposal { + bytes proposal_id = 1; + uint64 challenge_duration = 2; + bytes nonce_share = 3; + bytes app = 4; + bytes init_data = 5; + Allocation init_bals = 6; + Balances funding_agreement = 7; +} + +// BaseChannelProposalAcc represents client.BaseChannelProposalAcc. +message BaseChannelProposalAcc { + bytes proposal_id = 1; + bytes nonce_share = 2; +} + +// Params represents channel.Params. +message Params { + bytes id = 1; + uint64 challenge_duration = 2; + repeated bytes parts = 3; + bytes app = 4; + bytes nonce = 5; + bool ledger_channel = 6; + bool virtual_channel = 7; +} + +// State represents channel.State. +message State { + bytes id = 1; + uint64 version = 2; + bytes app = 3; + Allocation allocation = 4; + bytes data = 5; + bool is_final = 6; +} + +// Transaction represents channel.Transaction. +message Transaction { + State state = 1; + repeated bytes sigs = 2; +} + +// SignedState represents channel.SignedState. +message SignedState { + Params params = 1; + State state = 2; + repeated bytes sigs = 3; +} + +// ChannelUpdate represents channel.ChannelUpdate. +message ChannelUpdate { + State state = 1; + uint32 actor_idx = 2; +} + +// PingMsg represents wire.PingMsg. +message PingMsg { + int64 created = 1; +} + +// PongMsg represents wire.PongMsg. +message PongMsg { + int64 created = 1; +} + +// ShutdownMsg represents wire.ShutdownMsg. +message ShutdownMsg { + string reason = 1; +} + +// AuthResponseMsg represents wire.AuthResponseMsg. +message AuthResponseMsg { +} + +// LedgerChannelProposalMsg represents client.LedgerChannelProposalMsg. +message LedgerChannelProposalMsg { + BaseChannelProposal base_channel_proposal = 1; + bytes participant = 2; + repeated bytes peers = 3; +} + +// LedgerChannelProposalAccMsg represents client.LedgerChannelProposalAccMsg. +message LedgerChannelProposalAccMsg { + BaseChannelProposalAcc base_channel_proposal_acc = 1; + bytes participant = 2; +} + +// SubChannelProposalMsg represents client.SubChannelProposalMsg. +message SubChannelProposalMsg { + BaseChannelProposal base_channel_proposal = 1; + bytes parent = 2; +} + +// SubChannelProposalAccMsg represents client.SubChannelProposalAccMsg. +message SubChannelProposalAccMsg { + BaseChannelProposalAcc base_channel_proposal_acc = 1; +} + +// VirtualChannelProposalMsg represents client.VirtualChannelProposalMsg. +message VirtualChannelProposalMsg { + BaseChannelProposal base_channel_proposal = 1; + bytes proposer = 2; + repeated bytes peers = 3; + repeated bytes parents = 4; + repeated IndexMap index_maps = 5; +} + +// VirtualChannelProposalAccMsg represents client.VirtualChannelProposalAccMsg. +message VirtualChannelProposalAccMsg { + BaseChannelProposalAcc base_channel_proposal_acc = 1; + bytes responder = 2; +} + +// ChannelProposalRejMsg represents client.ChannelProposalRejMsg. +message ChannelProposalRejMsg { + bytes proposal_id = 1; + string reason = 2; +} + +// ChannelUpdateMsg represents client.ChannelUpdateMsg. +message ChannelUpdateMsg { + ChannelUpdate channel_update = 1; + bytes sig = 2; +} + + +// VirtualChannelFundingProposalMsg represents +// client.VirtualChannelFundingProposalMsg. +message VirtualChannelFundingProposalMsg { + ChannelUpdateMsg channel_update_msg = 1; + SignedState initial = 2; + IndexMap index_map = 3; +} + +// VirtualChannelSettlementProposalMsg represents +// client.VirtualChannelSettlementProposalMsg. +message VirtualChannelSettlementProposalMsg { + ChannelUpdateMsg channel_update_msg = 1; + SignedState final = 2; +} + +// ChannelUpdateAccMsg represents client.ChannelUpdateAccMsg. +message ChannelUpdateAccMsg { + bytes channel_id = 1; + uint64 version = 2; + bytes sig = 3; +} + +// ChannelUpdateRejMsg represents client.ChannelUpdateRejMsg. +message ChannelUpdateRejMsg { + bytes channel_id = 1; + uint64 version = 2; + string reason = 3; +} + +// ChannelSyncMsg represents client.ChannelSyncMsg. +message ChannelSyncMsg { + uint32 phase = 1; + Transaction current_tx = 2; +} From e4597f8a1c7b8c4fda8f4d310965cb99e94cd6b3 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 11 Feb 2022 18:54:26 +0530 Subject: [PATCH 02/19] wire/protobuf: Add pkg docs, vanity import path Signed-off-by: Manoranjith --- wire/protobuf/doc.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 wire/protobuf/doc.go diff --git a/wire/protobuf/doc.go b/wire/protobuf/doc.go new file mode 100644 index 00000000..d7f09303 --- /dev/null +++ b/wire/protobuf/doc.go @@ -0,0 +1,17 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package protobuf implements the wire serializer interface using the protocol +// buffers serialization protocol. +package protobuf // import "perun.network/go-perun/wire/protobuf" From 37beb88be001c903b6eda4b19303f3911d15ab13 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Thu, 3 Feb 2022 14:16:20 +0530 Subject: [PATCH 03/19] ci: Add linter config for protobuf files (*.proto) Signed-off-by: Manoranjith --- .protolint.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .protolint.yaml diff --git a/.protolint.yaml b/.protolint.yaml new file mode 100644 index 00000000..5e4ffc82 --- /dev/null +++ b/.protolint.yaml @@ -0,0 +1,21 @@ +lint: + ignores: + # Sometimes, when variable names are long line length exceeds 80 char. + - id: MAX_LINE_LENGTH + files: + - wire/protobuf/wire.proto + + # Some fields with repeated type intentionally have non plural names. + # Eg: balance, index_map etc., + - id: REPEATED_FIELD_NAMES_PLURALIZED + files: + - wire/protobuf/wire.proto + + rules: + + # Enable a few additional linters, that are not part of official style + # guide for protonbuf. + add: + - MESSAGES_HAVE_COMMENT + - FILE_HAS_COMMENT + - SYNTAX_CONSISTENT From 50786cb53ccb7cada03d5c81450e0895e29e9524 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Thu, 3 Feb 2022 15:10:35 +0530 Subject: [PATCH 04/19] ci: Add github ci job for linting protobuf files Signed-off-by: Manoranjith --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c5ebd25..30449fbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,13 +25,20 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - name: Check vanity import run: .scripts/check-vanity-imports.sh $GITHUB_WORKSPACE - - name: Lint + + - name: Lint golang files uses: golangci/golangci-lint-action@v2 with: version: v1.43 + - name: Lint proto files + uses: plexsystems/protolint-action@v0.6.0 + with: + configDirectory: . + tests: name: Tests runs-on: ubuntu-latest From 0835b9cb47f37080e76d672af1629fb9f2809ba4 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 4 Feb 2022 07:38:27 +0530 Subject: [PATCH 05/19] wire: Add generated bindings for protobuf serializer Signed-off-by: Manoranjith --- go.mod | 1 + go.sum | 2 + wire/protobuf/wire.pb.go | 2923 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 2926 insertions(+) create mode 100644 wire/protobuf/wire.pb.go diff --git a/go.mod b/go.mod index 9ae52e62..621dc14b 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( go.uber.org/goleak v1.1.11 golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c + google.golang.org/protobuf v1.23.0 polycry.pt/poly-go v0.0.0-20211115212618-87069dfa360f ) diff --git a/go.sum b/go.sum index b548eed4..2e028008 100644 --- a/go.sum +++ b/go.sum @@ -186,6 +186,7 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -621,6 +622,7 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/wire/protobuf/wire.pb.go b/wire/protobuf/wire.pb.go new file mode 100644 index 00000000..71204dc8 --- /dev/null +++ b/wire/protobuf/wire.pb.go @@ -0,0 +1,2923 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file contains protocol buffer definitions for perun wire messages. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.12.4 +// source: wire.proto + +package protobuf + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Envelope encapsulates a message with the routing information. That is the +// the sender and the intended receiver. +type Envelope struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // sender of the message. + Sender []byte `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + // intended recipient of the message. + Recipient []byte `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` + // msg should contain on the valid message types. + // + // Types that are assignable to Msg: + // *Envelope_PingMsg + // *Envelope_PongMsg + // *Envelope_ShutdownMsg + // *Envelope_AuthResponseMsg + // *Envelope_LedgerChannelProposalMsg + // *Envelope_LedgerChannelProposalAccMsg + // *Envelope_SubChannelProposalMsg + // *Envelope_SubChannelProposalAccMsg + // *Envelope_VirtualChannelProposalMsg + // *Envelope_VirtualChannelProposalAccMsg + // *Envelope_ChannelProposalRejMsg + // *Envelope_ChannelUpdateMsg + // *Envelope_VirtualChannelFundingProposalMsg + // *Envelope_VirtualChannelSettlementProposalMsg + // *Envelope_ChannelUpdateAccMsg + // *Envelope_ChannelUpdateRejMsg + // *Envelope_ChannelSyncMsg + Msg isEnvelope_Msg `protobuf_oneof:"msg"` +} + +func (x *Envelope) Reset() { + *x = Envelope{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Envelope) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Envelope) ProtoMessage() {} + +func (x *Envelope) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Envelope.ProtoReflect.Descriptor instead. +func (*Envelope) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{0} +} + +func (x *Envelope) GetSender() []byte { + if x != nil { + return x.Sender + } + return nil +} + +func (x *Envelope) GetRecipient() []byte { + if x != nil { + return x.Recipient + } + return nil +} + +func (m *Envelope) GetMsg() isEnvelope_Msg { + if m != nil { + return m.Msg + } + return nil +} + +func (x *Envelope) GetPingMsg() *PingMsg { + if x, ok := x.GetMsg().(*Envelope_PingMsg); ok { + return x.PingMsg + } + return nil +} + +func (x *Envelope) GetPongMsg() *PongMsg { + if x, ok := x.GetMsg().(*Envelope_PongMsg); ok { + return x.PongMsg + } + return nil +} + +func (x *Envelope) GetShutdownMsg() *ShutdownMsg { + if x, ok := x.GetMsg().(*Envelope_ShutdownMsg); ok { + return x.ShutdownMsg + } + return nil +} + +func (x *Envelope) GetAuthResponseMsg() *AuthResponseMsg { + if x, ok := x.GetMsg().(*Envelope_AuthResponseMsg); ok { + return x.AuthResponseMsg + } + return nil +} + +func (x *Envelope) GetLedgerChannelProposalMsg() *LedgerChannelProposalMsg { + if x, ok := x.GetMsg().(*Envelope_LedgerChannelProposalMsg); ok { + return x.LedgerChannelProposalMsg + } + return nil +} + +func (x *Envelope) GetLedgerChannelProposalAccMsg() *LedgerChannelProposalAccMsg { + if x, ok := x.GetMsg().(*Envelope_LedgerChannelProposalAccMsg); ok { + return x.LedgerChannelProposalAccMsg + } + return nil +} + +func (x *Envelope) GetSubChannelProposalMsg() *SubChannelProposalMsg { + if x, ok := x.GetMsg().(*Envelope_SubChannelProposalMsg); ok { + return x.SubChannelProposalMsg + } + return nil +} + +func (x *Envelope) GetSubChannelProposalAccMsg() *SubChannelProposalAccMsg { + if x, ok := x.GetMsg().(*Envelope_SubChannelProposalAccMsg); ok { + return x.SubChannelProposalAccMsg + } + return nil +} + +func (x *Envelope) GetVirtualChannelProposalMsg() *VirtualChannelProposalMsg { + if x, ok := x.GetMsg().(*Envelope_VirtualChannelProposalMsg); ok { + return x.VirtualChannelProposalMsg + } + return nil +} + +func (x *Envelope) GetVirtualChannelProposalAccMsg() *VirtualChannelProposalAccMsg { + if x, ok := x.GetMsg().(*Envelope_VirtualChannelProposalAccMsg); ok { + return x.VirtualChannelProposalAccMsg + } + return nil +} + +func (x *Envelope) GetChannelProposalRejMsg() *ChannelProposalRejMsg { + if x, ok := x.GetMsg().(*Envelope_ChannelProposalRejMsg); ok { + return x.ChannelProposalRejMsg + } + return nil +} + +func (x *Envelope) GetChannelUpdateMsg() *ChannelUpdateMsg { + if x, ok := x.GetMsg().(*Envelope_ChannelUpdateMsg); ok { + return x.ChannelUpdateMsg + } + return nil +} + +func (x *Envelope) GetVirtualChannelFundingProposalMsg() *VirtualChannelFundingProposalMsg { + if x, ok := x.GetMsg().(*Envelope_VirtualChannelFundingProposalMsg); ok { + return x.VirtualChannelFundingProposalMsg + } + return nil +} + +func (x *Envelope) GetVirtualChannelSettlementProposalMsg() *VirtualChannelSettlementProposalMsg { + if x, ok := x.GetMsg().(*Envelope_VirtualChannelSettlementProposalMsg); ok { + return x.VirtualChannelSettlementProposalMsg + } + return nil +} + +func (x *Envelope) GetChannelUpdateAccMsg() *ChannelUpdateAccMsg { + if x, ok := x.GetMsg().(*Envelope_ChannelUpdateAccMsg); ok { + return x.ChannelUpdateAccMsg + } + return nil +} + +func (x *Envelope) GetChannelUpdateRejMsg() *ChannelUpdateRejMsg { + if x, ok := x.GetMsg().(*Envelope_ChannelUpdateRejMsg); ok { + return x.ChannelUpdateRejMsg + } + return nil +} + +func (x *Envelope) GetChannelSyncMsg() *ChannelSyncMsg { + if x, ok := x.GetMsg().(*Envelope_ChannelSyncMsg); ok { + return x.ChannelSyncMsg + } + return nil +} + +type isEnvelope_Msg interface { + isEnvelope_Msg() +} + +type Envelope_PingMsg struct { + PingMsg *PingMsg `protobuf:"bytes,3,opt,name=ping_msg,json=pingMsg,proto3,oneof"` +} + +type Envelope_PongMsg struct { + PongMsg *PongMsg `protobuf:"bytes,4,opt,name=pong_msg,json=pongMsg,proto3,oneof"` +} + +type Envelope_ShutdownMsg struct { + ShutdownMsg *ShutdownMsg `protobuf:"bytes,5,opt,name=shutdown_msg,json=shutdownMsg,proto3,oneof"` +} + +type Envelope_AuthResponseMsg struct { + AuthResponseMsg *AuthResponseMsg `protobuf:"bytes,6,opt,name=auth_response_msg,json=authResponseMsg,proto3,oneof"` +} + +type Envelope_LedgerChannelProposalMsg struct { + LedgerChannelProposalMsg *LedgerChannelProposalMsg `protobuf:"bytes,7,opt,name=ledger_channel_proposal_msg,json=ledgerChannelProposalMsg,proto3,oneof"` +} + +type Envelope_LedgerChannelProposalAccMsg struct { + LedgerChannelProposalAccMsg *LedgerChannelProposalAccMsg `protobuf:"bytes,8,opt,name=ledger_channel_proposal_acc_msg,json=ledgerChannelProposalAccMsg,proto3,oneof"` +} + +type Envelope_SubChannelProposalMsg struct { + SubChannelProposalMsg *SubChannelProposalMsg `protobuf:"bytes,9,opt,name=sub_channel_proposal_msg,json=subChannelProposalMsg,proto3,oneof"` +} + +type Envelope_SubChannelProposalAccMsg struct { + SubChannelProposalAccMsg *SubChannelProposalAccMsg `protobuf:"bytes,10,opt,name=sub_channel_proposal_acc_msg,json=subChannelProposalAccMsg,proto3,oneof"` +} + +type Envelope_VirtualChannelProposalMsg struct { + VirtualChannelProposalMsg *VirtualChannelProposalMsg `protobuf:"bytes,11,opt,name=virtual_channel_proposal_msg,json=virtualChannelProposalMsg,proto3,oneof"` +} + +type Envelope_VirtualChannelProposalAccMsg struct { + VirtualChannelProposalAccMsg *VirtualChannelProposalAccMsg `protobuf:"bytes,12,opt,name=virtual_channel_proposal_acc_msg,json=virtualChannelProposalAccMsg,proto3,oneof"` +} + +type Envelope_ChannelProposalRejMsg struct { + ChannelProposalRejMsg *ChannelProposalRejMsg `protobuf:"bytes,13,opt,name=channel_proposal_rej_msg,json=channelProposalRejMsg,proto3,oneof"` +} + +type Envelope_ChannelUpdateMsg struct { + ChannelUpdateMsg *ChannelUpdateMsg `protobuf:"bytes,14,opt,name=channel_update_msg,json=channelUpdateMsg,proto3,oneof"` +} + +type Envelope_VirtualChannelFundingProposalMsg struct { + VirtualChannelFundingProposalMsg *VirtualChannelFundingProposalMsg `protobuf:"bytes,15,opt,name=virtual_channel_funding_proposal_msg,json=virtualChannelFundingProposalMsg,proto3,oneof"` +} + +type Envelope_VirtualChannelSettlementProposalMsg struct { + VirtualChannelSettlementProposalMsg *VirtualChannelSettlementProposalMsg `protobuf:"bytes,16,opt,name=virtual_channel_settlement_proposal_msg,json=virtualChannelSettlementProposalMsg,proto3,oneof"` +} + +type Envelope_ChannelUpdateAccMsg struct { + ChannelUpdateAccMsg *ChannelUpdateAccMsg `protobuf:"bytes,17,opt,name=channel_update_acc_msg,json=channelUpdateAccMsg,proto3,oneof"` +} + +type Envelope_ChannelUpdateRejMsg struct { + ChannelUpdateRejMsg *ChannelUpdateRejMsg `protobuf:"bytes,18,opt,name=channel_update_rej_msg,json=channelUpdateRejMsg,proto3,oneof"` +} + +type Envelope_ChannelSyncMsg struct { + ChannelSyncMsg *ChannelSyncMsg `protobuf:"bytes,19,opt,name=channel_sync_msg,json=channelSyncMsg,proto3,oneof"` +} + +func (*Envelope_PingMsg) isEnvelope_Msg() {} + +func (*Envelope_PongMsg) isEnvelope_Msg() {} + +func (*Envelope_ShutdownMsg) isEnvelope_Msg() {} + +func (*Envelope_AuthResponseMsg) isEnvelope_Msg() {} + +func (*Envelope_LedgerChannelProposalMsg) isEnvelope_Msg() {} + +func (*Envelope_LedgerChannelProposalAccMsg) isEnvelope_Msg() {} + +func (*Envelope_SubChannelProposalMsg) isEnvelope_Msg() {} + +func (*Envelope_SubChannelProposalAccMsg) isEnvelope_Msg() {} + +func (*Envelope_VirtualChannelProposalMsg) isEnvelope_Msg() {} + +func (*Envelope_VirtualChannelProposalAccMsg) isEnvelope_Msg() {} + +func (*Envelope_ChannelProposalRejMsg) isEnvelope_Msg() {} + +func (*Envelope_ChannelUpdateMsg) isEnvelope_Msg() {} + +func (*Envelope_VirtualChannelFundingProposalMsg) isEnvelope_Msg() {} + +func (*Envelope_VirtualChannelSettlementProposalMsg) isEnvelope_Msg() {} + +func (*Envelope_ChannelUpdateAccMsg) isEnvelope_Msg() {} + +func (*Envelope_ChannelUpdateRejMsg) isEnvelope_Msg() {} + +func (*Envelope_ChannelSyncMsg) isEnvelope_Msg() {} + +// Balance represents the balance of a single asset, for all the channel +// participants. +type Balance struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Balance [][]byte `protobuf:"bytes,1,rep,name=balance,proto3" json:"balance,omitempty"` +} + +func (x *Balance) Reset() { + *x = Balance{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Balance) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Balance) ProtoMessage() {} + +func (x *Balance) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Balance.ProtoReflect.Descriptor instead. +func (*Balance) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{1} +} + +func (x *Balance) GetBalance() [][]byte { + if x != nil { + return x.Balance + } + return nil +} + +// Balances represents the balance of all the assets, for all the channel +// participants. +type Balances struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Balances []*Balance `protobuf:"bytes,1,rep,name=balances,proto3" json:"balances,omitempty"` +} + +func (x *Balances) Reset() { + *x = Balances{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Balances) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Balances) ProtoMessage() {} + +func (x *Balances) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Balances.ProtoReflect.Descriptor instead. +func (*Balances) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{2} +} + +func (x *Balances) GetBalances() []*Balance { + if x != nil { + return x.Balances + } + return nil +} + +// IndexMap represents the mapping of a participant indices in a sub allocation +// or a virtual channel funding proposal to the corresponding indices in the +// parent channel. +type IndexMap struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IndexMap []uint32 `protobuf:"varint,1,rep,packed,name=index_map,json=indexMap,proto3" json:"index_map,omitempty"` +} + +func (x *IndexMap) Reset() { + *x = IndexMap{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IndexMap) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IndexMap) ProtoMessage() {} + +func (x *IndexMap) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IndexMap.ProtoReflect.Descriptor instead. +func (*IndexMap) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{3} +} + +func (x *IndexMap) GetIndexMap() []uint32 { + if x != nil { + return x.IndexMap + } + return nil +} + +// SubAlloc represts a sub allocation. +type SubAlloc struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Bals *Balance `protobuf:"bytes,2,opt,name=bals,proto3" json:"bals,omitempty"` + IndexMap *IndexMap `protobuf:"bytes,3,opt,name=index_map,json=indexMap,proto3" json:"index_map,omitempty"` +} + +func (x *SubAlloc) Reset() { + *x = SubAlloc{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubAlloc) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubAlloc) ProtoMessage() {} + +func (x *SubAlloc) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubAlloc.ProtoReflect.Descriptor instead. +func (*SubAlloc) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{4} +} + +func (x *SubAlloc) GetId() []byte { + if x != nil { + return x.Id + } + return nil +} + +func (x *SubAlloc) GetBals() *Balance { + if x != nil { + return x.Bals + } + return nil +} + +func (x *SubAlloc) GetIndexMap() *IndexMap { + if x != nil { + return x.IndexMap + } + return nil +} + +// Allocation represents channel.Allocation. +type Allocation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Assets [][]byte `protobuf:"bytes,1,rep,name=assets,proto3" json:"assets,omitempty"` + Balances *Balances `protobuf:"bytes,2,opt,name=balances,proto3" json:"balances,omitempty"` + Locked []*SubAlloc `protobuf:"bytes,3,rep,name=locked,proto3" json:"locked,omitempty"` +} + +func (x *Allocation) Reset() { + *x = Allocation{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Allocation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Allocation) ProtoMessage() {} + +func (x *Allocation) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Allocation.ProtoReflect.Descriptor instead. +func (*Allocation) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{5} +} + +func (x *Allocation) GetAssets() [][]byte { + if x != nil { + return x.Assets + } + return nil +} + +func (x *Allocation) GetBalances() *Balances { + if x != nil { + return x.Balances + } + return nil +} + +func (x *Allocation) GetLocked() []*SubAlloc { + if x != nil { + return x.Locked + } + return nil +} + +// BaseChannelProposal represents client.BaseChannelProposal. +type BaseChannelProposal struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProposalId []byte `protobuf:"bytes,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + ChallengeDuration uint64 `protobuf:"varint,2,opt,name=challenge_duration,json=challengeDuration,proto3" json:"challenge_duration,omitempty"` + NonceShare []byte `protobuf:"bytes,3,opt,name=nonce_share,json=nonceShare,proto3" json:"nonce_share,omitempty"` + App []byte `protobuf:"bytes,4,opt,name=app,proto3" json:"app,omitempty"` + InitData []byte `protobuf:"bytes,5,opt,name=init_data,json=initData,proto3" json:"init_data,omitempty"` + InitBals *Allocation `protobuf:"bytes,6,opt,name=init_bals,json=initBals,proto3" json:"init_bals,omitempty"` + FundingAgreement *Balances `protobuf:"bytes,7,opt,name=funding_agreement,json=fundingAgreement,proto3" json:"funding_agreement,omitempty"` +} + +func (x *BaseChannelProposal) Reset() { + *x = BaseChannelProposal{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BaseChannelProposal) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BaseChannelProposal) ProtoMessage() {} + +func (x *BaseChannelProposal) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BaseChannelProposal.ProtoReflect.Descriptor instead. +func (*BaseChannelProposal) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{6} +} + +func (x *BaseChannelProposal) GetProposalId() []byte { + if x != nil { + return x.ProposalId + } + return nil +} + +func (x *BaseChannelProposal) GetChallengeDuration() uint64 { + if x != nil { + return x.ChallengeDuration + } + return 0 +} + +func (x *BaseChannelProposal) GetNonceShare() []byte { + if x != nil { + return x.NonceShare + } + return nil +} + +func (x *BaseChannelProposal) GetApp() []byte { + if x != nil { + return x.App + } + return nil +} + +func (x *BaseChannelProposal) GetInitData() []byte { + if x != nil { + return x.InitData + } + return nil +} + +func (x *BaseChannelProposal) GetInitBals() *Allocation { + if x != nil { + return x.InitBals + } + return nil +} + +func (x *BaseChannelProposal) GetFundingAgreement() *Balances { + if x != nil { + return x.FundingAgreement + } + return nil +} + +// BaseChannelProposalAcc represents client.BaseChannelProposalAcc. +type BaseChannelProposalAcc struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProposalId []byte `protobuf:"bytes,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + NonceShare []byte `protobuf:"bytes,2,opt,name=nonce_share,json=nonceShare,proto3" json:"nonce_share,omitempty"` +} + +func (x *BaseChannelProposalAcc) Reset() { + *x = BaseChannelProposalAcc{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BaseChannelProposalAcc) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BaseChannelProposalAcc) ProtoMessage() {} + +func (x *BaseChannelProposalAcc) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BaseChannelProposalAcc.ProtoReflect.Descriptor instead. +func (*BaseChannelProposalAcc) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{7} +} + +func (x *BaseChannelProposalAcc) GetProposalId() []byte { + if x != nil { + return x.ProposalId + } + return nil +} + +func (x *BaseChannelProposalAcc) GetNonceShare() []byte { + if x != nil { + return x.NonceShare + } + return nil +} + +// Params represents channel.Params. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ChallengeDuration uint64 `protobuf:"varint,2,opt,name=challenge_duration,json=challengeDuration,proto3" json:"challenge_duration,omitempty"` + Parts [][]byte `protobuf:"bytes,3,rep,name=parts,proto3" json:"parts,omitempty"` + App []byte `protobuf:"bytes,4,opt,name=app,proto3" json:"app,omitempty"` + Nonce []byte `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"` + LedgerChannel bool `protobuf:"varint,6,opt,name=ledger_channel,json=ledgerChannel,proto3" json:"ledger_channel,omitempty"` + VirtualChannel bool `protobuf:"varint,7,opt,name=virtual_channel,json=virtualChannel,proto3" json:"virtual_channel,omitempty"` +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +func (x *Params) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{8} +} + +func (x *Params) GetId() []byte { + if x != nil { + return x.Id + } + return nil +} + +func (x *Params) GetChallengeDuration() uint64 { + if x != nil { + return x.ChallengeDuration + } + return 0 +} + +func (x *Params) GetParts() [][]byte { + if x != nil { + return x.Parts + } + return nil +} + +func (x *Params) GetApp() []byte { + if x != nil { + return x.App + } + return nil +} + +func (x *Params) GetNonce() []byte { + if x != nil { + return x.Nonce + } + return nil +} + +func (x *Params) GetLedgerChannel() bool { + if x != nil { + return x.LedgerChannel + } + return false +} + +func (x *Params) GetVirtualChannel() bool { + if x != nil { + return x.VirtualChannel + } + return false +} + +// State represents channel.State. +type State struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + App []byte `protobuf:"bytes,3,opt,name=app,proto3" json:"app,omitempty"` + Allocation *Allocation `protobuf:"bytes,4,opt,name=allocation,proto3" json:"allocation,omitempty"` + Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` + IsFinal bool `protobuf:"varint,6,opt,name=is_final,json=isFinal,proto3" json:"is_final,omitempty"` +} + +func (x *State) Reset() { + *x = State{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *State) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*State) ProtoMessage() {} + +func (x *State) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use State.ProtoReflect.Descriptor instead. +func (*State) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{9} +} + +func (x *State) GetId() []byte { + if x != nil { + return x.Id + } + return nil +} + +func (x *State) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *State) GetApp() []byte { + if x != nil { + return x.App + } + return nil +} + +func (x *State) GetAllocation() *Allocation { + if x != nil { + return x.Allocation + } + return nil +} + +func (x *State) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *State) GetIsFinal() bool { + if x != nil { + return x.IsFinal + } + return false +} + +// Transaction represents channel.Transaction. +type Transaction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State *State `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + Sigs [][]byte `protobuf:"bytes,2,rep,name=sigs,proto3" json:"sigs,omitempty"` +} + +func (x *Transaction) Reset() { + *x = Transaction{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Transaction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Transaction) ProtoMessage() {} + +func (x *Transaction) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Transaction.ProtoReflect.Descriptor instead. +func (*Transaction) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{10} +} + +func (x *Transaction) GetState() *State { + if x != nil { + return x.State + } + return nil +} + +func (x *Transaction) GetSigs() [][]byte { + if x != nil { + return x.Sigs + } + return nil +} + +// SignedState represents channel.SignedState. +type SignedState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + State *State `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` + Sigs [][]byte `protobuf:"bytes,3,rep,name=sigs,proto3" json:"sigs,omitempty"` +} + +func (x *SignedState) Reset() { + *x = SignedState{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignedState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignedState) ProtoMessage() {} + +func (x *SignedState) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignedState.ProtoReflect.Descriptor instead. +func (*SignedState) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{11} +} + +func (x *SignedState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +func (x *SignedState) GetState() *State { + if x != nil { + return x.State + } + return nil +} + +func (x *SignedState) GetSigs() [][]byte { + if x != nil { + return x.Sigs + } + return nil +} + +// ChannelUpdate represents channel.ChannelUpdate. +type ChannelUpdate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State *State `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + ActorIdx uint32 `protobuf:"varint,2,opt,name=actor_idx,json=actorIdx,proto3" json:"actor_idx,omitempty"` +} + +func (x *ChannelUpdate) Reset() { + *x = ChannelUpdate{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChannelUpdate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChannelUpdate) ProtoMessage() {} + +func (x *ChannelUpdate) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChannelUpdate.ProtoReflect.Descriptor instead. +func (*ChannelUpdate) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{12} +} + +func (x *ChannelUpdate) GetState() *State { + if x != nil { + return x.State + } + return nil +} + +func (x *ChannelUpdate) GetActorIdx() uint32 { + if x != nil { + return x.ActorIdx + } + return 0 +} + +// PingMsg represents wire.PingMsg. +type PingMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Created int64 `protobuf:"varint,1,opt,name=created,proto3" json:"created,omitempty"` +} + +func (x *PingMsg) Reset() { + *x = PingMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PingMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PingMsg) ProtoMessage() {} + +func (x *PingMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PingMsg.ProtoReflect.Descriptor instead. +func (*PingMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{13} +} + +func (x *PingMsg) GetCreated() int64 { + if x != nil { + return x.Created + } + return 0 +} + +// PongMsg represents wire.PongMsg. +type PongMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Created int64 `protobuf:"varint,1,opt,name=created,proto3" json:"created,omitempty"` +} + +func (x *PongMsg) Reset() { + *x = PongMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PongMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PongMsg) ProtoMessage() {} + +func (x *PongMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PongMsg.ProtoReflect.Descriptor instead. +func (*PongMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{14} +} + +func (x *PongMsg) GetCreated() int64 { + if x != nil { + return x.Created + } + return 0 +} + +// ShutdownMsg represents wire.ShutdownMsg. +type ShutdownMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Reason string `protobuf:"bytes,1,opt,name=reason,proto3" json:"reason,omitempty"` +} + +func (x *ShutdownMsg) Reset() { + *x = ShutdownMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShutdownMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShutdownMsg) ProtoMessage() {} + +func (x *ShutdownMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ShutdownMsg.ProtoReflect.Descriptor instead. +func (*ShutdownMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{15} +} + +func (x *ShutdownMsg) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +// AuthResponseMsg represents wire.AuthResponseMsg. +type AuthResponseMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *AuthResponseMsg) Reset() { + *x = AuthResponseMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthResponseMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthResponseMsg) ProtoMessage() {} + +func (x *AuthResponseMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AuthResponseMsg.ProtoReflect.Descriptor instead. +func (*AuthResponseMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{16} +} + +// LedgerChannelProposalMsg represents client.LedgerChannelProposalMsg. +type LedgerChannelProposalMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BaseChannelProposal *BaseChannelProposal `protobuf:"bytes,1,opt,name=base_channel_proposal,json=baseChannelProposal,proto3" json:"base_channel_proposal,omitempty"` + Participant []byte `protobuf:"bytes,2,opt,name=participant,proto3" json:"participant,omitempty"` + Peers [][]byte `protobuf:"bytes,3,rep,name=peers,proto3" json:"peers,omitempty"` +} + +func (x *LedgerChannelProposalMsg) Reset() { + *x = LedgerChannelProposalMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LedgerChannelProposalMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LedgerChannelProposalMsg) ProtoMessage() {} + +func (x *LedgerChannelProposalMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LedgerChannelProposalMsg.ProtoReflect.Descriptor instead. +func (*LedgerChannelProposalMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{17} +} + +func (x *LedgerChannelProposalMsg) GetBaseChannelProposal() *BaseChannelProposal { + if x != nil { + return x.BaseChannelProposal + } + return nil +} + +func (x *LedgerChannelProposalMsg) GetParticipant() []byte { + if x != nil { + return x.Participant + } + return nil +} + +func (x *LedgerChannelProposalMsg) GetPeers() [][]byte { + if x != nil { + return x.Peers + } + return nil +} + +// LedgerChannelProposalAccMsg represents client.LedgerChannelProposalAccMsg. +type LedgerChannelProposalAccMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BaseChannelProposalAcc *BaseChannelProposalAcc `protobuf:"bytes,1,opt,name=base_channel_proposal_acc,json=baseChannelProposalAcc,proto3" json:"base_channel_proposal_acc,omitempty"` + Participant []byte `protobuf:"bytes,2,opt,name=participant,proto3" json:"participant,omitempty"` +} + +func (x *LedgerChannelProposalAccMsg) Reset() { + *x = LedgerChannelProposalAccMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LedgerChannelProposalAccMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LedgerChannelProposalAccMsg) ProtoMessage() {} + +func (x *LedgerChannelProposalAccMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LedgerChannelProposalAccMsg.ProtoReflect.Descriptor instead. +func (*LedgerChannelProposalAccMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{18} +} + +func (x *LedgerChannelProposalAccMsg) GetBaseChannelProposalAcc() *BaseChannelProposalAcc { + if x != nil { + return x.BaseChannelProposalAcc + } + return nil +} + +func (x *LedgerChannelProposalAccMsg) GetParticipant() []byte { + if x != nil { + return x.Participant + } + return nil +} + +// SubChannelProposalMsg represents client.SubChannelProposalMsg. +type SubChannelProposalMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BaseChannelProposal *BaseChannelProposal `protobuf:"bytes,1,opt,name=base_channel_proposal,json=baseChannelProposal,proto3" json:"base_channel_proposal,omitempty"` + Parent []byte `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` +} + +func (x *SubChannelProposalMsg) Reset() { + *x = SubChannelProposalMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubChannelProposalMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubChannelProposalMsg) ProtoMessage() {} + +func (x *SubChannelProposalMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubChannelProposalMsg.ProtoReflect.Descriptor instead. +func (*SubChannelProposalMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{19} +} + +func (x *SubChannelProposalMsg) GetBaseChannelProposal() *BaseChannelProposal { + if x != nil { + return x.BaseChannelProposal + } + return nil +} + +func (x *SubChannelProposalMsg) GetParent() []byte { + if x != nil { + return x.Parent + } + return nil +} + +// SubChannelProposalAccMsg represents client.SubChannelProposalAccMsg. +type SubChannelProposalAccMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BaseChannelProposalAcc *BaseChannelProposalAcc `protobuf:"bytes,1,opt,name=base_channel_proposal_acc,json=baseChannelProposalAcc,proto3" json:"base_channel_proposal_acc,omitempty"` +} + +func (x *SubChannelProposalAccMsg) Reset() { + *x = SubChannelProposalAccMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubChannelProposalAccMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubChannelProposalAccMsg) ProtoMessage() {} + +func (x *SubChannelProposalAccMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubChannelProposalAccMsg.ProtoReflect.Descriptor instead. +func (*SubChannelProposalAccMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{20} +} + +func (x *SubChannelProposalAccMsg) GetBaseChannelProposalAcc() *BaseChannelProposalAcc { + if x != nil { + return x.BaseChannelProposalAcc + } + return nil +} + +// VirtualChannelProposalMsg represents client.VirtualChannelProposalMsg. +type VirtualChannelProposalMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BaseChannelProposal *BaseChannelProposal `protobuf:"bytes,1,opt,name=base_channel_proposal,json=baseChannelProposal,proto3" json:"base_channel_proposal,omitempty"` + Proposer []byte `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"` + Peers [][]byte `protobuf:"bytes,3,rep,name=peers,proto3" json:"peers,omitempty"` + Parents [][]byte `protobuf:"bytes,4,rep,name=parents,proto3" json:"parents,omitempty"` + IndexMaps []*IndexMap `protobuf:"bytes,5,rep,name=index_maps,json=indexMaps,proto3" json:"index_maps,omitempty"` +} + +func (x *VirtualChannelProposalMsg) Reset() { + *x = VirtualChannelProposalMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VirtualChannelProposalMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VirtualChannelProposalMsg) ProtoMessage() {} + +func (x *VirtualChannelProposalMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VirtualChannelProposalMsg.ProtoReflect.Descriptor instead. +func (*VirtualChannelProposalMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{21} +} + +func (x *VirtualChannelProposalMsg) GetBaseChannelProposal() *BaseChannelProposal { + if x != nil { + return x.BaseChannelProposal + } + return nil +} + +func (x *VirtualChannelProposalMsg) GetProposer() []byte { + if x != nil { + return x.Proposer + } + return nil +} + +func (x *VirtualChannelProposalMsg) GetPeers() [][]byte { + if x != nil { + return x.Peers + } + return nil +} + +func (x *VirtualChannelProposalMsg) GetParents() [][]byte { + if x != nil { + return x.Parents + } + return nil +} + +func (x *VirtualChannelProposalMsg) GetIndexMaps() []*IndexMap { + if x != nil { + return x.IndexMaps + } + return nil +} + +// VirtualChannelProposalAccMsg represents client.VirtualChannelProposalAccMsg. +type VirtualChannelProposalAccMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BaseChannelProposalAcc *BaseChannelProposalAcc `protobuf:"bytes,1,opt,name=base_channel_proposal_acc,json=baseChannelProposalAcc,proto3" json:"base_channel_proposal_acc,omitempty"` + Responder []byte `protobuf:"bytes,2,opt,name=responder,proto3" json:"responder,omitempty"` +} + +func (x *VirtualChannelProposalAccMsg) Reset() { + *x = VirtualChannelProposalAccMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VirtualChannelProposalAccMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VirtualChannelProposalAccMsg) ProtoMessage() {} + +func (x *VirtualChannelProposalAccMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VirtualChannelProposalAccMsg.ProtoReflect.Descriptor instead. +func (*VirtualChannelProposalAccMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{22} +} + +func (x *VirtualChannelProposalAccMsg) GetBaseChannelProposalAcc() *BaseChannelProposalAcc { + if x != nil { + return x.BaseChannelProposalAcc + } + return nil +} + +func (x *VirtualChannelProposalAccMsg) GetResponder() []byte { + if x != nil { + return x.Responder + } + return nil +} + +// ChannelProposalRejMsg represents client.ChannelProposalRejMsg. +type ChannelProposalRejMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProposalId []byte `protobuf:"bytes,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` +} + +func (x *ChannelProposalRejMsg) Reset() { + *x = ChannelProposalRejMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChannelProposalRejMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChannelProposalRejMsg) ProtoMessage() {} + +func (x *ChannelProposalRejMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChannelProposalRejMsg.ProtoReflect.Descriptor instead. +func (*ChannelProposalRejMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{23} +} + +func (x *ChannelProposalRejMsg) GetProposalId() []byte { + if x != nil { + return x.ProposalId + } + return nil +} + +func (x *ChannelProposalRejMsg) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +// ChannelUpdateMsg represents client.ChannelUpdateMsg. +type ChannelUpdateMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ChannelUpdate *ChannelUpdate `protobuf:"bytes,1,opt,name=channel_update,json=channelUpdate,proto3" json:"channel_update,omitempty"` + Sig []byte `protobuf:"bytes,2,opt,name=sig,proto3" json:"sig,omitempty"` +} + +func (x *ChannelUpdateMsg) Reset() { + *x = ChannelUpdateMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChannelUpdateMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChannelUpdateMsg) ProtoMessage() {} + +func (x *ChannelUpdateMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChannelUpdateMsg.ProtoReflect.Descriptor instead. +func (*ChannelUpdateMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{24} +} + +func (x *ChannelUpdateMsg) GetChannelUpdate() *ChannelUpdate { + if x != nil { + return x.ChannelUpdate + } + return nil +} + +func (x *ChannelUpdateMsg) GetSig() []byte { + if x != nil { + return x.Sig + } + return nil +} + +// VirtualChannelFundingProposalMsg represents +// client.VirtualChannelFundingProposalMsg. +type VirtualChannelFundingProposalMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ChannelUpdateMsg *ChannelUpdateMsg `protobuf:"bytes,1,opt,name=channel_update_msg,json=channelUpdateMsg,proto3" json:"channel_update_msg,omitempty"` + Initial *SignedState `protobuf:"bytes,2,opt,name=initial,proto3" json:"initial,omitempty"` + IndexMap *IndexMap `protobuf:"bytes,3,opt,name=index_map,json=indexMap,proto3" json:"index_map,omitempty"` +} + +func (x *VirtualChannelFundingProposalMsg) Reset() { + *x = VirtualChannelFundingProposalMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VirtualChannelFundingProposalMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VirtualChannelFundingProposalMsg) ProtoMessage() {} + +func (x *VirtualChannelFundingProposalMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VirtualChannelFundingProposalMsg.ProtoReflect.Descriptor instead. +func (*VirtualChannelFundingProposalMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{25} +} + +func (x *VirtualChannelFundingProposalMsg) GetChannelUpdateMsg() *ChannelUpdateMsg { + if x != nil { + return x.ChannelUpdateMsg + } + return nil +} + +func (x *VirtualChannelFundingProposalMsg) GetInitial() *SignedState { + if x != nil { + return x.Initial + } + return nil +} + +func (x *VirtualChannelFundingProposalMsg) GetIndexMap() *IndexMap { + if x != nil { + return x.IndexMap + } + return nil +} + +// VirtualChannelSettlementProposalMsg represents +// client.VirtualChannelSettlementProposalMsg. +type VirtualChannelSettlementProposalMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ChannelUpdateMsg *ChannelUpdateMsg `protobuf:"bytes,1,opt,name=channel_update_msg,json=channelUpdateMsg,proto3" json:"channel_update_msg,omitempty"` + Final *SignedState `protobuf:"bytes,2,opt,name=final,proto3" json:"final,omitempty"` +} + +func (x *VirtualChannelSettlementProposalMsg) Reset() { + *x = VirtualChannelSettlementProposalMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VirtualChannelSettlementProposalMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VirtualChannelSettlementProposalMsg) ProtoMessage() {} + +func (x *VirtualChannelSettlementProposalMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VirtualChannelSettlementProposalMsg.ProtoReflect.Descriptor instead. +func (*VirtualChannelSettlementProposalMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{26} +} + +func (x *VirtualChannelSettlementProposalMsg) GetChannelUpdateMsg() *ChannelUpdateMsg { + if x != nil { + return x.ChannelUpdateMsg + } + return nil +} + +func (x *VirtualChannelSettlementProposalMsg) GetFinal() *SignedState { + if x != nil { + return x.Final + } + return nil +} + +// ChannelUpdateAccMsg represents client.ChannelUpdateAccMsg. +type ChannelUpdateAccMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ChannelId []byte `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + Sig []byte `protobuf:"bytes,3,opt,name=sig,proto3" json:"sig,omitempty"` +} + +func (x *ChannelUpdateAccMsg) Reset() { + *x = ChannelUpdateAccMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChannelUpdateAccMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChannelUpdateAccMsg) ProtoMessage() {} + +func (x *ChannelUpdateAccMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChannelUpdateAccMsg.ProtoReflect.Descriptor instead. +func (*ChannelUpdateAccMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{27} +} + +func (x *ChannelUpdateAccMsg) GetChannelId() []byte { + if x != nil { + return x.ChannelId + } + return nil +} + +func (x *ChannelUpdateAccMsg) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *ChannelUpdateAccMsg) GetSig() []byte { + if x != nil { + return x.Sig + } + return nil +} + +// ChannelUpdateRejMsg represents client.ChannelUpdateRejMsg. +type ChannelUpdateRejMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ChannelId []byte `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"` +} + +func (x *ChannelUpdateRejMsg) Reset() { + *x = ChannelUpdateRejMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChannelUpdateRejMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChannelUpdateRejMsg) ProtoMessage() {} + +func (x *ChannelUpdateRejMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChannelUpdateRejMsg.ProtoReflect.Descriptor instead. +func (*ChannelUpdateRejMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{28} +} + +func (x *ChannelUpdateRejMsg) GetChannelId() []byte { + if x != nil { + return x.ChannelId + } + return nil +} + +func (x *ChannelUpdateRejMsg) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *ChannelUpdateRejMsg) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +// ChannelSyncMsg represents client.ChannelSyncMsg. +type ChannelSyncMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Phase uint32 `protobuf:"varint,1,opt,name=phase,proto3" json:"phase,omitempty"` + CurrentTx *Transaction `protobuf:"bytes,2,opt,name=current_tx,json=currentTx,proto3" json:"current_tx,omitempty"` +} + +func (x *ChannelSyncMsg) Reset() { + *x = ChannelSyncMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChannelSyncMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChannelSyncMsg) ProtoMessage() {} + +func (x *ChannelSyncMsg) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChannelSyncMsg.ProtoReflect.Descriptor instead. +func (*ChannelSyncMsg) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{29} +} + +func (x *ChannelSyncMsg) GetPhase() uint32 { + if x != nil { + return x.Phase + } + return 0 +} + +func (x *ChannelSyncMsg) GetCurrentTx() *Transaction { + if x != nil { + return x.CurrentTx + } + return nil +} + +var File_wire_proto protoreflect.FileDescriptor + +var file_wire_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x70, 0x65, + 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x22, 0xcd, 0x0c, 0x0a, 0x08, 0x45, 0x6e, 0x76, 0x65, + 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, + 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x08, 0x70, 0x69, + 0x6e, 0x67, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, + 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x4d, 0x73, 0x67, + 0x48, 0x00, 0x52, 0x07, 0x70, 0x69, 0x6e, 0x67, 0x4d, 0x73, 0x67, 0x12, 0x2f, 0x0a, 0x08, 0x70, + 0x6f, 0x6e, 0x67, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x50, 0x6f, 0x6e, 0x67, 0x4d, 0x73, + 0x67, 0x48, 0x00, 0x52, 0x07, 0x70, 0x6f, 0x6e, 0x67, 0x4d, 0x73, 0x67, 0x12, 0x3b, 0x0a, 0x0c, + 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x53, + 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4d, 0x73, 0x67, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x68, + 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4d, 0x73, 0x67, 0x12, 0x48, 0x0a, 0x11, 0x61, 0x75, 0x74, + 0x68, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, + 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x73, 0x67, + 0x48, 0x00, 0x52, 0x0f, 0x61, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x4d, 0x73, 0x67, 0x12, 0x64, 0x0a, 0x1b, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x5f, 0x63, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x6d, + 0x73, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, + 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, + 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x48, 0x00, 0x52, + 0x18, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x6e, 0x0a, 0x1f, 0x6c, 0x65, 0x64, + 0x67, 0x65, 0x72, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, + 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x61, 0x63, 0x63, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4c, + 0x65, 0x64, 0x67, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, + 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x4d, 0x73, 0x67, 0x48, 0x00, 0x52, 0x1b, 0x6c, 0x65, + 0x64, 0x67, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x4d, 0x73, 0x67, 0x12, 0x5b, 0x0a, 0x18, 0x73, 0x75, 0x62, + 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x65, + 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x53, 0x75, 0x62, 0x43, 0x68, 0x61, 0x6e, 0x6e, + 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x48, 0x00, 0x52, + 0x15, 0x73, 0x75, 0x62, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x65, 0x0a, 0x1c, 0x73, 0x75, 0x62, 0x5f, 0x63, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x61, + 0x63, 0x63, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, + 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x53, 0x75, 0x62, 0x43, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x4d, 0x73, + 0x67, 0x48, 0x00, 0x52, 0x18, 0x73, 0x75, 0x62, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x4d, 0x73, 0x67, 0x12, 0x67, 0x0a, + 0x1c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, + 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x48, 0x00, 0x52, 0x19, 0x76, 0x69, 0x72, + 0x74, 0x75, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x71, 0x0a, 0x20, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, + 0x6c, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, + 0x61, 0x6c, 0x5f, 0x61, 0x63, 0x63, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x27, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x56, 0x69, 0x72, + 0x74, 0x75, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x4d, 0x73, 0x67, 0x48, 0x00, 0x52, 0x1c, 0x76, 0x69, 0x72, + 0x74, 0x75, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x4d, 0x73, 0x67, 0x12, 0x5b, 0x0a, 0x18, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x72, 0x65, + 0x6a, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x65, + 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x6a, 0x4d, 0x73, 0x67, 0x48, 0x00, 0x52, + 0x15, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, + 0x52, 0x65, 0x6a, 0x4d, 0x73, 0x67, 0x12, 0x4b, 0x0a, 0x12, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x0e, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x43, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x48, + 0x00, 0x52, 0x10, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x4d, 0x73, 0x67, 0x12, 0x7d, 0x0a, 0x24, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x66, 0x75, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x70, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x0f, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2b, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x56, 0x69, + 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x46, 0x75, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x48, 0x00, + 0x52, 0x20, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x46, 0x75, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, + 0x73, 0x67, 0x12, 0x86, 0x01, 0x0a, 0x27, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x10, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, + 0x2e, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x53, + 0x65, 0x74, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x4d, 0x73, 0x67, 0x48, 0x00, 0x52, 0x23, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x55, 0x0a, 0x16, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x63, + 0x63, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x65, + 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x4d, 0x73, 0x67, 0x48, 0x00, 0x52, 0x13, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x4d, + 0x73, 0x67, 0x12, 0x55, 0x0a, 0x16, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x65, 0x6a, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x12, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x43, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x6a, 0x4d, + 0x73, 0x67, 0x48, 0x00, 0x52, 0x13, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x6a, 0x4d, 0x73, 0x67, 0x12, 0x45, 0x0a, 0x10, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x13, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, + 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x79, 0x6e, 0x63, 0x4d, 0x73, 0x67, 0x48, 0x00, + 0x52, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x79, 0x6e, 0x63, 0x4d, 0x73, 0x67, + 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x23, 0x0a, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, + 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0c, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x3a, 0x0a, 0x08, + 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x08, 0x62, 0x61, 0x6c, 0x61, + 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x65, 0x72, + 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x08, + 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x22, 0x27, 0x0a, 0x08, 0x49, 0x6e, 0x64, 0x65, + 0x78, 0x4d, 0x61, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6d, 0x61, + 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4d, 0x61, + 0x70, 0x22, 0x74, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x26, 0x0a, + 0x04, 0x62, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x65, + 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, + 0x04, 0x62, 0x61, 0x6c, 0x73, 0x12, 0x30, 0x0a, 0x09, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6d, + 0x61, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, + 0x77, 0x69, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4d, 0x61, 0x70, 0x52, 0x08, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x4d, 0x61, 0x70, 0x22, 0x82, 0x01, 0x0a, 0x0a, 0x41, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x2f, + 0x0a, 0x08, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x42, 0x61, 0x6c, + 0x61, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, + 0x2b, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x13, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x53, 0x75, 0x62, 0x41, + 0x6c, 0x6c, 0x6f, 0x63, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x22, 0xab, 0x02, 0x0a, + 0x13, 0x42, 0x61, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, + 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, + 0x67, 0x65, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x11, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x44, 0x75, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x5f, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x6e, 0x6f, 0x6e, 0x63, 0x65, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x70, 0x70, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x03, 0x61, 0x70, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6e, 0x69, 0x74, 0x5f, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x69, 0x6e, 0x69, 0x74, + 0x44, 0x61, 0x74, 0x61, 0x12, 0x32, 0x0a, 0x09, 0x69, 0x6e, 0x69, 0x74, 0x5f, 0x62, 0x61, 0x6c, + 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, + 0x69, 0x72, 0x65, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, + 0x69, 0x6e, 0x69, 0x74, 0x42, 0x61, 0x6c, 0x73, 0x12, 0x40, 0x0a, 0x11, 0x66, 0x75, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x67, 0x72, 0x65, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, + 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x10, 0x66, 0x75, 0x6e, 0x64, 0x69, 0x6e, + 0x67, 0x41, 0x67, 0x72, 0x65, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x5a, 0x0a, 0x16, 0x42, 0x61, + 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x41, 0x63, 0x63, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x5f, 0x73, + 0x68, 0x61, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x6e, 0x6f, 0x6e, 0x63, + 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x22, 0xd5, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x5f, 0x64, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x63, + 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, + 0x05, 0x70, 0x61, 0x72, 0x74, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x70, 0x70, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x03, 0x61, 0x70, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x25, + 0x0a, 0x0e, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x43, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x27, 0x0a, 0x0f, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, + 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, + 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x22, 0xa9, + 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x70, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x03, 0x61, 0x70, 0x70, 0x12, 0x35, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, + 0x77, 0x69, 0x72, 0x65, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x69, 0x73, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x22, 0x49, 0x0a, 0x0b, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, + 0x77, 0x69, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, + 0x04, 0x73, 0x69, 0x67, 0x73, 0x22, 0x74, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, + 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x26, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x69, 0x67, 0x73, 0x22, 0x54, 0x0a, 0x0d, 0x43, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x26, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x65, + 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x64, + 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, + 0x78, 0x22, 0x23, 0x0a, 0x07, 0x50, 0x69, 0x6e, 0x67, 0x4d, 0x73, 0x67, 0x12, 0x18, 0x0a, 0x07, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, 0x23, 0x0a, 0x07, 0x50, 0x6f, 0x6e, 0x67, 0x4d, 0x73, + 0x67, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, 0x25, 0x0a, 0x0b, 0x53, + 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4d, 0x73, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, + 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, + 0x6f, 0x6e, 0x22, 0x11, 0x0a, 0x0f, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x4d, 0x73, 0x67, 0x22, 0xa6, 0x01, 0x0a, 0x18, 0x4c, 0x65, 0x64, 0x67, 0x65, 0x72, + 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, + 0x73, 0x67, 0x12, 0x52, 0x0a, 0x15, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, + 0x65, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x42, 0x61, + 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x52, 0x13, 0x62, 0x61, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, + 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x70, 0x61, 0x72, + 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x22, 0x9d, + 0x01, 0x0a, 0x1b, 0x4c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x4d, 0x73, 0x67, 0x12, 0x5c, + 0x0a, 0x19, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x70, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x61, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x42, 0x61, + 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x41, 0x63, 0x63, 0x52, 0x16, 0x62, 0x61, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x12, 0x20, 0x0a, 0x0b, + 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x22, 0x83, + 0x01, 0x0a, 0x15, 0x53, 0x75, 0x62, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, + 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x52, 0x0a, 0x15, 0x62, 0x61, 0x73, 0x65, + 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, + 0x69, 0x72, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x13, 0x62, 0x61, 0x73, 0x65, 0x43, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x22, 0x78, 0x0a, 0x18, 0x53, 0x75, 0x62, 0x43, 0x68, 0x61, 0x6e, 0x6e, + 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x4d, 0x73, 0x67, + 0x12, 0x5c, 0x0a, 0x19, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x61, 0x63, 0x63, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, + 0x42, 0x61, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x52, 0x16, 0x62, 0x61, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x22, 0xef, + 0x01, 0x0a, 0x19, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x52, 0x0a, 0x15, + 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x70, 0x72, 0x6f, + 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x65, + 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x13, 0x62, 0x61, 0x73, + 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, + 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x05, 0x70, 0x65, 0x65, + 0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x32, 0x0a, 0x0a, + 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x6d, 0x61, 0x70, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x4d, 0x61, 0x70, 0x52, 0x09, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4d, 0x61, 0x70, 0x73, + 0x22, 0x9a, 0x01, 0x0a, 0x1c, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x4d, 0x73, + 0x67, 0x12, 0x5c, 0x0a, 0x19, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x61, 0x63, 0x63, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, + 0x2e, 0x42, 0x61, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, + 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x52, 0x16, 0x62, 0x61, 0x73, 0x65, 0x43, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x41, 0x63, 0x63, 0x12, + 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x50, 0x0a, + 0x15, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, + 0x52, 0x65, 0x6a, 0x4d, 0x73, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, + 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x72, 0x6f, + 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, + 0x65, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x4d, 0x73, 0x67, 0x12, 0x3f, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x65, + 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x03, 0x73, 0x69, 0x67, 0x22, 0xd1, 0x01, 0x0a, 0x20, 0x56, 0x69, 0x72, 0x74, 0x75, + 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x46, 0x75, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x49, 0x0a, 0x12, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x73, + 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, + 0x69, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4d, 0x73, 0x67, 0x52, 0x10, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x12, 0x30, 0x0a, 0x07, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, + 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, + 0x69, 0x72, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, + 0x07, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x30, 0x0a, 0x09, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x65, + 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x4d, 0x61, 0x70, + 0x52, 0x08, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4d, 0x61, 0x70, 0x22, 0x9e, 0x01, 0x0a, 0x23, 0x56, + 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x65, 0x74, + 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x4d, + 0x73, 0x67, 0x12, 0x49, 0x0a, 0x12, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, + 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x10, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x12, 0x2c, 0x0a, + 0x05, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, + 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x22, 0x60, 0x0a, 0x13, 0x43, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x4d, + 0x73, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, + 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x73, + 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x69, 0x67, 0x22, 0x66, 0x0a, + 0x13, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x6a, 0x4d, 0x73, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, + 0x6c, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, + 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, + 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x5d, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x53, 0x79, 0x6e, 0x63, 0x4d, 0x73, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x61, 0x73, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x70, 0x68, 0x61, 0x73, 0x65, 0x12, 0x35, 0x0a, + 0x0a, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x63, 0x75, 0x72, 0x72, 0x65, + 0x6e, 0x74, 0x54, 0x78, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_wire_proto_rawDescOnce sync.Once + file_wire_proto_rawDescData = file_wire_proto_rawDesc +) + +func file_wire_proto_rawDescGZIP() []byte { + file_wire_proto_rawDescOnce.Do(func() { + file_wire_proto_rawDescData = protoimpl.X.CompressGZIP(file_wire_proto_rawDescData) + }) + return file_wire_proto_rawDescData +} + +var file_wire_proto_msgTypes = make([]protoimpl.MessageInfo, 30) +var file_wire_proto_goTypes = []interface{}{ + (*Envelope)(nil), // 0: perunwire.Envelope + (*Balance)(nil), // 1: perunwire.Balance + (*Balances)(nil), // 2: perunwire.Balances + (*IndexMap)(nil), // 3: perunwire.IndexMap + (*SubAlloc)(nil), // 4: perunwire.SubAlloc + (*Allocation)(nil), // 5: perunwire.Allocation + (*BaseChannelProposal)(nil), // 6: perunwire.BaseChannelProposal + (*BaseChannelProposalAcc)(nil), // 7: perunwire.BaseChannelProposalAcc + (*Params)(nil), // 8: perunwire.Params + (*State)(nil), // 9: perunwire.State + (*Transaction)(nil), // 10: perunwire.Transaction + (*SignedState)(nil), // 11: perunwire.SignedState + (*ChannelUpdate)(nil), // 12: perunwire.ChannelUpdate + (*PingMsg)(nil), // 13: perunwire.PingMsg + (*PongMsg)(nil), // 14: perunwire.PongMsg + (*ShutdownMsg)(nil), // 15: perunwire.ShutdownMsg + (*AuthResponseMsg)(nil), // 16: perunwire.AuthResponseMsg + (*LedgerChannelProposalMsg)(nil), // 17: perunwire.LedgerChannelProposalMsg + (*LedgerChannelProposalAccMsg)(nil), // 18: perunwire.LedgerChannelProposalAccMsg + (*SubChannelProposalMsg)(nil), // 19: perunwire.SubChannelProposalMsg + (*SubChannelProposalAccMsg)(nil), // 20: perunwire.SubChannelProposalAccMsg + (*VirtualChannelProposalMsg)(nil), // 21: perunwire.VirtualChannelProposalMsg + (*VirtualChannelProposalAccMsg)(nil), // 22: perunwire.VirtualChannelProposalAccMsg + (*ChannelProposalRejMsg)(nil), // 23: perunwire.ChannelProposalRejMsg + (*ChannelUpdateMsg)(nil), // 24: perunwire.ChannelUpdateMsg + (*VirtualChannelFundingProposalMsg)(nil), // 25: perunwire.VirtualChannelFundingProposalMsg + (*VirtualChannelSettlementProposalMsg)(nil), // 26: perunwire.VirtualChannelSettlementProposalMsg + (*ChannelUpdateAccMsg)(nil), // 27: perunwire.ChannelUpdateAccMsg + (*ChannelUpdateRejMsg)(nil), // 28: perunwire.ChannelUpdateRejMsg + (*ChannelSyncMsg)(nil), // 29: perunwire.ChannelSyncMsg +} +var file_wire_proto_depIdxs = []int32{ + 13, // 0: perunwire.Envelope.ping_msg:type_name -> perunwire.PingMsg + 14, // 1: perunwire.Envelope.pong_msg:type_name -> perunwire.PongMsg + 15, // 2: perunwire.Envelope.shutdown_msg:type_name -> perunwire.ShutdownMsg + 16, // 3: perunwire.Envelope.auth_response_msg:type_name -> perunwire.AuthResponseMsg + 17, // 4: perunwire.Envelope.ledger_channel_proposal_msg:type_name -> perunwire.LedgerChannelProposalMsg + 18, // 5: perunwire.Envelope.ledger_channel_proposal_acc_msg:type_name -> perunwire.LedgerChannelProposalAccMsg + 19, // 6: perunwire.Envelope.sub_channel_proposal_msg:type_name -> perunwire.SubChannelProposalMsg + 20, // 7: perunwire.Envelope.sub_channel_proposal_acc_msg:type_name -> perunwire.SubChannelProposalAccMsg + 21, // 8: perunwire.Envelope.virtual_channel_proposal_msg:type_name -> perunwire.VirtualChannelProposalMsg + 22, // 9: perunwire.Envelope.virtual_channel_proposal_acc_msg:type_name -> perunwire.VirtualChannelProposalAccMsg + 23, // 10: perunwire.Envelope.channel_proposal_rej_msg:type_name -> perunwire.ChannelProposalRejMsg + 24, // 11: perunwire.Envelope.channel_update_msg:type_name -> perunwire.ChannelUpdateMsg + 25, // 12: perunwire.Envelope.virtual_channel_funding_proposal_msg:type_name -> perunwire.VirtualChannelFundingProposalMsg + 26, // 13: perunwire.Envelope.virtual_channel_settlement_proposal_msg:type_name -> perunwire.VirtualChannelSettlementProposalMsg + 27, // 14: perunwire.Envelope.channel_update_acc_msg:type_name -> perunwire.ChannelUpdateAccMsg + 28, // 15: perunwire.Envelope.channel_update_rej_msg:type_name -> perunwire.ChannelUpdateRejMsg + 29, // 16: perunwire.Envelope.channel_sync_msg:type_name -> perunwire.ChannelSyncMsg + 1, // 17: perunwire.Balances.balances:type_name -> perunwire.Balance + 1, // 18: perunwire.SubAlloc.bals:type_name -> perunwire.Balance + 3, // 19: perunwire.SubAlloc.index_map:type_name -> perunwire.IndexMap + 2, // 20: perunwire.Allocation.balances:type_name -> perunwire.Balances + 4, // 21: perunwire.Allocation.locked:type_name -> perunwire.SubAlloc + 5, // 22: perunwire.BaseChannelProposal.init_bals:type_name -> perunwire.Allocation + 2, // 23: perunwire.BaseChannelProposal.funding_agreement:type_name -> perunwire.Balances + 5, // 24: perunwire.State.allocation:type_name -> perunwire.Allocation + 9, // 25: perunwire.Transaction.state:type_name -> perunwire.State + 8, // 26: perunwire.SignedState.params:type_name -> perunwire.Params + 9, // 27: perunwire.SignedState.state:type_name -> perunwire.State + 9, // 28: perunwire.ChannelUpdate.state:type_name -> perunwire.State + 6, // 29: perunwire.LedgerChannelProposalMsg.base_channel_proposal:type_name -> perunwire.BaseChannelProposal + 7, // 30: perunwire.LedgerChannelProposalAccMsg.base_channel_proposal_acc:type_name -> perunwire.BaseChannelProposalAcc + 6, // 31: perunwire.SubChannelProposalMsg.base_channel_proposal:type_name -> perunwire.BaseChannelProposal + 7, // 32: perunwire.SubChannelProposalAccMsg.base_channel_proposal_acc:type_name -> perunwire.BaseChannelProposalAcc + 6, // 33: perunwire.VirtualChannelProposalMsg.base_channel_proposal:type_name -> perunwire.BaseChannelProposal + 3, // 34: perunwire.VirtualChannelProposalMsg.index_maps:type_name -> perunwire.IndexMap + 7, // 35: perunwire.VirtualChannelProposalAccMsg.base_channel_proposal_acc:type_name -> perunwire.BaseChannelProposalAcc + 12, // 36: perunwire.ChannelUpdateMsg.channel_update:type_name -> perunwire.ChannelUpdate + 24, // 37: perunwire.VirtualChannelFundingProposalMsg.channel_update_msg:type_name -> perunwire.ChannelUpdateMsg + 11, // 38: perunwire.VirtualChannelFundingProposalMsg.initial:type_name -> perunwire.SignedState + 3, // 39: perunwire.VirtualChannelFundingProposalMsg.index_map:type_name -> perunwire.IndexMap + 24, // 40: perunwire.VirtualChannelSettlementProposalMsg.channel_update_msg:type_name -> perunwire.ChannelUpdateMsg + 11, // 41: perunwire.VirtualChannelSettlementProposalMsg.final:type_name -> perunwire.SignedState + 10, // 42: perunwire.ChannelSyncMsg.current_tx:type_name -> perunwire.Transaction + 43, // [43:43] is the sub-list for method output_type + 43, // [43:43] is the sub-list for method input_type + 43, // [43:43] is the sub-list for extension type_name + 43, // [43:43] is the sub-list for extension extendee + 0, // [0:43] is the sub-list for field type_name +} + +func init() { file_wire_proto_init() } +func file_wire_proto_init() { + if File_wire_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_wire_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Envelope); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Balance); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Balances); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IndexMap); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubAlloc); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Allocation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BaseChannelProposal); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BaseChannelProposalAcc); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*State); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Transaction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignedState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChannelUpdate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PingMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PongMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShutdownMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthResponseMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LedgerChannelProposalMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LedgerChannelProposalAccMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubChannelProposalMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubChannelProposalAccMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VirtualChannelProposalMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VirtualChannelProposalAccMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChannelProposalRejMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChannelUpdateMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VirtualChannelFundingProposalMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VirtualChannelSettlementProposalMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChannelUpdateAccMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChannelUpdateRejMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_wire_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChannelSyncMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_wire_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Envelope_PingMsg)(nil), + (*Envelope_PongMsg)(nil), + (*Envelope_ShutdownMsg)(nil), + (*Envelope_AuthResponseMsg)(nil), + (*Envelope_LedgerChannelProposalMsg)(nil), + (*Envelope_LedgerChannelProposalAccMsg)(nil), + (*Envelope_SubChannelProposalMsg)(nil), + (*Envelope_SubChannelProposalAccMsg)(nil), + (*Envelope_VirtualChannelProposalMsg)(nil), + (*Envelope_VirtualChannelProposalAccMsg)(nil), + (*Envelope_ChannelProposalRejMsg)(nil), + (*Envelope_ChannelUpdateMsg)(nil), + (*Envelope_VirtualChannelFundingProposalMsg)(nil), + (*Envelope_VirtualChannelSettlementProposalMsg)(nil), + (*Envelope_ChannelUpdateAccMsg)(nil), + (*Envelope_ChannelUpdateRejMsg)(nil), + (*Envelope_ChannelSyncMsg)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_wire_proto_rawDesc, + NumEnums: 0, + NumMessages: 30, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_wire_proto_goTypes, + DependencyIndexes: file_wire_proto_depIdxs, + MessageInfos: file_wire_proto_msgTypes, + }.Build() + File_wire_proto = out.File + file_wire_proto_rawDesc = nil + file_wire_proto_goTypes = nil + file_wire_proto_depIdxs = nil +} From 77663eb78ae7812b1f26bfc9b17869d84578dfd7 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 4 Feb 2022 08:08:50 +0530 Subject: [PATCH 06/19] wire: Make the wire serializer configurable - Until now, perunio was the only wire serializer. Hence, it was used by default, by directly importing it in the wire package. - In preparation for implementing protobuf wire serializer, remove this default import and allow the user to choose the serialization adapter. - In tests for perunio serialization, use perunio adapter. Signed-off-by: Manoranjith --- client/proposalmsgs_test.go | 1 + wire/controlmsgs_test.go | 1 + wire/net/exchange_addr_internal_test.go | 1 + wire/net/ioconn.go | 2 -- wire/net/simple/dialer_internal_test.go | 1 + wire/net/test/connhub_internal_test.go | 1 + wire/test/serializinglocalbus.go | 2 -- 7 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/proposalmsgs_test.go b/client/proposalmsgs_test.go index 6acb2ef5..8c1f42d6 100644 --- a/client/proposalmsgs_test.go +++ b/client/proposalmsgs_test.go @@ -24,6 +24,7 @@ import ( "perun.network/go-perun/channel/test" "perun.network/go-perun/client" clienttest "perun.network/go-perun/client/test" + _ "perun.network/go-perun/wire/perunio/serializer" // wire serialzer init peruniotest "perun.network/go-perun/wire/perunio/test" pkgtest "polycry.pt/poly-go/test" ) diff --git a/wire/controlmsgs_test.go b/wire/controlmsgs_test.go index e07d6a09..008e88e3 100644 --- a/wire/controlmsgs_test.go +++ b/wire/controlmsgs_test.go @@ -17,6 +17,7 @@ package wire_test import ( "testing" + _ "perun.network/go-perun/wire/perunio/serializer" // wire serialzer init peruniotest "perun.network/go-perun/wire/perunio/test" wiretest "perun.network/go-perun/wire/test" ) diff --git a/wire/net/exchange_addr_internal_test.go b/wire/net/exchange_addr_internal_test.go index 78995c2e..1d7ce910 100644 --- a/wire/net/exchange_addr_internal_test.go +++ b/wire/net/exchange_addr_internal_test.go @@ -23,6 +23,7 @@ import ( wallettest "perun.network/go-perun/wallet/test" "perun.network/go-perun/wire" + _ "perun.network/go-perun/wire/perunio/serializer" // wire serialzer init wiretest "perun.network/go-perun/wire/test" ctxtest "polycry.pt/poly-go/context/test" "polycry.pt/poly-go/test" diff --git a/wire/net/ioconn.go b/wire/net/ioconn.go index 6b05680d..83fc87ea 100644 --- a/wire/net/ioconn.go +++ b/wire/net/ioconn.go @@ -20,8 +20,6 @@ import ( "github.com/pkg/errors" "perun.network/go-perun/wire" - // nolint: blank-imports // allow blank import package that is not main or test. - _ "perun.network/go-perun/wire/perunio/serializer" "polycry.pt/poly-go/sync/atomic" ) diff --git a/wire/net/simple/dialer_internal_test.go b/wire/net/simple/dialer_internal_test.go index 6fad1219..bd0d6c62 100644 --- a/wire/net/simple/dialer_internal_test.go +++ b/wire/net/simple/dialer_internal_test.go @@ -25,6 +25,7 @@ import ( simwallet "perun.network/go-perun/backend/sim/wallet" "perun.network/go-perun/wallet" "perun.network/go-perun/wire" + _ "perun.network/go-perun/wire/perunio/serializer" // wire serialzer init ctxtest "polycry.pt/poly-go/context/test" "polycry.pt/poly-go/test" ) diff --git a/wire/net/test/connhub_internal_test.go b/wire/net/test/connhub_internal_test.go index a5aa159d..9f5bd957 100644 --- a/wire/net/test/connhub_internal_test.go +++ b/wire/net/test/connhub_internal_test.go @@ -24,6 +24,7 @@ import ( _ "perun.network/go-perun/backend/sim" // backend init wallettest "perun.network/go-perun/wallet/test" "perun.network/go-perun/wire" + _ "perun.network/go-perun/wire/perunio/serializer" // wire serialzer init wiretest "perun.network/go-perun/wire/test" ctxtest "polycry.pt/poly-go/context/test" "polycry.pt/poly-go/sync" diff --git a/wire/test/serializinglocalbus.go b/wire/test/serializinglocalbus.go index a2c92d67..5da06e93 100644 --- a/wire/test/serializinglocalbus.go +++ b/wire/test/serializinglocalbus.go @@ -19,8 +19,6 @@ import ( "context" "perun.network/go-perun/wire" - // nolint: blank-imports // allow blank import package that is not main or test. - _ "perun.network/go-perun/wire/perunio/serializer" ) // SerializingLocalBus is a local bus that also serializes messages for testing. From 1a9ef646405f4c34edca630e410f3d8e749506ce Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 4 Feb 2022 11:43:12 +0530 Subject: [PATCH 07/19] wire: Make PingPongMsg type exported - For implementing the protobuf adapter, all the fields of a Msg should be exported. Signed-off-by: Manoranjith --- wire/controlmsgs.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/wire/controlmsgs.go b/wire/controlmsgs.go index 8d2e69bc..5ae16204 100644 --- a/wire/controlmsgs.go +++ b/wire/controlmsgs.go @@ -29,31 +29,36 @@ func init() { // Since ping and pong messages are essentially the same, this is a common // implementation for both. -type pingPongMsg struct { + +// PingPongMsg is the common message type used by ping and pong msgs, since +// both the messages are essentially the same. +type PingPongMsg struct { Created time.Time } -func (m pingPongMsg) Encode(writer io.Writer) error { +// Encode implements msg.Encode. +func (m PingPongMsg) Encode(writer io.Writer) error { return perunio.Encode(writer, m.Created) } -func (m *pingPongMsg) Decode(reader io.Reader) error { +// Decode implements msg.Decode. +func (m *PingPongMsg) Decode(reader io.Reader) error { return perunio.Decode(reader, &m.Created) } -func newPingPongMsg() pingPongMsg { +func newPingPongMsg() PingPongMsg { // do not use `time.Now()` directly because it contains monotonic clock // data specific to the current process which breaks, e.g., // `reflect.DeepEqual`, cf. "Marshal/Unmarshal functions are asymmetrical" // https://github.com/golang/go/issues/19502 - return pingPongMsg{Created: time.Unix(0, time.Now().UnixNano())} + return PingPongMsg{Created: time.Unix(0, time.Now().UnixNano())} } // PingMsg is a ping request. // It contains the time at which it was sent, so that the recipient can also // measure the time it took to transmit the ping request. type PingMsg struct { - pingPongMsg + PingPongMsg } // Type returns Ping. @@ -71,7 +76,7 @@ func NewPingMsg() *PingMsg { // long the ping request took to be transmitted, and how quickly the response // was sent. type PongMsg struct { - pingPongMsg + PingPongMsg } // Type returns Pong. From ec17c46d5ac03929e1b37542a8c19c3a4c64d8df Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 4 Feb 2022 11:52:06 +0530 Subject: [PATCH 08/19] wire/protobuf: Impl serializer for control msgs Signed-off-by: Manoranjith --- wire/controlmsgs_test.go | 2 +- wire/protobuf/controlmsgs.go | 57 +++++++++++++ wire/protobuf/serializer.go | 123 +++++++++++++++++++++++++++ wire/protobuf/serializer_test.go | 28 ++++++ wire/protobuf/test/doc.go | 17 ++++ wire/protobuf/test/serializertest.go | 51 +++++++++++ wire/test/msgstest.go | 4 +- 7 files changed, 279 insertions(+), 3 deletions(-) create mode 100644 wire/protobuf/controlmsgs.go create mode 100644 wire/protobuf/serializer.go create mode 100644 wire/protobuf/serializer_test.go create mode 100644 wire/protobuf/test/doc.go create mode 100644 wire/protobuf/test/serializertest.go diff --git a/wire/controlmsgs_test.go b/wire/controlmsgs_test.go index 008e88e3..2d8b1ff2 100644 --- a/wire/controlmsgs_test.go +++ b/wire/controlmsgs_test.go @@ -23,5 +23,5 @@ import ( ) func TestControlMsgs(t *testing.T) { - wiretest.ControlMsgsTest(t, peruniotest.MsgSerializerTest) + wiretest.ControlMsgsSerializationTest(t, peruniotest.MsgSerializerTest) } diff --git a/wire/protobuf/controlmsgs.go b/wire/protobuf/controlmsgs.go new file mode 100644 index 00000000..ed907af6 --- /dev/null +++ b/wire/protobuf/controlmsgs.go @@ -0,0 +1,57 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protobuf + +import ( + "time" + + "perun.network/go-perun/wire" +) + +func fromPingMsg(msg *wire.PingMsg) *Envelope_PingMsg { + protoMsg := &PingMsg{} + protoMsg.Created = msg.Created.UnixNano() + return &Envelope_PingMsg{protoMsg} +} + +func fromPongMsg(msg *wire.PongMsg) *Envelope_PongMsg { + protoMsg := &PongMsg{} + protoMsg.Created = msg.Created.UnixNano() + return &Envelope_PongMsg{protoMsg} +} + +func fromShutdownMsg(msg *wire.ShutdownMsg) *Envelope_ShutdownMsg { + protoMsg := &ShutdownMsg{} + protoMsg.Reason = msg.Reason + return &Envelope_ShutdownMsg{protoMsg} +} + +func toPingMsg(protoMsg *Envelope_PingMsg) (msg *wire.PingMsg) { + msg = &wire.PingMsg{} + msg.Created = time.Unix(0, protoMsg.PingMsg.Created) + return msg +} + +func toPongMsg(protoEnvMsg *Envelope_PongMsg) (msg *wire.PongMsg) { + msg = &wire.PongMsg{} + msg.Created = time.Unix(0, protoEnvMsg.PongMsg.Created) + return msg +} + +func toShutdownMsg(protoEnvMsg *Envelope_ShutdownMsg) (msg *wire.ShutdownMsg) { + msg = &wire.ShutdownMsg{} + msg.Reason = protoEnvMsg.ShutdownMsg.Reason + return msg +} diff --git a/wire/protobuf/serializer.go b/wire/protobuf/serializer.go new file mode 100644 index 00000000..f2f7c562 --- /dev/null +++ b/wire/protobuf/serializer.go @@ -0,0 +1,123 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protobuf + +import ( + "encoding/binary" + "io" + + "github.com/pkg/errors" + "google.golang.org/protobuf/proto" + "perun.network/go-perun/wire" +) + +type serializer struct{} + +func init() { + wire.SetEnvelopeSerializer(serializer{}) +} + +// Encode encodes an envelope from the reader using protocol buffers +// serialization format. +func (serializer) Encode(w io.Writer, env *wire.Envelope) (err error) { + protoEnv := &Envelope{} + + switch msg := env.Msg.(type) { + case *wire.PingMsg: + protoEnv.Msg = fromPingMsg(msg) + case *wire.PongMsg: + protoEnv.Msg = fromPongMsg(msg) + case *wire.ShutdownMsg: + protoEnv.Msg = fromShutdownMsg(msg) + } + + protoEnv.Sender, protoEnv.Recipient, err = marshalSenderRecipient(env) + if err != nil { + return err + } + + return writeEnvelope(w, protoEnv) +} + +func marshalSenderRecipient(env *wire.Envelope) ([]byte, []byte, error) { + sender, err := env.Sender.MarshalBinary() + if err != nil { + return nil, nil, errors.WithMessage(err, "marshalling sender address") + } + recipient, err := env.Recipient.MarshalBinary() + return sender, recipient, errors.WithMessage(err, "marshalling recipient address") +} + +func writeEnvelope(w io.Writer, env *Envelope) error { + data, err := proto.Marshal(env) + if err != nil { + return errors.Wrap(err, "marshalling envelope") + } + if err := binary.Write(w, binary.BigEndian, uint16(len(data))); err != nil { + return errors.Wrap(err, "writing length to wire") + } + _, err = w.Write(data) + return errors.Wrap(err, "writing data to wire") +} + +// Decode decodes an envelope from the reader, that was encoded using protocol +// buffers serialization format. +func (serializer) Decode(r io.Reader) (env *wire.Envelope, err error) { + env = &wire.Envelope{} + + protoEnv, err := readEnvelope(r) + if err != nil { + return nil, err + } + + env.Sender, env.Recipient, err = unmarshalSenderRecipient(protoEnv) + if err != nil { + return nil, err + } + + switch protoMsg := protoEnv.Msg.(type) { + case *Envelope_PingMsg: + env.Msg = toPingMsg(protoMsg) + case *Envelope_PongMsg: + env.Msg = toPongMsg(protoMsg) + case *Envelope_ShutdownMsg: + env.Msg = toShutdownMsg(protoMsg) + } + + return env, nil +} + +func readEnvelope(r io.Reader) (*Envelope, error) { + var size uint16 + if err := binary.Read(r, binary.BigEndian, &size); err != nil { + return nil, errors.Wrap(err, "reading size of data from wire") + } + data := make([]byte, size) + if _, err := r.Read(data); err != nil { + return nil, errors.Wrap(err, "reading data from wire") + } + var protoEnv Envelope + return &protoEnv, errors.Wrap(proto.Unmarshal(data, &protoEnv), "unmarshalling envelope") +} + +func unmarshalSenderRecipient(protoEnv *Envelope) (wire.Address, wire.Address, error) { + sender := wire.NewAddress() + if err := sender.UnmarshalBinary(protoEnv.Sender); err != nil { + return nil, nil, errors.Wrap(err, "unmarshalling sender address") + } + recipient := wire.NewAddress() + err := recipient.UnmarshalBinary(protoEnv.Recipient) + return sender, recipient, errors.Wrap(err, "unmarshalling recipient address") +} diff --git a/wire/protobuf/serializer_test.go b/wire/protobuf/serializer_test.go new file mode 100644 index 00000000..13c0c7da --- /dev/null +++ b/wire/protobuf/serializer_test.go @@ -0,0 +1,28 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protobuf_test + +import ( + "testing" + + _ "perun.network/go-perun/backend/sim/wallet" + _ "perun.network/go-perun/wire/protobuf" + protobuftest "perun.network/go-perun/wire/protobuf/test" + wiretest "perun.network/go-perun/wire/test" +) + +func TestControlMsgsSerialization(t *testing.T) { + wiretest.ControlMsgsSerializationTest(t, protobuftest.MsgSerializerTest) +} diff --git a/wire/protobuf/test/doc.go b/wire/protobuf/test/doc.go new file mode 100644 index 00000000..8aa64563 --- /dev/null +++ b/wire/protobuf/test/doc.go @@ -0,0 +1,17 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package test contains test helper functions for running generic tests for +// protobuf serialization. +package test // import "perun.network/go-perun/wire/protobuf/test" diff --git a/wire/protobuf/test/serializertest.go b/wire/protobuf/test/serializertest.go new file mode 100644 index 00000000..6872951f --- /dev/null +++ b/wire/protobuf/test/serializertest.go @@ -0,0 +1,51 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package test + +import ( + "bytes" + "math/rand" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + wallettest "perun.network/go-perun/wallet/test" + "perun.network/go-perun/wire" + pkgtest "polycry.pt/poly-go/test" +) + +// MsgSerializerTest runs multiple tests to check whether encoding and decoding +// of msg values works. +func MsgSerializerTest(t *testing.T, msg wire.Msg) { + t.Helper() + + rng := pkgtest.Prng(t) + envelope := newEnvelope(rng) + envelope.Msg = msg + + var buff bytes.Buffer + require.NoError(t, wire.EncodeEnvelope(&buff, envelope)) + + gotEnvelope, err := wire.DecodeEnvelope(&buff) + require.NoError(t, err) + assert.EqualValues(t, envelope, gotEnvelope) +} + +func newEnvelope(rng *rand.Rand) *wire.Envelope { + return &wire.Envelope{ + Sender: wallettest.NewRandomAddress(rng), + Recipient: wallettest.NewRandomAddress(rng), + } +} diff --git a/wire/test/msgstest.go b/wire/test/msgstest.go index b8308066..964bc8a4 100644 --- a/wire/test/msgstest.go +++ b/wire/test/msgstest.go @@ -24,8 +24,8 @@ import ( pkgtest "polycry.pt/poly-go/test" ) -// ControlMsgsTest runs serialization tests on control messages. -func ControlMsgsTest(t *testing.T, serializerTest func(t *testing.T, msg wire.Msg)) { +// ControlMsgsSerializationTest runs serialization tests on control messages. +func ControlMsgsSerializationTest(t *testing.T, serializerTest func(t *testing.T, msg wire.Msg)) { t.Helper() serializerTest(t, wire.NewPingMsg()) From f08fb8084c1976f854a3f1883309ad7744e8f396 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Tue, 8 Feb 2022 14:26:09 +0530 Subject: [PATCH 09/19] wire/test: Fix random string generation for tests - Previously, random string was generated by just converting an array of bytes. - In case of protobuf adapter this was causing a problem, as protobuf serializes strings using UTF-8 encoding and not all byte values are valid UTF-8 characters. - Hence, modify the random string function to generate only ASCII characters, which are a subset of valid UTF-8 characters. Signed-off-by: Manoranjith --- wire/controlmsgs.go | 2 ++ wire/test/msgstest.go | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/wire/controlmsgs.go b/wire/controlmsgs.go index 5ae16204..9d0c955e 100644 --- a/wire/controlmsgs.go +++ b/wire/controlmsgs.go @@ -90,6 +90,8 @@ func NewPongMsg() *PongMsg { } // ShutdownMsg is sent when orderly shutting down a connection. +// +// Reason should be a UTF-8 encodable string. type ShutdownMsg struct { Reason string } diff --git a/wire/test/msgstest.go b/wire/test/msgstest.go index 964bc8a4..1e9210e5 100644 --- a/wire/test/msgstest.go +++ b/wire/test/msgstest.go @@ -33,7 +33,7 @@ func ControlMsgsSerializationTest(t *testing.T, serializerTest func(t *testing.T minLen := 16 maxLenDiff := 16 rng := pkgtest.Prng(t) - serializerTest(t, &wire.ShutdownMsg{Reason: newRandomString(rng, minLen, maxLenDiff)}) + serializerTest(t, &wire.ShutdownMsg{Reason: newRandomASCIIString(rng, minLen, maxLenDiff)}) } // AuthMsgsTest runs serialization tests on auth message. @@ -44,10 +44,14 @@ func AuthMsgsTest(t *testing.T, serializerTest func(t *testing.T, msg wire.Msg)) serializerTest(t, wire.NewAuthResponseMsg(wallettest.NewRandomAccount(rng))) } -// newRandomstring returns a random ascii string of length between minLen and +// newRandomASCIIString returns a random ascii string of length between minLen and // minLen+maxLenDiff. -func newRandomString(rng *rand.Rand, minLen, maxLenDiff int) string { - r := make([]byte, minLen+rng.Intn(maxLenDiff)) - rng.Read(r) - return string(r) +func newRandomASCIIString(rng *rand.Rand, minLen, maxLenDiff int) string { + str := make([]byte, minLen+rng.Intn(maxLenDiff)) + const firstPrintableASCII = 32 + const lastPrintableASCII = 126 + for i := range str { + str[i] = byte(firstPrintableASCII + rng.Intn(lastPrintableASCII-firstPrintableASCII)) + } + return string(str) } From f1d93996341787fdb7a1dcfd8c40e8ee6ef945a5 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Thu, 10 Feb 2022 20:00:57 +0530 Subject: [PATCH 10/19] wire/protobuf: Impl serializer for auth msg Signed-off-by: Manoranjith --- wire/account_test.go | 2 +- wire/protobuf/serializer.go | 4 ++++ wire/protobuf/serializer_test.go | 4 ++++ wire/test/msgstest.go | 4 ++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/wire/account_test.go b/wire/account_test.go index be74c247..23c61791 100644 --- a/wire/account_test.go +++ b/wire/account_test.go @@ -23,5 +23,5 @@ import ( ) func TestAuthResponseMsg(t *testing.T) { - wiretest.AuthMsgsTest(t, peruniotest.MsgSerializerTest) + wiretest.AuthMsgsSerializationTest(t, peruniotest.MsgSerializerTest) } diff --git a/wire/protobuf/serializer.go b/wire/protobuf/serializer.go index f2f7c562..06a74859 100644 --- a/wire/protobuf/serializer.go +++ b/wire/protobuf/serializer.go @@ -41,6 +41,8 @@ func (serializer) Encode(w io.Writer, env *wire.Envelope) (err error) { protoEnv.Msg = fromPongMsg(msg) case *wire.ShutdownMsg: protoEnv.Msg = fromShutdownMsg(msg) + case *wire.AuthResponseMsg: + protoEnv.Msg = &Envelope_AuthResponseMsg{} } protoEnv.Sender, protoEnv.Recipient, err = marshalSenderRecipient(env) @@ -94,6 +96,8 @@ func (serializer) Decode(r io.Reader) (env *wire.Envelope, err error) { env.Msg = toPongMsg(protoMsg) case *Envelope_ShutdownMsg: env.Msg = toShutdownMsg(protoMsg) + case *Envelope_AuthResponseMsg: + env.Msg = &wire.AuthResponseMsg{} } return env, nil diff --git a/wire/protobuf/serializer_test.go b/wire/protobuf/serializer_test.go index 13c0c7da..c63ba401 100644 --- a/wire/protobuf/serializer_test.go +++ b/wire/protobuf/serializer_test.go @@ -26,3 +26,7 @@ import ( func TestControlMsgsSerialization(t *testing.T) { wiretest.ControlMsgsSerializationTest(t, protobuftest.MsgSerializerTest) } + +func TestAuthResponseMsgSerialization(t *testing.T) { + wiretest.AuthMsgsSerializationTest(t, protobuftest.MsgSerializerTest) +} diff --git a/wire/test/msgstest.go b/wire/test/msgstest.go index 1e9210e5..db0ecd5c 100644 --- a/wire/test/msgstest.go +++ b/wire/test/msgstest.go @@ -36,8 +36,8 @@ func ControlMsgsSerializationTest(t *testing.T, serializerTest func(t *testing.T serializerTest(t, &wire.ShutdownMsg{Reason: newRandomASCIIString(rng, minLen, maxLenDiff)}) } -// AuthMsgsTest runs serialization tests on auth message. -func AuthMsgsTest(t *testing.T, serializerTest func(t *testing.T, msg wire.Msg)) { +// AuthMsgsSerializationTest runs serialization tests on auth message. +func AuthMsgsSerializationTest(t *testing.T, serializerTest func(t *testing.T, msg wire.Msg)) { t.Helper() rng := pkgtest.Prng(t) From 826b7040917f05469c675f79c9797cdd397528e4 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Thu, 10 Feb 2022 20:34:40 +0530 Subject: [PATCH 11/19] wire/protobuf: Impl serializer for proposal msgs Signed-off-by: Manoranjith --- wire/protobuf/proposalmsgs.go | 429 +++++++++++++++++++++++++++++++ wire/protobuf/serializer.go | 35 ++- wire/protobuf/serializer_test.go | 6 + 3 files changed, 468 insertions(+), 2 deletions(-) create mode 100644 wire/protobuf/proposalmsgs.go diff --git a/wire/protobuf/proposalmsgs.go b/wire/protobuf/proposalmsgs.go new file mode 100644 index 00000000..0c55171c --- /dev/null +++ b/wire/protobuf/proposalmsgs.go @@ -0,0 +1,429 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protobuf + +import ( + "fmt" + "math" + "math/big" + + "github.com/pkg/errors" + "perun.network/go-perun/channel" + "perun.network/go-perun/client" + "perun.network/go-perun/wallet" + "perun.network/go-perun/wire" +) + +func toLedgerChannelProposalMsg(protoEnvMsg *Envelope_LedgerChannelProposalMsg) (msg *client.LedgerChannelProposalMsg, err error) { + protoMsg := protoEnvMsg.LedgerChannelProposalMsg + + msg = &client.LedgerChannelProposalMsg{} + msg.BaseChannelProposal, err = toBaseChannelProposal(protoMsg.BaseChannelProposal) + if err != nil { + return nil, err + } + msg.Participant, err = toWalletAddr(protoMsg.Participant) + if err != nil { + return nil, errors.WithMessage(err, "participant address") + } + msg.Peers, err = toWireAddrs(protoMsg.Peers) + return msg, errors.WithMessage(err, "peers") +} + +func toSubChannelProposalMsg(protoEnvMsg *Envelope_SubChannelProposalMsg) (msg *client.SubChannelProposalMsg, err error) { + protoMsg := protoEnvMsg.SubChannelProposalMsg + + msg = &client.SubChannelProposalMsg{} + copy(msg.Parent[:], protoMsg.Parent) + msg.BaseChannelProposal, err = toBaseChannelProposal(protoMsg.BaseChannelProposal) + return msg, err +} + +func toVirtualChannelProposalMsg(protoEnvMsg *Envelope_VirtualChannelProposalMsg) (msg *client.VirtualChannelProposalMsg, err error) { + protoMsg := protoEnvMsg.VirtualChannelProposalMsg + + msg = &client.VirtualChannelProposalMsg{} + msg.BaseChannelProposal, err = toBaseChannelProposal(protoMsg.BaseChannelProposal) + if err != nil { + return nil, err + } + msg.Proposer, err = toWalletAddr(protoMsg.Proposer) + if err != nil { + return nil, errors.WithMessage(err, "proposer") + } + msg.Parents = make([]channel.ID, len(protoMsg.Parents)) + for i := range protoMsg.Parents { + copy(msg.Parents[i][:], protoMsg.Parents[i]) + } + msg.IndexMaps = make([][]channel.Index, len(protoMsg.IndexMaps)) + for i := range protoMsg.IndexMaps { + msg.IndexMaps[i], err = toIndexMap(protoMsg.IndexMaps[i].IndexMap) + if err != nil { + return nil, err + } + } + msg.Peers, err = toWireAddrs(protoMsg.Peers) + return msg, errors.WithMessage(err, "peers") +} + +func toLedgerChannelProposalAccMsg(protoEnvMsg *Envelope_LedgerChannelProposalAccMsg) (msg *client.LedgerChannelProposalAccMsg, err error) { + protoMsg := protoEnvMsg.LedgerChannelProposalAccMsg + + msg = &client.LedgerChannelProposalAccMsg{} + msg.BaseChannelProposalAcc = toBaseChannelProposalAcc(protoMsg.BaseChannelProposalAcc) + msg.Participant, err = toWalletAddr(protoMsg.Participant) + return msg, errors.WithMessage(err, "participant") +} + +func toSubChannelProposalAccMsg(protoEnvMsg *Envelope_SubChannelProposalAccMsg) (msg *client.SubChannelProposalAccMsg) { + protoMsg := protoEnvMsg.SubChannelProposalAccMsg + + msg = &client.SubChannelProposalAccMsg{} + msg.BaseChannelProposalAcc = toBaseChannelProposalAcc(protoMsg.BaseChannelProposalAcc) + return msg +} + +func toVirtualChannelProposalAccMsg(protoEnvMsg *Envelope_VirtualChannelProposalAccMsg) (msg *client.VirtualChannelProposalAccMsg, err error) { + protoMsg := protoEnvMsg.VirtualChannelProposalAccMsg + + msg = &client.VirtualChannelProposalAccMsg{} + msg.BaseChannelProposalAcc = toBaseChannelProposalAcc(protoMsg.BaseChannelProposalAcc) + msg.Responder, err = toWalletAddr(protoMsg.Responder) + return msg, errors.WithMessage(err, "responder") +} + +func toChannelProposalRejMsg(protoEnvMsg *Envelope_ChannelProposalRejMsg) (msg *client.ChannelProposalRejMsg) { + protoMsg := protoEnvMsg.ChannelProposalRejMsg + + msg = &client.ChannelProposalRejMsg{} + copy(msg.ProposalID[:], protoMsg.ProposalId) + msg.Reason = protoMsg.Reason + return msg +} + +func toWalletAddr(protoAddr []byte) (wallet.Address, error) { + addr := wallet.NewAddress() + return addr, addr.UnmarshalBinary(protoAddr) +} + +func toWireAddrs(protoAddrs [][]byte) ([]wire.Address, error) { + addrs := make([]wire.Address, len(protoAddrs)) + for i := range protoAddrs { + addrs[i] = wire.NewAddress() + err := addrs[i].UnmarshalBinary(protoAddrs[i]) + if err != nil { + return nil, errors.WithMessagef(err, "%d'th address", i) + } + } + return addrs, nil +} + +func toBaseChannelProposal(protoProp *BaseChannelProposal) (prop client.BaseChannelProposal, err error) { + prop.ChallengeDuration = protoProp.ChallengeDuration + copy(prop.ProposalID[:], protoProp.ProposalId) + copy(prop.NonceShare[:], protoProp.NonceShare) + prop.InitBals, err = toAllocation(protoProp.InitBals) + if err != nil { + return prop, errors.WithMessage(err, "init bals") + } + prop.FundingAgreement = toBalances(protoProp.FundingAgreement) + if err != nil { + return prop, errors.WithMessage(err, "funding agreement") + } + prop.App, prop.InitData, err = toAppAndData(protoProp.App, protoProp.InitData) + return prop, err +} + +func toBaseChannelProposalAcc(protoPropAcc *BaseChannelProposalAcc) (propAcc client.BaseChannelProposalAcc) { + copy(propAcc.ProposalID[:], protoPropAcc.ProposalId) + copy(propAcc.NonceShare[:], protoPropAcc.NonceShare) + return +} + +func toAppAndData(protoApp, protoData []byte) (app channel.App, data channel.Data, err error) { + if len(protoApp) == 0 { + app = channel.NoApp() + data = channel.NoData() + return app, data, nil + } + appDef := wallet.NewAddress() + err = appDef.UnmarshalBinary(protoApp) + if err != nil { + return nil, nil, err + } + app, err = channel.Resolve(appDef) + if err != nil { + return + } + data = app.NewData() + return app, data, data.UnmarshalBinary(protoData) +} + +func toAllocation(protoAlloc *Allocation) (alloc *channel.Allocation, err error) { + alloc = &channel.Allocation{} + alloc.Assets = make([]channel.Asset, len(protoAlloc.Assets)) + for i := range protoAlloc.Assets { + alloc.Assets[i] = channel.NewAsset() + err = alloc.Assets[i].UnmarshalBinary(protoAlloc.Assets[i]) + if err != nil { + return nil, errors.WithMessagef(err, "%d'th asset", i) + } + } + alloc.Locked = make([]channel.SubAlloc, len(protoAlloc.Locked)) + for i := range protoAlloc.Locked { + alloc.Locked[i], err = toSubAlloc(protoAlloc.Locked[i]) + if err != nil { + return nil, errors.WithMessagef(err, "%d'th sub alloc", i) + } + } + alloc.Balances = toBalances(protoAlloc.Balances) + return alloc, nil +} + +func toBalances(protoBalances *Balances) (balances channel.Balances) { + balances = make([][]channel.Bal, len(protoBalances.Balances)) + for i := range protoBalances.Balances { + balances[i] = toBalance(protoBalances.Balances[i]) + } + return balances +} + +func toBalance(protoBalance *Balance) (balance []channel.Bal) { + balance = make([]channel.Bal, len(protoBalance.Balance)) + for j := range protoBalance.Balance { + balance[j] = new(big.Int).SetBytes(protoBalance.Balance[j]) + } + return balance +} + +func toSubAlloc(protoSubAlloc *SubAlloc) (subAlloc channel.SubAlloc, err error) { + subAlloc = channel.SubAlloc{} + subAlloc.Bals = toBalance(protoSubAlloc.Bals) + if len(protoSubAlloc.Id) != len(subAlloc.ID) { + return subAlloc, errors.New("sub alloc id has incorrect length") + } + copy(subAlloc.ID[:], protoSubAlloc.Id) + subAlloc.IndexMap, err = toIndexMap(protoSubAlloc.IndexMap.IndexMap) + return subAlloc, err +} + +func toIndexMap(protoIndexMap []uint32) (indexMap []channel.Index, err error) { + indexMap = make([]channel.Index, len(protoIndexMap)) + for i := range protoIndexMap { + if protoIndexMap[i] > math.MaxUint16 { + return nil, fmt.Errorf("%d'th index is invalid", i) + } + indexMap[i] = channel.Index(uint16(protoIndexMap[i])) + } + return indexMap, nil +} + +func fromLedgerChannelProposalMsg(msg *client.LedgerChannelProposalMsg) (_ *Envelope_LedgerChannelProposalMsg, err error) { + protoMsg := &LedgerChannelProposalMsg{} + protoMsg.BaseChannelProposal, err = fromBaseChannelProposal(msg.BaseChannelProposal) + if err != nil { + return nil, err + } + protoMsg.Participant, err = fromWalletAddr(msg.Participant) + if err != nil { + return nil, errors.WithMessage(err, "participant address") + } + protoMsg.Peers, err = fromWireAddrs(msg.Peers) + return &Envelope_LedgerChannelProposalMsg{protoMsg}, errors.WithMessage(err, "peers") +} + +func fromSubChannelProposalMsg(msg *client.SubChannelProposalMsg) (_ *Envelope_SubChannelProposalMsg, err error) { + protoMsg := &SubChannelProposalMsg{} + protoMsg.Parent = make([]byte, len(msg.Parent)) + copy(protoMsg.Parent, msg.Parent[:]) + protoMsg.BaseChannelProposal, err = fromBaseChannelProposal(msg.BaseChannelProposal) + return &Envelope_SubChannelProposalMsg{protoMsg}, err +} + +func fromVirtualChannelProposalMsg(msg *client.VirtualChannelProposalMsg) (_ *Envelope_VirtualChannelProposalMsg, err error) { + protoMsg := &VirtualChannelProposalMsg{} + protoMsg.BaseChannelProposal, err = fromBaseChannelProposal(msg.BaseChannelProposal) + if err != nil { + return nil, err + } + protoMsg.Proposer, err = fromWalletAddr(msg.Proposer) + if err != nil { + return nil, err + } + protoMsg.Parents = make([][]byte, len(msg.Parents)) + for i := range msg.Parents { + protoMsg.Parents[i] = make([]byte, len(msg.Parents[i])) + copy(protoMsg.Parents[i], msg.Parents[i][:]) + } + protoMsg.IndexMaps = make([]*IndexMap, len(msg.IndexMaps)) + for i := range msg.IndexMaps { + protoMsg.IndexMaps[i] = &IndexMap{IndexMap: fromIndexMap(msg.IndexMaps[i])} + } + protoMsg.Peers, err = fromWireAddrs(msg.Peers) + return &Envelope_VirtualChannelProposalMsg{protoMsg}, errors.WithMessage(err, "peers") +} + +func fromLedgerChannelProposalAccMsg(msg *client.LedgerChannelProposalAccMsg) (_ *Envelope_LedgerChannelProposalAccMsg, err error) { + protoMsg := &LedgerChannelProposalAccMsg{} + protoMsg.BaseChannelProposalAcc = fromBaseChannelProposalAcc(msg.BaseChannelProposalAcc) + protoMsg.Participant, err = fromWalletAddr(msg.Participant) + return &Envelope_LedgerChannelProposalAccMsg{protoMsg}, errors.WithMessage(err, "participant") +} + +func fromSubChannelProposalAccMsg(msg *client.SubChannelProposalAccMsg) (_ *Envelope_SubChannelProposalAccMsg) { + protoMsg := &SubChannelProposalAccMsg{} + protoMsg.BaseChannelProposalAcc = fromBaseChannelProposalAcc(msg.BaseChannelProposalAcc) + return &Envelope_SubChannelProposalAccMsg{protoMsg} +} + +func fromVirtualChannelProposalAccMsg(msg *client.VirtualChannelProposalAccMsg) (_ *Envelope_VirtualChannelProposalAccMsg, err error) { + protoMsg := &VirtualChannelProposalAccMsg{} + protoMsg.BaseChannelProposalAcc = fromBaseChannelProposalAcc(msg.BaseChannelProposalAcc) + protoMsg.Responder, err = fromWalletAddr(msg.Responder) + return &Envelope_VirtualChannelProposalAccMsg{protoMsg}, errors.WithMessage(err, "responder") +} + +func fromChannelProposalRejMsg(msg *client.ChannelProposalRejMsg) (_ *Envelope_ChannelProposalRejMsg) { + protoMsg := &ChannelProposalRejMsg{} + protoMsg.ProposalId = make([]byte, len(msg.ProposalID)) + copy(protoMsg.ProposalId, msg.ProposalID[:]) + protoMsg.Reason = msg.Reason + return &Envelope_ChannelProposalRejMsg{protoMsg} +} + +func fromWalletAddr(addr wallet.Address) ([]byte, error) { + return addr.MarshalBinary() +} + +func fromWireAddrs(addrs []wire.Address) (protoAddrs [][]byte, err error) { + protoAddrs = make([][]byte, len(addrs)) + for i := range addrs { + protoAddrs[i], err = addrs[i].MarshalBinary() + if err != nil { + return nil, errors.WithMessagef(err, "%d'th address", i) + } + } + return protoAddrs, nil +} + +func fromBaseChannelProposal(prop client.BaseChannelProposal) (protoProp *BaseChannelProposal, err error) { + protoProp = &BaseChannelProposal{} + + protoProp.ProposalId = make([]byte, len(prop.ProposalID)) + copy(protoProp.ProposalId, prop.ProposalID[:]) + + protoProp.NonceShare = make([]byte, len(prop.NonceShare)) + copy(protoProp.NonceShare, prop.NonceShare[:]) + + protoProp.ChallengeDuration = prop.ChallengeDuration + + protoProp.InitBals, err = fromAllocation(*prop.InitBals) + if err != nil { + return nil, errors.WithMessage(err, "init bals") + } + protoProp.FundingAgreement, err = fromBalances(prop.FundingAgreement) + if err != nil { + return nil, errors.WithMessage(err, "funding agreement") + } + protoProp.App, protoProp.InitData, err = fromAppAndData(prop.App, prop.InitData) + return protoProp, err +} + +func fromBaseChannelProposalAcc(propAcc client.BaseChannelProposalAcc) (protoPropAcc *BaseChannelProposalAcc) { + protoPropAcc = &BaseChannelProposalAcc{} + protoPropAcc.ProposalId = make([]byte, len(propAcc.ProposalID)) + protoPropAcc.NonceShare = make([]byte, len(propAcc.NonceShare)) + copy(protoPropAcc.ProposalId, propAcc.ProposalID[:]) + copy(protoPropAcc.NonceShare, propAcc.NonceShare[:]) + return protoPropAcc +} + +func fromAppAndData(app channel.App, data channel.Data) (protoApp, protoData []byte, err error) { + if channel.IsNoApp(app) { + return []byte{}, []byte{}, nil + } + protoApp, err = app.Def().MarshalBinary() + if err != nil { + return []byte{}, []byte{}, err + } + protoData, err = data.MarshalBinary() + return protoApp, protoData, err +} + +func fromAllocation(alloc channel.Allocation) (protoAlloc *Allocation, err error) { + protoAlloc = &Allocation{} + protoAlloc.Assets = make([][]byte, len(alloc.Assets)) + for i := range alloc.Assets { + protoAlloc.Assets[i], err = alloc.Assets[i].MarshalBinary() + if err != nil { + return nil, errors.WithMessagef(err, "%d'th asset", i) + } + } + locked := make([]*SubAlloc, len(alloc.Locked)) + for i := range alloc.Locked { + locked[i], err = fromSubAlloc(alloc.Locked[i]) + if err != nil { + return nil, errors.WithMessagef(err, "%d'th sub alloc", i) + } + } + protoAlloc.Balances, err = fromBalances(alloc.Balances) + return protoAlloc, err +} + +func fromBalances(balances channel.Balances) (protoBalances *Balances, err error) { + protoBalances = &Balances{ + Balances: make([]*Balance, len(balances)), + } + for i := range balances { + protoBalances.Balances[i], err = fromBalance(balances[i]) + if err != nil { + return nil, errors.WithMessagef(err, "%d'th balance", i) + } + } + return protoBalances, nil +} + +func fromBalance(balance []channel.Bal) (protoBalance *Balance, err error) { + protoBalance = &Balance{ + Balance: make([][]byte, len(balance)), + } + for i := range balance { + if balance[i] == nil { + return nil, fmt.Errorf("%d'th amount is nil", i) + } + if balance[i].Sign() == -1 { + return nil, fmt.Errorf("%d'th amount is negative", i) + } + protoBalance.Balance[i] = balance[i].Bytes() + } + return protoBalance, nil +} + +func fromSubAlloc(subAlloc channel.SubAlloc) (protoSubAlloc *SubAlloc, err error) { + protoSubAlloc = &SubAlloc{} + protoSubAlloc.Id = make([]byte, len(subAlloc.ID)) + copy(protoSubAlloc.Id, subAlloc.ID[:]) + protoSubAlloc.IndexMap = &IndexMap{IndexMap: fromIndexMap(subAlloc.IndexMap)} + protoSubAlloc.Bals, err = fromBalance(subAlloc.Bals) + return protoSubAlloc, err +} + +func fromIndexMap(indexMap []channel.Index) (protoIndexMap []uint32) { + protoIndexMap = make([]uint32, len(indexMap)) + for i := range indexMap { + protoIndexMap[i] = uint32(indexMap[i]) + } + return protoIndexMap +} diff --git a/wire/protobuf/serializer.go b/wire/protobuf/serializer.go index 06a74859..8ffd792f 100644 --- a/wire/protobuf/serializer.go +++ b/wire/protobuf/serializer.go @@ -20,6 +20,7 @@ import ( "github.com/pkg/errors" "google.golang.org/protobuf/proto" + "perun.network/go-perun/client" "perun.network/go-perun/wire" ) @@ -43,8 +44,24 @@ func (serializer) Encode(w io.Writer, env *wire.Envelope) (err error) { protoEnv.Msg = fromShutdownMsg(msg) case *wire.AuthResponseMsg: protoEnv.Msg = &Envelope_AuthResponseMsg{} + case *client.LedgerChannelProposalMsg: + protoEnv.Msg, err = fromLedgerChannelProposalMsg(msg) + case *client.SubChannelProposalMsg: + protoEnv.Msg, err = fromSubChannelProposalMsg(msg) + case *client.VirtualChannelProposalMsg: + protoEnv.Msg, err = fromVirtualChannelProposalMsg(msg) + case *client.LedgerChannelProposalAccMsg: + protoEnv.Msg, err = fromLedgerChannelProposalAccMsg(msg) + case *client.SubChannelProposalAccMsg: + protoEnv.Msg = fromSubChannelProposalAccMsg(msg) + case *client.VirtualChannelProposalAccMsg: + protoEnv.Msg, err = fromVirtualChannelProposalAccMsg(msg) + case *client.ChannelProposalRejMsg: + protoEnv.Msg = fromChannelProposalRejMsg(msg) + } + if err != nil { + return err } - protoEnv.Sender, protoEnv.Recipient, err = marshalSenderRecipient(env) if err != nil { return err @@ -98,9 +115,23 @@ func (serializer) Decode(r io.Reader) (env *wire.Envelope, err error) { env.Msg = toShutdownMsg(protoMsg) case *Envelope_AuthResponseMsg: env.Msg = &wire.AuthResponseMsg{} + case *Envelope_LedgerChannelProposalMsg: + env.Msg, err = toLedgerChannelProposalMsg(protoMsg) + case *Envelope_SubChannelProposalMsg: + env.Msg, err = toSubChannelProposalMsg(protoMsg) + case *Envelope_VirtualChannelProposalMsg: + env.Msg, err = toVirtualChannelProposalMsg(protoMsg) + case *Envelope_LedgerChannelProposalAccMsg: + env.Msg, err = toLedgerChannelProposalAccMsg(protoMsg) + case *Envelope_SubChannelProposalAccMsg: + env.Msg = toSubChannelProposalAccMsg(protoMsg) + case *Envelope_VirtualChannelProposalAccMsg: + env.Msg, err = toVirtualChannelProposalAccMsg(protoMsg) + case *Envelope_ChannelProposalRejMsg: + env.Msg = toChannelProposalRejMsg(protoMsg) } - return env, nil + return env, err } func readEnvelope(r io.Reader) (*Envelope, error) { diff --git a/wire/protobuf/serializer_test.go b/wire/protobuf/serializer_test.go index c63ba401..57caa3c5 100644 --- a/wire/protobuf/serializer_test.go +++ b/wire/protobuf/serializer_test.go @@ -17,7 +17,9 @@ package protobuf_test import ( "testing" + _ "perun.network/go-perun/backend/sim/channel" _ "perun.network/go-perun/backend/sim/wallet" + clienttest "perun.network/go-perun/client/test" _ "perun.network/go-perun/wire/protobuf" protobuftest "perun.network/go-perun/wire/protobuf/test" wiretest "perun.network/go-perun/wire/test" @@ -30,3 +32,7 @@ func TestControlMsgsSerialization(t *testing.T) { func TestAuthResponseMsgSerialization(t *testing.T) { wiretest.AuthMsgsSerializationTest(t, protobuftest.MsgSerializerTest) } + +func TestProposalMsgsSerialization(t *testing.T) { + clienttest.ProposalMsgsSerializationTest(t, protobuftest.MsgSerializerTest) +} From 57e48716d58c38d26367ba9e1f8e9bcac1f79474 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 11 Feb 2022 18:16:38 +0530 Subject: [PATCH 12/19] client/test: Fix random string generation for tests - Previously, random string was generated by just converting an array of bytes. - In case of protobuf adapter this was causing a problem, as protobuf serializes strings using UTF-8 encoding and not all byte values are valid UTF-8 characters. - Hence, modify the random string function to generate only ASCII characters, which are a subset of valid UTF-8 characters. Signed-off-by: Manoranjith --- client/proposal.go | 2 ++ client/proposalmsgs.go | 2 ++ client/test/proposalmsgs.go | 16 ++++++++++------ client/test/updatemsgs.go | 2 +- client/updatemsgs.go | 2 ++ 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/client/proposal.go b/client/proposal.go index 1d8c57e8..f1d22dfe 100644 --- a/client/proposal.go +++ b/client/proposal.go @@ -68,6 +68,8 @@ type ( // PeerRejectedError indicates the channel proposal or channel update was // rejected by the peer. + // + // Reason should be a UTF-8 encodable string. PeerRejectedError struct { ItemType string // ItemType indicates the type of item rejected (channel proposal or channel update). Reason string // Reason sent by the peer for the rejection. diff --git a/client/proposalmsgs.go b/client/proposalmsgs.go index 612829c6..6115587c 100644 --- a/client/proposalmsgs.go +++ b/client/proposalmsgs.go @@ -487,6 +487,8 @@ func (acc *SubChannelProposalAccMsg) Decode(r io.Reader) error { // // The message is one of two possible responses in the // Multi-Party Channel Proposal Protocol (MPCPP). +// +// Reason should be a UTF-8 encodable string. type ChannelProposalRejMsg struct { ProposalID ProposalID // The channel proposal to reject. Reason string // The rejection reason. diff --git a/client/test/proposalmsgs.go b/client/test/proposalmsgs.go index 94661a80..c8984807 100644 --- a/client/test/proposalmsgs.go +++ b/client/test/proposalmsgs.go @@ -99,7 +99,7 @@ func channelProposalRejSerializationTest(t *testing.T, serializerTest func(t *te for i := 0; i < 16; i++ { m := &client.ChannelProposalRejMsg{ ProposalID: newRandomProposalID(rng), - Reason: newRandomString(rng, minLen, maxLenDiff), + Reason: newRandomASCIIString(rng, minLen, maxLenDiff), } serializerTest(t, m) } @@ -110,10 +110,14 @@ func newRandomProposalID(rng *rand.Rand) (id client.ProposalID) { return } -// newRandomstring returns a random ascii string of length between minLen and +// newRandomASCIIString returns a random ascii string of length between minLen and // minLen+maxLenDiff. -func newRandomString(rng *rand.Rand, minLen, maxLenDiff int) string { - r := make([]byte, minLen+rng.Intn(maxLenDiff)) - rng.Read(r) - return string(r) +func newRandomASCIIString(rng *rand.Rand, minLen, maxLenDiff int) string { + str := make([]byte, minLen+rng.Intn(maxLenDiff)) + const firstPrintableASCII = 32 + const lastPrintableASCII = 126 + for i := range str { + str[i] = byte(firstPrintableASCII + rng.Intn(lastPrintableASCII-firstPrintableASCII)) + } + return string(str) } diff --git a/client/test/updatemsgs.go b/client/test/updatemsgs.go index 268a45dc..676617cb 100644 --- a/client/test/updatemsgs.go +++ b/client/test/updatemsgs.go @@ -113,7 +113,7 @@ func channelUpdateRejSerializationTest(t *testing.T, serializerTest func(t *test m := &client.ChannelUpdateRejMsg{ ChannelID: test.NewRandomChannelID(rng), Version: uint64(rng.Int63()), - Reason: newRandomString(rng, minLen, maxLenDiff), + Reason: newRandomASCIIString(rng, minLen, maxLenDiff), } serializerTest(t, m) } diff --git a/client/updatemsgs.go b/client/updatemsgs.go index 22c1f36b..6a06f325 100644 --- a/client/updatemsgs.go +++ b/client/updatemsgs.go @@ -95,6 +95,8 @@ type ( // ChannelUpdateRejMsg is the wire message sent as a negative reply to a // ChannelUpdate. It references the channel ID and version and states a // reason for the rejection. + // + // Reason should be a UTF-8 encodable string. ChannelUpdateRejMsg struct { // ChannelID is the channel ID. ChannelID channel.ID From 173b6b05d5ae82fd7e338cd9c501f6e7da0714e8 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 11 Feb 2022 20:35:30 +0530 Subject: [PATCH 13/19] wire/protobuf: Impl serializer for update msgs Signed-off-by: Manoranjith --- wire/protobuf/proposalmsgs.go | 45 ++++++ wire/protobuf/serializer.go | 20 +++ wire/protobuf/serializer_test.go | 4 + wire/protobuf/updatemsgs.go | 253 +++++++++++++++++++++++++++++++ 4 files changed, 322 insertions(+) create mode 100644 wire/protobuf/updatemsgs.go diff --git a/wire/protobuf/proposalmsgs.go b/wire/protobuf/proposalmsgs.go index 0c55171c..846ceb56 100644 --- a/wire/protobuf/proposalmsgs.go +++ b/wire/protobuf/proposalmsgs.go @@ -118,6 +118,18 @@ func toWalletAddr(protoAddr []byte) (wallet.Address, error) { return addr, addr.UnmarshalBinary(protoAddr) } +func toWalletAddrs(protoAddrs [][]byte) ([]wallet.Address, error) { + addrs := make([]wallet.Address, len(protoAddrs)) + for i := range protoAddrs { + addrs[i] = wire.NewAddress() + err := addrs[i].UnmarshalBinary(protoAddrs[i]) + if err != nil { + return nil, errors.WithMessagef(err, "%d'th address", i) + } + } + return addrs, nil +} + func toWireAddrs(protoAddrs [][]byte) ([]wire.Address, error) { addrs := make([]wire.Address, len(protoAddrs)) for i := range protoAddrs { @@ -152,6 +164,20 @@ func toBaseChannelProposalAcc(protoPropAcc *BaseChannelProposalAcc) (propAcc cli return } +func toApp(protoApp []byte) (app channel.App, err error) { + if len(protoApp) == 0 { + app = channel.NoApp() + return app, nil + } + appDef := wallet.NewAddress() + err = appDef.UnmarshalBinary(protoApp) + if err != nil { + return app, err + } + app, err = channel.Resolve(appDef) + return app, err +} + func toAppAndData(protoApp, protoData []byte) (app channel.App, data channel.Data, err error) { if len(protoApp) == 0 { app = channel.NoApp() @@ -307,6 +333,17 @@ func fromWalletAddr(addr wallet.Address) ([]byte, error) { return addr.MarshalBinary() } +func fromWalletAddrs(addrs []wallet.Address) (protoAddrs [][]byte, err error) { + protoAddrs = make([][]byte, len(addrs)) + for i := range addrs { + protoAddrs[i], err = addrs[i].MarshalBinary() + if err != nil { + return nil, errors.WithMessagef(err, "%d'th address", i) + } + } + return protoAddrs, nil +} + func fromWireAddrs(addrs []wire.Address) (protoAddrs [][]byte, err error) { protoAddrs = make([][]byte, len(addrs)) for i := range addrs { @@ -350,6 +387,14 @@ func fromBaseChannelProposalAcc(propAcc client.BaseChannelProposalAcc) (protoPro return protoPropAcc } +func fromApp(app channel.App) (protoApp []byte, err error) { + if channel.IsNoApp(app) { + return []byte{}, nil + } + protoApp, err = app.Def().MarshalBinary() + return protoApp, err +} + func fromAppAndData(app channel.App, data channel.Data) (protoApp, protoData []byte, err error) { if channel.IsNoApp(app) { return []byte{}, []byte{}, nil diff --git a/wire/protobuf/serializer.go b/wire/protobuf/serializer.go index 8ffd792f..4d29cbc9 100644 --- a/wire/protobuf/serializer.go +++ b/wire/protobuf/serializer.go @@ -58,6 +58,16 @@ func (serializer) Encode(w io.Writer, env *wire.Envelope) (err error) { protoEnv.Msg, err = fromVirtualChannelProposalAccMsg(msg) case *client.ChannelProposalRejMsg: protoEnv.Msg = fromChannelProposalRejMsg(msg) + case *client.ChannelUpdateMsg: + protoEnv.Msg, err = fromChannelUpdateMsg(msg) + case *client.VirtualChannelFundingProposalMsg: + protoEnv.Msg, err = fromVirtualChannelFundingProposalMsg(msg) + case *client.VirtualChannelSettlementProposalMsg: + protoEnv.Msg, err = fromVirtualChannelSettlementProposalMsg(msg) + case *client.ChannelUpdateAccMsg: + protoEnv.Msg = fromChannelUpdateAccMsg(msg) + case *client.ChannelUpdateRejMsg: + protoEnv.Msg = fromChannelUpdateRejMsg(msg) } if err != nil { return err @@ -129,6 +139,16 @@ func (serializer) Decode(r io.Reader) (env *wire.Envelope, err error) { env.Msg, err = toVirtualChannelProposalAccMsg(protoMsg) case *Envelope_ChannelProposalRejMsg: env.Msg = toChannelProposalRejMsg(protoMsg) + case *Envelope_ChannelUpdateMsg: + env.Msg, err = toChannelUpdateMsg(protoMsg) + case *Envelope_VirtualChannelFundingProposalMsg: + env.Msg, err = toVirtualChannelFundingProposalMsg(protoMsg) + case *Envelope_VirtualChannelSettlementProposalMsg: + env.Msg, err = toVirtualChannelSettlementProposalMsg(protoMsg) + case *Envelope_ChannelUpdateAccMsg: + env.Msg = toChannelUpdateAccMsg(protoMsg) + case *Envelope_ChannelUpdateRejMsg: + env.Msg = toChannelUpdateRejMsg(protoMsg) } return env, err diff --git a/wire/protobuf/serializer_test.go b/wire/protobuf/serializer_test.go index 57caa3c5..7df86aed 100644 --- a/wire/protobuf/serializer_test.go +++ b/wire/protobuf/serializer_test.go @@ -36,3 +36,7 @@ func TestAuthResponseMsgSerialization(t *testing.T) { func TestProposalMsgsSerialization(t *testing.T) { clienttest.ProposalMsgsSerializationTest(t, protobuftest.MsgSerializerTest) } + +func TestUpdateMsgsSerialization(t *testing.T) { + clienttest.UpdateMsgsSerializationTest(t, protobuftest.MsgSerializerTest) +} diff --git a/wire/protobuf/updatemsgs.go b/wire/protobuf/updatemsgs.go new file mode 100644 index 00000000..8aa6ace9 --- /dev/null +++ b/wire/protobuf/updatemsgs.go @@ -0,0 +1,253 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protobuf + +import ( + "math" + "math/big" + + "github.com/pkg/errors" + "perun.network/go-perun/channel" + "perun.network/go-perun/client" +) + +func toChannelUpdateMsg(protoEnvMsg *Envelope_ChannelUpdateMsg) (*client.ChannelUpdateMsg, error) { + update, err := toChannelUpdate(protoEnvMsg.ChannelUpdateMsg) + return &update, err +} + +func toVirtualChannelFundingProposalMsg(protoEnvMsg *Envelope_VirtualChannelFundingProposalMsg) ( + msg *client.VirtualChannelFundingProposalMsg, + err error, +) { + protoMsg := protoEnvMsg.VirtualChannelFundingProposalMsg + + msg = &client.VirtualChannelFundingProposalMsg{} + msg.Initial, err = toSignedState(protoMsg.Initial) + if err != nil { + return nil, errors.WithMessage(err, "initial state") + } + msg.IndexMap, err = toIndexMap(protoMsg.IndexMap.IndexMap) + if err != nil { + return nil, err + } + msg.ChannelUpdateMsg, err = toChannelUpdate(protoMsg.ChannelUpdateMsg) + return msg, err +} + +func toVirtualChannelSettlementProposalMsg(protoEnvMsg *Envelope_VirtualChannelSettlementProposalMsg) ( + msg *client.VirtualChannelSettlementProposalMsg, + err error, +) { + protoMsg := protoEnvMsg.VirtualChannelSettlementProposalMsg + + msg = &client.VirtualChannelSettlementProposalMsg{} + msg.Final, err = toSignedState(protoMsg.Final) + if err != nil { + return nil, errors.WithMessage(err, "final state") + } + msg.ChannelUpdateMsg, err = toChannelUpdate(protoMsg.ChannelUpdateMsg) + return msg, err +} + +func toChannelUpdateAccMsg(protoEnvMsg *Envelope_ChannelUpdateAccMsg) (msg *client.ChannelUpdateAccMsg) { + protoMsg := protoEnvMsg.ChannelUpdateAccMsg + + msg = &client.ChannelUpdateAccMsg{} + copy(msg.ChannelID[:], protoMsg.ChannelId) + msg.Version = protoMsg.Version + msg.Sig = make([]byte, len(protoMsg.Sig)) + copy(msg.Sig, protoMsg.Sig) + return msg +} + +func toChannelUpdateRejMsg(protoEnvMsg *Envelope_ChannelUpdateRejMsg) (msg *client.ChannelUpdateRejMsg) { + protoMsg := protoEnvMsg.ChannelUpdateRejMsg + + msg = &client.ChannelUpdateRejMsg{} + copy(msg.ChannelID[:], protoMsg.ChannelId) + msg.Version = protoMsg.Version + msg.Reason = protoMsg.Reason + return msg +} + +func toChannelUpdate(protoUpdate *ChannelUpdateMsg) (update client.ChannelUpdateMsg, err error) { + if protoUpdate.ChannelUpdate.ActorIdx > math.MaxUint16 { + return update, errors.New("actor index is invalid") + } + update.ActorIdx = channel.Index(protoUpdate.ChannelUpdate.ActorIdx) + update.Sig = make([]byte, len(protoUpdate.Sig)) + copy(update.Sig, protoUpdate.Sig) + update.State, err = toState(protoUpdate.ChannelUpdate.State) + return update, err +} + +func toSignedState(protoSignedState *SignedState) (signedState channel.SignedState, err error) { + signedState.Params, err = toParams(protoSignedState.Params) + if err != nil { + return signedState, err + } + signedState.Sigs = make([][]byte, len(protoSignedState.Sigs)) + for i := range protoSignedState.Sigs { + signedState.Sigs[i] = make([]byte, len(protoSignedState.Sigs[i])) + copy(signedState.Sigs[i], protoSignedState.Sigs[i]) + } + signedState.State, err = toState(protoSignedState.State) + return signedState, err +} + +func toParams(protoParams *Params) (*channel.Params, error) { + app, err := toApp(protoParams.App) + if err != nil { + return nil, err + } + parts, err := toWalletAddrs(protoParams.Parts) + if err != nil { + return nil, errors.WithMessage(err, "parts") + } + params := channel.NewParamsUnsafe( + protoParams.ChallengeDuration, + parts, + app, + (new(big.Int)).SetBytes(protoParams.Nonce), + protoParams.LedgerChannel, + protoParams.VirtualChannel) + + return params, nil +} + +func toState(protoState *State) (state *channel.State, err error) { + state = &channel.State{} + copy(state.ID[:], protoState.Id) + state.Version = protoState.Version + state.IsFinal = protoState.IsFinal + allocation, err := toAllocation(protoState.Allocation) + if err != nil { + return nil, errors.WithMessage(err, "allocation") + } + state.Allocation = *allocation + state.App, state.Data, err = toAppAndData(protoState.App, protoState.Data) + return state, err +} + +func fromChannelUpdateMsg(msg *client.ChannelUpdateMsg) (*Envelope_ChannelUpdateMsg, error) { + protoMsg, err := fromChannelUpdate(msg) + return &Envelope_ChannelUpdateMsg{protoMsg}, err +} + +func fromVirtualChannelFundingProposalMsg(msg *client.VirtualChannelFundingProposalMsg) ( + _ *Envelope_VirtualChannelFundingProposalMsg, + err error, +) { + protoMsg := &VirtualChannelFundingProposalMsg{} + + protoMsg.Initial, err = fromSignedState(&msg.Initial) + if err != nil { + return nil, errors.WithMessage(err, "initial state") + } + protoMsg.IndexMap = &IndexMap{IndexMap: fromIndexMap(msg.IndexMap)} + protoMsg.ChannelUpdateMsg, err = fromChannelUpdate(&msg.ChannelUpdateMsg) + return &Envelope_VirtualChannelFundingProposalMsg{protoMsg}, err +} + +func fromVirtualChannelSettlementProposalMsg(msg *client.VirtualChannelSettlementProposalMsg) ( + _ *Envelope_VirtualChannelSettlementProposalMsg, + err error, +) { + protoMsg := &VirtualChannelSettlementProposalMsg{} + + protoMsg.ChannelUpdateMsg, err = fromChannelUpdate(&msg.ChannelUpdateMsg) + if err != nil { + return nil, err + } + protoMsg.Final, err = fromSignedState(&msg.Final) + return &Envelope_VirtualChannelSettlementProposalMsg{protoMsg}, err +} + +func fromChannelUpdateAccMsg(msg *client.ChannelUpdateAccMsg) *Envelope_ChannelUpdateAccMsg { + protoMsg := &ChannelUpdateAccMsg{} + + protoMsg.ChannelId = make([]byte, len(msg.ChannelID)) + copy(protoMsg.ChannelId, msg.ChannelID[:]) + protoMsg.Sig = make([]byte, len(msg.Sig)) + copy(protoMsg.Sig, msg.Sig) + protoMsg.Version = msg.Version + return &Envelope_ChannelUpdateAccMsg{protoMsg} +} + +func fromChannelUpdateRejMsg(msg *client.ChannelUpdateRejMsg) *Envelope_ChannelUpdateRejMsg { + protoMsg := &ChannelUpdateRejMsg{} + protoMsg.ChannelId = make([]byte, len(msg.ChannelID)) + copy(protoMsg.ChannelId, msg.ChannelID[:]) + protoMsg.Version = msg.Version + protoMsg.Reason = msg.Reason + return &Envelope_ChannelUpdateRejMsg{protoMsg} +} + +func fromChannelUpdate(update *client.ChannelUpdateMsg) (protoUpdate *ChannelUpdateMsg, err error) { + protoUpdate = &ChannelUpdateMsg{} + protoUpdate.ChannelUpdate = &ChannelUpdate{} + + protoUpdate.ChannelUpdate.ActorIdx = uint32(update.ChannelUpdate.ActorIdx) + protoUpdate.Sig = make([]byte, len(update.Sig)) + copy(protoUpdate.Sig, update.Sig) + protoUpdate.ChannelUpdate.State, err = fromState(update.ChannelUpdate.State) + return protoUpdate, err +} + +func fromSignedState(signedState *channel.SignedState) (protoSignedState *SignedState, err error) { + protoSignedState = &SignedState{} + protoSignedState.Sigs = make([][]byte, len(signedState.Sigs)) + for i := range signedState.Sigs { + protoSignedState.Sigs[i] = make([]byte, len(signedState.Sigs[i])) + copy(protoSignedState.Sigs[i], signedState.Sigs[i]) + } + protoSignedState.Params, err = fromParams(signedState.Params) + if err != nil { + return nil, err + } + protoSignedState.State, err = fromState(signedState.State) + return protoSignedState, err +} + +func fromParams(params *channel.Params) (protoParams *Params, err error) { + protoParams = &Params{} + + protoParams.Nonce = params.Nonce.Bytes() + protoParams.ChallengeDuration = params.ChallengeDuration + protoParams.LedgerChannel = params.LedgerChannel + protoParams.VirtualChannel = params.VirtualChannel + protoParams.Parts, err = fromWalletAddrs(params.Parts) + if err != nil { + return nil, errors.WithMessage(err, "parts") + } + protoParams.App, err = fromApp(params.App) + return protoParams, err +} + +func fromState(state *channel.State) (protoState *State, err error) { + protoState = &State{} + + protoState.Id = make([]byte, len(state.ID)) + copy(protoState.Id, state.ID[:]) + protoState.Version = state.Version + protoState.IsFinal = state.IsFinal + protoState.Allocation, err = fromAllocation(state.Allocation) + if err != nil { + return nil, errors.WithMessage(err, "allocation") + } + protoState.App, protoState.Data, err = fromAppAndData(state.App, state.Data) + return protoState, err +} From 2d80e5a709ae26a279fde5669822a15d784a9382 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 11 Feb 2022 21:08:57 +0530 Subject: [PATCH 14/19] wire/protobuf: Impl serializer for sync msg Signed-off-by: Manoranjith --- wire/protobuf/serializer.go | 4 +++ wire/protobuf/serializer_test.go | 4 +++ wire/protobuf/syncmsgs.go | 48 ++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 wire/protobuf/syncmsgs.go diff --git a/wire/protobuf/serializer.go b/wire/protobuf/serializer.go index 4d29cbc9..d63c7318 100644 --- a/wire/protobuf/serializer.go +++ b/wire/protobuf/serializer.go @@ -68,6 +68,8 @@ func (serializer) Encode(w io.Writer, env *wire.Envelope) (err error) { protoEnv.Msg = fromChannelUpdateAccMsg(msg) case *client.ChannelUpdateRejMsg: protoEnv.Msg = fromChannelUpdateRejMsg(msg) + case *client.ChannelSyncMsg: + protoEnv.Msg, err = fromChannelSyncMsg(msg) } if err != nil { return err @@ -149,6 +151,8 @@ func (serializer) Decode(r io.Reader) (env *wire.Envelope, err error) { env.Msg = toChannelUpdateAccMsg(protoMsg) case *Envelope_ChannelUpdateRejMsg: env.Msg = toChannelUpdateRejMsg(protoMsg) + case *Envelope_ChannelSyncMsg: + env.Msg, err = toChannelSyncMsg(protoMsg) } return env, err diff --git a/wire/protobuf/serializer_test.go b/wire/protobuf/serializer_test.go index 7df86aed..4da1fe5f 100644 --- a/wire/protobuf/serializer_test.go +++ b/wire/protobuf/serializer_test.go @@ -40,3 +40,7 @@ func TestProposalMsgsSerialization(t *testing.T) { func TestUpdateMsgsSerialization(t *testing.T) { clienttest.UpdateMsgsSerializationTest(t, protobuftest.MsgSerializerTest) } + +func TestChannelSyncMsgSerialization(t *testing.T) { + clienttest.ChannelSyncMsgSerializationTest(t, protobuftest.MsgSerializerTest) +} diff --git a/wire/protobuf/syncmsgs.go b/wire/protobuf/syncmsgs.go new file mode 100644 index 00000000..f1cdb37b --- /dev/null +++ b/wire/protobuf/syncmsgs.go @@ -0,0 +1,48 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protobuf + +import ( + "perun.network/go-perun/channel" + "perun.network/go-perun/client" +) + +func toChannelSyncMsg(protoEnvMsg *Envelope_ChannelSyncMsg) (msg *client.ChannelSyncMsg, err error) { + protoMsg := protoEnvMsg.ChannelSyncMsg + + msg = &client.ChannelSyncMsg{} + msg.Phase = channel.Phase(protoMsg.Phase) + msg.CurrentTX.Sigs = make([][]byte, len(protoMsg.CurrentTx.Sigs)) + for i := range protoMsg.CurrentTx.Sigs { + msg.CurrentTX.Sigs[i] = make([]byte, len(protoMsg.CurrentTx.Sigs[i])) + copy(msg.CurrentTX.Sigs[i], protoMsg.CurrentTx.Sigs[i]) + } + msg.CurrentTX.State, err = toState(protoMsg.CurrentTx.State) + return msg, err +} + +func fromChannelSyncMsg(msg *client.ChannelSyncMsg) (_ *Envelope_ChannelSyncMsg, err error) { + protoMsg := &ChannelSyncMsg{} + protoMsg.CurrentTx = &Transaction{} + + protoMsg.Phase = uint32(msg.Phase) + protoMsg.CurrentTx.Sigs = make([][]byte, len(msg.CurrentTX.Sigs)) + for i := range msg.CurrentTX.Sigs { + protoMsg.CurrentTx.Sigs[i] = make([]byte, len(msg.CurrentTX.Sigs[i])) + copy(protoMsg.CurrentTx.Sigs[i], msg.CurrentTX.Sigs[i]) + } + protoMsg.CurrentTx.State, err = fromState(msg.CurrentTX.State) + return &Envelope_ChannelSyncMsg{protoMsg}, err +} From d995e181dfa441ec16a8d7a7415c4084a8da08bc Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Tue, 15 Feb 2022 11:06:52 +0530 Subject: [PATCH 15/19] wire/protobuf: Impl default case for unknown msgs Signed-off-by: Manoranjith --- wire/protobuf/serializer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wire/protobuf/serializer.go b/wire/protobuf/serializer.go index d63c7318..f225004e 100644 --- a/wire/protobuf/serializer.go +++ b/wire/protobuf/serializer.go @@ -16,6 +16,7 @@ package protobuf import ( "encoding/binary" + "fmt" "io" "github.com/pkg/errors" @@ -70,6 +71,8 @@ func (serializer) Encode(w io.Writer, env *wire.Envelope) (err error) { protoEnv.Msg = fromChannelUpdateRejMsg(msg) case *client.ChannelSyncMsg: protoEnv.Msg, err = fromChannelSyncMsg(msg) + default: + err = fmt.Errorf("unknown message type: %T", msg) } if err != nil { return err @@ -153,6 +156,8 @@ func (serializer) Decode(r io.Reader) (env *wire.Envelope, err error) { env.Msg = toChannelUpdateRejMsg(protoMsg) case *Envelope_ChannelSyncMsg: env.Msg, err = toChannelSyncMsg(protoMsg) + default: + err = fmt.Errorf("unknown message type: %T", protoMsg) } return env, err From 13bad5d4c1fcae920b36a3631cbeec33636a9a51 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 11 Feb 2022 20:41:38 +0530 Subject: [PATCH 16/19] Fix linter errors (funlen, cyclop) - Ignore funlen and cyclomatic complexity limits for Encode,Decode funcs in protobuf serializer. - Because, these functions contain type switch statements that cover all message types. Signed-off-by: Manoranjith --- wire/protobuf/serializer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wire/protobuf/serializer.go b/wire/protobuf/serializer.go index f225004e..b080b8ba 100644 --- a/wire/protobuf/serializer.go +++ b/wire/protobuf/serializer.go @@ -33,7 +33,7 @@ func init() { // Encode encodes an envelope from the reader using protocol buffers // serialization format. -func (serializer) Encode(w io.Writer, env *wire.Envelope) (err error) { +func (serializer) Encode(w io.Writer, env *wire.Envelope) (err error) { //nolint: funlen, cyclop protoEnv := &Envelope{} switch msg := env.Msg.(type) { @@ -108,7 +108,7 @@ func writeEnvelope(w io.Writer, env *Envelope) error { // Decode decodes an envelope from the reader, that was encoded using protocol // buffers serialization format. -func (serializer) Decode(r io.Reader) (env *wire.Envelope, err error) { +func (serializer) Decode(r io.Reader) (env *wire.Envelope, err error) { //nolint: funlen, cyclop env = &wire.Envelope{} protoEnv, err := readEnvelope(r) From d73dd3a12ec89bf806b724a309ada443b775ffe6 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 11 Feb 2022 20:46:29 +0530 Subject: [PATCH 17/19] Fix linter errors (goerr113) - Suppress the error, as we do not want to define these errors as constants. Signed-off-by: Manoranjith --- wire/protobuf/proposalmsgs.go | 6 +++--- wire/protobuf/serializer.go | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/wire/protobuf/proposalmsgs.go b/wire/protobuf/proposalmsgs.go index 846ceb56..b71bf8a9 100644 --- a/wire/protobuf/proposalmsgs.go +++ b/wire/protobuf/proposalmsgs.go @@ -249,7 +249,7 @@ func toIndexMap(protoIndexMap []uint32) (indexMap []channel.Index, err error) { indexMap = make([]channel.Index, len(protoIndexMap)) for i := range protoIndexMap { if protoIndexMap[i] > math.MaxUint16 { - return nil, fmt.Errorf("%d'th index is invalid", i) + return nil, fmt.Errorf("%d'th index is invalid", i) //nolint:goerr113 // We do not want to define this as constant error. } indexMap[i] = channel.Index(uint16(protoIndexMap[i])) } @@ -446,10 +446,10 @@ func fromBalance(balance []channel.Bal) (protoBalance *Balance, err error) { } for i := range balance { if balance[i] == nil { - return nil, fmt.Errorf("%d'th amount is nil", i) + return nil, fmt.Errorf("%d'th amount is nil", i) //nolint:goerr113 // We do not want to define this as constant error. } if balance[i].Sign() == -1 { - return nil, fmt.Errorf("%d'th amount is negative", i) + return nil, fmt.Errorf("%d'th amount is negative", i) //nolint:goerr113 // We do not want to define this as constant error. } protoBalance.Balance[i] = balance[i].Bytes() } diff --git a/wire/protobuf/serializer.go b/wire/protobuf/serializer.go index b080b8ba..370114e7 100644 --- a/wire/protobuf/serializer.go +++ b/wire/protobuf/serializer.go @@ -72,6 +72,7 @@ func (serializer) Encode(w io.Writer, env *wire.Envelope) (err error) { //nolint case *client.ChannelSyncMsg: protoEnv.Msg, err = fromChannelSyncMsg(msg) default: + //nolint: goerr113 // We do not want to define this as constant error. err = fmt.Errorf("unknown message type: %T", msg) } if err != nil { @@ -157,6 +158,7 @@ func (serializer) Decode(r io.Reader) (env *wire.Envelope, err error) { //nolint case *Envelope_ChannelSyncMsg: env.Msg, err = toChannelSyncMsg(protoMsg) default: + //nolint: goerr113 // We do not want to define this as constant error. err = fmt.Errorf("unknown message type: %T", protoMsg) } From 051b45f095877a624760d565887699dc18c5f992 Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 11 Feb 2022 21:16:25 +0530 Subject: [PATCH 18/19] wire: Switch wire serializer (perunio->protobuf) - To demonstrate that protobuf adapter is working. Signed-off-by: Manoranjith --- wire/net/exchange_addr_internal_test.go | 2 +- wire/net/simple/dialer_internal_test.go | 2 +- wire/net/test/connhub_internal_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wire/net/exchange_addr_internal_test.go b/wire/net/exchange_addr_internal_test.go index 1d7ce910..a8a8fd8c 100644 --- a/wire/net/exchange_addr_internal_test.go +++ b/wire/net/exchange_addr_internal_test.go @@ -23,7 +23,7 @@ import ( wallettest "perun.network/go-perun/wallet/test" "perun.network/go-perun/wire" - _ "perun.network/go-perun/wire/perunio/serializer" // wire serialzer init + _ "perun.network/go-perun/wire/protobuf" // wire serialzer init wiretest "perun.network/go-perun/wire/test" ctxtest "polycry.pt/poly-go/context/test" "polycry.pt/poly-go/test" diff --git a/wire/net/simple/dialer_internal_test.go b/wire/net/simple/dialer_internal_test.go index bd0d6c62..3cf409c6 100644 --- a/wire/net/simple/dialer_internal_test.go +++ b/wire/net/simple/dialer_internal_test.go @@ -25,7 +25,7 @@ import ( simwallet "perun.network/go-perun/backend/sim/wallet" "perun.network/go-perun/wallet" "perun.network/go-perun/wire" - _ "perun.network/go-perun/wire/perunio/serializer" // wire serialzer init + _ "perun.network/go-perun/wire/protobuf" // wire serialzer init ctxtest "polycry.pt/poly-go/context/test" "polycry.pt/poly-go/test" ) diff --git a/wire/net/test/connhub_internal_test.go b/wire/net/test/connhub_internal_test.go index 9f5bd957..e83e0736 100644 --- a/wire/net/test/connhub_internal_test.go +++ b/wire/net/test/connhub_internal_test.go @@ -24,7 +24,7 @@ import ( _ "perun.network/go-perun/backend/sim" // backend init wallettest "perun.network/go-perun/wallet/test" "perun.network/go-perun/wire" - _ "perun.network/go-perun/wire/perunio/serializer" // wire serialzer init + _ "perun.network/go-perun/wire/protobuf" // wire serialzer init wiretest "perun.network/go-perun/wire/test" ctxtest "polycry.pt/poly-go/context/test" "polycry.pt/poly-go/sync" From b22e8de1730301f3130969d0444e2bd7aea75c3b Mon Sep 17 00:00:00 2001 From: Manoranjith Date: Fri, 11 Feb 2022 22:50:15 +0530 Subject: [PATCH 19/19] wire/protobuf: Add cmd for generating protobuf bindings Signed-off-by: Manoranjith --- wire/protobuf/generate.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 wire/protobuf/generate.go diff --git a/wire/protobuf/generate.go b/wire/protobuf/generate.go new file mode 100644 index 00000000..44a093fe --- /dev/null +++ b/wire/protobuf/generate.go @@ -0,0 +1,22 @@ +// Copyright 2022 - See NOTICE file for copyright holders. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protobuf + +// This command generates the bindings for serializing wire messages using +// protocol buffers serialization protocol. +// +// It requires protoc and protoc-gen-go to be installed. + +//go:generate protoc --go_out=. wire.proto