Skip to content

Commit

Permalink
conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Jan 13, 2025
1 parent 699c221 commit f7e91d5
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 140 deletions.
17 changes: 0 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,6 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* (x/auth/tx) [23144](https://github.com/cosmos/cosmos-sdk/pull/23144) Add missing CacheWithValue for ExtensionOptions.
* (x/auth/tx) [#23148](https://github.com/cosmos/cosmos-sdk/pull/23148) Avoid panic from intoAnyV2 when v1.PublicKey is optional.

<<<<<<< HEAD
=======
### API Breaking Changes

* (x/params) [#22995](https://github.com/cosmos/cosmos-sdk/pull/22995) Remove `x/params`. Migrate to the new params system introduced in `v0.47` as demonstrated [here](https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md#xparams).
* (testutil) [#22392](https://github.com/cosmos/cosmos-sdk/pull/22392) Remove `testutil/network` package. Use the integration framework or systemtests framework instead.

#### Removal of v0 components

This subsection lists the API breaking changes that are [part of the removal of v0 components](https://github.com/cosmos/cosmos-sdk/issues/22904). The v0 components were deprecated in `v0.52` and are now removed.

* (simapp) [#23009](https://github.com/cosmos/cosmos-sdk/pull/23009) Simapp has been removed. Check-out Simapp/v2 instead.
* (server) [#23018](https://github.com/cosmos/cosmos-sdk/pull/23018) [#23238](https://github.com/cosmos/cosmos-sdk/pull/23238) The server package has been removed. Use server/v2 instead
* (x/genutil) [#23238](https://github.com/cosmos/cosmos-sdk/pull/23238) Genutil commands specific to a baseapp chain have been deleted.
* (client) [#22904](https://github.com/cosmos/cosmos-sdk/issues/22904) v1 specific client commands have been removed.

>>>>>>> c79e19dfc (fix(server/v2/grpc): fix reflection (#23333))
### Deprecated

* (modules) [#22994](https://github.com/cosmos/cosmos-sdk/pull/22994) Deprecate `Invariants` and associated methods.
Expand Down
90 changes: 0 additions & 90 deletions server/grpc/gogoreflection/serverreflection.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,42 +49,21 @@ import (
"google.golang.org/grpc/codes"
rpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
"google.golang.org/grpc/status"
<<<<<<< HEAD:server/grpc/gogoreflection/serverreflection.go
=======
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"

"cosmossdk.io/core/log"
>>>>>>> c79e19dfc (fix(server/v2/grpc): fix reflection (#23333)):server/v2/api/grpc/gogoreflection/serverreflection.go
)

type serverReflectionServer struct {
rpb.UnimplementedServerReflectionServer
s *grpc.Server

<<<<<<< HEAD:server/grpc/gogoreflection/serverreflection.go
=======
messages []string

>>>>>>> c79e19dfc (fix(server/v2/grpc): fix reflection (#23333)):server/v2/api/grpc/gogoreflection/serverreflection.go
initSymbols sync.Once
serviceNames []string
symbols map[string]*dpb.FileDescriptorProto // map of fully-qualified names to files
}

// Register registers the server reflection service on the given gRPC server.
<<<<<<< HEAD:server/grpc/gogoreflection/serverreflection.go
func Register(s *grpc.Server) {
rpb.RegisterServerReflectionServer(s, &serverReflectionServer{
s: s,
=======
func Register(s *grpc.Server, messages []string, logger log.Logger) {
rpb.RegisterServerReflectionServer(s, &serverReflectionServer{
s: s,
messages: messages,
log: logger,
>>>>>>> c79e19dfc (fix(server/v2/grpc): fix reflection (#23333)):server/v2/api/grpc/gogoreflection/serverreflection.go
})
}

Expand All @@ -98,13 +77,7 @@ type protoMessage interface {

func (s *serverReflectionServer) getSymbols() (svcNames []string, symbolIndex map[string]*dpb.FileDescriptorProto) {
s.initSymbols.Do(func() {
<<<<<<< HEAD:server/grpc/gogoreflection/serverreflection.go
serviceInfo := s.s.GetServiceInfo()
=======
s.symbols = map[string]*dpb.FileDescriptorProto{}
services, fds := s.getServices(s.messages)
s.serviceNames = services
>>>>>>> c79e19dfc (fix(server/v2/grpc): fix reflection (#23333)):server/v2/api/grpc/gogoreflection/serverreflection.go

s.symbols = map[string]*dpb.FileDescriptorProto{}
s.serviceNames = make([]string, 0, len(serviceInfo))
Expand Down Expand Up @@ -498,66 +471,3 @@ func (s *serverReflectionServer) ServerReflectionInfo(stream rpb.ServerReflectio
}
}
}
<<<<<<< HEAD:server/grpc/gogoreflection/serverreflection.go
=======

// getServices gets the unique list of services given a list of methods.
func (s *serverReflectionServer) getServices(messages []string) (svcs []string, fds []*dpb.FileDescriptorProto) {
registry, err := gogoproto.MergedRegistry()
if err != nil {
s.log.Error("unable to load merged registry", "err", err)
return nil, nil
}
seenSvc := map[protoreflect.FullName]struct{}{}
for _, messageName := range messages {
md, err := registry.FindDescriptorByName(protoreflect.FullName(messageName))
if err != nil {
s.log.Error("unable to load message descriptor", "message", messageName, "err", err)
continue
}

svc, ok := findServiceForMessage(registry, md.(protoreflect.MessageDescriptor))
if !ok {
// if a service is not found for the message, simply skip
// this is likely the message isn't part of a service and using appmodulev2.Handler instead.
continue
}

if _, seen := seenSvc[svc.FullName()]; !seen {
svcs = append(svcs, string(svc.FullName()))
file := svc.ParentFile()
fds = append(fds, protodesc.ToFileDescriptorProto(file))
}

seenSvc[svc.FullName()] = struct{}{}
}

return svcs, fds
}

func findServiceForMessage(registry *protoregistry.Files, messageDesc protoreflect.MessageDescriptor) (protoreflect.ServiceDescriptor, bool) {
var (
service protoreflect.ServiceDescriptor
found bool
)

registry.RangeFiles(func(fileDescriptor protoreflect.FileDescriptor) bool {
for i := 0; i < fileDescriptor.Services().Len(); i++ {
serviceDesc := fileDescriptor.Services().Get(i)

for j := 0; j < serviceDesc.Methods().Len(); j++ {
methodDesc := serviceDesc.Methods().Get(j)

if methodDesc.Input() == messageDesc || methodDesc.Output() == messageDesc {
service = serviceDesc
found = true
return false
}
}
}
return true
})

return service, found
}
>>>>>>> c79e19dfc (fix(server/v2/grpc): fix reflection (#23333)):server/v2/api/grpc/gogoreflection/serverreflection.go
4 changes: 2 additions & 2 deletions server/v2/cometbft/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
cosmossdk.io/errors/v2 v2.0.0
cosmossdk.io/log v1.5.0
cosmossdk.io/schema v1.0.0 //main
cosmossdk.io/server/v2 v2.0.0-beta.1.0.20250109081935-cf721a654090 // main
cosmossdk.io/server/v2 v2.0.0-beta.1.0.20250113101424-c79e19dfc9ca // main
cosmossdk.io/server/v2/appmanager v1.0.0-beta.1.0.20250109081935-cf721a654090 // main
cosmossdk.io/server/v2/stf v1.0.0-beta.1.0.20250109081935-cf721a654090 // main
cosmossdk.io/store/v2 v2.0.0-beta.1 // main
Expand Down Expand Up @@ -99,7 +99,7 @@ require (
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-metrics v0.5.3 // indirect
github.com/hashicorp/go-metrics v0.5.4 // indirect
github.com/hashicorp/go-plugin v1.6.2 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
Expand Down
Loading

0 comments on commit f7e91d5

Please sign in to comment.