Skip to content

Commit 092d3ad

Browse files
authored
refactor: undo block api renaming for compatibility (#1722)
## Description Must maintain parity with naming of the service for running celestia-app/v3 consensus nodes in standalone mode with a v0.38 cometbft/celestia-core. This allows the app to create a `BlockAPI` proxy service by enabling the core grpc server. See: celestiaorg/cosmos-sdk#453 If this PR is non-trivial/large/complex, please ensure that you have either created an issue that the team's had a chance to respond to, or had some discussion with the team prior to submitting substantial pull requests. The team can be reached via GitHub Discussions or the Cosmos Network Discord server in the #cometbft channel. GitHub Discussions is preferred over Discord as it allows us to keep track of conversations topically. https://github.com/cometbft/cometbft/discussions If the work in this PR is not aligned with the team's current priorities, please be advised that it may take some time before it is merged - especially if it has not yet been discussed with the team. See the project board for the team's current priorities: https://github.com/orgs/cometbft/projects/1 --> --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments
1 parent 6aac2ab commit 092d3ad

File tree

7 files changed

+331
-326
lines changed

7 files changed

+331
-326
lines changed

abci/types/types.pb.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/tendermint/rpc/grpc/types.pb.go

Lines changed: 161 additions & 159 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/tendermint/rpc/grpc/types.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ service BroadcastAPI {
4343
}
4444

4545
// BlockAPI is an API for querying blocks.
46-
service BlockAPIService {
46+
service BlockAPI {
4747
// BlockByHash returns a block by its hash.
4848
rpc BlockByHash(BlockByHashRequest) returns (stream BlockByHashResponse);
4949
// BlockByHeight returns a block by its height.

rpc/grpc/api.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func (blockAPI *BlockAPI) Stop(ctx context.Context) error {
222222
return err
223223
}
224224

225-
func (blockAPI *BlockAPI) BlockByHash(req *BlockByHashRequest, stream BlockAPIService_BlockByHashServer) error {
225+
func (blockAPI *BlockAPI) BlockByHash(req *BlockByHashRequest, stream BlockAPI_BlockByHashServer) error {
226226
blockStore := blockAPI.env.BlockStore
227227
blockMeta := blockStore.LoadBlockMetaByHash(req.Hash)
228228
if blockMeta == nil {
@@ -271,7 +271,7 @@ func (blockAPI *BlockAPI) BlockByHash(req *BlockByHashRequest, stream BlockAPISe
271271
return nil
272272
}
273273

274-
func (blockAPI *BlockAPI) BlockByHeight(req *BlockByHeightRequest, stream BlockAPIService_BlockByHeightServer) error {
274+
func (blockAPI *BlockAPI) BlockByHeight(req *BlockByHeightRequest, stream BlockAPI_BlockByHeightServer) error {
275275
blockStore := blockAPI.env.BlockStore
276276
height := req.Height
277277
if height == 0 {
@@ -399,7 +399,7 @@ func (blockAPI *BlockAPI) ValidatorSet(_ context.Context, req *ValidatorSetReque
399399
}, nil
400400
}
401401

402-
func (blockAPI *BlockAPI) SubscribeNewHeights(_ *SubscribeNewHeightsRequest, stream BlockAPIService_SubscribeNewHeightsServer) error {
402+
func (blockAPI *BlockAPI) SubscribeNewHeights(_ *SubscribeNewHeightsRequest, stream BlockAPI_SubscribeNewHeightsServer) error {
403403
heightListener := blockAPI.addHeightListener()
404404
defer blockAPI.removeHeightListener(heightListener)
405405

rpc/grpc/client_server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func StartGRPCServer(env *core.Environment, ln net.Listener) error {
2929

3030
// block api
3131
api := NewBlockAPI(env)
32-
RegisterBlockAPIServiceServer(grpcServer, api)
32+
RegisterBlockAPIServer(grpcServer, api)
3333

3434
// blobstream api
3535
blobstreamAPI := NewBlobstreamAPI(env)
@@ -73,7 +73,7 @@ func dialerFunc(_ context.Context, addr string) (net.Conn, error) {
7373

7474
// StartBlockAPIGRPCClient dials the gRPC server using protoAddr and returns a new
7575
// BlockAPIClient.
76-
func StartBlockAPIGRPCClient(protoAddr string, opts ...grpc.DialOption) (BlockAPIServiceClient, error) {
76+
func StartBlockAPIGRPCClient(protoAddr string, opts ...grpc.DialOption) (BlockAPIClient, error) {
7777
if len(opts) == 0 {
7878
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
7979
}
@@ -85,7 +85,7 @@ func StartBlockAPIGRPCClient(protoAddr string, opts ...grpc.DialOption) (BlockAP
8585
if err != nil {
8686
return nil, err
8787
}
88-
return NewBlockAPIServiceClient(conn), nil
88+
return NewBlockAPIClient(conn), nil
8989
}
9090

9191
// StartBlobstreamAPIGRPCClient dials the gRPC server using protoAddr and returns a new

rpc/grpc/types.pb.go

Lines changed: 161 additions & 159 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/test/helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func MaxReqBatchSize(o *Options) {
209209
o.maxReqBatchSize = 2
210210
}
211211

212-
func GetBlockAPIClient() (core_grpc.BlockAPIServiceClient, error) {
212+
func GetBlockAPIClient() (core_grpc.BlockAPIClient, error) {
213213
grpcAddr := globalConfig.RPC.GRPCListenAddress
214214
client, err := core_grpc.StartBlockAPIGRPCClient(grpcAddr)
215215
if err != nil {

0 commit comments

Comments
 (0)