Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Apr 18, 2024
1 parent 487db3b commit e9e8564
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions client/v2/internal/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ func ResolveMessageType(resolver protoregistry.MessageTypeResolver, descriptor p
// IsSupportedVersion is used to determine in which version of a module / sdk a rpc was introduced.
// It returns false if the rpc has comment for an higher version than the current one.
func IsSupportedVersion(methodDesc protoreflect.MethodDescriptor) bool {
return IsSupportedVersionWithCustomBuildInfo(methodDesc, buildInfo)
return isSupportedVersion(methodDesc, buildInfo)
}

// IsSupportedVersionWithBuildInfo is used to determine in which version of a module / sdk a rpc was introduced.
// isSupportedVersion is used to determine in which version of a module / sdk a rpc was introduced.
// It returns false if the rpc has comment for an higher version than the current one.
// It takes a buildInfo as argument to be able to test it.
func IsSupportedVersionWithCustomBuildInfo(methodDesc protoreflect.MethodDescriptor, buildInfo *debug.BuildInfo) bool {
func isSupportedVersion(methodDesc protoreflect.MethodDescriptor, buildInfo *debug.BuildInfo) bool {
hasVersion := proto.HasExtension(methodDesc.Options(), cosmos_proto.E_MethodAddedIn)
if !hasVersion || buildInfo == nil {
if !hasVersion || buildInfo == nil || len(buildInfo.Deps) == 0 {
return true
}

Expand Down
2 changes: 1 addition & 1 deletion client/v2/internal/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestIsSupportedVersion(t *testing.T) {
}

methodDesc := desc.(protoreflect.MethodDescriptor)
isSupported := IsSupportedVersionWithCustomBuildInfo(methodDesc, mockBuildInfo)
isSupported := isSupportedVersion(methodDesc, mockBuildInfo)
if isSupported != tc.expected {
t.Errorf("expected %v, got %v for %s", tc.expected, isSupported, methodDesc.FullName())
}
Expand Down

0 comments on commit e9e8564

Please sign in to comment.