Skip to content

Commit

Permalink
refactor(server)!: remove duplicate bech32 prefix endpoint
Browse files Browse the repository at this point in the history
This pr removes bech32prefix endpoint from grpc refelction in server. This removes the global usage of bech32 and puts it into auth. Auth already had an endpointt that was used elsewhere.
  • Loading branch information
tac0turtle committed Dec 28, 2023
1 parent 77b2366 commit 1aad1b2
Show file tree
Hide file tree
Showing 10 changed files with 885 additions and 3,077 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/auth) [#18351](https://github.com/cosmos/cosmos-sdk/pull/18351) Auth module was moved to its own go.mod `cosmossdk.io/x/auth`
* (types) [#18372](https://github.com/cosmos/cosmos-sdk/pull/18372) Removed global configuration for coin type and purpose. Setters and getters should be removed and access directly to defined types.
* (types) [#18695](https://github.com/cosmos/cosmos-sdk/pull/18695) Removed global configuration for txEncoder.
* (server) [#18909](https://github.com/cosmos/cosmos-sdk/pull/18909) Remove configuration endpoint on grpc reflection endpoint in favour of auth module bech32prefix endpoint already exposed.

### CLI Breaking Changes

Expand Down
3,067 changes: 794 additions & 2,273 deletions api/cosmos/base/reflection/v2alpha1/reflection.pulsar.go

Large diffs are not rendered by default.

39 changes: 0 additions & 39 deletions api/cosmos/base/reflection/v2alpha1/reflection_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 2 additions & 20 deletions proto/cosmos/base/reflection/v2alpha1/reflection.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ message AppDescriptor {
ChainDescriptor chain = 2;
// codec provides metadata information regarding codec related types
CodecDescriptor codec = 3;
// configuration provides metadata information regarding the sdk.Config type
ConfigurationDescriptor configuration = 4;
// query_services provides metadata information regarding the available queryable endpoints
QueryServicesDescriptor query_services = 5;
// tx provides metadata information regarding how to send transactions to the given application
TxDescriptor tx = 6;

reserved 4;
}

// TxDescriptor describes the accepted transaction type
Expand Down Expand Up @@ -99,12 +99,6 @@ message InterfaceAcceptingMessageDescriptor {
repeated string field_descriptor_names = 2;
}

// ConfigurationDescriptor contains metadata information on the sdk.Config
message ConfigurationDescriptor {
// bech32_account_address_prefix is the account address prefix
string bech32_account_address_prefix = 1;
}

// MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction
message MsgDescriptor {
// msg_type_url contains the TypeURL of a sdk.Msg.
Expand All @@ -127,10 +121,6 @@ service ReflectionService {
rpc GetCodecDescriptor(GetCodecDescriptorRequest) returns (GetCodecDescriptorResponse) {
option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/codec";
}
// GetConfigurationDescriptor returns the descriptor for the sdk.Config of the application
rpc GetConfigurationDescriptor(GetConfigurationDescriptorRequest) returns (GetConfigurationDescriptorResponse) {
option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/configuration";
}
// GetQueryServicesDescriptor returns the available gRPC queryable services of the application
rpc GetQueryServicesDescriptor(GetQueryServicesDescriptorRequest) returns (GetQueryServicesDescriptorResponse) {
option (google.api.http).get = "/cosmos/base/reflection/v1beta1/app_descriptor/query_services";
Expand Down Expand Up @@ -165,14 +155,6 @@ message GetCodecDescriptorResponse {
CodecDescriptor codec = 1;
}

// GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC
message GetConfigurationDescriptorRequest {}
// GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC
message GetConfigurationDescriptorResponse {
// config describes the application's sdk.Config
ConfigurationDescriptor config = 1;
}

// GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC
message GetQueryServicesDescriptorRequest {}
// GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC
Expand Down
10 changes: 0 additions & 10 deletions server/grpc/reflection/v2alpha1/reflection.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
type Config struct {
SigningModes map[string]int32
ChainID string
SdkConfig *sdk.Config
InterfaceRegistry codectypes.InterfaceRegistry
}

Expand Down Expand Up @@ -46,10 +45,6 @@ func (r reflectionServiceServer) GetCodecDescriptor(_ context.Context, _ *GetCod
return &GetCodecDescriptorResponse{Codec: r.desc.Codec}, nil
}

func (r reflectionServiceServer) GetConfigurationDescriptor(_ context.Context, _ *GetConfigurationDescriptorRequest) (*GetConfigurationDescriptorResponse, error) {
return &GetConfigurationDescriptorResponse{Config: r.desc.Configuration}, nil
}

func (r reflectionServiceServer) GetQueryServicesDescriptor(_ context.Context, _ *GetQueryServicesDescriptorRequest) (*GetQueryServicesDescriptorResponse, error) {
return &GetQueryServicesDescriptorResponse{Queries: r.desc.QueryServices}, nil
}
Expand All @@ -61,10 +56,6 @@ func (r reflectionServiceServer) GetTxDescriptor(_ context.Context, _ *GetTxDesc
func newReflectionServiceServer(grpcSrv *grpc.Server, conf Config) (reflectionServiceServer, error) {
// set chain descriptor
chainDescriptor := &ChainDescriptor{Id: conf.ChainID}
// set configuration descriptor
configurationDescriptor := &ConfigurationDescriptor{
Bech32AccountAddressPrefix: conf.SdkConfig.GetBech32AccountAddrPrefix(),
}
// set codec descriptor
codecDescriptor, err := newCodecDescriptor(conf.InterfaceRegistry)
if err != nil {
Expand All @@ -82,7 +73,6 @@ func newReflectionServiceServer(grpcSrv *grpc.Server, conf Config) (reflectionSe
Authn: authnDescriptor,
Chain: chainDescriptor,
Codec: codecDescriptor,
Configuration: configurationDescriptor,
QueryServices: queryServiceDescriptor,
Tx: txDescriptor,
}
Expand Down
Loading

0 comments on commit 1aad1b2

Please sign in to comment.