From 36af32d17ee0b3f3300aecb385a02a85afd2e768 Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Fri, 6 Oct 2023 10:50:33 +0200 Subject: [PATCH 01/19] go mod --- go.mod | 19 ++++++++++--------- go.sum | 41 +++++++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/go.mod b/go.mod index db716aa..fae96c3 100644 --- a/go.mod +++ b/go.mod @@ -14,14 +14,15 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/sirupsen/logrus v1.8.1 // indirect - github.com/stretchr/testify v1.7.0 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/net v0.12.0 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/stretchr/testify v1.8.4 // indirect + golang.org/x/crypto v0.13.0 // indirect + golang.org/x/net v0.15.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect - polycry.pt/poly-go v0.0.0-20220222131629-aa4bdbaab60b // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8 // indirect + polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 // indirect ) diff --git a/go.sum b/go.sum index 6b0d2a9..c556369 100644 --- a/go.sum +++ b/go.sum @@ -18,26 +18,26 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= @@ -46,9 +46,14 @@ google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= perun.network/go-perun v0.10.6 h1:uj1e33yfCSfE75DK/uwjNp+TwvGG85Qhi6HuYQ9EPrQ= perun.network/go-perun v0.10.6/go.mod h1:BGBZC3npkX457u87pjDd0NEIXr1a4dsH4H/YpLdGGe8= -polycry.pt/poly-go v0.0.0-20220222131629-aa4bdbaab60b h1:BJsSrLQ3kLRNYXNqly//IYeXlVmAhpI5wYbg2WD1wR0= -polycry.pt/poly-go v0.0.0-20220222131629-aa4bdbaab60b/go.mod h1:XUBrNtqgEhN3EEOP/5gh7IBd3xVHKidCjXDZfl9+kMU= +perun.network/perun-ckb-backend v0.0.0-20230925132505-c8804c6d97bc h1:obq/G7ZsOFyvHL8cD1q6SzUiLQ6Y5LOR+17SC7SZhWw= +perun.network/perun-ckb-backend v0.0.0-20230925132505-c8804c6d97bc/go.mod h1:9bemdwIr/a8rg2FWWn+l4fEel6uJOSJHB7V0OX/X1LM= +perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8 h1:XbA3PJBVgxQWTbsHYh8KIE9IbyudjpSodS5APkEPuPs= +perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8/go.mod h1:9bemdwIr/a8rg2FWWn+l4fEel6uJOSJHB7V0OX/X1LM= +polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 h1:iA5GzEa/hHfVlQpimEjPV09NATwHXxSjWNB0VVodtew= +polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37/go.mod h1:XUBrNtqgEhN3EEOP/5gh7IBd3xVHKidCjXDZfl9+kMU= From 2cb59b6317a1ae2fd9aba29aad38ddeebebd8bab Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Fri, 6 Oct 2023 10:51:25 +0200 Subject: [PATCH 02/19] wallet: Implement ExternalClient --- wallet/client.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 wallet/client.go diff --git a/wallet/client.go b/wallet/client.go new file mode 100644 index 0000000..2a8170e --- /dev/null +++ b/wallet/client.go @@ -0,0 +1,29 @@ +package wallet + +import ( + "context" + "perun.network/channel-service/rpc" + "perun.network/perun-ckb-backend/wallet/address" +) + +type ExternalClient struct { + c rpc.WalletServiceClient +} + +func (e ExternalClient) Unlock(participant address.Participant) error { + return nil +} + +func (e ExternalClient) SignData(participant address.Participant, data []byte) ([]byte, error) { + sm := &rpc.SignMessageRequest{Data: data} + // TODO: SignMessage needs some reference to the participant / key to sign with. + smr, err := e.c.SignMessage(context.TODO(), sm) + if err != nil { + return nil, err + } + return smr.GetSignature(), nil +} + +func NewExternalClient(c rpc.WalletServiceClient) *ExternalClient { + return &ExternalClient{c: c} +} From f35469a964a25a03b2007c63a812714357625aac Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Fri, 6 Oct 2023 10:53:52 +0200 Subject: [PATCH 03/19] service: Implement User as channel proxy for wallet user --- service/user.go | 158 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 service/user.go diff --git a/service/user.go b/service/user.go new file mode 100644 index 0000000..0b40e6c --- /dev/null +++ b/service/user.go @@ -0,0 +1,158 @@ +package service + +import ( + "context" + "errors" + "fmt" + "log" + "perun.network/channel-service/rpc" + "perun.network/go-perun/channel" + "perun.network/go-perun/client" + "perun.network/go-perun/wallet" + "perun.network/go-perun/watcher" + "perun.network/go-perun/wire" + "perun.network/go-perun/wire/protobuf" + "perun.network/perun-ckb-backend/wallet/address" + "sync" +) + +var ErrChannelNotFound = errors.New("channel not found") + +// User handles all channel related operations for a single user (wire / wallet address pair). +type User struct { + usrMutex sync.Mutex + + Channels map[channel.ID]*client.Channel + Participant address.Participant + PerunClient *client.Client + WireAddress wire.Address + wsc rpc.WalletServiceClient +} + +func (u *User) HandleUpdate(oldState *channel.State, update client.ChannelUpdate, responder *client.UpdateResponder) { + pbNewState, err := protobuf.FromState(update.State.Clone()) + if err != nil { + _ = responder.Reject(context.TODO(), "unable to encode state") + return + } + + resp, err := u.wsc.UpdateNotification(context.TODO(), &rpc.UpdateNotificationRequest{ + State: pbNewState, + ChannelId: pbNewState.Id, + }) + if err != nil { + _ = responder.Reject(context.TODO(), "unable to send update notification to wallet") + return + } + if resp.GetAccepted() { + _ = responder.Accept(context.TODO()) + } else { + _ = responder.Reject(context.TODO(), "wallet rejected update") + } + +} + +func (u *User) HandleProposal(proposal client.ChannelProposal, responder *client.ProposalResponder) { + proposal.Base() + // FIXME: Make protobuf type for client.ChannelProposal and use it in OpenChannel. + panic("fixme") + // FIXME: OpenChannel needs OpenChannelResponse as return type! + // wcs.OpenChannel(nil, nil) +} + +func (u *User) HandleAdjudicatorEvent(event channel.AdjudicatorEvent) { + // TODO: Do we need to do anything here? + log.Printf("Adjudicator event: type = %T", event) +} + +func NewUser(participant address.Participant, wAddr wire.Address, bus wire.Bus, funder channel.Funder, adjudicator channel.Adjudicator, wallet wallet.Wallet, watcher watcher.Watcher, wsc rpc.WalletServiceClient) (*User, error) { + c, err := client.New(wAddr, bus, funder, adjudicator, wallet, watcher) + if err != nil { + return nil, err + } + u := &User{ + Participant: participant, + PerunClient: c, + WireAddress: wAddr, + wsc: wsc, + } + go c.Handle(u, u) + return u, nil +} + +func (u *User) OpenChannel(ctxt context.Context, peer wire.Address, allocation *channel.Allocation, challengeDuration uint64) (channel.ID, error) { + proposal, err := client.NewLedgerChannelProposal( + challengeDuration, + &u.Participant, + allocation, + []wire.Address{u.WireAddress}) + if err != nil { + return channel.ID{}, err + } + ch, err := u.PerunClient.ProposeChannel(ctxt, proposal) + if err != nil { + return channel.ID{}, err + } + u.startWatching(ch) + u.usrMutex.Lock() + defer u.usrMutex.Unlock() + u.Channels[ch.ID()] = ch + return ch.ID(), nil +} + +func (u *User) UpdateChannel(ctxt context.Context, id channel.ID, alloc channel.Allocation) error { + u.usrMutex.Lock() + defer u.usrMutex.Unlock() + ch, ok := u.Channels[id] + if !ok { + return ErrChannelNotFound + } + err := ch.Update(ctxt, UpdateToAllocation(alloc)) + return err +} + +func UpdateToAllocation(alloc channel.Allocation) func(state *channel.State) { + return func(state *channel.State) { + // TODO: Properly update allocation with checks etc. + state.Allocation = alloc + } +} + +func (u *User) CloseChannel(ctxt context.Context, id channel.ID) error { + u.usrMutex.Lock() + defer u.usrMutex.Unlock() + ch, ok := u.Channels[id] + if !ok { + return ErrChannelNotFound + } + // Finalize the channel to enable fast settlement. + if !ch.State().IsFinal { + err := ch.Update(ctxt, func(state *channel.State) { + state.IsFinal = true + }) + if err != nil { + panic(err) + } + } + + // Settle concludes the channel and withdraws the funds. + err := ch.Settle(ctxt) + if err != nil { + panic(err) + } + + // Close frees up channel resources. + _ = ch.Close() + delete(u.Channels, id) + return nil +} + +// startWatching starts the dispute watcher for the specified channel. +func (u *User) startWatching(ch *client.Channel) { + go func() { + err := ch.Watch(u) + if err != nil { + fmt.Printf("Watcher returned with error: %v", err) + } + }() +} From 7eb723ec8ad9089e629e5b82ed8a94160e4096a9 Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Fri, 6 Oct 2023 10:55:09 +0200 Subject: [PATCH 04/19] service: Add UserRegister to connect users with channel ids --- service/user_register.go | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 service/user_register.go diff --git a/service/user_register.go b/service/user_register.go new file mode 100644 index 0000000..27b2383 --- /dev/null +++ b/service/user_register.go @@ -0,0 +1,47 @@ +package service + +import ( + "errors" + "perun.network/go-perun/channel" + "sync" +) + +var ErrUserNotFound = errors.New("user not found") + +// UserRegister connects channel.IDs to Users. +type UserRegister interface { + GetUser(channel.ID) (*User, error) + AssignChannelID(channel.ID, *User) error +} + +type MutexUserRegister struct { + mtx sync.Mutex + register map[channel.ID]*User +} + +func (m *MutexUserRegister) GetUser(cid channel.ID) (*User, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + u, ok := m.register[cid] + if !ok { + return nil, ErrUserNotFound + } + return u, nil +} + +func (m *MutexUserRegister) AssignChannelID(cid channel.ID, user *User) error { + m.mtx.Lock() + defer m.mtx.Unlock() + _, ok := m.register[cid] + if ok { + return errors.New("channel already exists") + } + m.register[cid] = user + return nil +} + +func NewMutexUserRegister() *MutexUserRegister { + return &MutexUserRegister{ + register: make(map[channel.ID]*User), + } +} From 0304a3153b1311d1bf4de7dcf0042fa2a97b294f Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Fri, 6 Oct 2023 10:55:47 +0200 Subject: [PATCH 05/19] service: Implement ChannelServiceServer --- service/channel_service.go | 148 +++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 service/channel_service.go diff --git a/service/channel_service.go b/service/channel_service.go new file mode 100644 index 0000000..bbce170 --- /dev/null +++ b/service/channel_service.go @@ -0,0 +1,148 @@ +package service + +import ( + "context" + "fmt" + "perun.network/channel-service/rpc" + "perun.network/channel-service/wallet" + "perun.network/go-perun/channel" + gpwallet "perun.network/go-perun/wallet" + "perun.network/go-perun/wire" + "perun.network/go-perun/wire/net/simple" + "perun.network/go-perun/wire/protobuf" + "perun.network/perun-ckb-backend/wallet/external" +) + +type ChannelService struct { + UserRegister UserRegister + Wallet gpwallet.Wallet + + rpc.UnimplementedChannelServiceServer // always embed +} + +func NewChannelService(c rpc.WalletServiceClient) *ChannelService { + return &ChannelService{ + UserRegister: NewMutexUserRegister(), + Wallet: external.NewWallet(wallet.NewExternalClient(c)), + } +} + +func (c ChannelService) OpenChannel(ctx context.Context, request *rpc.ChannelOpenRequest) (*rpc.ChannelOpenResponse, error) { + + user, err := c.GetUserFromChannelOpenRequest(request) + if err != nil { + return nil, err + } + allocation, err := c.GetAllocationFromChannelOpenRequest(request) + if err != nil { + return nil, err + } + peer := c.GetPeerAddressFromChannelOpenRequest(request) + challengeDuration := c.GetChallengeDurationFromChannelOpenRequest(request) + id, err := user.OpenChannel(ctx, peer, allocation, challengeDuration) + if err != nil { + return &rpc.ChannelOpenResponse{Msg: &rpc.ChannelOpenResponse_Rejected{Rejected: &rpc.Rejected{Reason: err.Error()}}}, err + } + return &rpc.ChannelOpenResponse{Msg: &rpc.ChannelOpenResponse_ChannelId{ChannelId: id[:]}}, nil + +} + +func (c ChannelService) UpdateChannel(ctx context.Context, request *rpc.ChannelUpdateRequest) (*rpc.ChannelUpdateResponse, error) { + // FIXME: rpc.UpdateChannelRequest should probably not contain a state. If it does, we need to verify that it matches the state in the channel. + cid, user, err := c.GetChannelInfoFromRequest(request.GetChannelId()) + if err != nil { + return nil, err + } + state, err := AsChannelState(request.GetState()) + if err != nil { + return nil, err + } + err = user.UpdateChannel(ctx, cid, state.Allocation) + if err != nil { + rejected := rpc.Rejected{Reason: err.Error()} + return &rpc.ChannelUpdateResponse{Msg: &rpc.ChannelUpdateResponse_Rejected{Rejected: &rejected}}, err + } + + return &rpc.ChannelUpdateResponse{Msg: &rpc.ChannelUpdateResponse_Update{Update: &rpc.SuccessfulUpdate{ + // TODO: Use actual resulting state instead of the request state. + State: request.State, + // TODO: Abstract channel id encoding. + ChannelId: cid[:], + }}}, nil +} + +func (c ChannelService) CloseChannel(ctx context.Context, request *rpc.ChannelCloseRequest) (*rpc.ChannelCloseResponse, error) { + cid, user, err := c.GetChannelInfoFromRequest(request.GetChannelId()) + if err != nil { + return nil, err + } + err = user.CloseChannel(ctx, cid) + if err != nil { + // TODO: Do we want to return the error here? + return &rpc.ChannelCloseResponse{Msg: &rpc.ChannelCloseResponse_Rejected{Rejected: &rpc.Rejected{Reason: err.Error()}}}, err + } + return &rpc.ChannelCloseResponse{Msg: &rpc.ChannelCloseResponse_Close{Close: &rpc.SuccessfulClose{ChannelId: cid[:]}}}, nil +} + +func (c ChannelService) ForceCloseChannel(ctx context.Context, request *rpc.ChannelForceCloseRequest) (*rpc.ChannelForceCloseResponse, error) { + cid, user, err := c.GetChannelInfoFromRequest(request.GetChannelId()) + if err != nil { + return nil, err + } + // TODO: Verify assumption that this is the same as close. + err = user.CloseChannel(ctx, cid) + if err != nil { + return &rpc.ChannelForceCloseResponse{Msg: &rpc.ChannelForceCloseResponse_Rejected{Rejected: &rpc.Rejected{Reason: err.Error()}}}, err + } + return &rpc.ChannelForceCloseResponse{Msg: &rpc.ChannelForceCloseResponse_Close{Close: &rpc.SuccessfulClose{ChannelId: cid[:]}}}, nil +} + +func (c ChannelService) ChallengeChannel(ctx context.Context, request *rpc.ChallengeChannelRequest) (*rpc.ChallengeChannelResponse, error) { + // FIXME: This endpoint does not make sense. It should be removed. + // There is no concept of challenging with an arbitrary state, but only with the latest state. + // In the context of Payment Channels, this is the same as settle. + + panic("fixme") +} + +func AsChannelID(in []byte) (channel.ID, error) { + id := channel.ID{} + n := copy(id[:], in) + if n != len(id) { + return channel.ID{}, fmt.Errorf("channel id too short: expected %d bytes, got %d", len(id), n) + } + return id, nil +} + +func AsChannelState(ps *protobuf.State) (*channel.State, error) { + return protobuf.ToState(ps) +} + +func (c ChannelService) GetChannelInfoFromRequest(reqChannelId []byte) (channel.ID, *User, error) { + cid, err := AsChannelID(reqChannelId) + if err != nil { + return channel.ID{}, nil, err + } + usr, err := c.UserRegister.GetUser(cid) + return cid, usr, err +} + +func (c ChannelService) GetUserFromChannelOpenRequest(request *rpc.ChannelOpenRequest) (*User, error) { + // FIXME: The OpenChannelRequest should contain info about the acting participant. + panic("fixme") +} + +func (c ChannelService) GetAllocationFromChannelOpenRequest(request *rpc.ChannelOpenRequest) (*channel.Allocation, error) { + // FIXME: ChannelOpenRequest should specify an allocation / initial funds. + panic("fixme") +} + +func (c ChannelService) GetPeerAddressFromChannelOpenRequest(request *rpc.ChannelOpenRequest) wire.Address { + // FIXME: Do this properly and change the peer type in the request field. + return simple.NewAddress(string(request.GetPeer())) +} + +func (c ChannelService) GetChallengeDurationFromChannelOpenRequest(request *rpc.ChannelOpenRequest) uint64 { + // TODO: This should be specified in the request or hardcoded with default value. + return 10 +} From d32fe6cfae20dbe8e906c0622e14f4de111b0503 Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Fri, 6 Oct 2023 11:51:55 +0200 Subject: [PATCH 06/19] go.mod: Add replace for ckb-sdk and tidy --- go.mod | 8 +++++++- go.sum | 11 ++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index fae96c3..a42d042 100644 --- a/go.mod +++ b/go.mod @@ -6,12 +6,17 @@ require ( google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 perun.network/go-perun v0.10.6 + perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect + github.com/ethereum/go-ethereum v1.10.22 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/kr/pretty v0.3.1 // indirect + github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect + github.com/nervosnetwork/ckb-sdk-go/v2 v2.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect @@ -23,6 +28,7 @@ require ( golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8 // indirect polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 // indirect ) + +replace github.com/nervosnetwork/ckb-sdk-go/v2 v2.2.0 => github.com/perun-network/ckb-sdk-go/v2 v2.2.1-0.20230601140721-2bf596fddd80 diff --git a/go.sum b/go.sum index c556369..cd2b4d6 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,10 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= +github.com/ethereum/go-ethereum v1.10.22 h1:HbEgsDo1YTGIf4KB/NNpn+XH+PiNJXUZ9ksRxiqWyMc= +github.com/ethereum/go-ethereum v1.10.22/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -11,6 +15,10 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= +github.com/perun-network/ckb-sdk-go/v2 v2.2.1-0.20230601140721-2bf596fddd80 h1:45S239s+5oGVJHakd+BjfZmstG7wHnA8Tkeq43R9eFA= +github.com/perun-network/ckb-sdk-go/v2 v2.2.1-0.20230601140721-2bf596fddd80/go.mod h1:nPpBML8fuaM1NgkKCwv2gSHiCv+xKH43fu8LA9LOQUg= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -49,10 +57,7 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -perun.network/go-perun v0.10.6 h1:uj1e33yfCSfE75DK/uwjNp+TwvGG85Qhi6HuYQ9EPrQ= perun.network/go-perun v0.10.6/go.mod h1:BGBZC3npkX457u87pjDd0NEIXr1a4dsH4H/YpLdGGe8= -perun.network/perun-ckb-backend v0.0.0-20230925132505-c8804c6d97bc h1:obq/G7ZsOFyvHL8cD1q6SzUiLQ6Y5LOR+17SC7SZhWw= -perun.network/perun-ckb-backend v0.0.0-20230925132505-c8804c6d97bc/go.mod h1:9bemdwIr/a8rg2FWWn+l4fEel6uJOSJHB7V0OX/X1LM= perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8 h1:XbA3PJBVgxQWTbsHYh8KIE9IbyudjpSodS5APkEPuPs= perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8/go.mod h1:9bemdwIr/a8rg2FWWn+l4fEel6uJOSJHB7V0OX/X1LM= polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 h1:iA5GzEa/hHfVlQpimEjPV09NATwHXxSjWNB0VVodtew= From d2b0aa6592886d332158b26cef9c01ce26c78bf0 Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Fri, 6 Oct 2023 11:52:28 +0200 Subject: [PATCH 07/19] wallet+service: Add missing TODOs --- service/user.go | 5 +++-- wallet/client.go | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/service/user.go b/service/user.go index 0b40e6c..7a74145 100644 --- a/service/user.go +++ b/service/user.go @@ -54,14 +54,15 @@ func (u *User) HandleUpdate(oldState *channel.State, update client.ChannelUpdate func (u *User) HandleProposal(proposal client.ChannelProposal, responder *client.ProposalResponder) { proposal.Base() - // FIXME: Make protobuf type for client.ChannelProposal and use it in OpenChannel. + // FIXME: Make protobuf type for client.ChannelProposal and use it in OpenChannel. There might be an existing protobuf type for client.ChannelProposal. panic("fixme") // FIXME: OpenChannel needs OpenChannelResponse as return type! - // wcs.OpenChannel(nil, nil) + //u.wsc.OpenChannel(nil, nil) } func (u *User) HandleAdjudicatorEvent(event channel.AdjudicatorEvent) { // TODO: Do we need to do anything here? + // TODO: Inform wallet service server about event. log.Printf("Adjudicator event: type = %T", event) } diff --git a/wallet/client.go b/wallet/client.go index 2a8170e..7805d2b 100644 --- a/wallet/client.go +++ b/wallet/client.go @@ -21,6 +21,7 @@ func (e ExternalClient) SignData(participant address.Participant, data []byte) ( if err != nil { return nil, err } + // We assume that the wallet returns a PaddedSignature (see perun-ckb-backend/wallet/signature.go). return smr.GetSignature(), nil } From 2e99110ef48a97d4b4c610f6b3e600e674b55c46 Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Tue, 17 Oct 2023 13:27:36 +0200 Subject: [PATCH 08/19] pws: Add wallet spec as submodule --- .gitmodules | 3 +++ perun-wallet-spec | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 perun-wallet-spec diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6dfdf75 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "perun-wallet-spec"] + path = perun-wallet-spec + url = git@github.com:perun-network/perun-wallet-spec diff --git a/perun-wallet-spec b/perun-wallet-spec new file mode 160000 index 0000000..a8ac212 --- /dev/null +++ b/perun-wallet-spec @@ -0,0 +1 @@ +Subproject commit a8ac2129e3ecf4254855e837a471900625634b16 From e941301661a8db23d22f43ed9ef9a15b160b61b5 Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Tue, 17 Oct 2023 14:01:41 +0200 Subject: [PATCH 09/19] scripts: Add script for proto codegen from wallet spec --- scripts/gen_proto.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 scripts/gen_proto.sh diff --git a/scripts/gen_proto.sh b/scripts/gen_proto.sh new file mode 100755 index 0000000..c79dfa8 --- /dev/null +++ b/scripts/gen_proto.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +function check_installed() { + if ! command -v $1 &> /dev/null + then + echo "$1 could not be found" + exit + fi +} + +check_installed protoc + +if [ -z "$2" ] +then + echo "Usage: gen_proto.sh " + exit +fi + +# Directory where perun-wallet-spec is located: +PROTO_DIR=$1 +TARGET_DIR=$2 + +protoc --go_out=$TARGET_DIR \ + --go-grpc_out=$TARGET_DIR \ + --go_opt=Mperun-wallet.proto=proto/ \ + --go-grpc_opt=Mperun-wallet.proto=proto/ \ + --proto_path=$PROTO_DIR/src/proto \ + $PROTO_DIR/src/proto/perun-wallet.proto From 2eeb222b75f59a0465baf00c0964275594403e27 Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Tue, 17 Oct 2023 14:02:57 +0200 Subject: [PATCH 10/19] proto+wallet+service: Adjust to spec rework --- rpc/{ => proto}/perun-wallet.pb.go | 1216 ++++++++--------------- rpc/{ => proto}/perun-wallet_grpc.pb.go | 222 +---- service/channel_service.go | 60 +- service/user.go | 83 +- wallet/client.go | 9 +- 5 files changed, 485 insertions(+), 1105 deletions(-) rename rpc/{ => proto}/perun-wallet.pb.go (56%) rename rpc/{ => proto}/perun-wallet_grpc.pb.go (64%) diff --git a/rpc/perun-wallet.pb.go b/rpc/proto/perun-wallet.pb.go similarity index 56% rename from rpc/perun-wallet.pb.go rename to rpc/proto/perun-wallet.pb.go index 181dedd..adc7bd4 100644 --- a/rpc/perun-wallet.pb.go +++ b/rpc/proto/perun-wallet.pb.go @@ -1,15 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 -// protoc v4.24.2 +// protoc v4.24.3 // source: perun-wallet.proto -package rpc +package proto import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" + _ "google.golang.org/protobuf/types/known/emptypb" protobuf "perun.network/go-perun/wire/protobuf" reflect "reflect" sync "sync" @@ -75,8 +75,14 @@ type ChannelOpenRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Peer []byte `protobuf:"bytes,1,opt,name=peer,proto3" json:"peer,omitempty"` - Assets *Assets `protobuf:"bytes,2,opt,name=assets,proto3" json:"assets,omitempty"` + // The identity of the requester. + Requester []byte `protobuf:"bytes,1,opt,name=requester,proto3" json:"requester,omitempty"` + // Identity of the peer to open the channel with. + Peer []byte `protobuf:"bytes,2,opt,name=peer,proto3" json:"peer,omitempty"` + // The desired allocation of funds within said channel. + Allocation *protobuf.Allocation `protobuf:"bytes,3,opt,name=allocation,proto3" json:"allocation,omitempty"` + // The duration of the challenge period. + ChallengeDuration uint64 `protobuf:"varint,4,opt,name=challenge_duration,json=challengeDuration,proto3" json:"challenge_duration,omitempty"` } func (x *ChannelOpenRequest) Reset() { @@ -111,6 +117,13 @@ func (*ChannelOpenRequest) Descriptor() ([]byte, []int) { return file_perun_wallet_proto_rawDescGZIP(), []int{1} } +func (x *ChannelOpenRequest) GetRequester() []byte { + if x != nil { + return x.Requester + } + return nil +} + func (x *ChannelOpenRequest) GetPeer() []byte { if x != nil { return x.Peer @@ -118,13 +131,20 @@ func (x *ChannelOpenRequest) GetPeer() []byte { return nil } -func (x *ChannelOpenRequest) GetAssets() *Assets { +func (x *ChannelOpenRequest) GetAllocation() *protobuf.Allocation { if x != nil { - return x.Assets + return x.Allocation } return nil } +func (x *ChannelOpenRequest) GetChallengeDuration() uint64 { + if x != nil { + return x.ChallengeDuration + } + return 0 +} + type ChannelOpenResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -213,8 +233,6 @@ type ChannelUpdateRequest struct { // The state with which the channel should be updated. State *protobuf.State `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` - // The channel id of the channel to be updated. - ChannelId []byte `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` } func (x *ChannelUpdateRequest) Reset() { @@ -256,13 +274,6 @@ func (x *ChannelUpdateRequest) GetState() *protobuf.State { return nil } -func (x *ChannelUpdateRequest) GetChannelId() []byte { - if x != nil { - return x.ChannelId - } - return nil -} - type SuccessfulUpdate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -578,17 +589,20 @@ func (*ChannelCloseResponse_Rejected) isChannelCloseResponse_Msg() {} func (*ChannelCloseResponse_Close) isChannelCloseResponse_Msg() {} -type ChannelForceCloseRequest struct { +// Called by the Perun channel service if it received a channel opening request +// from another peer. The proposed channel state is passed to the wallet which +// might use it to show it in to the user. +type OpenChannelRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The channel id of the channel to be force closed. - ChannelId []byte `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // The state with which the channel should be opened. + Proposal *protobuf.LedgerChannelProposalMsg `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal,omitempty"` } -func (x *ChannelForceCloseRequest) Reset() { - *x = ChannelForceCloseRequest{} +func (x *OpenChannelRequest) Reset() { + *x = OpenChannelRequest{} if protoimpl.UnsafeEnabled { mi := &file_perun_wallet_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -596,13 +610,13 @@ func (x *ChannelForceCloseRequest) Reset() { } } -func (x *ChannelForceCloseRequest) String() string { +func (x *OpenChannelRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ChannelForceCloseRequest) ProtoMessage() {} +func (*OpenChannelRequest) ProtoMessage() {} -func (x *ChannelForceCloseRequest) ProtoReflect() protoreflect.Message { +func (x *OpenChannelRequest) ProtoReflect() protoreflect.Message { mi := &file_perun_wallet_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -614,29 +628,32 @@ func (x *ChannelForceCloseRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ChannelForceCloseRequest.ProtoReflect.Descriptor instead. -func (*ChannelForceCloseRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use OpenChannelRequest.ProtoReflect.Descriptor instead. +func (*OpenChannelRequest) Descriptor() ([]byte, []int) { return file_perun_wallet_proto_rawDescGZIP(), []int{9} } -func (x *ChannelForceCloseRequest) GetChannelId() []byte { +func (x *OpenChannelRequest) GetProposal() *protobuf.LedgerChannelProposalMsg { if x != nil { - return x.ChannelId + return x.Proposal } return nil } -type SuccessfulForceClose struct { +type OpenChannelResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The channel id of the channel which was force closed. - ChannelId []byte `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // Types that are assignable to Msg: + // + // *OpenChannelResponse_Rejected + // *OpenChannelResponse_NonceShare + Msg isOpenChannelResponse_Msg `protobuf_oneof:"msg"` } -func (x *SuccessfulForceClose) Reset() { - *x = SuccessfulForceClose{} +func (x *OpenChannelResponse) Reset() { + *x = OpenChannelResponse{} if protoimpl.UnsafeEnabled { mi := &file_perun_wallet_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -644,13 +661,13 @@ func (x *SuccessfulForceClose) Reset() { } } -func (x *SuccessfulForceClose) String() string { +func (x *OpenChannelResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SuccessfulForceClose) ProtoMessage() {} +func (*OpenChannelResponse) ProtoMessage() {} -func (x *SuccessfulForceClose) ProtoReflect() protoreflect.Message { +func (x *OpenChannelResponse) ProtoReflect() protoreflect.Message { mi := &file_perun_wallet_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -662,298 +679,48 @@ func (x *SuccessfulForceClose) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SuccessfulForceClose.ProtoReflect.Descriptor instead. -func (*SuccessfulForceClose) Descriptor() ([]byte, []int) { +// Deprecated: Use OpenChannelResponse.ProtoReflect.Descriptor instead. +func (*OpenChannelResponse) Descriptor() ([]byte, []int) { return file_perun_wallet_proto_rawDescGZIP(), []int{10} } -func (x *SuccessfulForceClose) GetChannelId() []byte { - if x != nil { - return x.ChannelId - } - return nil -} - -type ChannelForceCloseResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Msg: - // - // *ChannelForceCloseResponse_Rejected - // *ChannelForceCloseResponse_Close - Msg isChannelForceCloseResponse_Msg `protobuf_oneof:"msg"` -} - -func (x *ChannelForceCloseResponse) Reset() { - *x = ChannelForceCloseResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ChannelForceCloseResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChannelForceCloseResponse) ProtoMessage() {} - -func (x *ChannelForceCloseResponse) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_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 ChannelForceCloseResponse.ProtoReflect.Descriptor instead. -func (*ChannelForceCloseResponse) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{11} -} - -func (m *ChannelForceCloseResponse) GetMsg() isChannelForceCloseResponse_Msg { +func (m *OpenChannelResponse) GetMsg() isOpenChannelResponse_Msg { if m != nil { return m.Msg } return nil } -func (x *ChannelForceCloseResponse) GetRejected() *Rejected { - if x, ok := x.GetMsg().(*ChannelForceCloseResponse_Rejected); ok { +func (x *OpenChannelResponse) GetRejected() *Rejected { + if x, ok := x.GetMsg().(*OpenChannelResponse_Rejected); ok { return x.Rejected } return nil } -func (x *ChannelForceCloseResponse) GetClose() *SuccessfulClose { - if x, ok := x.GetMsg().(*ChannelForceCloseResponse_Close); ok { - return x.Close +func (x *OpenChannelResponse) GetNonceShare() []byte { + if x, ok := x.GetMsg().(*OpenChannelResponse_NonceShare); ok { + return x.NonceShare } return nil } -type isChannelForceCloseResponse_Msg interface { - isChannelForceCloseResponse_Msg() +type isOpenChannelResponse_Msg interface { + isOpenChannelResponse_Msg() } -type ChannelForceCloseResponse_Rejected struct { +type OpenChannelResponse_Rejected struct { Rejected *Rejected `protobuf:"bytes,1,opt,name=rejected,proto3,oneof"` } -type ChannelForceCloseResponse_Close struct { - Close *SuccessfulClose `protobuf:"bytes,2,opt,name=close,proto3,oneof"` +type OpenChannelResponse_NonceShare struct { + // The NonceShare generated by the wallet. + NonceShare []byte `protobuf:"bytes,2,opt,name=nonce_share,json=nonceShare,proto3,oneof"` } -func (*ChannelForceCloseResponse_Rejected) isChannelForceCloseResponse_Msg() {} - -func (*ChannelForceCloseResponse_Close) isChannelForceCloseResponse_Msg() {} - -type ChallengeChannelRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The channel id of the channel to be challenged. - ChannelId []byte `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - // The state with which the channel should be challenged. - State *protobuf.State `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` -} +func (*OpenChannelResponse_Rejected) isOpenChannelResponse_Msg() {} -func (x *ChallengeChannelRequest) Reset() { - *x = ChallengeChannelRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ChallengeChannelRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChallengeChannelRequest) ProtoMessage() {} - -func (x *ChallengeChannelRequest) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_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 ChallengeChannelRequest.ProtoReflect.Descriptor instead. -func (*ChallengeChannelRequest) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{12} -} - -func (x *ChallengeChannelRequest) GetChannelId() []byte { - if x != nil { - return x.ChannelId - } - return nil -} - -func (x *ChallengeChannelRequest) GetState() *protobuf.State { - if x != nil { - return x.State - } - return nil -} - -type ChallengeChannelResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Msg: - // - // *ChallengeChannelResponse_Rejected - // *ChallengeChannelResponse_Update - Msg isChallengeChannelResponse_Msg `protobuf_oneof:"msg"` -} - -func (x *ChallengeChannelResponse) Reset() { - *x = ChallengeChannelResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ChallengeChannelResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChallengeChannelResponse) ProtoMessage() {} - -func (x *ChallengeChannelResponse) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_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 ChallengeChannelResponse.ProtoReflect.Descriptor instead. -func (*ChallengeChannelResponse) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{13} -} - -func (m *ChallengeChannelResponse) GetMsg() isChallengeChannelResponse_Msg { - if m != nil { - return m.Msg - } - return nil -} - -func (x *ChallengeChannelResponse) GetRejected() *Rejected { - if x, ok := x.GetMsg().(*ChallengeChannelResponse_Rejected); ok { - return x.Rejected - } - return nil -} - -func (x *ChallengeChannelResponse) GetUpdate() *SuccessfulUpdate { - if x, ok := x.GetMsg().(*ChallengeChannelResponse_Update); ok { - return x.Update - } - return nil -} - -type isChallengeChannelResponse_Msg interface { - isChallengeChannelResponse_Msg() -} - -type ChallengeChannelResponse_Rejected struct { - Rejected *Rejected `protobuf:"bytes,1,opt,name=rejected,proto3,oneof"` -} - -type ChallengeChannelResponse_Update struct { - // In case the challenge was successful return the updated channel state. - // Can be used for confirmation in the frontend. - Update *SuccessfulUpdate `protobuf:"bytes,2,opt,name=update,proto3,oneof"` -} - -func (*ChallengeChannelResponse_Rejected) isChallengeChannelResponse_Msg() {} - -func (*ChallengeChannelResponse_Update) isChallengeChannelResponse_Msg() {} - -// Called by the Perun channel service if it received a channel opening request -// from another peer. The proposed channel state is passed to the wallet which -// might use it to show it in to the user. -type OpenChannelRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The state with which the channel should be opened. - State *protobuf.State `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` - // The channel id of the channel to be opened. - ChannelId []byte `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` -} - -func (x *OpenChannelRequest) Reset() { - *x = OpenChannelRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OpenChannelRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OpenChannelRequest) ProtoMessage() {} - -func (x *OpenChannelRequest) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_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 OpenChannelRequest.ProtoReflect.Descriptor instead. -func (*OpenChannelRequest) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{14} -} - -func (x *OpenChannelRequest) GetState() *protobuf.State { - if x != nil { - return x.State - } - return nil -} - -func (x *OpenChannelRequest) GetChannelId() []byte { - if x != nil { - return x.ChannelId - } - return nil -} +func (*OpenChannelResponse_NonceShare) isOpenChannelResponse_Msg() {} type CloseChannelRequest struct { state protoimpl.MessageState @@ -969,7 +736,7 @@ type CloseChannelRequest struct { func (x *CloseChannelRequest) Reset() { *x = CloseChannelRequest{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[15] + mi := &file_perun_wallet_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -982,7 +749,7 @@ func (x *CloseChannelRequest) String() string { func (*CloseChannelRequest) ProtoMessage() {} func (x *CloseChannelRequest) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[15] + mi := &file_perun_wallet_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -995,7 +762,7 @@ func (x *CloseChannelRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CloseChannelRequest.ProtoReflect.Descriptor instead. func (*CloseChannelRequest) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{15} + return file_perun_wallet_proto_rawDescGZIP(), []int{11} } func (x *CloseChannelRequest) GetChannelId() []byte { @@ -1026,7 +793,7 @@ type ForceCloseChannelRequest struct { func (x *ForceCloseChannelRequest) Reset() { *x = ForceCloseChannelRequest{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[16] + mi := &file_perun_wallet_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1039,7 +806,7 @@ func (x *ForceCloseChannelRequest) String() string { func (*ForceCloseChannelRequest) ProtoMessage() {} func (x *ForceCloseChannelRequest) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[16] + mi := &file_perun_wallet_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1052,7 +819,7 @@ func (x *ForceCloseChannelRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ForceCloseChannelRequest.ProtoReflect.Descriptor instead. func (*ForceCloseChannelRequest) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{16} + return file_perun_wallet_proto_rawDescGZIP(), []int{12} } func (x *ForceCloseChannelRequest) GetChannelId() []byte { @@ -1083,7 +850,7 @@ type ChallengeEventRequest struct { func (x *ChallengeEventRequest) Reset() { *x = ChallengeEventRequest{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[17] + mi := &file_perun_wallet_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1096,7 +863,7 @@ func (x *ChallengeEventRequest) String() string { func (*ChallengeEventRequest) ProtoMessage() {} func (x *ChallengeEventRequest) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[17] + mi := &file_perun_wallet_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1109,7 +876,7 @@ func (x *ChallengeEventRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ChallengeEventRequest.ProtoReflect.Descriptor instead. func (*ChallengeEventRequest) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{17} + return file_perun_wallet_proto_rawDescGZIP(), []int{13} } func (x *ChallengeEventRequest) GetChannelId() []byte { @@ -1133,14 +900,12 @@ type UpdateNotificationRequest struct { // The state with which the channel should be updated. State *protobuf.State `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` - // The channel id of the channel to be updated. - ChannelId []byte `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` } func (x *UpdateNotificationRequest) Reset() { *x = UpdateNotificationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[18] + mi := &file_perun_wallet_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1153,7 +918,7 @@ func (x *UpdateNotificationRequest) String() string { func (*UpdateNotificationRequest) ProtoMessage() {} func (x *UpdateNotificationRequest) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[18] + mi := &file_perun_wallet_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1166,7 +931,7 @@ func (x *UpdateNotificationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateNotificationRequest.ProtoReflect.Descriptor instead. func (*UpdateNotificationRequest) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{18} + return file_perun_wallet_proto_rawDescGZIP(), []int{14} } func (x *UpdateNotificationRequest) GetState() *protobuf.State { @@ -1176,13 +941,6 @@ func (x *UpdateNotificationRequest) GetState() *protobuf.State { return nil } -func (x *UpdateNotificationRequest) GetChannelId() []byte { - if x != nil { - return x.ChannelId - } - return nil -} - type UpdateNotificationResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1195,7 +953,7 @@ type UpdateNotificationResponse struct { func (x *UpdateNotificationResponse) Reset() { *x = UpdateNotificationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[19] + mi := &file_perun_wallet_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1208,7 +966,7 @@ func (x *UpdateNotificationResponse) String() string { func (*UpdateNotificationResponse) ProtoMessage() {} func (x *UpdateNotificationResponse) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[19] + mi := &file_perun_wallet_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1221,7 +979,7 @@ func (x *UpdateNotificationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateNotificationResponse.ProtoReflect.Descriptor instead. func (*UpdateNotificationResponse) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{19} + return file_perun_wallet_proto_rawDescGZIP(), []int{15} } func (x *UpdateNotificationResponse) GetAccepted() bool { @@ -1236,14 +994,16 @@ type SignMessageRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // The public key expected to sign the given message. + Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` // The message to be signed. - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` } func (x *SignMessageRequest) Reset() { *x = SignMessageRequest{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[20] + mi := &file_perun_wallet_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1256,7 +1016,7 @@ func (x *SignMessageRequest) String() string { func (*SignMessageRequest) ProtoMessage() {} func (x *SignMessageRequest) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[20] + mi := &file_perun_wallet_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1269,7 +1029,14 @@ func (x *SignMessageRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SignMessageRequest.ProtoReflect.Descriptor instead. func (*SignMessageRequest) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{20} + return file_perun_wallet_proto_rawDescGZIP(), []int{16} +} + +func (x *SignMessageRequest) GetPubkey() []byte { + if x != nil { + return x.Pubkey + } + return nil } func (x *SignMessageRequest) GetData() []byte { @@ -1294,7 +1061,7 @@ type SignMessageResponse struct { func (x *SignMessageResponse) Reset() { *x = SignMessageResponse{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[21] + mi := &file_perun_wallet_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1307,7 +1074,7 @@ func (x *SignMessageResponse) String() string { func (*SignMessageResponse) ProtoMessage() {} func (x *SignMessageResponse) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[21] + mi := &file_perun_wallet_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1320,7 +1087,7 @@ func (x *SignMessageResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SignMessageResponse.ProtoReflect.Descriptor instead. func (*SignMessageResponse) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{21} + return file_perun_wallet_proto_rawDescGZIP(), []int{17} } func (m *SignMessageResponse) GetMsg() isSignMessageResponse_Msg { @@ -1353,7 +1120,6 @@ type SignMessageResponse_Rejected struct { } type SignMessageResponse_Signature struct { - // The signature of the message. Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3,oneof"` } @@ -1373,7 +1139,7 @@ type GetAssetsRequest struct { func (x *GetAssetsRequest) Reset() { *x = GetAssetsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[22] + mi := &file_perun_wallet_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1386,7 +1152,7 @@ func (x *GetAssetsRequest) String() string { func (*GetAssetsRequest) ProtoMessage() {} func (x *GetAssetsRequest) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[22] + mi := &file_perun_wallet_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1399,7 +1165,7 @@ func (x *GetAssetsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAssetsRequest.ProtoReflect.Descriptor instead. func (*GetAssetsRequest) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{22} + return file_perun_wallet_proto_rawDescGZIP(), []int{18} } func (x *GetAssetsRequest) GetAssets() *protobuf.Balances { @@ -1416,14 +1182,12 @@ type Asset struct { // The asset id of the asset. AssetId []byte `protobuf:"bytes,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` - // A list of outpoints of the given asset_id. - Outpoints [][]byte `protobuf:"bytes,2,rep,name=outpoints,proto3" json:"outpoints,omitempty"` } func (x *Asset) Reset() { *x = Asset{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[23] + mi := &file_perun_wallet_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1436,7 +1200,7 @@ func (x *Asset) String() string { func (*Asset) ProtoMessage() {} func (x *Asset) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[23] + mi := &file_perun_wallet_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1449,7 +1213,7 @@ func (x *Asset) ProtoReflect() protoreflect.Message { // Deprecated: Use Asset.ProtoReflect.Descriptor instead. func (*Asset) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{23} + return file_perun_wallet_proto_rawDescGZIP(), []int{19} } func (x *Asset) GetAssetId() []byte { @@ -1459,60 +1223,6 @@ func (x *Asset) GetAssetId() []byte { return nil } -func (x *Asset) GetOutpoints() [][]byte { - if x != nil { - return x.Outpoints - } - return nil -} - -type Assets struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Assets []*Asset `protobuf:"bytes,1,rep,name=assets,proto3" json:"assets,omitempty"` -} - -func (x *Assets) Reset() { - *x = Assets{} - if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Assets) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Assets) ProtoMessage() {} - -func (x *Assets) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_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 Assets.ProtoReflect.Descriptor instead. -func (*Assets) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{24} -} - -func (x *Assets) GetAssets() []*Asset { - if x != nil { - return x.Assets - } - return nil -} - type UnmatchableAssetsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1527,7 +1237,7 @@ type UnmatchableAssetsResponse struct { func (x *UnmatchableAssetsResponse) Reset() { *x = UnmatchableAssetsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[25] + mi := &file_perun_wallet_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1540,7 +1250,7 @@ func (x *UnmatchableAssetsResponse) String() string { func (*UnmatchableAssetsResponse) ProtoMessage() {} func (x *UnmatchableAssetsResponse) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[25] + mi := &file_perun_wallet_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1553,7 +1263,7 @@ func (x *UnmatchableAssetsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UnmatchableAssetsResponse.ProtoReflect.Descriptor instead. func (*UnmatchableAssetsResponse) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{25} + return file_perun_wallet_proto_rawDescGZIP(), []int{20} } func (x *UnmatchableAssetsResponse) GetAssetIdx() uint32 { @@ -1578,14 +1288,13 @@ type GetAssetsResponse struct { // Types that are assignable to Msg: // // *GetAssetsResponse_Rejected - // *GetAssetsResponse_Assets Msg isGetAssetsResponse_Msg `protobuf_oneof:"msg"` } func (x *GetAssetsResponse) Reset() { *x = GetAssetsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[26] + mi := &file_perun_wallet_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1598,7 +1307,7 @@ func (x *GetAssetsResponse) String() string { func (*GetAssetsResponse) ProtoMessage() {} func (x *GetAssetsResponse) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[26] + mi := &file_perun_wallet_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1611,7 +1320,7 @@ func (x *GetAssetsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAssetsResponse.ProtoReflect.Descriptor instead. func (*GetAssetsResponse) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{26} + return file_perun_wallet_proto_rawDescGZIP(), []int{21} } func (m *GetAssetsResponse) GetMsg() isGetAssetsResponse_Msg { @@ -1628,13 +1337,6 @@ func (x *GetAssetsResponse) GetRejected() *UnmatchableAssetsResponse { return nil } -func (x *GetAssetsResponse) GetAssets() *Assets { - if x, ok := x.GetMsg().(*GetAssetsResponse_Assets); ok { - return x.Assets - } - return nil -} - type isGetAssetsResponse_Msg interface { isGetAssetsResponse_Msg() } @@ -1643,27 +1345,22 @@ type GetAssetsResponse_Rejected struct { Rejected *UnmatchableAssetsResponse `protobuf:"bytes,2,opt,name=rejected,proto3,oneof"` } -type GetAssetsResponse_Assets struct { - Assets *Assets `protobuf:"bytes,1,opt,name=assets,proto3,oneof"` -} - func (*GetAssetsResponse_Rejected) isGetAssetsResponse_Msg() {} -func (*GetAssetsResponse_Assets) isGetAssetsResponse_Msg() {} - type SignTransactionRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + Identifier []byte `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` // The transaction to be signed. - Transaction []byte `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"` + Transaction []byte `protobuf:"bytes,2,opt,name=transaction,proto3" json:"transaction,omitempty"` } func (x *SignTransactionRequest) Reset() { *x = SignTransactionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[27] + mi := &file_perun_wallet_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1676,7 +1373,7 @@ func (x *SignTransactionRequest) String() string { func (*SignTransactionRequest) ProtoMessage() {} func (x *SignTransactionRequest) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[27] + mi := &file_perun_wallet_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1689,7 +1386,14 @@ func (x *SignTransactionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SignTransactionRequest.ProtoReflect.Descriptor instead. func (*SignTransactionRequest) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{27} + return file_perun_wallet_proto_rawDescGZIP(), []int{22} +} + +func (x *SignTransactionRequest) GetIdentifier() []byte { + if x != nil { + return x.Identifier + } + return nil } func (x *SignTransactionRequest) GetTransaction() []byte { @@ -1707,14 +1411,14 @@ type SignTransactionResponse struct { // Types that are assignable to Msg: // // *SignTransactionResponse_Rejected - // *SignTransactionResponse_Signature + // *SignTransactionResponse_Transaction Msg isSignTransactionResponse_Msg `protobuf_oneof:"msg"` } func (x *SignTransactionResponse) Reset() { *x = SignTransactionResponse{} if protoimpl.UnsafeEnabled { - mi := &file_perun_wallet_proto_msgTypes[28] + mi := &file_perun_wallet_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1727,7 +1431,7 @@ func (x *SignTransactionResponse) String() string { func (*SignTransactionResponse) ProtoMessage() {} func (x *SignTransactionResponse) ProtoReflect() protoreflect.Message { - mi := &file_perun_wallet_proto_msgTypes[28] + mi := &file_perun_wallet_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1740,7 +1444,7 @@ func (x *SignTransactionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SignTransactionResponse.ProtoReflect.Descriptor instead. func (*SignTransactionResponse) Descriptor() ([]byte, []int) { - return file_perun_wallet_proto_rawDescGZIP(), []int{28} + return file_perun_wallet_proto_rawDescGZIP(), []int{23} } func (m *SignTransactionResponse) GetMsg() isSignTransactionResponse_Msg { @@ -1757,9 +1461,9 @@ func (x *SignTransactionResponse) GetRejected() *Rejected { return nil } -func (x *SignTransactionResponse) GetSignature() []byte { - if x, ok := x.GetMsg().(*SignTransactionResponse_Signature); ok { - return x.Signature +func (x *SignTransactionResponse) GetTransaction() []byte { + if x, ok := x.GetMsg().(*SignTransactionResponse_Transaction); ok { + return x.Transaction } return nil } @@ -1772,14 +1476,14 @@ type SignTransactionResponse_Rejected struct { Rejected *Rejected `protobuf:"bytes,1,opt,name=rejected,proto3,oneof"` } -type SignTransactionResponse_Signature struct { - // The signature of the transaction. - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3,oneof"` +type SignTransactionResponse_Transaction struct { + // The signed transaction. + Transaction []byte `protobuf:"bytes,2,opt,name=transaction,proto3,oneof"` } func (*SignTransactionResponse_Rejected) isSignTransactionResponse_Msg() {} -func (*SignTransactionResponse_Signature) isSignTransactionResponse_Msg() {} +func (*SignTransactionResponse_Transaction) isSignTransactionResponse_Msg() {} var File_perun_wallet_proto protoreflect.FileDescriptor @@ -1791,242 +1495,187 @@ var file_perun_wallet_proto_rawDesc = []byte{ 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x22, 0x0a, 0x08, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 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, - 0x56, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x06, 0x61, 0x73, 0x73, - 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x65, 0x72, 0x75, - 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, - 0x06, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x22, 0x73, 0x0a, 0x13, 0x43, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, - 0x0a, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x6a, 0x65, - 0x63, 0x74, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x5d, 0x0a, 0x14, - 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 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, 0x1d, 0x0a, 0x0a, - 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x59, 0x0a, 0x10, 0x53, - 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 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, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x8e, 0x01, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, - 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x38, 0x0a, 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x34, 0x0a, 0x13, 0x43, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x22, 0x30, 0x0a, - 0x0f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, - 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, 0x22, - 0x8a, 0x01, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, + 0xac, 0x01, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 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, + 0x2d, 0x0a, 0x12, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x5f, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x63, 0x68, 0x61, + 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x73, + 0x0a, 0x13, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, + 0x00, 0x52, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0a, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, + 0x00, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x42, 0x05, 0x0a, 0x03, + 0x6d, 0x73, 0x67, 0x22, 0x3e, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x22, 0x59, 0x0a, 0x10, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, + 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, + 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x8e, + 0x01, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, - 0x65, 0x64, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x35, - 0x0a, 0x05, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, - 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x75, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x48, 0x00, 0x52, 0x05, - 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x39, 0x0a, 0x18, - 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x6f, 0x73, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, + 0x65, 0x64, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x38, + 0x0a, 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x75, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x00, + 0x52, 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, + 0x34, 0x0a, 0x13, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x22, 0x30, 0x0a, 0x0f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x66, 0x75, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 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, 0x22, 0x35, 0x0a, 0x14, 0x53, 0x75, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x66, 0x75, 0x6c, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 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, 0x22, 0x8f, - 0x01, 0x0a, 0x19, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43, - 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, - 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, - 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, - 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, - 0x65, 0x64, 0x12, 0x35, 0x0a, 0x05, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, - 0x48, 0x00, 0x52, 0x05, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, - 0x22, 0x60, 0x0a, 0x17, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x43, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 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, 0x22, 0x91, 0x01, 0x0a, 0x18, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, - 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x34, 0x0a, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x6a, - 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x38, 0x0a, 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, - 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x5b, 0x0a, 0x12, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x68, - 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x49, 0x64, 0x22, 0x5c, 0x0a, 0x13, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, - 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, - 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 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, 0x22, 0x61, 0x0a, 0x18, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, - 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 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, 0x22, 0x5e, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, - 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 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, 0x22, 0x62, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, - 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 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, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x8a, 0x01, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, + 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x05, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x43, + 0x6c, 0x6f, 0x73, 0x65, 0x48, 0x00, 0x52, 0x05, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x42, 0x05, 0x0a, + 0x03, 0x6d, 0x73, 0x67, 0x22, 0x55, 0x0a, 0x12, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x08, 0x70, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x18, 0x01, 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, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x22, 0x75, 0x0a, 0x13, 0x4f, + 0x70, 0x65, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x08, + 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x21, 0x0a, 0x0b, 0x6e, 0x6f, 0x6e, 0x63, + 0x65, 0x5f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, + 0x0a, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x6d, + 0x73, 0x67, 0x22, 0x5c, 0x0a, 0x13, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, + 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x38, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 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, + 0x22, 0x61, 0x0a, 0x18, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, + 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 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, 0x22, 0x5e, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 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, 0x22, 0x43, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 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, 0x22, 0x38, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, - 0x65, 0x64, 0x22, 0x28, 0x0a, 0x12, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x72, 0x0a, 0x13, - 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, - 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x09, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, - 0x22, 0x3f, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, 0x01, - 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, 0x06, 0x61, 0x73, 0x73, 0x65, 0x74, - 0x73, 0x22, 0x40, 0x0a, 0x05, 0x41, 0x73, 0x73, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x73, - 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x73, - 0x73, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, - 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x09, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, - 0x6e, 0x74, 0x73, 0x22, 0x35, 0x0a, 0x06, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x2b, 0x0a, - 0x06, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, - 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x41, 0x73, 0x73, - 0x65, 0x74, 0x52, 0x06, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x22, 0x50, 0x0a, 0x19, 0x55, 0x6e, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x73, 0x73, 0x65, 0x74, - 0x5f, 0x69, 0x64, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x61, 0x73, 0x73, 0x65, - 0x74, 0x49, 0x64, 0x78, 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, 0x91, 0x01, 0x0a, - 0x11, 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x45, 0x0a, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x55, 0x6e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x61, 0x62, 0x6c, 0x65, 0x41, - 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, - 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x06, 0x61, 0x73, 0x73, - 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x65, 0x72, 0x75, - 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x48, - 0x00, 0x52, 0x06, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, - 0x22, 0x3a, 0x0a, 0x16, 0x53, 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x76, 0x0a, 0x17, - 0x53, 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, - 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, 0x72, 0x75, - 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, - 0x64, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x0a, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x48, 0x00, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0x05, 0x0a, - 0x03, 0x6d, 0x73, 0x67, 0x32, 0xde, 0x03, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x52, 0x0a, 0x0b, 0x4f, 0x70, 0x65, 0x6e, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x20, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x65, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, - 0x70, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0d, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x22, 0x2e, 0x70, + 0x65, 0x64, 0x22, 0x40, 0x0a, 0x12, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, + 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x22, 0x72, 0x0a, 0x13, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x72, + 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, + 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6a, + 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, + 0x64, 0x12, 0x1e, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x3f, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x41, + 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x06, + 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, 0x01, 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, 0x06, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x22, 0x22, 0x0a, 0x05, 0x41, 0x73, 0x73, + 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x73, 0x73, 0x65, 0x74, 0x49, 0x64, 0x22, 0x50, 0x0a, + 0x19, 0x55, 0x6e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x65, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x73, + 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x61, + 0x73, 0x73, 0x65, 0x74, 0x49, 0x64, 0x78, 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, + 0x61, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x6e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x61, 0x62, 0x6c, + 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, + 0x00, 0x52, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x42, 0x05, 0x0a, 0x03, 0x6d, + 0x73, 0x67, 0x22, 0x5a, 0x0a, 0x16, 0x53, 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x7a, + 0x0a, 0x17, 0x53, 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x6a, + 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x65, + 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6a, 0x65, 0x63, + 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, + 0x22, 0x0a, 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x05, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x32, 0x95, 0x02, 0x0a, 0x0e, 0x43, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x52, 0x0a, + 0x0b, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x20, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x23, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68, - 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x21, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6c, 0x6f, 0x73, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, - 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x11, - 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x12, 0x26, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x6f, - 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x70, 0x65, 0x72, 0x75, - 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x61, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x25, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, - 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x61, - 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb2, 0x05, 0x0a, 0x0d, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0b, 0x4f, 0x70, 0x65, 0x6e, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x20, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x12, 0x49, 0x0a, 0x0c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x12, 0x21, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x53, 0x0a, 0x11, 0x46, - 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x12, 0x26, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, - 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x12, 0x4d, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x12, 0x23, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, - 0x67, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, + 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, + 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x58, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, + 0x65, 0x6c, 0x12, 0x22, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0c, 0x43, + 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x21, 0x2e, 0x70, 0x65, + 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x6e, + 0x65, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, + 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x32, 0xce, 0x03, 0x0a, 0x0d, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x52, 0x0a, 0x0b, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x12, 0x20, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x65, 0x72, 0x75, - 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0f, - 0x53, 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x24, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x09, - 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x70, 0x65, 0x72, 0x75, - 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x65, - 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x65, 0x72, 0x75, - 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x65, - 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x07, 0x5a, 0x05, 0x2e, 0x2f, - 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x52, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x20, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0f, 0x53, 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, + 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x65, + 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x65, 0x72, 0x75, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2041,97 +1690,77 @@ func file_perun_wallet_proto_rawDescGZIP() []byte { return file_perun_wallet_proto_rawDescData } -var file_perun_wallet_proto_msgTypes = make([]protoimpl.MessageInfo, 29) +var file_perun_wallet_proto_msgTypes = make([]protoimpl.MessageInfo, 24) var file_perun_wallet_proto_goTypes = []interface{}{ - (*Rejected)(nil), // 0: perunservice.Rejected - (*ChannelOpenRequest)(nil), // 1: perunservice.ChannelOpenRequest - (*ChannelOpenResponse)(nil), // 2: perunservice.ChannelOpenResponse - (*ChannelUpdateRequest)(nil), // 3: perunservice.ChannelUpdateRequest - (*SuccessfulUpdate)(nil), // 4: perunservice.SuccessfulUpdate - (*ChannelUpdateResponse)(nil), // 5: perunservice.ChannelUpdateResponse - (*ChannelCloseRequest)(nil), // 6: perunservice.ChannelCloseRequest - (*SuccessfulClose)(nil), // 7: perunservice.SuccessfulClose - (*ChannelCloseResponse)(nil), // 8: perunservice.ChannelCloseResponse - (*ChannelForceCloseRequest)(nil), // 9: perunservice.ChannelForceCloseRequest - (*SuccessfulForceClose)(nil), // 10: perunservice.SuccessfulForceClose - (*ChannelForceCloseResponse)(nil), // 11: perunservice.ChannelForceCloseResponse - (*ChallengeChannelRequest)(nil), // 12: perunservice.ChallengeChannelRequest - (*ChallengeChannelResponse)(nil), // 13: perunservice.ChallengeChannelResponse - (*OpenChannelRequest)(nil), // 14: perunservice.OpenChannelRequest - (*CloseChannelRequest)(nil), // 15: perunservice.CloseChannelRequest - (*ForceCloseChannelRequest)(nil), // 16: perunservice.ForceCloseChannelRequest - (*ChallengeEventRequest)(nil), // 17: perunservice.ChallengeEventRequest - (*UpdateNotificationRequest)(nil), // 18: perunservice.UpdateNotificationRequest - (*UpdateNotificationResponse)(nil), // 19: perunservice.UpdateNotificationResponse - (*SignMessageRequest)(nil), // 20: perunservice.SignMessageRequest - (*SignMessageResponse)(nil), // 21: perunservice.SignMessageResponse - (*GetAssetsRequest)(nil), // 22: perunservice.GetAssetsRequest - (*Asset)(nil), // 23: perunservice.Asset - (*Assets)(nil), // 24: perunservice.Assets - (*UnmatchableAssetsResponse)(nil), // 25: perunservice.UnmatchableAssetsResponse - (*GetAssetsResponse)(nil), // 26: perunservice.GetAssetsResponse - (*SignTransactionRequest)(nil), // 27: perunservice.SignTransactionRequest - (*SignTransactionResponse)(nil), // 28: perunservice.SignTransactionResponse - (*protobuf.State)(nil), // 29: perunwire.State - (*protobuf.Balances)(nil), // 30: perunwire.Balances - (*emptypb.Empty)(nil), // 31: google.protobuf.Empty + (*Rejected)(nil), // 0: perunservice.Rejected + (*ChannelOpenRequest)(nil), // 1: perunservice.ChannelOpenRequest + (*ChannelOpenResponse)(nil), // 2: perunservice.ChannelOpenResponse + (*ChannelUpdateRequest)(nil), // 3: perunservice.ChannelUpdateRequest + (*SuccessfulUpdate)(nil), // 4: perunservice.SuccessfulUpdate + (*ChannelUpdateResponse)(nil), // 5: perunservice.ChannelUpdateResponse + (*ChannelCloseRequest)(nil), // 6: perunservice.ChannelCloseRequest + (*SuccessfulClose)(nil), // 7: perunservice.SuccessfulClose + (*ChannelCloseResponse)(nil), // 8: perunservice.ChannelCloseResponse + (*OpenChannelRequest)(nil), // 9: perunservice.OpenChannelRequest + (*OpenChannelResponse)(nil), // 10: perunservice.OpenChannelResponse + (*CloseChannelRequest)(nil), // 11: perunservice.CloseChannelRequest + (*ForceCloseChannelRequest)(nil), // 12: perunservice.ForceCloseChannelRequest + (*ChallengeEventRequest)(nil), // 13: perunservice.ChallengeEventRequest + (*UpdateNotificationRequest)(nil), // 14: perunservice.UpdateNotificationRequest + (*UpdateNotificationResponse)(nil), // 15: perunservice.UpdateNotificationResponse + (*SignMessageRequest)(nil), // 16: perunservice.SignMessageRequest + (*SignMessageResponse)(nil), // 17: perunservice.SignMessageResponse + (*GetAssetsRequest)(nil), // 18: perunservice.GetAssetsRequest + (*Asset)(nil), // 19: perunservice.Asset + (*UnmatchableAssetsResponse)(nil), // 20: perunservice.UnmatchableAssetsResponse + (*GetAssetsResponse)(nil), // 21: perunservice.GetAssetsResponse + (*SignTransactionRequest)(nil), // 22: perunservice.SignTransactionRequest + (*SignTransactionResponse)(nil), // 23: perunservice.SignTransactionResponse + (*protobuf.Allocation)(nil), // 24: perunwire.Allocation + (*protobuf.State)(nil), // 25: perunwire.State + (*protobuf.LedgerChannelProposalMsg)(nil), // 26: perunwire.LedgerChannelProposalMsg + (*protobuf.Balances)(nil), // 27: perunwire.Balances } var file_perun_wallet_proto_depIdxs = []int32{ - 24, // 0: perunservice.ChannelOpenRequest.assets:type_name -> perunservice.Assets + 24, // 0: perunservice.ChannelOpenRequest.allocation:type_name -> perunwire.Allocation 0, // 1: perunservice.ChannelOpenResponse.rejected:type_name -> perunservice.Rejected - 29, // 2: perunservice.ChannelUpdateRequest.state:type_name -> perunwire.State - 29, // 3: perunservice.SuccessfulUpdate.state:type_name -> perunwire.State + 25, // 2: perunservice.ChannelUpdateRequest.state:type_name -> perunwire.State + 25, // 3: perunservice.SuccessfulUpdate.state:type_name -> perunwire.State 0, // 4: perunservice.ChannelUpdateResponse.rejected:type_name -> perunservice.Rejected 4, // 5: perunservice.ChannelUpdateResponse.update:type_name -> perunservice.SuccessfulUpdate 0, // 6: perunservice.ChannelCloseResponse.rejected:type_name -> perunservice.Rejected 7, // 7: perunservice.ChannelCloseResponse.close:type_name -> perunservice.SuccessfulClose - 0, // 8: perunservice.ChannelForceCloseResponse.rejected:type_name -> perunservice.Rejected - 7, // 9: perunservice.ChannelForceCloseResponse.close:type_name -> perunservice.SuccessfulClose - 29, // 10: perunservice.ChallengeChannelRequest.state:type_name -> perunwire.State - 0, // 11: perunservice.ChallengeChannelResponse.rejected:type_name -> perunservice.Rejected - 4, // 12: perunservice.ChallengeChannelResponse.update:type_name -> perunservice.SuccessfulUpdate - 29, // 13: perunservice.OpenChannelRequest.state:type_name -> perunwire.State - 29, // 14: perunservice.CloseChannelRequest.state:type_name -> perunwire.State - 29, // 15: perunservice.ForceCloseChannelRequest.state:type_name -> perunwire.State - 29, // 16: perunservice.ChallengeEventRequest.state:type_name -> perunwire.State - 29, // 17: perunservice.UpdateNotificationRequest.state:type_name -> perunwire.State - 0, // 18: perunservice.SignMessageResponse.rejected:type_name -> perunservice.Rejected - 30, // 19: perunservice.GetAssetsRequest.assets:type_name -> perunwire.Balances - 23, // 20: perunservice.Assets.assets:type_name -> perunservice.Asset - 25, // 21: perunservice.GetAssetsResponse.rejected:type_name -> perunservice.UnmatchableAssetsResponse - 24, // 22: perunservice.GetAssetsResponse.assets:type_name -> perunservice.Assets - 0, // 23: perunservice.SignTransactionResponse.rejected:type_name -> perunservice.Rejected - 1, // 24: perunservice.ChannelService.OpenChannel:input_type -> perunservice.ChannelOpenRequest - 3, // 25: perunservice.ChannelService.UpdateChannel:input_type -> perunservice.ChannelUpdateRequest - 6, // 26: perunservice.ChannelService.CloseChannel:input_type -> perunservice.ChannelCloseRequest - 9, // 27: perunservice.ChannelService.ForceCloseChannel:input_type -> perunservice.ChannelForceCloseRequest - 12, // 28: perunservice.ChannelService.ChallengeChannel:input_type -> perunservice.ChallengeChannelRequest - 14, // 29: perunservice.WalletService.OpenChannel:input_type -> perunservice.OpenChannelRequest - 15, // 30: perunservice.WalletService.CloseChannel:input_type -> perunservice.CloseChannelRequest - 16, // 31: perunservice.WalletService.ForceCloseChannel:input_type -> perunservice.ForceCloseChannelRequest - 17, // 32: perunservice.WalletService.ChallengeEvent:input_type -> perunservice.ChallengeEventRequest - 18, // 33: perunservice.WalletService.UpdateNotification:input_type -> perunservice.UpdateNotificationRequest - 20, // 34: perunservice.WalletService.SignMessage:input_type -> perunservice.SignMessageRequest - 27, // 35: perunservice.WalletService.SignTransaction:input_type -> perunservice.SignTransactionRequest - 22, // 36: perunservice.WalletService.GetAssets:input_type -> perunservice.GetAssetsRequest - 2, // 37: perunservice.ChannelService.OpenChannel:output_type -> perunservice.ChannelOpenResponse - 5, // 38: perunservice.ChannelService.UpdateChannel:output_type -> perunservice.ChannelUpdateResponse - 8, // 39: perunservice.ChannelService.CloseChannel:output_type -> perunservice.ChannelCloseResponse - 11, // 40: perunservice.ChannelService.ForceCloseChannel:output_type -> perunservice.ChannelForceCloseResponse - 13, // 41: perunservice.ChannelService.ChallengeChannel:output_type -> perunservice.ChallengeChannelResponse - 31, // 42: perunservice.WalletService.OpenChannel:output_type -> google.protobuf.Empty - 31, // 43: perunservice.WalletService.CloseChannel:output_type -> google.protobuf.Empty - 31, // 44: perunservice.WalletService.ForceCloseChannel:output_type -> google.protobuf.Empty - 31, // 45: perunservice.WalletService.ChallengeEvent:output_type -> google.protobuf.Empty - 19, // 46: perunservice.WalletService.UpdateNotification:output_type -> perunservice.UpdateNotificationResponse - 21, // 47: perunservice.WalletService.SignMessage:output_type -> perunservice.SignMessageResponse - 28, // 48: perunservice.WalletService.SignTransaction:output_type -> perunservice.SignTransactionResponse - 26, // 49: perunservice.WalletService.GetAssets:output_type -> perunservice.GetAssetsResponse - 37, // [37:50] is the sub-list for method output_type - 24, // [24:37] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name + 26, // 8: perunservice.OpenChannelRequest.proposal:type_name -> perunwire.LedgerChannelProposalMsg + 0, // 9: perunservice.OpenChannelResponse.rejected:type_name -> perunservice.Rejected + 25, // 10: perunservice.CloseChannelRequest.state:type_name -> perunwire.State + 25, // 11: perunservice.ForceCloseChannelRequest.state:type_name -> perunwire.State + 25, // 12: perunservice.ChallengeEventRequest.state:type_name -> perunwire.State + 25, // 13: perunservice.UpdateNotificationRequest.state:type_name -> perunwire.State + 0, // 14: perunservice.SignMessageResponse.rejected:type_name -> perunservice.Rejected + 27, // 15: perunservice.GetAssetsRequest.assets:type_name -> perunwire.Balances + 20, // 16: perunservice.GetAssetsResponse.rejected:type_name -> perunservice.UnmatchableAssetsResponse + 0, // 17: perunservice.SignTransactionResponse.rejected:type_name -> perunservice.Rejected + 1, // 18: perunservice.ChannelService.OpenChannel:input_type -> perunservice.ChannelOpenRequest + 3, // 19: perunservice.ChannelService.UpdateChannel:input_type -> perunservice.ChannelUpdateRequest + 6, // 20: perunservice.ChannelService.CloseChannel:input_type -> perunservice.ChannelCloseRequest + 9, // 21: perunservice.WalletService.OpenChannel:input_type -> perunservice.OpenChannelRequest + 14, // 22: perunservice.WalletService.UpdateNotification:input_type -> perunservice.UpdateNotificationRequest + 16, // 23: perunservice.WalletService.SignMessage:input_type -> perunservice.SignMessageRequest + 22, // 24: perunservice.WalletService.SignTransaction:input_type -> perunservice.SignTransactionRequest + 18, // 25: perunservice.WalletService.GetAssets:input_type -> perunservice.GetAssetsRequest + 2, // 26: perunservice.ChannelService.OpenChannel:output_type -> perunservice.ChannelOpenResponse + 5, // 27: perunservice.ChannelService.UpdateChannel:output_type -> perunservice.ChannelUpdateResponse + 8, // 28: perunservice.ChannelService.CloseChannel:output_type -> perunservice.ChannelCloseResponse + 10, // 29: perunservice.WalletService.OpenChannel:output_type -> perunservice.OpenChannelResponse + 15, // 30: perunservice.WalletService.UpdateNotification:output_type -> perunservice.UpdateNotificationResponse + 17, // 31: perunservice.WalletService.SignMessage:output_type -> perunservice.SignMessageResponse + 23, // 32: perunservice.WalletService.SignTransaction:output_type -> perunservice.SignTransactionResponse + 21, // 33: perunservice.WalletService.GetAssets:output_type -> perunservice.GetAssetsResponse + 26, // [26:34] is the sub-list for method output_type + 18, // [18:26] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name } func init() { file_perun_wallet_proto_init() } @@ -2249,7 +1878,7 @@ func file_perun_wallet_proto_init() { } } file_perun_wallet_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChannelForceCloseRequest); i { + switch v := v.(*OpenChannelRequest); i { case 0: return &v.state case 1: @@ -2261,7 +1890,7 @@ func file_perun_wallet_proto_init() { } } file_perun_wallet_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SuccessfulForceClose); i { + switch v := v.(*OpenChannelResponse); i { case 0: return &v.state case 1: @@ -2273,54 +1902,6 @@ func file_perun_wallet_proto_init() { } } file_perun_wallet_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChannelForceCloseResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_perun_wallet_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChallengeChannelRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_perun_wallet_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChallengeChannelResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_perun_wallet_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OpenChannelRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_perun_wallet_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CloseChannelRequest); i { case 0: return &v.state @@ -2332,7 +1913,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ForceCloseChannelRequest); i { case 0: return &v.state @@ -2344,7 +1925,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChallengeEventRequest); i { case 0: return &v.state @@ -2356,7 +1937,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateNotificationRequest); i { case 0: return &v.state @@ -2368,7 +1949,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateNotificationResponse); i { case 0: return &v.state @@ -2380,7 +1961,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignMessageRequest); i { case 0: return &v.state @@ -2392,7 +1973,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignMessageResponse); i { case 0: return &v.state @@ -2404,7 +1985,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetAssetsRequest); i { case 0: return &v.state @@ -2416,7 +1997,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Asset); i { case 0: return &v.state @@ -2428,19 +2009,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Assets); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_perun_wallet_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UnmatchableAssetsResponse); i { case 0: return &v.state @@ -2452,7 +2021,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetAssetsResponse); i { case 0: return &v.state @@ -2464,7 +2033,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignTransactionRequest); i { case 0: return &v.state @@ -2476,7 +2045,7 @@ func file_perun_wallet_proto_init() { return nil } } - file_perun_wallet_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_perun_wallet_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignTransactionResponse); i { case 0: return &v.state @@ -2501,25 +2070,20 @@ func file_perun_wallet_proto_init() { (*ChannelCloseResponse_Rejected)(nil), (*ChannelCloseResponse_Close)(nil), } - file_perun_wallet_proto_msgTypes[11].OneofWrappers = []interface{}{ - (*ChannelForceCloseResponse_Rejected)(nil), - (*ChannelForceCloseResponse_Close)(nil), + file_perun_wallet_proto_msgTypes[10].OneofWrappers = []interface{}{ + (*OpenChannelResponse_Rejected)(nil), + (*OpenChannelResponse_NonceShare)(nil), } - file_perun_wallet_proto_msgTypes[13].OneofWrappers = []interface{}{ - (*ChallengeChannelResponse_Rejected)(nil), - (*ChallengeChannelResponse_Update)(nil), - } - file_perun_wallet_proto_msgTypes[21].OneofWrappers = []interface{}{ + file_perun_wallet_proto_msgTypes[17].OneofWrappers = []interface{}{ (*SignMessageResponse_Rejected)(nil), (*SignMessageResponse_Signature)(nil), } - file_perun_wallet_proto_msgTypes[26].OneofWrappers = []interface{}{ + file_perun_wallet_proto_msgTypes[21].OneofWrappers = []interface{}{ (*GetAssetsResponse_Rejected)(nil), - (*GetAssetsResponse_Assets)(nil), } - file_perun_wallet_proto_msgTypes[28].OneofWrappers = []interface{}{ + file_perun_wallet_proto_msgTypes[23].OneofWrappers = []interface{}{ (*SignTransactionResponse_Rejected)(nil), - (*SignTransactionResponse_Signature)(nil), + (*SignTransactionResponse_Transaction)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -2527,7 +2091,7 @@ func file_perun_wallet_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_perun_wallet_proto_rawDesc, NumEnums: 0, - NumMessages: 29, + NumMessages: 24, NumExtensions: 0, NumServices: 2, }, diff --git a/rpc/perun-wallet_grpc.pb.go b/rpc/proto/perun-wallet_grpc.pb.go similarity index 64% rename from rpc/perun-wallet_grpc.pb.go rename to rpc/proto/perun-wallet_grpc.pb.go index a30a312..c99e4f5 100644 --- a/rpc/perun-wallet_grpc.pb.go +++ b/rpc/proto/perun-wallet_grpc.pb.go @@ -1,17 +1,16 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v4.24.2 +// - protoc v4.24.3 // source: perun-wallet.proto -package rpc +package proto import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - emptypb "google.golang.org/protobuf/types/known/emptypb" ) // This is a compile-time assertion to ensure that this generated file @@ -29,10 +28,6 @@ type ChannelServiceClient interface { UpdateChannel(ctx context.Context, in *ChannelUpdateRequest, opts ...grpc.CallOption) (*ChannelUpdateResponse, error) // Initiate channel closing. CloseChannel(ctx context.Context, in *ChannelCloseRequest, opts ...grpc.CallOption) (*ChannelCloseResponse, error) - // Initiate force closing a channel. - ForceCloseChannel(ctx context.Context, in *ChannelForceCloseRequest, opts ...grpc.CallOption) (*ChannelForceCloseResponse, error) - // Initiate challenging some channel. - ChallengeChannel(ctx context.Context, in *ChallengeChannelRequest, opts ...grpc.CallOption) (*ChallengeChannelResponse, error) } type channelServiceClient struct { @@ -70,24 +65,6 @@ func (c *channelServiceClient) CloseChannel(ctx context.Context, in *ChannelClos return out, nil } -func (c *channelServiceClient) ForceCloseChannel(ctx context.Context, in *ChannelForceCloseRequest, opts ...grpc.CallOption) (*ChannelForceCloseResponse, error) { - out := new(ChannelForceCloseResponse) - err := c.cc.Invoke(ctx, "/perunservice.ChannelService/ForceCloseChannel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *channelServiceClient) ChallengeChannel(ctx context.Context, in *ChallengeChannelRequest, opts ...grpc.CallOption) (*ChallengeChannelResponse, error) { - out := new(ChallengeChannelResponse) - err := c.cc.Invoke(ctx, "/perunservice.ChannelService/ChallengeChannel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // ChannelServiceServer is the server API for ChannelService service. // All implementations must embed UnimplementedChannelServiceServer // for forward compatibility @@ -98,10 +75,6 @@ type ChannelServiceServer interface { UpdateChannel(context.Context, *ChannelUpdateRequest) (*ChannelUpdateResponse, error) // Initiate channel closing. CloseChannel(context.Context, *ChannelCloseRequest) (*ChannelCloseResponse, error) - // Initiate force closing a channel. - ForceCloseChannel(context.Context, *ChannelForceCloseRequest) (*ChannelForceCloseResponse, error) - // Initiate challenging some channel. - ChallengeChannel(context.Context, *ChallengeChannelRequest) (*ChallengeChannelResponse, error) mustEmbedUnimplementedChannelServiceServer() } @@ -118,12 +91,6 @@ func (UnimplementedChannelServiceServer) UpdateChannel(context.Context, *Channel func (UnimplementedChannelServiceServer) CloseChannel(context.Context, *ChannelCloseRequest) (*ChannelCloseResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CloseChannel not implemented") } -func (UnimplementedChannelServiceServer) ForceCloseChannel(context.Context, *ChannelForceCloseRequest) (*ChannelForceCloseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ForceCloseChannel not implemented") -} -func (UnimplementedChannelServiceServer) ChallengeChannel(context.Context, *ChallengeChannelRequest) (*ChallengeChannelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChallengeChannel not implemented") -} func (UnimplementedChannelServiceServer) mustEmbedUnimplementedChannelServiceServer() {} // UnsafeChannelServiceServer may be embedded to opt out of forward compatibility for this service. @@ -191,42 +158,6 @@ func _ChannelService_CloseChannel_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } -func _ChannelService_ForceCloseChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ChannelForceCloseRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ChannelServiceServer).ForceCloseChannel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/perunservice.ChannelService/ForceCloseChannel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChannelServiceServer).ForceCloseChannel(ctx, req.(*ChannelForceCloseRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ChannelService_ChallengeChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ChallengeChannelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ChannelServiceServer).ChallengeChannel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/perunservice.ChannelService/ChallengeChannel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChannelServiceServer).ChallengeChannel(ctx, req.(*ChallengeChannelRequest)) - } - return interceptor(ctx, in, info, handler) -} - // ChannelService_ServiceDesc is the grpc.ServiceDesc for ChannelService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -246,14 +177,6 @@ var ChannelService_ServiceDesc = grpc.ServiceDesc{ MethodName: "CloseChannel", Handler: _ChannelService_CloseChannel_Handler, }, - { - MethodName: "ForceCloseChannel", - Handler: _ChannelService_ForceCloseChannel_Handler, - }, - { - MethodName: "ChallengeChannel", - Handler: _ChannelService_ChallengeChannel_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "perun-wallet.proto", @@ -267,21 +190,7 @@ type WalletServiceClient interface { // channel service received a channel opening request from another peer. // This method lets the wallet know that it should ask the user whether or // not to accept the channel opening request. - OpenChannel(ctx context.Context, in *OpenChannelRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // Requesting channel closing form the wallet. This happesn if the Perun - // channel service received a channel closing request from another peer. - // This method lets the wallet know that it should ask the user whether or - // not to accept the channel closing request. - CloseChannel(ctx context.Context, in *CloseChannelRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // Requesting force closing a channel from the wallet. This happens if some - // Perun channel can be force closed by this user and might be called by the - // Perun channel service if it deems it to be an appropriate action. - ForceCloseChannel(ctx context.Context, in *ForceCloseChannelRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // Notifying the wallet about a challenge event regarding some channel. This - // is called by the Perun channel service if it receives challenge events - // from the ledger. The wallet might use this event to query the user whether - // or not to act on the challenge event. - ChallengeEvent(ctx context.Context, in *ChallengeEventRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + OpenChannel(ctx context.Context, in *OpenChannelRequest, opts ...grpc.CallOption) (*OpenChannelResponse, error) // The Perun channel service calls this method if it received a channel // update request from another peer. The wallet might use this channel update // request containing the proposed/new channel state to shown it in the @@ -306,8 +215,8 @@ func NewWalletServiceClient(cc grpc.ClientConnInterface) WalletServiceClient { return &walletServiceClient{cc} } -func (c *walletServiceClient) OpenChannel(ctx context.Context, in *OpenChannelRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) +func (c *walletServiceClient) OpenChannel(ctx context.Context, in *OpenChannelRequest, opts ...grpc.CallOption) (*OpenChannelResponse, error) { + out := new(OpenChannelResponse) err := c.cc.Invoke(ctx, "/perunservice.WalletService/OpenChannel", in, out, opts...) if err != nil { return nil, err @@ -315,33 +224,6 @@ func (c *walletServiceClient) OpenChannel(ctx context.Context, in *OpenChannelRe return out, nil } -func (c *walletServiceClient) CloseChannel(ctx context.Context, in *CloseChannelRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/perunservice.WalletService/CloseChannel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) ForceCloseChannel(ctx context.Context, in *ForceCloseChannelRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/perunservice.WalletService/ForceCloseChannel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *walletServiceClient) ChallengeEvent(ctx context.Context, in *ChallengeEventRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/perunservice.WalletService/ChallengeEvent", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *walletServiceClient) UpdateNotification(ctx context.Context, in *UpdateNotificationRequest, opts ...grpc.CallOption) (*UpdateNotificationResponse, error) { out := new(UpdateNotificationResponse) err := c.cc.Invoke(ctx, "/perunservice.WalletService/UpdateNotification", in, out, opts...) @@ -386,21 +268,7 @@ type WalletServiceServer interface { // channel service received a channel opening request from another peer. // This method lets the wallet know that it should ask the user whether or // not to accept the channel opening request. - OpenChannel(context.Context, *OpenChannelRequest) (*emptypb.Empty, error) - // Requesting channel closing form the wallet. This happesn if the Perun - // channel service received a channel closing request from another peer. - // This method lets the wallet know that it should ask the user whether or - // not to accept the channel closing request. - CloseChannel(context.Context, *CloseChannelRequest) (*emptypb.Empty, error) - // Requesting force closing a channel from the wallet. This happens if some - // Perun channel can be force closed by this user and might be called by the - // Perun channel service if it deems it to be an appropriate action. - ForceCloseChannel(context.Context, *ForceCloseChannelRequest) (*emptypb.Empty, error) - // Notifying the wallet about a challenge event regarding some channel. This - // is called by the Perun channel service if it receives challenge events - // from the ledger. The wallet might use this event to query the user whether - // or not to act on the challenge event. - ChallengeEvent(context.Context, *ChallengeEventRequest) (*emptypb.Empty, error) + OpenChannel(context.Context, *OpenChannelRequest) (*OpenChannelResponse, error) // The Perun channel service calls this method if it received a channel // update request from another peer. The wallet might use this channel update // request containing the proposed/new channel state to shown it in the @@ -418,23 +286,13 @@ type WalletServiceServer interface { mustEmbedUnimplementedWalletServiceServer() } -// TODO: Implement // UnimplementedWalletServiceServer must be embedded to have forward compatible implementations. type UnimplementedWalletServiceServer struct { } -func (UnimplementedWalletServiceServer) OpenChannel(context.Context, *OpenChannelRequest) (*emptypb.Empty, error) { +func (UnimplementedWalletServiceServer) OpenChannel(context.Context, *OpenChannelRequest) (*OpenChannelResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OpenChannel not implemented") } -func (UnimplementedWalletServiceServer) CloseChannel(context.Context, *CloseChannelRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseChannel not implemented") -} -func (UnimplementedWalletServiceServer) ForceCloseChannel(context.Context, *ForceCloseChannelRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method ForceCloseChannel not implemented") -} -func (UnimplementedWalletServiceServer) ChallengeEvent(context.Context, *ChallengeEventRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChallengeEvent not implemented") -} func (UnimplementedWalletServiceServer) UpdateNotification(context.Context, *UpdateNotificationRequest) (*UpdateNotificationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateNotification not implemented") } @@ -478,60 +336,6 @@ func _WalletService_OpenChannel_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } -func _WalletService_CloseChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseChannelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).CloseChannel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/perunservice.WalletService/CloseChannel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).CloseChannel(ctx, req.(*CloseChannelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_ForceCloseChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ForceCloseChannelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).ForceCloseChannel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/perunservice.WalletService/ForceCloseChannel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).ForceCloseChannel(ctx, req.(*ForceCloseChannelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WalletService_ChallengeEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ChallengeEventRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WalletServiceServer).ChallengeEvent(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/perunservice.WalletService/ChallengeEvent", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WalletServiceServer).ChallengeEvent(ctx, req.(*ChallengeEventRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _WalletService_UpdateNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UpdateNotificationRequest) if err := dec(in); err != nil { @@ -615,18 +419,6 @@ var WalletService_ServiceDesc = grpc.ServiceDesc{ MethodName: "OpenChannel", Handler: _WalletService_OpenChannel_Handler, }, - { - MethodName: "CloseChannel", - Handler: _WalletService_CloseChannel_Handler, - }, - { - MethodName: "ForceCloseChannel", - Handler: _WalletService_ForceCloseChannel_Handler, - }, - { - MethodName: "ChallengeEvent", - Handler: _WalletService_ChallengeEvent_Handler, - }, { MethodName: "UpdateNotification", Handler: _WalletService_UpdateNotification_Handler, diff --git a/service/channel_service.go b/service/channel_service.go index bbce170..8c875b1 100644 --- a/service/channel_service.go +++ b/service/channel_service.go @@ -3,7 +3,7 @@ package service import ( "context" "fmt" - "perun.network/channel-service/rpc" + "perun.network/channel-service/rpc/proto" "perun.network/channel-service/wallet" "perun.network/go-perun/channel" gpwallet "perun.network/go-perun/wallet" @@ -17,17 +17,17 @@ type ChannelService struct { UserRegister UserRegister Wallet gpwallet.Wallet - rpc.UnimplementedChannelServiceServer // always embed + proto.UnimplementedChannelServiceServer // always embed } -func NewChannelService(c rpc.WalletServiceClient) *ChannelService { +func NewChannelService(c proto.WalletServiceClient) *ChannelService { return &ChannelService{ UserRegister: NewMutexUserRegister(), Wallet: external.NewWallet(wallet.NewExternalClient(c)), } } -func (c ChannelService) OpenChannel(ctx context.Context, request *rpc.ChannelOpenRequest) (*rpc.ChannelOpenResponse, error) { +func (c ChannelService) OpenChannel(ctx context.Context, request *proto.ChannelOpenRequest) (*proto.ChannelOpenResponse, error) { user, err := c.GetUserFromChannelOpenRequest(request) if err != nil { @@ -41,15 +41,14 @@ func (c ChannelService) OpenChannel(ctx context.Context, request *rpc.ChannelOpe challengeDuration := c.GetChallengeDurationFromChannelOpenRequest(request) id, err := user.OpenChannel(ctx, peer, allocation, challengeDuration) if err != nil { - return &rpc.ChannelOpenResponse{Msg: &rpc.ChannelOpenResponse_Rejected{Rejected: &rpc.Rejected{Reason: err.Error()}}}, err + return &proto.ChannelOpenResponse{Msg: &proto.ChannelOpenResponse_Rejected{Rejected: &proto.Rejected{Reason: err.Error()}}}, err } - return &rpc.ChannelOpenResponse{Msg: &rpc.ChannelOpenResponse_ChannelId{ChannelId: id[:]}}, nil + return &proto.ChannelOpenResponse{Msg: &proto.ChannelOpenResponse_ChannelId{ChannelId: id[:]}}, nil } -func (c ChannelService) UpdateChannel(ctx context.Context, request *rpc.ChannelUpdateRequest) (*rpc.ChannelUpdateResponse, error) { - // FIXME: rpc.UpdateChannelRequest should probably not contain a state. If it does, we need to verify that it matches the state in the channel. - cid, user, err := c.GetChannelInfoFromRequest(request.GetChannelId()) +func (c ChannelService) UpdateChannel(ctx context.Context, request *proto.ChannelUpdateRequest) (*proto.ChannelUpdateResponse, error) { + cid, user, err := c.GetChannelInfoFromRequest(request.State.GetId()) if err != nil { return nil, err } @@ -57,13 +56,13 @@ func (c ChannelService) UpdateChannel(ctx context.Context, request *rpc.ChannelU if err != nil { return nil, err } - err = user.UpdateChannel(ctx, cid, state.Allocation) + err = user.UpdateChannel(ctx, cid, state) if err != nil { - rejected := rpc.Rejected{Reason: err.Error()} - return &rpc.ChannelUpdateResponse{Msg: &rpc.ChannelUpdateResponse_Rejected{Rejected: &rejected}}, err + rejected := proto.Rejected{Reason: err.Error()} + return &proto.ChannelUpdateResponse{Msg: &proto.ChannelUpdateResponse_Rejected{Rejected: &rejected}}, err } - return &rpc.ChannelUpdateResponse{Msg: &rpc.ChannelUpdateResponse_Update{Update: &rpc.SuccessfulUpdate{ + return &proto.ChannelUpdateResponse{Msg: &proto.ChannelUpdateResponse_Update{Update: &proto.SuccessfulUpdate{ // TODO: Use actual resulting state instead of the request state. State: request.State, // TODO: Abstract channel id encoding. @@ -71,7 +70,7 @@ func (c ChannelService) UpdateChannel(ctx context.Context, request *rpc.ChannelU }}}, nil } -func (c ChannelService) CloseChannel(ctx context.Context, request *rpc.ChannelCloseRequest) (*rpc.ChannelCloseResponse, error) { +func (c ChannelService) CloseChannel(ctx context.Context, request *proto.ChannelCloseRequest) (*proto.ChannelCloseResponse, error) { cid, user, err := c.GetChannelInfoFromRequest(request.GetChannelId()) if err != nil { return nil, err @@ -79,30 +78,9 @@ func (c ChannelService) CloseChannel(ctx context.Context, request *rpc.ChannelCl err = user.CloseChannel(ctx, cid) if err != nil { // TODO: Do we want to return the error here? - return &rpc.ChannelCloseResponse{Msg: &rpc.ChannelCloseResponse_Rejected{Rejected: &rpc.Rejected{Reason: err.Error()}}}, err - } - return &rpc.ChannelCloseResponse{Msg: &rpc.ChannelCloseResponse_Close{Close: &rpc.SuccessfulClose{ChannelId: cid[:]}}}, nil -} - -func (c ChannelService) ForceCloseChannel(ctx context.Context, request *rpc.ChannelForceCloseRequest) (*rpc.ChannelForceCloseResponse, error) { - cid, user, err := c.GetChannelInfoFromRequest(request.GetChannelId()) - if err != nil { - return nil, err + return &proto.ChannelCloseResponse{Msg: &proto.ChannelCloseResponse_Rejected{Rejected: &proto.Rejected{Reason: err.Error()}}}, err } - // TODO: Verify assumption that this is the same as close. - err = user.CloseChannel(ctx, cid) - if err != nil { - return &rpc.ChannelForceCloseResponse{Msg: &rpc.ChannelForceCloseResponse_Rejected{Rejected: &rpc.Rejected{Reason: err.Error()}}}, err - } - return &rpc.ChannelForceCloseResponse{Msg: &rpc.ChannelForceCloseResponse_Close{Close: &rpc.SuccessfulClose{ChannelId: cid[:]}}}, nil -} - -func (c ChannelService) ChallengeChannel(ctx context.Context, request *rpc.ChallengeChannelRequest) (*rpc.ChallengeChannelResponse, error) { - // FIXME: This endpoint does not make sense. It should be removed. - // There is no concept of challenging with an arbitrary state, but only with the latest state. - // In the context of Payment Channels, this is the same as settle. - - panic("fixme") + return &proto.ChannelCloseResponse{Msg: &proto.ChannelCloseResponse_Close{Close: &proto.SuccessfulClose{ChannelId: cid[:]}}}, nil } func AsChannelID(in []byte) (channel.ID, error) { @@ -127,22 +105,22 @@ func (c ChannelService) GetChannelInfoFromRequest(reqChannelId []byte) (channel. return cid, usr, err } -func (c ChannelService) GetUserFromChannelOpenRequest(request *rpc.ChannelOpenRequest) (*User, error) { +func (c ChannelService) GetUserFromChannelOpenRequest(request *proto.ChannelOpenRequest) (*User, error) { // FIXME: The OpenChannelRequest should contain info about the acting participant. panic("fixme") } -func (c ChannelService) GetAllocationFromChannelOpenRequest(request *rpc.ChannelOpenRequest) (*channel.Allocation, error) { +func (c ChannelService) GetAllocationFromChannelOpenRequest(request *proto.ChannelOpenRequest) (*channel.Allocation, error) { // FIXME: ChannelOpenRequest should specify an allocation / initial funds. panic("fixme") } -func (c ChannelService) GetPeerAddressFromChannelOpenRequest(request *rpc.ChannelOpenRequest) wire.Address { +func (c ChannelService) GetPeerAddressFromChannelOpenRequest(request *proto.ChannelOpenRequest) wire.Address { // FIXME: Do this properly and change the peer type in the request field. return simple.NewAddress(string(request.GetPeer())) } -func (c ChannelService) GetChallengeDurationFromChannelOpenRequest(request *rpc.ChannelOpenRequest) uint64 { +func (c ChannelService) GetChallengeDurationFromChannelOpenRequest(request *proto.ChannelOpenRequest) uint64 { // TODO: This should be specified in the request or hardcoded with default value. return 10 } diff --git a/service/user.go b/service/user.go index 7a74145..2d5344a 100644 --- a/service/user.go +++ b/service/user.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" "log" - "perun.network/channel-service/rpc" + "perun.network/channel-service/rpc/proto" "perun.network/go-perun/channel" "perun.network/go-perun/client" "perun.network/go-perun/wallet" @@ -22,11 +22,12 @@ var ErrChannelNotFound = errors.New("channel not found") type User struct { usrMutex sync.Mutex - Channels map[channel.ID]*client.Channel - Participant address.Participant - PerunClient *client.Client - WireAddress wire.Address - wsc rpc.WalletServiceClient + Channels map[channel.ID]*client.Channel + Participant address.Participant + PerunClient *client.Client + WireAddress wire.Address + wsc proto.WalletServiceClient + userRegister UserRegister } func (u *User) HandleUpdate(oldState *channel.State, update client.ChannelUpdate, responder *client.UpdateResponder) { @@ -36,9 +37,8 @@ func (u *User) HandleUpdate(oldState *channel.State, update client.ChannelUpdate return } - resp, err := u.wsc.UpdateNotification(context.TODO(), &rpc.UpdateNotificationRequest{ - State: pbNewState, - ChannelId: pbNewState.Id, + resp, err := u.wsc.UpdateNotification(context.TODO(), &proto.UpdateNotificationRequest{ + State: pbNewState, }) if err != nil { _ = responder.Reject(context.TODO(), "unable to send update notification to wallet") @@ -53,11 +53,44 @@ func (u *User) HandleUpdate(oldState *channel.State, update client.ChannelUpdate } func (u *User) HandleProposal(proposal client.ChannelProposal, responder *client.ProposalResponder) { - proposal.Base() - // FIXME: Make protobuf type for client.ChannelProposal and use it in OpenChannel. There might be an existing protobuf type for client.ChannelProposal. - panic("fixme") - // FIXME: OpenChannel needs OpenChannelResponse as return type! - //u.wsc.OpenChannel(nil, nil) + lcp, ok := proposal.(*client.LedgerChannelProposalMsg) + if !ok { + _ = responder.Reject(context.TODO(), "only ledger channel proposals are supported") + } + pLcp, err := protobuf.FromLedgerChannelProposalMsg(lcp) + if err != nil { + _ = responder.Reject(context.TODO(), fmt.Sprintf("unable to encode proposal: %v", err)) + } + resp, err := u.wsc.OpenChannel(context.TODO(), &proto.OpenChannelRequest{Proposal: pLcp.LedgerChannelProposalMsg}) + if err != nil { + _ = responder.Reject(context.TODO(), fmt.Sprintf("unable to open channel: %v", err)) + } + ns := resp.GetNonceShare() + if ns == nil { + if resp.GetRejected() != nil { + _ = responder.Reject(context.TODO(), resp.GetRejected().GetReason()) + } else { + _ = responder.Reject(context.TODO(), "wallet rejected channel proposal") + } + } + nonceShare := client.NonceShare{} + copy(nonceShare[:], ns) + cpa := client.LedgerChannelProposalAccMsg{ + BaseChannelProposalAcc: client.BaseChannelProposalAcc{ + ProposalID: lcp.ProposalID, + NonceShare: nonceShare, + }, + Participant: &u.Participant, + } + ch, err := responder.Accept(context.TODO(), &cpa) + if err != nil { + panic(err) + } + err = u.userRegister.AssignChannelID(ch.ID(), u) + if err != nil { + panic(err) + } + u.Channels[ch.ID()] = ch } func (u *User) HandleAdjudicatorEvent(event channel.AdjudicatorEvent) { @@ -66,7 +99,7 @@ func (u *User) HandleAdjudicatorEvent(event channel.AdjudicatorEvent) { log.Printf("Adjudicator event: type = %T", event) } -func NewUser(participant address.Participant, wAddr wire.Address, bus wire.Bus, funder channel.Funder, adjudicator channel.Adjudicator, wallet wallet.Wallet, watcher watcher.Watcher, wsc rpc.WalletServiceClient) (*User, error) { +func NewUser(participant address.Participant, wAddr wire.Address, bus wire.Bus, funder channel.Funder, adjudicator channel.Adjudicator, wallet wallet.Wallet, watcher watcher.Watcher, wsc proto.WalletServiceClient) (*User, error) { c, err := client.New(wAddr, bus, funder, adjudicator, wallet, watcher) if err != nil { return nil, err @@ -86,7 +119,7 @@ func (u *User) OpenChannel(ctxt context.Context, peer wire.Address, allocation * challengeDuration, &u.Participant, allocation, - []wire.Address{u.WireAddress}) + []wire.Address{u.WireAddress, peer}) if err != nil { return channel.ID{}, err } @@ -101,17 +134,25 @@ func (u *User) OpenChannel(ctxt context.Context, peer wire.Address, allocation * return ch.ID(), nil } -func (u *User) UpdateChannel(ctxt context.Context, id channel.ID, alloc channel.Allocation) error { +func (u *User) UpdateChannel(ctxt context.Context, id channel.ID, newState *channel.State) error { u.usrMutex.Lock() defer u.usrMutex.Unlock() ch, ok := u.Channels[id] if !ok { return ErrChannelNotFound } - err := ch.Update(ctxt, UpdateToAllocation(alloc)) + if err := VerifyStateTransition(ch.State().Clone(), newState.Clone()); err != nil { + return err + } + err := ch.Update(ctxt, UpdateToState(newState)) return err } +func VerifyStateTransition(old, new *channel.State) error { + // TODO: implement + return nil +} + func UpdateToAllocation(alloc channel.Allocation) func(state *channel.State) { return func(state *channel.State) { // TODO: Properly update allocation with checks etc. @@ -119,6 +160,12 @@ func UpdateToAllocation(alloc channel.Allocation) func(state *channel.State) { } } +func UpdateToState(ns *channel.State) func(state *channel.State) { + return func(state *channel.State) { + *state = *ns + } +} + func (u *User) CloseChannel(ctxt context.Context, id channel.ID) error { u.usrMutex.Lock() defer u.usrMutex.Unlock() diff --git a/wallet/client.go b/wallet/client.go index 7805d2b..19d066e 100644 --- a/wallet/client.go +++ b/wallet/client.go @@ -2,12 +2,12 @@ package wallet import ( "context" - "perun.network/channel-service/rpc" + "perun.network/channel-service/rpc/proto" "perun.network/perun-ckb-backend/wallet/address" ) type ExternalClient struct { - c rpc.WalletServiceClient + c proto.WalletServiceClient } func (e ExternalClient) Unlock(participant address.Participant) error { @@ -15,8 +15,7 @@ func (e ExternalClient) Unlock(participant address.Participant) error { } func (e ExternalClient) SignData(participant address.Participant, data []byte) ([]byte, error) { - sm := &rpc.SignMessageRequest{Data: data} - // TODO: SignMessage needs some reference to the participant / key to sign with. + sm := &proto.SignMessageRequest{Pubkey: participant.PubKey.SerializeCompressed(), Data: data} smr, err := e.c.SignMessage(context.TODO(), sm) if err != nil { return nil, err @@ -25,6 +24,6 @@ func (e ExternalClient) SignData(participant address.Participant, data []byte) ( return smr.GetSignature(), nil } -func NewExternalClient(c rpc.WalletServiceClient) *ExternalClient { +func NewExternalClient(c proto.WalletServiceClient) *ExternalClient { return &ExternalClient{c: c} } From d50656d051e83bff0317176b9d84d0b08c645f18 Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Mon, 23 Oct 2023 11:51:57 +0200 Subject: [PATCH 11/19] wallet: Add RemoteSigner --- go.mod | 2 +- go.sum | 4 ++++ wallet/singer.go | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 wallet/singer.go diff --git a/go.mod b/go.mod index a42d042..4b0fc84 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 perun.network/go-perun v0.10.6 - perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8 + perun.network/perun-ckb-backend v0.0.0-20231023094541-d04bb9a4a12c ) require ( diff --git a/go.sum b/go.sum index cd2b4d6..6b01b9d 100644 --- a/go.sum +++ b/go.sum @@ -60,5 +60,9 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= perun.network/go-perun v0.10.6/go.mod h1:BGBZC3npkX457u87pjDd0NEIXr1a4dsH4H/YpLdGGe8= perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8 h1:XbA3PJBVgxQWTbsHYh8KIE9IbyudjpSodS5APkEPuPs= perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8/go.mod h1:9bemdwIr/a8rg2FWWn+l4fEel6uJOSJHB7V0OX/X1LM= +perun.network/perun-ckb-backend v0.0.0-20231023092546-635c50b915cc h1:gmT6YblvjYHz+7A2zS80UclO4/gHM3bpf/Q9qQxcGuc= +perun.network/perun-ckb-backend v0.0.0-20231023092546-635c50b915cc/go.mod h1:9bemdwIr/a8rg2FWWn+l4fEel6uJOSJHB7V0OX/X1LM= +perun.network/perun-ckb-backend v0.0.0-20231023094541-d04bb9a4a12c h1:nwtxEmCj6o5sTmei6KxYWa3B2e2E22eHJ5rs4l2ICSA= +perun.network/perun-ckb-backend v0.0.0-20231023094541-d04bb9a4a12c/go.mod h1:9bemdwIr/a8rg2FWWn+l4fEel6uJOSJHB7V0OX/X1LM= polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 h1:iA5GzEa/hHfVlQpimEjPV09NATwHXxSjWNB0VVodtew= polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37/go.mod h1:XUBrNtqgEhN3EEOP/5gh7IBd3xVHKidCjXDZfl9+kMU= diff --git a/wallet/singer.go b/wallet/singer.go new file mode 100644 index 0000000..cb72f02 --- /dev/null +++ b/wallet/singer.go @@ -0,0 +1,48 @@ +package wallet + +import ( + "context" + "encoding/json" + "fmt" + "github.com/nervosnetwork/ckb-sdk-go/v2/address" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "perun.network/channel-service/rpc/proto" +) + +type RemoteSigner struct { + wcs proto.WalletServiceClient + addr address.Address +} + +func (s RemoteSigner) SignTransaction(tx *transaction.TransactionWithScriptGroups) (*transaction.TransactionWithScriptGroups, error) { + scriptBytes, err := json.Marshal(s.addr.Script) + if err != nil { + return nil, err + } + txBytes, err := json.Marshal(tx) + if err != nil { + return nil, err + } + req := &proto.SignTransactionRequest{ + Identifier: scriptBytes, // TODO: Maybe encode network also? + Transaction: txBytes, + } + resp, err := s.wcs.SignTransaction(context.TODO(), req) + if err != nil { + return nil, err + } + if rej := resp.GetRejected(); rej != nil { + return nil, fmt.Errorf("transaction signing failed: %s", rej.Reason) + } + + var signedTx transaction.TransactionWithScriptGroups + signedTxBytes := resp.GetTransaction() + if err = json.Unmarshal(signedTxBytes, &signedTx); err != nil { + return nil, err + } + return &signedTx, nil +} + +func (s RemoteSigner) Address() address.Address { + return s.addr +} From 2a9e61fc7d7c7237792f346fb3376458c6924efc Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Mon, 23 Oct 2023 11:53:17 +0200 Subject: [PATCH 12/19] wallet: Add constructor for RemoteSigner --- wallet/singer.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wallet/singer.go b/wallet/singer.go index cb72f02..1246bdb 100644 --- a/wallet/singer.go +++ b/wallet/singer.go @@ -14,6 +14,13 @@ type RemoteSigner struct { addr address.Address } +func NewRemoteSigner(wcs proto.WalletServiceClient, addr address.Address) *RemoteSigner { + return &RemoteSigner{ + wcs: wcs, + addr: addr, + } +} + func (s RemoteSigner) SignTransaction(tx *transaction.TransactionWithScriptGroups) (*transaction.TransactionWithScriptGroups, error) { scriptBytes, err := json.Marshal(s.addr.Script) if err != nil { From 0baab7d6c8f00109bcc1dfa30aaeabe4fb3531ae Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Mon, 23 Oct 2023 12:43:25 +0200 Subject: [PATCH 13/19] service: Upgrade UserRegister --- service/user_register.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/service/user_register.go b/service/user_register.go index 27b2383..dde1b4b 100644 --- a/service/user_register.go +++ b/service/user_register.go @@ -3,6 +3,7 @@ package service import ( "errors" "perun.network/go-perun/channel" + "perun.network/perun-ckb-backend/wallet/address" "sync" ) @@ -10,13 +11,41 @@ var ErrUserNotFound = errors.New("user not found") // UserRegister connects channel.IDs to Users. type UserRegister interface { + // GetUser returns the user associated with the channel or an ErrUserNotFound error, if no such user is registered. GetUser(channel.ID) (*User, error) AssignChannelID(channel.ID, *User) error + // GetUserFromParticipant returns the user associated with the participant or an ErrUserNotFound error, if no such + // user is registered. + GetUserFromParticipant(participant address.Participant) (*User, error) + // AddUser adds the user to the register and returns it. If the user already exists, it returns the existing user. + AddUser(participant address.Participant, user *User) *User } type MutexUserRegister struct { mtx sync.Mutex register map[channel.ID]*User + users map[address.Participant]*User +} + +func (m *MutexUserRegister) GetUserFromParticipant(participant address.Participant) (*User, error) { + m.mtx.Lock() + defer m.mtx.Unlock() + u, ok := m.users[participant] + if !ok { + return nil, ErrUserNotFound + } + return u, nil +} + +func (m *MutexUserRegister) AddUser(participant address.Participant, user *User) *User { + m.mtx.Lock() + defer m.mtx.Unlock() + u, ok := m.users[participant] + if ok { + return u + } + m.users[participant] = user + return user } func (m *MutexUserRegister) GetUser(cid channel.ID) (*User, error) { From 1f66897fb9a89ff531598b70a64efce231fab789 Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Mon, 23 Oct 2023 12:44:04 +0200 Subject: [PATCH 14/19] service: Implement User recognition from ChannelOpenRequest --- service/channel_service.go | 101 ++++++++++++++++++++++++++++++++----- 1 file changed, 88 insertions(+), 13 deletions(-) diff --git a/service/channel_service.go b/service/channel_service.go index 8c875b1..3bd26b2 100644 --- a/service/channel_service.go +++ b/service/channel_service.go @@ -2,29 +2,54 @@ package service import ( "context" + "errors" "fmt" + address2 "github.com/nervosnetwork/ckb-sdk-go/v2/address" + "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "perun.network/channel-service/rpc/proto" "perun.network/channel-service/wallet" "perun.network/go-perun/channel" gpwallet "perun.network/go-perun/wallet" + "perun.network/go-perun/watcher/local" "perun.network/go-perun/wire" "perun.network/go-perun/wire/net/simple" "perun.network/go-perun/wire/protobuf" + "perun.network/perun-ckb-backend/backend" + "perun.network/perun-ckb-backend/channel/adjudicator" + "perun.network/perun-ckb-backend/channel/funder" + "perun.network/perun-ckb-backend/client" + "perun.network/perun-ckb-backend/wallet/address" "perun.network/perun-ckb-backend/wallet/external" ) type ChannelService struct { UserRegister UserRegister - Wallet gpwallet.Wallet + wsc proto.WalletServiceClient + bus wire.Bus + network types.Network + node rpc.Client + deployment backend.Deployment + wallet gpwallet.Wallet proto.UnimplementedChannelServiceServer // always embed } -func NewChannelService(c proto.WalletServiceClient) *ChannelService { +func NewChannelService(c proto.WalletServiceClient, bus wire.Bus, network types.Network, nodeUrl string, deployment backend.Deployment) (*ChannelService, error) { + node, err := rpc.Dial(nodeUrl) + if err != nil { + return nil, err + } + return &ChannelService{ UserRegister: NewMutexUserRegister(), - Wallet: external.NewWallet(wallet.NewExternalClient(c)), - } + wsc: c, + bus: bus, + network: network, + node: node, + deployment: deployment, + wallet: external.NewWallet(wallet.NewExternalClient(c)), + }, nil } func (c ChannelService) OpenChannel(ctx context.Context, request *proto.ChannelOpenRequest) (*proto.ChannelOpenResponse, error) { @@ -64,8 +89,7 @@ func (c ChannelService) UpdateChannel(ctx context.Context, request *proto.Channe return &proto.ChannelUpdateResponse{Msg: &proto.ChannelUpdateResponse_Update{Update: &proto.SuccessfulUpdate{ // TODO: Use actual resulting state instead of the request state. - State: request.State, - // TODO: Abstract channel id encoding. + State: request.State, ChannelId: cid[:], }}}, nil } @@ -106,21 +130,72 @@ func (c ChannelService) GetChannelInfoFromRequest(reqChannelId []byte) (channel. } func (c ChannelService) GetUserFromChannelOpenRequest(request *proto.ChannelOpenRequest) (*User, error) { - // FIXME: The OpenChannelRequest should contain info about the acting participant. - panic("fixme") + requester := request.GetRequester() + if requester == nil { + return nil, fmt.Errorf("missing requester in ChannelOpenRequest") + } + var addr address.Participant + err := addr.UnmarshalBinary(requester) + if err != nil { + return nil, err + } + usr, err := c.UserRegister.GetUserFromParticipant(addr) + if err == nil { + return usr, nil + } + if !errors.Is(err, ErrUserNotFound) { // TODO: Maybe we should create a new user in this case. + return nil, err + } + usr, err = c.InitializeUser(addr) + if err != nil { + return nil, err + } + return c.UserRegister.AddUser(addr, usr), nil +} + +func (c ChannelService) InitializeUser(participant address.Participant) (*User, error) { + wAddr, err := c.MakeDefaultWireAddress(participant) + if err != nil { + return nil, err + } + rs := wallet.NewRemoteSigner(c.wsc, c.ToCKBAddress(participant)) + ckbClient, err := client.NewClient(c.node, rs, c.deployment) + if err != nil { + return nil, err + } + f := funder.NewDefaultFunder(ckbClient, c.deployment) + adj := adjudicator.NewAdjudicator(ckbClient) + watcher, err := local.NewWatcher(adj) + if err != nil { + return nil, err + } + return NewUser(participant, wAddr, c.bus, f, adj, c.wallet, watcher, c.wsc) } func (c ChannelService) GetAllocationFromChannelOpenRequest(request *proto.ChannelOpenRequest) (*channel.Allocation, error) { - // FIXME: ChannelOpenRequest should specify an allocation / initial funds. - panic("fixme") + if request.GetAllocation() == nil { + return nil, fmt.Errorf("missing allocation in ChannelOpenRequest") + } + return protobuf.ToAllocation(request.GetAllocation()) } func (c ChannelService) GetPeerAddressFromChannelOpenRequest(request *proto.ChannelOpenRequest) wire.Address { - // FIXME: Do this properly and change the peer type in the request field. + // NOTE: The peer address should probably be a string-encoded CKB Address (see MakeDefaultWireAddress). return simple.NewAddress(string(request.GetPeer())) } func (c ChannelService) GetChallengeDurationFromChannelOpenRequest(request *proto.ChannelOpenRequest) uint64 { - // TODO: This should be specified in the request or hardcoded with default value. - return 10 + return request.ChallengeDuration +} + +func (c ChannelService) MakeDefaultWireAddress(participant address.Participant) (wire.Address, error) { + ckbAddr, err := c.ToCKBAddress(participant).Encode() + if err != nil { + return nil, err + } + return simple.NewAddress(ckbAddr), nil +} + +func (c ChannelService) ToCKBAddress(addr address.Participant) address2.Address { + return addr.ToCKBAddress(c.network) } From 568b98df05b9cb2d2599a31eca0260eb20a9f004 Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Thu, 26 Oct 2023 13:09:34 +0200 Subject: [PATCH 15/19] deployment: Add deployment to work within devnet --- deployment/deployment.go | 159 ++++++++++++++++++++++++++++++ deployment/keys.go | 33 +++++++ deployment/system_scripts.go | 58 +++++++++++ deployment/system_scripts_test.go | 21 ++++ go.mod | 23 ++++- go.sum | 43 ++++++-- 6 files changed, 325 insertions(+), 12 deletions(-) create mode 100644 deployment/deployment.go create mode 100644 deployment/keys.go create mode 100644 deployment/system_scripts.go create mode 100644 deployment/system_scripts_test.go diff --git a/deployment/deployment.go b/deployment/deployment.go new file mode 100644 index 0000000..376c050 --- /dev/null +++ b/deployment/deployment.go @@ -0,0 +1,159 @@ +package deployment + +import ( + "encoding/hex" + "encoding/json" + "fmt" + "io" + "os" + "path" + "strings" + + "github.com/nervosnetwork/ckb-sdk-go/v2/types" + "perun.network/perun-ckb-backend/backend" +) + +const PFLSMinCapacity = 4100000032 + +type SUDTInfo struct { + Script *types.Script + CellDep *types.CellDep +} + +type Migration struct { + CellRecipes []struct { + Name string `json:"name"` + TxHash string `json:"tx_hash"` + Index uint32 `json:"index"` + OccupiedCapacity int64 `json:"occupied_capacity"` + DataHash string `json:"data_hash"` + TypeId interface{} `json:"type_id"` + } `json:"cell_recipes"` + DepGroupRecipes []interface{} `json:"dep_group_recipes"` +} + +func (m Migration) MakeDeployment(systemScripts SystemScripts, sudtOwnerLockArg string) (backend.Deployment, SUDTInfo, error) { + pcts := m.CellRecipes[0] + if pcts.Name != "pcts" { + return backend.Deployment{}, SUDTInfo{}, fmt.Errorf("first cell recipe must be pcts") + } + pcls := m.CellRecipes[1] + if pcls.Name != "pcls" { + return backend.Deployment{}, SUDTInfo{}, fmt.Errorf("second cell recipe must be pcls") + } + pfls := m.CellRecipes[2] + if pfls.Name != "pfls" { + return backend.Deployment{}, SUDTInfo{}, fmt.Errorf("third cell recipe must be pfls") + } + sudtInfo, err := m.GetSUDT() + if err != nil { + return backend.Deployment{}, SUDTInfo{}, err + } + // NOTE: The SUDT lock-arg always contains a newline character at the end. + hexString := strings.ReplaceAll(sudtOwnerLockArg[2:], "\n", "") + hexString = strings.ReplaceAll(hexString, "\r", "") + hexString = strings.ReplaceAll(hexString, " ", "") + sudtInfo.Script.Args, err = hex.DecodeString(hexString) + if err != nil { + return backend.Deployment{}, SUDTInfo{}, fmt.Errorf("invalid sudt owner lock arg: %v", err) + } + + return backend.Deployment{ + Network: types.NetworkTest, + PCTSDep: types.CellDep{ + OutPoint: &types.OutPoint{ + TxHash: types.HexToHash(pcts.TxHash), + Index: m.CellRecipes[0].Index, + }, + DepType: types.DepTypeCode, + }, + PCLSDep: types.CellDep{ + OutPoint: &types.OutPoint{ + TxHash: types.HexToHash(pcls.TxHash), + Index: m.CellRecipes[0].Index, + }, + DepType: types.DepTypeCode, + }, + PFLSDep: types.CellDep{ + OutPoint: &types.OutPoint{ + TxHash: types.HexToHash(pfls.TxHash), + Index: m.CellRecipes[0].Index, + }, + DepType: types.DepTypeCode, + }, + PCTSCodeHash: types.HexToHash(pcts.DataHash), + PCTSHashType: types.HashTypeData1, + PCLSCodeHash: types.HexToHash(pcls.DataHash), + PCLSHashType: types.HashTypeData1, + PFLSCodeHash: types.HexToHash(pfls.DataHash), + PFLSHashType: types.HashTypeData1, + PFLSMinCapacity: PFLSMinCapacity, + DefaultLockScript: types.Script{ + CodeHash: systemScripts.Secp256k1Blake160SighashAll.ScriptID.CodeHash, + HashType: systemScripts.Secp256k1Blake160SighashAll.ScriptID.HashType, + Args: make([]byte, 32), + }, + DefaultLockScriptDep: systemScripts.Secp256k1Blake160SighashAll.CellDep, + SUDTDeps: map[types.Hash]types.CellDep{ + sudtInfo.Script.Hash(): *sudtInfo.CellDep, + }, + SUDTs: map[types.Hash]types.Script{ + sudtInfo.Script.Hash(): *sudtInfo.Script, + }, + }, *sudtInfo, nil +} + +func (m Migration) GetSUDT() (*SUDTInfo, error) { + sudt := m.CellRecipes[3] + if sudt.Name != "sudt" { + return nil, fmt.Errorf("fourth cell recipe must be sudt") + } + + sudtScript := types.Script{ + CodeHash: types.HexToHash(sudt.DataHash), + HashType: types.HashTypeData1, + Args: []byte{}, + } + sudtCellDep := types.CellDep{ + OutPoint: &types.OutPoint{ + TxHash: types.HexToHash(sudt.TxHash), + Index: sudt.Index, + }, + DepType: types.DepTypeCode, + } + return &SUDTInfo{ + Script: &sudtScript, + CellDep: &sudtCellDep, + }, nil +} + +func GetDeployment(migrationDir, systemScriptsDir, sudtOwnerLockArg string) (backend.Deployment, SUDTInfo, error) { + dir, err := os.ReadDir(migrationDir) + if err != nil { + return backend.Deployment{}, SUDTInfo{}, err + } + if len(dir) != 1 { + return backend.Deployment{}, SUDTInfo{}, fmt.Errorf("migration dir must contain exactly one file") + } + migrationName := dir[0].Name() + migrationFile, err := os.Open(path.Join(migrationDir, migrationName)) + defer migrationFile.Close() + if err != nil { + return backend.Deployment{}, SUDTInfo{}, err + } + migrationData, err := io.ReadAll(migrationFile) + if err != nil { + return backend.Deployment{}, SUDTInfo{}, err + } + var migration Migration + err = json.Unmarshal(migrationData, &migration) + if err != nil { + return backend.Deployment{}, SUDTInfo{}, err + } + + ss, err := GetSystemScripts(systemScriptsDir) + if err != nil { + return backend.Deployment{}, SUDTInfo{}, err + } + return migration.MakeDeployment(ss, sudtOwnerLockArg) +} diff --git a/deployment/keys.go b/deployment/keys.go new file mode 100644 index 0000000..1d7d6bc --- /dev/null +++ b/deployment/keys.go @@ -0,0 +1,33 @@ +package deployment + +import ( + "encoding/hex" + "fmt" + "github.com/decred/dcrd/dcrec/secp256k1/v4" + "io" + "os" + "strings" +) + +func GetKey(path string) (*secp256k1.PrivateKey, error) { + keyFile, err := os.Open(path) + if err != nil { + return nil, err + } + defer keyFile.Close() + + rawBytes, err := io.ReadAll(keyFile) + if err != nil { + return nil, err + } + lines := strings.Split(string(rawBytes), "\n") + if len(lines) != 2 { + return nil, fmt.Errorf("key file must contain exactly two lines") + } + x := strings.Trim(lines[0], " \n") + xBytes, err := hex.DecodeString(x) + if err != nil { + return nil, err + } + return secp256k1.PrivKeyFromBytes(xBytes), nil +} diff --git a/deployment/system_scripts.go b/deployment/system_scripts.go new file mode 100644 index 0000000..77ee117 --- /dev/null +++ b/deployment/system_scripts.go @@ -0,0 +1,58 @@ +package deployment + +import ( + "encoding/json" + "io" + "os" + "path" + + "github.com/nervosnetwork/ckb-sdk-go/v2/types" +) + +type SystemScripts struct { + DAO struct { + CellDep types.CellDep `json:"cell_dep"` + ScriptID ScriptID `json:"script_id"` + } `json:"dao"` + Secp256k1Blake160MultisigAll struct { + CellDep types.CellDep `json:"cell_dep"` + ScriptID ScriptID `json:"script_id"` + } `json:"secp256k1_blake160_multisig_all"` + Secp256k1Blake160SighashAll struct { + CellDep types.CellDep `json:"cell_dep"` + ScriptID ScriptID `json:"script_id"` + } `json:"secp256k1_blake160_sighash_all"` + Secp256k1Data types.OutPoint `json:"secp256k1_data"` + TypeID struct { + ScriptID ScriptID `json:"script_id"` + } `json:"type_id"` +} + +type ScriptID struct { + CodeHash types.Hash `json:"code_hash"` + HashType types.ScriptHashType `json:"hash_type"` +} + +const systemScriptName = "default_scripts.json" + +func GetSystemScripts(systemScriptDir string) (SystemScripts, error) { + var ss SystemScripts + err := readJSON(systemScriptDir, &ss) + if err != nil { + return SystemScripts{}, err + } + return ss, nil +} + +func readJSON(systemScriptDir string, systemScripts *SystemScripts) error { + systemScriptFile, err := os.Open(path.Join(systemScriptDir, systemScriptName)) + defer func() { _ = systemScriptFile.Close() }() + if err != nil { + return err + } + systemScriptContent, err := io.ReadAll(systemScriptFile) + if err != nil { + return err + } + return json.Unmarshal(systemScriptContent, systemScripts) +} diff --git a/deployment/system_scripts_test.go b/deployment/system_scripts_test.go new file mode 100644 index 0000000..717b494 --- /dev/null +++ b/deployment/system_scripts_test.go @@ -0,0 +1,21 @@ +package deployment_test + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/require" + "perun.network/channel-service/deployment" +) + +func TestSystemScripts(t *testing.T) { + var ss deployment.SystemScripts + require.NoError(t, json.Unmarshal([]byte(systemScriptCase), &ss)) + msg, err := json.Marshal(ss) + require.NoError(t, err) + recovered := new(deployment.SystemScripts) + require.NoError(t, json.Unmarshal(msg, recovered)) + require.Equal(t, ss, *recovered) +} + +var systemScriptCase string = "{\"dao\":{\"cell_dep\":{\"dep_type\":\"code\",\"out_point\":{\"index\":\"0x2\",\"tx_hash\":\"0x297d19805fee99a53a6274a976df562d678beeff286776e1cd5ac9d8e1870780\"}},\"script_id\":{\"code_hash\":\"0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e\",\"hash_type\":\"type\"}},\"secp256k1_blake160_multisig_all\":{\"cell_dep\":{\"dep_type\":\"dep_group\",\"out_point\":{\"index\":\"0x1\",\"tx_hash\":\"0xad69fbce31c6d8a8516789dec3cd4ddecbeb63619b4fa6cd3a7d00cdc788bf33\"}},\"script_id\":{\"code_hash\":\"0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8\",\"hash_type\":\"type\"}},\"secp256k1_blake160_sighash_all\":{\"cell_dep\":{\"dep_type\":\"dep_group\",\"out_point\":{\"index\":\"0x0\",\"tx_hash\":\"0xad69fbce31c6d8a8516789dec3cd4ddecbeb63619b4fa6cd3a7d00cdc788bf33\"}},\"script_id\":{\"code_hash\":\"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8\",\"hash_type\":\"type\"}},\"secp256k1_data\":{\"out_point\":{\"index\":\"0x3\",\"tx_hash\":\"0x297d19805fee99a53a6274a976df562d678beeff286776e1cd5ac9d8e1870780\"}},\"type_id\":{\"script_id\":{\"code_hash\":\"0x00000000000000000000000000000000000000000000000000545950455f4944\",\"hash_type\":\"type\"}}}" diff --git a/go.mod b/go.mod index 4b0fc84..495b86e 100644 --- a/go.mod +++ b/go.mod @@ -3,30 +3,43 @@ module perun.network/channel-service go 1.19 require ( + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 + github.com/nervosnetwork/ckb-sdk-go/v2 v2.2.0 + github.com/stretchr/testify v1.8.4 google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 - perun.network/go-perun v0.10.6 - perun.network/perun-ckb-backend v0.0.0-20231023094541-d04bb9a4a12c + perun.network/go-perun v0.10.7-0.20230808153546-74844191e56e + perun.network/perun-ckb-backend v0.0.0-20231026110519-7a17b08740d8 ) require ( + github.com/Pilatuz/bigz v1.2.1 // indirect + github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect + github.com/deckarep/golang-set v1.8.0 // indirect github.com/ethereum/go-ethereum v1.10.22 // indirect + github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-stack/stack v1.8.0 // indirect github.com/golang/protobuf v1.5.3 // indirect + github.com/gorilla/websocket v1.4.2 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect - github.com/nervosnetwork/ckb-sdk-go/v2 v2.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/sirupsen/logrus v1.9.3 // indirect - github.com/stretchr/testify v1.8.4 // indirect + github.com/stretchr/objx v0.5.0 // indirect + github.com/tklauser/go-sysconf v0.3.5 // indirect + github.com/tklauser/numcpus v0.2.2 // indirect golang.org/x/crypto v0.13.0 // indirect golang.org/x/net v0.15.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect + gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v3 v3.0.1 // indirect polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 // indirect ) diff --git a/go.sum b/go.sum index 6b01b9d..fd64250 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,33 @@ +github.com/Pilatuz/bigz v1.2.1 h1:S/R9NGdunq2lIz7KvHu6DmX8bdh41uMqijWeJDz0U5Y= +github.com/Pilatuz/bigz v1.2.1/go.mod h1:FZmplFUEZe3pUr647EQMQgYhV+n9h8+HGTsYK4X6xws= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= +github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= github.com/ethereum/go-ethereum v1.10.22 h1:HbEgsDo1YTGIf4KB/NNpn+XH+PiNJXUZ9ksRxiqWyMc= github.com/ethereum/go-ethereum v1.10.22/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= +github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -26,18 +43,31 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= +github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= +github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= +github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= +go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -54,15 +84,14 @@ google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -perun.network/go-perun v0.10.6/go.mod h1:BGBZC3npkX457u87pjDd0NEIXr1a4dsH4H/YpLdGGe8= -perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8 h1:XbA3PJBVgxQWTbsHYh8KIE9IbyudjpSodS5APkEPuPs= -perun.network/perun-ckb-backend v0.0.0-20231005112919-f9055c81dbd8/go.mod h1:9bemdwIr/a8rg2FWWn+l4fEel6uJOSJHB7V0OX/X1LM= -perun.network/perun-ckb-backend v0.0.0-20231023092546-635c50b915cc h1:gmT6YblvjYHz+7A2zS80UclO4/gHM3bpf/Q9qQxcGuc= -perun.network/perun-ckb-backend v0.0.0-20231023092546-635c50b915cc/go.mod h1:9bemdwIr/a8rg2FWWn+l4fEel6uJOSJHB7V0OX/X1LM= -perun.network/perun-ckb-backend v0.0.0-20231023094541-d04bb9a4a12c h1:nwtxEmCj6o5sTmei6KxYWa3B2e2E22eHJ5rs4l2ICSA= -perun.network/perun-ckb-backend v0.0.0-20231023094541-d04bb9a4a12c/go.mod h1:9bemdwIr/a8rg2FWWn+l4fEel6uJOSJHB7V0OX/X1LM= +perun.network/go-perun v0.10.7-0.20230808153546-74844191e56e h1:4SOKO0WZtcsQUwP5nKVUrLUohgUPIhMa8wto5iNCA/k= +perun.network/go-perun v0.10.7-0.20230808153546-74844191e56e/go.mod h1:BGBZC3npkX457u87pjDd0NEIXr1a4dsH4H/YpLdGGe8= +perun.network/perun-ckb-backend v0.0.0-20231026110519-7a17b08740d8 h1:VWi5VFNQRI/uLCicd/AxqxcREqzeSRULZiVfBU+ThTQ= +perun.network/perun-ckb-backend v0.0.0-20231026110519-7a17b08740d8/go.mod h1:GWqJX3AzevIeJnt1sOupgn8JgkJM0HrdY3LigKPlsLI= polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 h1:iA5GzEa/hHfVlQpimEjPV09NATwHXxSjWNB0VVodtew= polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37/go.mod h1:XUBrNtqgEhN3EEOP/5gh7IBd3xVHKidCjXDZfl9+kMU= From 8e160d076741a82181a27a0a8c4ecdb4ee5c0b14 Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Thu, 26 Oct 2023 13:10:55 +0200 Subject: [PATCH 16/19] service: Move users into UserRegister upon initializing them --- service/channel_service.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/service/channel_service.go b/service/channel_service.go index 3bd26b2..8f8476d 100644 --- a/service/channel_service.go +++ b/service/channel_service.go @@ -146,11 +146,7 @@ func (c ChannelService) GetUserFromChannelOpenRequest(request *proto.ChannelOpen if !errors.Is(err, ErrUserNotFound) { // TODO: Maybe we should create a new user in this case. return nil, err } - usr, err = c.InitializeUser(addr) - if err != nil { - return nil, err - } - return c.UserRegister.AddUser(addr, usr), nil + return c.InitializeUser(addr) } func (c ChannelService) InitializeUser(participant address.Participant) (*User, error) { @@ -169,7 +165,12 @@ func (c ChannelService) InitializeUser(participant address.Participant) (*User, if err != nil { return nil, err } - return NewUser(participant, wAddr, c.bus, f, adj, c.wallet, watcher, c.wsc) + usr, err := NewUser(participant, wAddr, c.bus, f, adj, c.wallet, watcher, c.wsc) + if err != nil { + return nil, err + } + c.UserRegister.AddUser(participant, usr) + return usr, nil } func (c ChannelService) GetAllocationFromChannelOpenRequest(request *proto.ChannelOpenRequest) (*channel.Allocation, error) { From 3ac9536f056fc53bf52b885c2ef8ab9c90eba92c Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Thu, 26 Oct 2023 13:11:21 +0200 Subject: [PATCH 17/19] main: Add executable to start channel-service --- main.go | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 main.go diff --git a/main.go b/main.go new file mode 100644 index 0000000..fbd0a44 --- /dev/null +++ b/main.go @@ -0,0 +1,136 @@ +package main + +import ( + "encoding/hex" + "errors" + "flag" + "fmt" + "github.com/decred/dcrd/dcrec/secp256k1/v4" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" + "google.golang.org/grpc" + "log" + "net" + "os" + "path/filepath" + "perun.network/channel-service/deployment" + "perun.network/channel-service/rpc/proto" + "perun.network/channel-service/service" + "perun.network/go-perun/wire" + "perun.network/perun-ckb-backend/backend" + "perun.network/perun-ckb-backend/wallet/address" +) + +func SetLogFile(path string) { + logFile, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) + if err != nil { + log.Fatalf("error opening file: %v", err) + } + log.SetOutput(logFile) +} + +func main() { + SetLogFile("demo.log") + + // Define command-line flags + nodeURL := flag.String("node-url", "", "CKB node URL") + host := flag.String("host", "", "Where to host Channel Service Server, e.g. localhost:4321") + wssURL := flag.String("wss-url", "", "URL of the WalletServiceServer e.g. localhost:1234") + flag.Parse() + + // Check if the node URL is provided + if *nodeURL == "" || *host == "" || *wssURL == "" { + fmt.Printf("Usage:\n%s -node-url -host -wss-url [public_key1] [public_key2] ...\n", filepath.Base(os.Args[0])) + os.Exit(1) + } + args := flag.Args() + pubKeys := make([]secp256k1.PublicKey, len(args)) + // Iterate through the command-line arguments + for i, arg := range flag.Args() { + publicKeyStr := arg + + // Parse the public key + publicKeyBytes, err := hex.DecodeString(publicKeyStr) + if err != nil { + log.Fatalf("error parsing public key: %v", err) + } + pubkey, err := secp256k1.ParsePubKey(publicKeyBytes) + pubKeys[i] = *pubkey + } + parts, err := MakeParticipants(pubKeys) + if err != nil { + log.Fatalf("error making participants: %v", err) + } + + // Set up WalletService Client + var dialOpts []grpc.DialOption + conn, err := grpc.Dial(*wssURL, dialOpts...) + if err != nil { + log.Fatalf("did not connect to wallet service server: %v", err) + } + wsc := proto.NewWalletServiceClient(conn) + + // Set up ChannelService + d, err := MakeDeployment() + if err != nil { + log.Fatalf("error getting deployment: %v", err) + } + bus := wire.NewLocalBus() + cs, err := service.NewChannelService(wsc, bus, types.NetworkTest, *nodeURL, d) + if err != nil { + log.Fatalf("error setting up channel service: %v", err) + } + + // Initialize Users + for _, part := range parts { + _, err = cs.InitializeUser(part) + if err != nil { + log.Fatalf("error initializing user: %v", err) + } + } + + // Set up ChannelService Server + lis, err := net.Listen("tcp", *host) + if err != nil { + log.Fatalf("failed to listen: %v", err) + } + var opts []grpc.ServerOption + grpcServer := grpc.NewServer(opts...) + proto.RegisterChannelServiceServer(grpcServer, cs) + err = grpcServer.Serve(lis) + if err != nil { + log.Fatal(err) + } +} + +func MakeParticipants(pks []secp256k1.PublicKey) ([]address.Participant, error) { + parts := make([]address.Participant, len(pks)) + for i, pk := range pks { + part, err := address.NewDefaultParticipant(&pk) + if err != nil { + return nil, fmt.Errorf("unable to create participant: %w", err) + } + parts[i] = *part + } + return parts, nil +} + +func parseSUDTOwnerLockArg(pathToSUDTOwnerLockArg string) (string, error) { + b, err := os.ReadFile(pathToSUDTOwnerLockArg) + if err != nil { + return "", fmt.Errorf("reading sudt owner lock arg from file: %w", err) + } + sudtOwnerLockArg := string(b) + if sudtOwnerLockArg == "" { + return "", errors.New("sudt owner lock arg not found in file") + } + return sudtOwnerLockArg, nil +} + +func MakeDeployment() (backend.Deployment, error) { + sudtOwnerLockArg, err := parseSUDTOwnerLockArg("./devnet/accounts/sudt-owner-lock-hash.txt") + if err != nil { + log.Fatalf("error getting SUDT owner lock arg: %v", err) + } + d, _, err := deployment.GetDeployment("./devnet/contracts/migrations/dev/", "./devnet/system_scripts", sudtOwnerLockArg) + return d, err +} From 343e93779ca0bf3faf03231a3a2db0119577e26b Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Thu, 26 Oct 2023 13:56:46 +0200 Subject: [PATCH 18/19] main: Connect wallet client without transport layer security --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index fbd0a44..2af91bd 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/nervosnetwork/ckb-sdk-go/v2/types" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "log" "net" "os" @@ -62,8 +63,7 @@ func main() { } // Set up WalletService Client - var dialOpts []grpc.DialOption - conn, err := grpc.Dial(*wssURL, dialOpts...) + conn, err := grpc.Dial(*wssURL, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatalf("did not connect to wallet service server: %v", err) } From 8bcf2c3273b74acc59e4a254a3bc30135c121cac Mon Sep 17 00:00:00 2001 From: Jan Bormet Date: Thu, 26 Oct 2023 14:07:41 +0200 Subject: [PATCH 19/19] go.mod: Upgrade deps --- go.mod | 41 +++++++++++++------------ go.sum | 95 +++++++++++++++++++++++++++++++--------------------------- 2 files changed, 73 insertions(+), 63 deletions(-) diff --git a/go.mod b/go.mod index 495b86e..f2f4d09 100644 --- a/go.mod +++ b/go.mod @@ -3,43 +3,46 @@ module perun.network/channel-service go 1.19 require ( - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 github.com/nervosnetwork/ckb-sdk-go/v2 v2.2.0 github.com/stretchr/testify v1.8.4 - google.golang.org/grpc v1.58.2 + google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 perun.network/go-perun v0.10.7-0.20230808153546-74844191e56e perun.network/perun-ckb-backend v0.0.0-20231026110519-7a17b08740d8 ) require ( + github.com/Microsoft/go-winio v0.6.1 // indirect github.com/Pilatuz/bigz v1.2.1 // indirect - github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/deckarep/golang-set v1.8.0 // indirect - github.com/ethereum/go-ethereum v1.10.22 // indirect - github.com/go-ole/go-ole v1.2.1 // indirect - github.com/go-stack/stack v1.8.0 // indirect + github.com/deckarep/golang-set/v2 v2.3.1 // indirect + github.com/ethereum/go-ethereum v1.13.4 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect + github.com/go-stack/stack v1.8.1 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/gorilla/websocket v1.4.2 // indirect - github.com/kr/pretty v0.3.1 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/holiman/uint256 v1.2.3 // indirect github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/sirupsen/logrus v1.9.3 // indirect - github.com/stretchr/objx v0.5.0 // indirect - github.com/tklauser/go-sysconf v0.3.5 // indirect - github.com/tklauser/numcpus v0.2.2 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.12.0 // indirect + github.com/stretchr/objx v0.5.1 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/yusufpapurcu/wmi v1.2.3 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect + golang.org/x/mod v0.13.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sync v0.4.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect - gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect + golang.org/x/tools v0.14.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect gopkg.in/yaml.v3 v3.0.1 // indirect polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 // indirect ) diff --git a/go.sum b/go.sum index fd64250..1f27899 100644 --- a/go.sum +++ b/go.sum @@ -1,96 +1,103 @@ +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Pilatuz/bigz v1.2.1 h1:S/R9NGdunq2lIz7KvHu6DmX8bdh41uMqijWeJDz0U5Y= github.com/Pilatuz/bigz v1.2.1/go.mod h1:FZmplFUEZe3pUr647EQMQgYhV+n9h8+HGTsYK4X6xws= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= -github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= -github.com/ethereum/go-ethereum v1.10.22 h1:HbEgsDo1YTGIf4KB/NNpn+XH+PiNJXUZ9ksRxiqWyMc= -github.com/ethereum/go-ethereum v1.10.22/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= -github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/deckarep/golang-set/v2 v2.3.1 h1:vjmkvJt/IV27WXPyYQpAh4bRyWJc5Y435D17XQ9QU5A= +github.com/deckarep/golang-set/v2 v2.3.1/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/ethereum/go-ethereum v1.13.4 h1:25HJnaWVg3q1O7Z62LaaI6S9wVq8QCw3K88g8wEzrcM= +github.com/ethereum/go-ethereum v1.13.4/go.mod h1:I0U5VewuuTzvBtVzKo7b3hJzDhXOUtn9mJW7SsIPB0Q= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= +github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= +github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/perun-network/ckb-sdk-go/v2 v2.2.1-0.20230601140721-2bf596fddd80 h1:45S239s+5oGVJHakd+BjfZmstG7wHnA8Tkeq43R9eFA= github.com/perun-network/ckb-sdk-go/v2 v2.2.1-0.20230601140721-2bf596fddd80/go.mod h1:nPpBML8fuaM1NgkKCwv2gSHiCv+xKH43fu8LA9LOQUg= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= +github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0= +github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= -github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= -github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= -github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= +github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b h1:ZlWIi1wSK56/8hn4QcBp/j9M7Gt3U/3hZw3mC7vDICo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -perun.network/go-perun v0.10.7-0.20230808153546-74844191e56e h1:4SOKO0WZtcsQUwP5nKVUrLUohgUPIhMa8wto5iNCA/k= -perun.network/go-perun v0.10.7-0.20230808153546-74844191e56e/go.mod h1:BGBZC3npkX457u87pjDd0NEIXr1a4dsH4H/YpLdGGe8= perun.network/perun-ckb-backend v0.0.0-20231026110519-7a17b08740d8 h1:VWi5VFNQRI/uLCicd/AxqxcREqzeSRULZiVfBU+ThTQ= perun.network/perun-ckb-backend v0.0.0-20231026110519-7a17b08740d8/go.mod h1:GWqJX3AzevIeJnt1sOupgn8JgkJM0HrdY3LigKPlsLI= polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 h1:iA5GzEa/hHfVlQpimEjPV09NATwHXxSjWNB0VVodtew=