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 78f6490
Show file tree
Hide file tree
Showing 8 changed files with 884 additions and 3,074 deletions.
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
9 changes: 0 additions & 9 deletions server/grpc/reflection/v2alpha1/reflection.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,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 +57,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 +74,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 78f6490

Please sign in to comment.