Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5e7fb0c

Browse files
authoredApr 12, 2023
Remove gRPC broadcast API (celestiaorg#659)
* Remove gRPC functionality and usage Signed-off-by: Thane Thomson <[email protected]> * Remove all gRPC-related configuration functionality Signed-off-by: Thane Thomson <[email protected]> * Add changelog entry Signed-off-by: Thane Thomson <[email protected]> * ci: Force use of very latest Go version for govulncheck Signed-off-by: Thane Thomson <[email protected]> * docs: Update config section Update the config section of the docs with a more recently generated `config.toml` file (generated using the current code on `main`). Signed-off-by: Thane Thomson <[email protected]> * Revert "ci: Force use of very latest Go version for govulncheck" This reverts commit ce2bfa1ea95148fbc90de785d13a4008ddc56a06. Signed-off-by: Thane Thomson <[email protected]> * config: Fix grammar in doc comment Signed-off-by: Thane Thomson <[email protected]> * config: Remove # for clarity Signed-off-by: Thane Thomson <[email protected]> * config: Fix comments to clarify In some places, the Go names of parameters are used instead of their TOML versions. This replaces the Go names with TOML versions, and fixes a few grammatical and formatting issues in the configuration template and docs. Signed-off-by: Thane Thomson <[email protected]> * docs: Remove extraneous # Signed-off-by: Thane Thomson <[email protected]> --------- Signed-off-by: Thane Thomson <[email protected]>
1 parent 3254a8f commit 5e7fb0c

File tree

19 files changed

+127
-2220
lines changed

19 files changed

+127
-2220
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `[rpc/grpc]` Remove the deprecated gRPC broadcast API
2+
([\#650](https://github.com/cometbft/cometbft/issues/650))

‎Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ proto-gen: check-proto-deps
128128
@echo "Generating Protobuf files"
129129
@go run github.com/bufbuild/buf/cmd/buf generate
130130
@mv ./proto/tendermint/abci/types.pb.go ./abci/types/
131-
@cp ./proto/tendermint/rpc/grpc/types.pb.go ./rpc/grpc
132131
.PHONY: proto-gen
133132

134133
# These targets are provided for convenience and are intended for local

‎cmd/cometbft/commands/run_node.go

+1-7
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ import (
1414
nm "github.com/cometbft/cometbft/node"
1515
)
1616

17-
var (
18-
genesisHash []byte
19-
)
17+
var genesisHash []byte
2018

2119
// AddNodeFlags exposes some common configuration options on the command-line
2220
// These are exposed for convenience of commands embedding a CometBFT node
@@ -50,10 +48,6 @@ func AddNodeFlags(cmd *cobra.Command) {
5048

5149
// rpc flags
5250
cmd.Flags().String("rpc.laddr", config.RPC.ListenAddress, "RPC listen address. Port required")
53-
cmd.Flags().String(
54-
"rpc.grpc_laddr",
55-
config.RPC.GRPCListenAddress,
56-
"GRPC listen address (BroadcastTx only). Port required")
5751
cmd.Flags().Bool("rpc.unsafe", config.RPC.Unsafe, "enabled unsafe rpc methods")
5852
cmd.Flags().String("rpc.pprof_laddr", config.RPC.PprofListenAddress, "pprof listen address (https://golang.org/pkg/net/http/pprof)")
5953

‎config/config.go

+7-25
Original file line numberDiff line numberDiff line change
@@ -324,22 +324,10 @@ type RPCConfig struct {
324324
// A list of non simple headers the client is allowed to use with cross-domain requests.
325325
CORSAllowedHeaders []string `mapstructure:"cors_allowed_headers"`
326326

327-
// TCP or UNIX socket address for the gRPC server to listen on
328-
// NOTE: This server only supports /broadcast_tx_commit
329-
GRPCListenAddress string `mapstructure:"grpc_laddr"`
330-
331-
// Maximum number of simultaneous connections.
332-
// Does not include RPC (HTTP&WebSocket) connections. See max_open_connections
333-
// If you want to accept a larger number than the default, make sure
334-
// you increase your OS limits.
335-
// 0 - unlimited.
336-
GRPCMaxOpenConnections int `mapstructure:"grpc_max_open_connections"`
337-
338327
// Activate unsafe RPC commands like /dial_persistent_peers and /unsafe_flush_mempool
339328
Unsafe bool `mapstructure:"unsafe"`
340329

341330
// Maximum number of simultaneous connections (including WebSocket).
342-
// Does not include gRPC connections. See grpc_max_open_connections
343331
// If you want to accept a larger number than the default, make sure
344332
// you increase your OS limits.
345333
// 0 - unlimited.
@@ -352,9 +340,9 @@ type RPCConfig struct {
352340
// of broadcast_tx_commit calls per block.
353341
MaxSubscriptionClients int `mapstructure:"max_subscription_clients"`
354342

355-
// Maximum number of unique queries a given client can /subscribe to
356-
// If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set
357-
// to the estimated maximum number of broadcast_tx_commit calls per block.
343+
// Maximum number of unique queries a given client can /subscribe to. If
344+
// you're using /broadcast_tx_commit, set to the estimated maximum number
345+
// of broadcast_tx_commit calls per block.
358346
MaxSubscriptionsPerClient int `mapstructure:"max_subscriptions_per_client"`
359347

360348
// The number of events that can be buffered per subscription before
@@ -418,12 +406,10 @@ type RPCConfig struct {
418406
// DefaultRPCConfig returns a default configuration for the RPC server
419407
func DefaultRPCConfig() *RPCConfig {
420408
return &RPCConfig{
421-
ListenAddress: "tcp://127.0.0.1:26657",
422-
CORSAllowedOrigins: []string{},
423-
CORSAllowedMethods: []string{http.MethodHead, http.MethodGet, http.MethodPost},
424-
CORSAllowedHeaders: []string{"Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"},
425-
GRPCListenAddress: "",
426-
GRPCMaxOpenConnections: 900,
409+
ListenAddress: "tcp://127.0.0.1:26657",
410+
CORSAllowedOrigins: []string{},
411+
CORSAllowedMethods: []string{http.MethodHead, http.MethodGet, http.MethodPost},
412+
CORSAllowedHeaders: []string{"Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"},
427413

428414
Unsafe: false,
429415
MaxOpenConnections: 900,
@@ -446,17 +432,13 @@ func DefaultRPCConfig() *RPCConfig {
446432
func TestRPCConfig() *RPCConfig {
447433
cfg := DefaultRPCConfig()
448434
cfg.ListenAddress = "tcp://127.0.0.1:36657"
449-
cfg.GRPCListenAddress = "tcp://127.0.0.1:36658"
450435
cfg.Unsafe = true
451436
return cfg
452437
}
453438

454439
// ValidateBasic performs basic validation (checking param bounds, etc.) and
455440
// returns an error if any check fails.
456441
func (cfg *RPCConfig) ValidateBasic() error {
457-
if cfg.GRPCMaxOpenConnections < 0 {
458-
return errors.New("grpc_max_open_connections can't be negative")
459-
}
460442
if cfg.MaxOpenConnections < 0 {
461443
return errors.New("max_open_connections can't be negative")
462444
}

‎config/config_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ func TestDefaultConfig(t *testing.T) {
2929
assert.Equal("/foo/bar", cfg.GenesisFile())
3030
assert.Equal("/opt/data", cfg.DBDir())
3131
assert.Equal("/foo/wal/mem", cfg.Mempool.WalDir())
32-
3332
}
3433

3534
func TestConfigValidateBasic(t *testing.T) {
@@ -71,7 +70,6 @@ func TestRPCConfigValidateBasic(t *testing.T) {
7170
assert.NoError(t, cfg.ValidateBasic())
7271

7372
fieldsToTest := []string{
74-
"GRPCMaxOpenConnections",
7573
"MaxOpenConnections",
7674
"MaxSubscriptionClients",
7775
"MaxSubscriptionsPerClient",

‎config/toml.go

+13-27
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
// DefaultDirPerm is the default permissions used when creating directories.
13-
const DefaultDirPerm = 0700
13+
const DefaultDirPerm = 0o700
1414

1515
var configTemplate *template.Template
1616

@@ -61,7 +61,7 @@ func WriteConfigFile(configFilePath string, config *Config) {
6161
panic(err)
6262
}
6363

64-
cmtos.MustWriteFile(configFilePath, buffer.Bytes(), 0644)
64+
cmtos.MustWriteFile(configFilePath, buffer.Bytes(), 0o644)
6565
}
6666

6767
// Note: any changes to the comments/variables/mapstructure
@@ -168,39 +168,25 @@ cors_allowed_methods = [{{ range .RPC.CORSAllowedMethods }}{{ printf "%q, " . }}
168168
# A list of non simple headers the client is allowed to use with cross-domain requests
169169
cors_allowed_headers = [{{ range .RPC.CORSAllowedHeaders }}{{ printf "%q, " . }}{{end}}]
170170
171-
# TCP or UNIX socket address for the gRPC server to listen on
172-
# NOTE: This server only supports /broadcast_tx_commit
173-
grpc_laddr = "{{ .RPC.GRPCListenAddress }}"
174-
175-
# Maximum number of simultaneous connections.
176-
# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections
177-
# If you want to accept a larger number than the default, make sure
178-
# you increase your OS limits.
179-
# 0 - unlimited.
180-
# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files}
181-
# 1024 - 40 - 10 - 50 = 924 = ~900
182-
grpc_max_open_connections = {{ .RPC.GRPCMaxOpenConnections }}
183-
184171
# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool
185172
unsafe = {{ .RPC.Unsafe }}
186173
187174
# Maximum number of simultaneous connections (including WebSocket).
188-
# Does not include gRPC connections. See grpc_max_open_connections
189175
# If you want to accept a larger number than the default, make sure
190176
# you increase your OS limits.
191177
# 0 - unlimited.
192178
# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files}
193179
# 1024 - 40 - 10 - 50 = 924 = ~900
194180
max_open_connections = {{ .RPC.MaxOpenConnections }}
195181
196-
# Maximum number of unique clientIDs that can /subscribe
182+
# Maximum number of unique clientIDs that can /subscribe.
197183
# If you're using /broadcast_tx_commit, set to the estimated maximum number
198184
# of broadcast_tx_commit calls per block.
199185
max_subscription_clients = {{ .RPC.MaxSubscriptionClients }}
200186
201-
# Maximum number of unique queries a given client can /subscribe to
202-
# If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to
203-
# the estimated # maximum number of broadcast_tx_commit calls per block.
187+
# Maximum number of unique queries a given client can /subscribe to.
188+
# If you're using /broadcast_tx_commit, set to the estimated maximum number
189+
# of broadcast_tx_commit calls per block.
204190
max_subscriptions_per_client = {{ .RPC.MaxSubscriptionsPerClient }}
205191
206192
# Experimental parameter to specify the maximum number of events a node will
@@ -253,7 +239,7 @@ tls_cert_file = "{{ .RPC.TLSCertFile }}"
253239
254240
# The path to a file containing matching private key that is used to create the HTTPS server.
255241
# Might be either absolute path or path related to CometBFT's config directory.
256-
# NOTE: both tls-cert-file and tls-key-file must be present for CometBFT to create HTTPS server.
242+
# NOTE: both tls_cert_file and tls_key_file must be present for CometBFT to create HTTPS server.
257243
# Otherwise, HTTP server is run.
258244
tls_key_file = "{{ .RPC.TLSKeyFile }}"
259245
@@ -279,7 +265,7 @@ external_address = "{{ .P2P.ExternalAddress }}"
279265
seeds = "{{ .P2P.Seeds }}"
280266
281267
# Comma separated list of peers to be added to the peer store
282-
# on startup. Either BootstrapPeers or PersistentPeers are
268+
# on startup. Either bootstrap_peers or persistent_peers is
283269
# needed for peer discovery
284270
bootstrap_peers = "{{ .P2P.BootstrapPeers }}"
285271
@@ -340,27 +326,27 @@ handshake_timeout = "{{ .P2P.HandshakeTimeout }}"
340326
dial_timeout = "{{ .P2P.DialTimeout }}"
341327
342328
#######################################################
343-
### Mempool Configuration Option ###
329+
### Mempool Configuration Options ###
344330
#######################################################
345331
[mempool]
346332
347-
# Recheck (default: true) defines whether CometBFT should recheck the
333+
# recheck (default: true) defines whether CometBFT should recheck the
348334
# validity for all remaining transaction in the mempool after a block.
349335
# Since a block affects the application state, some transactions in the
350336
# mempool may become invalid. If this does not apply to your application,
351337
# you can disable rechecking.
352338
recheck = {{ .Mempool.Recheck }}
353339
354-
# Broadcast (default: true) defines whether the mempool should relay
340+
# broadcast (default: true) defines whether the mempool should relay
355341
# transactions to other peers. Setting this to false will stop the mempool
356342
# from relaying transactions to other peers until they are included in a
357343
# block. In other words, if Broadcast is disabled, only the peer you send
358344
# the tx to will see it until it is included in a block.
359345
broadcast = {{ .Mempool.Broadcast }}
360346
361-
# WalPath (default: "") configures the location of the Write Ahead Log
347+
# wal_dir (default: "") configures the location of the Write Ahead Log
362348
# (WAL) for the mempool. The WAL is disabled by default. To enable, set
363-
# WalPath to where you want the WAL to be written (e.g.
349+
# wal_dir to where you want the WAL to be written (e.g.
364350
# "data/mempool.wal").
365351
wal_dir = "{{ js .Mempool.WalPath }}"
366352

‎consensus/wal_generator.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -139,22 +139,20 @@ func randPort() int {
139139
return base + cmtrand.Intn(spread)
140140
}
141141

142-
func makeAddrs() (string, string, string) {
142+
func makeAddrs() (string, string) {
143143
start := randPort()
144144
return fmt.Sprintf("tcp://127.0.0.1:%d", start),
145-
fmt.Sprintf("tcp://127.0.0.1:%d", start+1),
146-
fmt.Sprintf("tcp://127.0.0.1:%d", start+2)
145+
fmt.Sprintf("tcp://127.0.0.1:%d", start+1)
147146
}
148147

149148
// getConfig returns a config for test cases
150149
func getConfig(t *testing.T) *cfg.Config {
151150
c := test.ResetTestRoot(t.Name())
152151

153152
// and we use random ports to run in parallel
154-
cmt, rpc, grpc := makeAddrs()
153+
cmt, rpc := makeAddrs()
155154
c.P2P.ListenAddress = cmt
156155
c.RPC.ListenAddress = rpc
157-
c.RPC.GRPCListenAddress = grpc
158156
return c
159157
}
160158

‎docs/core/configuration.md

+88-22
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ like the file below, however, double check by inspecting the
2525
# "$HOME/.cometbft" by default, but could be changed via $CMTHOME env variable
2626
# or --home cmd flag.
2727

28+
# The version of the CometBFT binary that created or
29+
# last modified the config file. Do not modify this.
30+
version = "0.39.0"
31+
2832
#######################################################################
2933
### Main Base Config Options ###
3034
#######################################################################
@@ -115,24 +119,10 @@ cors_allowed_methods = ["HEAD", "GET", "POST", ]
115119
# A list of non simple headers the client is allowed to use with cross-domain requests
116120
cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time", ]
117121

118-
# TCP or UNIX socket address for the gRPC server to listen on
119-
# NOTE: This server only supports /broadcast_tx_commit
120-
grpc_laddr = ""
121-
122-
# Maximum number of simultaneous connections.
123-
# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections
124-
# If you want to accept a larger number than the default, make sure
125-
# you increase your OS limits.
126-
# 0 - unlimited.
127-
# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files}
128-
# 1024 - 40 - 10 - 50 = 924 = ~900
129-
grpc_max_open_connections = 900
130-
131122
# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool
132123
unsafe = false
133124

134125
# Maximum number of simultaneous connections (including WebSocket).
135-
# Does not include gRPC connections. See grpc_max_open_connections
136126
# If you want to accept a larger number than the default, make sure
137127
# you increase your OS limits.
138128
# 0 - unlimited.
@@ -146,10 +136,37 @@ max_open_connections = 900
146136
max_subscription_clients = 100
147137

148138
# Maximum number of unique queries a given client can /subscribe to
149-
# If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to
150-
# the estimated # maximum number of broadcast_tx_commit calls per block.
139+
# If you're using /broadcast_tx_commit, set to the estimated maximum number
140+
# of broadcast_tx_commit calls per block.
151141
max_subscriptions_per_client = 5
152142

143+
# Experimental parameter to specify the maximum number of events a node will
144+
# buffer, per subscription, before returning an error and closing the
145+
# subscription. Must be set to at least 100, but higher values will accommodate
146+
# higher event throughput rates (and will use more memory).
147+
experimental_subscription_buffer_size = 200
148+
149+
# Experimental parameter to specify the maximum number of RPC responses that
150+
# can be buffered per WebSocket client. If clients cannot read from the
151+
# WebSocket endpoint fast enough, they will be disconnected, so increasing this
152+
# parameter may reduce the chances of them being disconnected (but will cause
153+
# the node to use more memory).
154+
#
155+
# Must be at least the same as "experimental_subscription_buffer_size",
156+
# otherwise connections could be dropped unnecessarily. This value should
157+
# ideally be somewhat higher than "experimental_subscription_buffer_size" to
158+
# accommodate non-subscription-related RPC responses.
159+
experimental_websocket_write_buffer_size = 200
160+
161+
# If a WebSocket client cannot read fast enough, at present we may
162+
# silently drop events instead of generating an error or disconnecting the
163+
# client.
164+
#
165+
# Enabling this experimental parameter will cause the WebSocket connection to
166+
# be closed instead if it cannot read fast enough, allowing for greater
167+
# predictability in subscription behavior.
168+
experimental_close_on_slow_client = false
169+
153170
# How long to wait for a tx to be committed during /broadcast_tx_commit.
154171
# WARNING: Using a value larger than 10s will result in increasing the
155172
# global HTTP write timeout, which applies to all connections and endpoints.
@@ -191,12 +208,18 @@ laddr = "tcp://0.0.0.0:26656"
191208
# Address to advertise to peers for them to dial
192209
# If empty, will use the same port as the laddr,
193210
# and will introspect on the listener or use UPnP
194-
# to figure out the address.
211+
# to figure out the address. ip and port are required
212+
# example: 159.89.10.97:26656
195213
external_address = ""
196214

197215
# Comma separated list of seed nodes to connect to
198216
seeds = ""
199217

218+
# Comma separated list of peers to be added to the peer store
219+
# on startup. Either bootstrap_peers or persistent_peers is
220+
# needed for peer discovery
221+
bootstrap_peers = ""
222+
200223
# Comma separated list of nodes to keep persistent connections to
201224
persistent_peers = ""
202225

@@ -254,12 +277,29 @@ handshake_timeout = "20s"
254277
dial_timeout = "3s"
255278

256279
#######################################################
257-
### Mempool Configurattion Option ###
280+
### Mempool Configuration Options ###
258281
#######################################################
259282
[mempool]
260283

284+
# recheck (default: true) defines whether CometBFT should recheck the
285+
# validity for all remaining transaction in the mempool after a block.
286+
# Since a block affects the application state, some transactions in the
287+
# mempool may become invalid. If this does not apply to your application,
288+
# you can disable rechecking.
261289
recheck = true
290+
291+
# broadcast (default: true) defines whether the mempool should relay
292+
# transactions to other peers. Setting this to false will stop the mempool
293+
# from relaying transactions to other peers until they are included in a
294+
# block. In other words, if Broadcast is disabled, only the peer you send
295+
# the tx to will see it until it is included in a block.
262296
broadcast = true
297+
298+
# wal_dir (default: "") configures the location of the Write Ahead Log
299+
# (WAL) for the mempool. The WAL is disabled by default. To enable, set
300+
# wal_dir to where you want the WAL to be written (e.g.
301+
# "data/mempool.wal").
302+
# "data/mempool.wal").
263303
wal_dir = ""
264304

265305
# Maximum number of transactions in the mempool
@@ -285,7 +325,7 @@ max_tx_bytes = 1048576
285325
# Maximum size of a batch of transactions to send to a peer
286326
# Including space needed by encoding (one varint per transaction).
287327
# XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796
288-
max_batch_bytes = 10485760
328+
max_batch_bytes = 0
289329

290330
#######################################################
291331
### State Sync Configuration Options ###
@@ -307,19 +347,29 @@ enable = false
307347
rpc_servers = ""
308348
trust_height = 0
309349
trust_hash = ""
310-
trust_period = "0s"
350+
trust_period = "168h0m0s"
351+
352+
# Time to spend discovering snapshots before initiating a restore.
353+
discovery_time = "15s"
311354

312355
# Temporary directory for state sync snapshot chunks, defaults to the OS tempdir (typically /tmp).
313356
# Will create a new, randomly named directory within, and remove it when done.
314357
temp_dir = ""
315358

359+
# The timeout duration before re-requesting a chunk, possibly from a different
360+
# peer (default: 1 minute).
361+
chunk_request_timeout = "10s"
362+
363+
# The number of concurrent chunk fetchers to run (default: 1).
364+
chunk_fetchers = "4"
365+
316366
#######################################################
317367
### Block Sync Configuration Options ###
318368
#######################################################
319369
[blocksync]
320370

321371
# Block Sync version to use:
322-
#
372+
#
323373
# In v0.37, v1 and v2 of the block sync protocols were deprecated.
324374
# Please use v0 instead.
325375
#
@@ -367,6 +417,17 @@ create_empty_blocks_interval = "0s"
367417
peer_gossip_sleep_duration = "100ms"
368418
peer_query_maj23_sleep_duration = "2s"
369419

420+
#######################################################
421+
### Storage Configuration Options ###
422+
#######################################################
423+
[storage]
424+
425+
# Set to true to discard ABCI responses from the state store, which can save a
426+
# considerable amount of disk space. Set to false to ensure ABCI responses are
427+
# persisted. ABCI responses are required for /block_results RPC queries, and to
428+
# reindex events in the command-line tool.
429+
discard_abci_responses = false
430+
370431
#######################################################
371432
### Transaction Indexer Configuration Options ###
372433
#######################################################
@@ -381,8 +442,14 @@ peer_query_maj23_sleep_duration = "2s"
381442
# 1) "null"
382443
# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend).
383444
# - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed.
445+
# 3) "psql" - the indexer services backed by PostgreSQL.
446+
# When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed.
384447
indexer = "kv"
385448

449+
# The PostgreSQL connection configuration, the connection format:
450+
# postgresql://<user>:<password>@<host>:<port>/<db>?<opts>
451+
psql-conn = ""
452+
386453
#######################################################
387454
### Instrumentation Configuration Options ###
388455
#######################################################
@@ -404,7 +471,6 @@ max_open_connections = 3
404471

405472
# Instrumentation namespace
406473
namespace = "cometbft"
407-
408474
```
409475

410476
## Empty blocks VS no empty blocks

‎node/node.go

-29
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"github.com/cometbft/cometbft/p2p/pex"
2525
"github.com/cometbft/cometbft/proxy"
2626
rpccore "github.com/cometbft/cometbft/rpc/core"
27-
grpccore "github.com/cometbft/cometbft/rpc/grpc"
2827
rpcserver "github.com/cometbft/cometbft/rpc/jsonrpc/server"
2928
sm "github.com/cometbft/cometbft/state"
3029
"github.com/cometbft/cometbft/state/indexer"
@@ -620,34 +619,6 @@ func (n *Node) startRPC() ([]net.Listener, error) {
620619
listeners[i] = listener
621620
}
622621

623-
// we expose a simplified api over grpc for convenience to app devs
624-
grpcListenAddr := n.config.RPC.GRPCListenAddress
625-
if grpcListenAddr != "" {
626-
config := rpcserver.DefaultConfig()
627-
config.MaxBodyBytes = n.config.RPC.MaxBodyBytes
628-
config.MaxHeaderBytes = n.config.RPC.MaxHeaderBytes
629-
// NOTE: GRPCMaxOpenConnections is used, not MaxOpenConnections
630-
config.MaxOpenConnections = n.config.RPC.GRPCMaxOpenConnections
631-
// If necessary adjust global WriteTimeout to ensure it's greater than
632-
// TimeoutBroadcastTxCommit.
633-
// See https://github.com/tendermint/tendermint/issues/3435
634-
if config.WriteTimeout <= n.config.RPC.TimeoutBroadcastTxCommit {
635-
config.WriteTimeout = n.config.RPC.TimeoutBroadcastTxCommit + 1*time.Second
636-
}
637-
listener, err := rpcserver.Listen(grpcListenAddr, config.MaxOpenConnections)
638-
if err != nil {
639-
return nil, err
640-
}
641-
go func() {
642-
//nolint:staticcheck // SA1019: core_grpc.StartGRPCClient is deprecated: A new gRPC API will be introduced after v0.38.
643-
if err := grpccore.StartGRPCServer(env, listener); err != nil {
644-
n.Logger.Error("Error starting gRPC server", "err", err)
645-
}
646-
}()
647-
listeners = append(listeners, listener)
648-
649-
}
650-
651622
return listeners, nil
652623
}
653624

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

-926
This file was deleted.

‎proto/tendermint/rpc/grpc/types.proto

-36
This file was deleted.

‎rpc/client/local/local.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ import (
1818
)
1919

2020
/*
21-
Local is a Client implementation that directly executes the rpc
22-
functions on a given node, without going through HTTP or GRPC.
21+
Local is a Client implementation that directly executes the RPC
22+
functions on a given node, without going through HTTP.
2323
2424
This implementation is useful for:
2525
26-
* Running tests against a node in-process without the overhead
27-
of going through an http server
28-
* Communication between an ABCI app and CometBFT when they
29-
are compiled in process.
26+
- Running tests against a node in-process without the overhead
27+
of going through an HTTP server
28+
- Communication between an ABCI app and CometBFT when they
29+
are compiled in process.
3030
3131
For real clients, you probably want to use client.HTTP. For more
3232
powerful control during testing, you probably want the "client/mock" package.

‎rpc/grpc/api.go

-40
This file was deleted.

‎rpc/grpc/client_server.go

-45
This file was deleted.

‎rpc/grpc/grpc_test.go

-35
This file was deleted.

‎rpc/grpc/types.pb.go

-926
This file was deleted.

‎rpc/test/helpers.go

+2-22
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"github.com/cometbft/cometbft/privval"
2020
"github.com/cometbft/cometbft/proxy"
2121
ctypes "github.com/cometbft/cometbft/rpc/core/types"
22-
core_grpc "github.com/cometbft/cometbft/rpc/grpc"
2322
rpcclient "github.com/cometbft/cometbft/rpc/jsonrpc/client"
2423
)
2524

@@ -56,16 +55,6 @@ func waitForRPC() {
5655
}
5756
}
5857

59-
func waitForGRPC() {
60-
client := GetGRPCClient()
61-
for {
62-
_, err := client.Ping(context.Background(), &core_grpc.RequestPing{})
63-
if err == nil {
64-
return
65-
}
66-
}
67-
}
68-
6958
// f**ing long, but unique for each test
7059
func makePathname() string {
7160
// get path
@@ -86,9 +75,8 @@ func randPort() int {
8675
return port
8776
}
8877

89-
func makeAddrs() (string, string, string) {
78+
func makeAddrs() (string, string) {
9079
return fmt.Sprintf("tcp://127.0.0.1:%d", randPort()),
91-
fmt.Sprintf("tcp://127.0.0.1:%d", randPort()),
9280
fmt.Sprintf("tcp://127.0.0.1:%d", randPort())
9381
}
9482

@@ -97,11 +85,10 @@ func createConfig() *cfg.Config {
9785
c := test.ResetTestRoot(pathname)
9886

9987
// and we use random ports to run in parallel
100-
tm, rpc, grpc := makeAddrs()
88+
tm, rpc := makeAddrs()
10189
c.P2P.ListenAddress = tm
10290
c.RPC.ListenAddress = rpc
10391
c.RPC.CORSAllowedOrigins = []string{"https://cometbft.com/"}
104-
c.RPC.GRPCListenAddress = grpc
10592
return c
10693
}
10794

@@ -113,12 +100,6 @@ func GetConfig(forceCreate ...bool) *cfg.Config {
113100
return globalConfig
114101
}
115102

116-
func GetGRPCClient() core_grpc.BroadcastAPIClient {
117-
grpcAddr := globalConfig.RPC.GRPCListenAddress
118-
//nolint:staticcheck // SA1019: core_grpc.StartGRPCClient is deprecated: A new gRPC API will be introduced after v0.38.
119-
return core_grpc.StartGRPCClient(grpcAddr)
120-
}
121-
122103
// StartTendermint starts a test CometBFT server in a go routine and returns when it is initialized
123104
func StartTendermint(app abci.Application, opts ...func(*Options)) *nm.Node {
124105
nodeOpts := defaultOptions
@@ -133,7 +114,6 @@ func StartTendermint(app abci.Application, opts ...func(*Options)) *nm.Node {
133114

134115
// wait for rpc
135116
waitForRPC()
136-
waitForGRPC()
137117

138118
if !nodeOpts.suppressStdout {
139119
fmt.Println("CometBFT running!")

‎test/app/counter_test.sh

+5-24
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
export GO111MODULE=on
44

5-
if [[ "$GRPC_BROADCAST_TX" == "" ]]; then
6-
GRPC_BROADCAST_TX=""
7-
fi
8-
95
set -u
106

117
#####################
@@ -34,15 +30,6 @@ function getCode() {
3430
fi
3531
}
3632

37-
# build grpc client if needed
38-
if [[ "$GRPC_BROADCAST_TX" != "" ]]; then
39-
if [ -f test/app/grpc_client ]; then
40-
rm test/app/grpc_client
41-
fi
42-
echo "... building grpc_client"
43-
go build -mod=readonly -o test/app/grpc_client test/app/grpc_client.go
44-
fi
45-
4633
function sendTx() {
4734
TX=$1
4835
set +u
@@ -51,18 +38,12 @@ function sendTx() {
5138
SHOULD_ERR=false
5239
fi
5340
set -u
54-
if [[ "$GRPC_BROADCAST_TX" == "" ]]; then
55-
RESPONSE=$(curl -s localhost:26657/broadcast_tx_commit?tx=0x"$TX")
56-
IS_ERR=$(echo "$RESPONSE" | jq 'has("error")')
57-
ERROR=$(echo "$RESPONSE" | jq '.error')
58-
ERROR=$(echo "$ERROR" | tr -d '"') # remove surrounding quotes
41+
RESPONSE=$(curl -s localhost:26657/broadcast_tx_commit?tx=0x"$TX")
42+
IS_ERR=$(echo "$RESPONSE" | jq 'has("error")')
43+
ERROR=$(echo "$RESPONSE" | jq '.error')
44+
ERROR=$(echo "$ERROR" | tr -d '"') # remove surrounding quotes
5945

60-
RESPONSE=$(echo "$RESPONSE" | jq '.result')
61-
else
62-
RESPONSE=$(./test/app/grpc_client "$TX")
63-
IS_ERR=false
64-
ERROR=""
65-
fi
46+
RESPONSE=$(echo "$RESPONSE" | jq '.result')
6647

6748
echo "RESPONSE"
6849
echo "$RESPONSE"

‎test/app/grpc_client.go

-42
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.