Skip to content

Commit 756db0d

Browse files
author
shgandhi
committed
gRPC upgrade version
This commit upgrades gRPC from 1.37.x to the latest release version 1.48.0. Over the past ten versions of gRPC multiple optimizations and bug fixes have been introduced. Please see https://github.com/grpc/grpc/releases for the detailed breakdown of updates from 1.38.0 to 1.48.0. This upgrade would also allow for batching of updates natively via setting the buffer hint flag for improved performance. This change updates client, TRS and UTT CMakeLists files to account for the upgrade.
1 parent cbd5bab commit 756db0d

File tree

6 files changed

+217
-82
lines changed

6 files changed

+217
-82
lines changed

client/clientservice/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
set(CMAKE_CXX_STANDARD 17)
3+
14
find_package(GRPC REQUIRED)
5+
find_package(absl CONFIG REQUIRED)
6+
find_package(Protobuf CONFIG REQUIRED)
27
find_package(Boost ${MIN_BOOST_VERSION} COMPONENTS program_options REQUIRED)
38
find_package(jaegertracing REQUIRED)
49

@@ -13,6 +18,7 @@ target_link_libraries(clientservice-lib PUBLIC
1318
concordclient
1419
gRPC::grpc++
1520
gRPC::grpc++_reflection
21+
protobuf::libprotobuf
1622
logging
1723
yaml-cpp
1824
secret_retriever

client/proto/CMakeLists.txt

Lines changed: 98 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,102 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
set(CMAKE_CXX_STANDARD 17)
3+
4+
project(concord)
5+
16
find_package(Protobuf REQUIRED)
7+
find_package(absl CONFIG REQUIRED)
28
find_package(GRPC REQUIRED)
39

4-
include_directories(${GRPC_INCLUDE_DIR})
5-
6-
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_CURRENT_BINARY_DIR}
7-
request/v1/request.proto
8-
event/v1/event.proto
9-
state_snapshot/v1/state_snapshot.proto
10-
../concordclient/proto/concord_client_request/v1/concord_client_request.proto
11-
)
12-
grpc_generate_cpp(GRPC_SRCS GRPC_HDRS ${CMAKE_CURRENT_BINARY_DIR}
13-
request/v1/request.proto
14-
event/v1/event.proto
15-
state_snapshot/v1/state_snapshot.proto
16-
../concordclient/proto/concord_client_request/v1/concord_client_request.proto
17-
)
18-
19-
add_library(clientservice-proto STATIC ${PROTO_SRCS} ${GRPC_SRCS})
20-
target_link_libraries(clientservice-proto PRIVATE protobuf::libprotobuf gRPC::grpc++)
10+
# Proto file
11+
get_filename_component(rs_proto "request/v1/request.proto" ABSOLUTE)
12+
get_filename_component(es_proto "event/v1/event.proto" ABSOLUTE)
13+
get_filename_component(ss_proto "state_snapshot/v1/state_snapshot.proto" ABSOLUTE)
14+
get_filename_component(ccr_proto "../concordclient/proto/concord_client_request/v1/concord_client_request.proto" ABSOLUTE)
15+
get_filename_component(rs_proto_path "${rs_proto}" PATH)
16+
get_filename_component(es_proto_path "${es_proto}" PATH)
17+
get_filename_component(ss_proto_path "${ss_proto}" PATH)
18+
get_filename_component(ccr_proto_path "${ccr_proto}" PATH)
19+
20+
get_target_property(grpc_cpp_plugin_location gRPC::grpc_cpp_plugin LOCATION)
21+
22+
# Generated sources
23+
set(rs_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/request.pb.cc")
24+
set(rs_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/request.pb.h")
25+
set(rs_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/request.grpc.pb.cc")
26+
set(rs_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/request.grpc.pb.h")
27+
add_custom_command(
28+
OUTPUT "${rs_proto_srcs}" "${rs_proto_hdrs}" "${rs_grpc_srcs}" "${rs_grpc_hdrs}"
29+
COMMAND protoc
30+
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
31+
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
32+
-I "${rs_proto_path}"
33+
--plugin=protoc-gen-grpc="${grpc_cpp_plugin_location}"
34+
"${rs_proto}"
35+
DEPENDS "${rs_proto}")
36+
37+
set(es_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/event.pb.cc")
38+
set(es_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/event.pb.h")
39+
set(es_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/event.grpc.pb.cc")
40+
set(es_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/event.grpc.pb.h")
41+
add_custom_command(
42+
OUTPUT "${es_proto_srcs}" "${es_proto_hdrs}" "${es_grpc_srcs}" "${es_grpc_hdrs}"
43+
COMMAND protoc
44+
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
45+
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
46+
-I "${es_proto_path}"
47+
--plugin=protoc-gen-grpc="${grpc_cpp_plugin_location}"
48+
"${es_proto}"
49+
DEPENDS "${es_proto}")
50+
51+
set(ss_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/state_snapshot.pb.cc")
52+
set(ss_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/state_snapshot.pb.h")
53+
set(ss_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/state_snapshot.grpc.pb.cc")
54+
set(ss_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/state_snapshot.grpc.pb.h")
55+
add_custom_command(
56+
OUTPUT "${ss_proto_srcs}" "${ss_proto_hdrs}" "${ss_grpc_srcs}" "${ss_grpc_hdrs}"
57+
COMMAND protoc
58+
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
59+
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
60+
-I "${ss_proto_path}"
61+
--plugin=protoc-gen-grpc="${grpc_cpp_plugin_location}"
62+
"${ss_proto}"
63+
DEPENDS "${ss_proto}")
64+
65+
set(ccr_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/concord_client_request.pb.cc")
66+
set(ccr_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/concord_client_request.pb.h")
67+
set(ccr_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/concord_client_request.grpc.pb.cc")
68+
set(ccr_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/concord_client_request.grpc.pb.h")
69+
add_custom_command(
70+
OUTPUT "${ccr_proto_srcs}" "${ccr_proto_hdrs}" "${ccr_grpc_srcs}" "${ccr_grpc_hdrs}"
71+
COMMAND protoc
72+
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
73+
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
74+
-I "${ccr_proto_path}"
75+
--plugin=protoc-gen-grpc="${grpc_cpp_plugin_location}"
76+
"${ccr_proto}"
77+
DEPENDS "${ccr_proto}")
78+
79+
80+
# Include generated *.pb.h files
81+
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
82+
83+
# clientservice-proto
84+
add_library(clientservice-proto STATIC
85+
${rs_grpc_srcs}
86+
${rs_grpc_hdrs}
87+
${rs_proto_srcs}
88+
${rs_proto_hdrs}
89+
${es_grpc_srcs}
90+
${es_grpc_hdrs}
91+
${es_proto_srcs}
92+
${es_proto_hdrs}
93+
${ss_grpc_srcs}
94+
${ss_grpc_hdrs}
95+
${ss_proto_srcs}
96+
${ss_proto_hdrs}
97+
${ccr_grpc_srcs}
98+
${ccr_grpc_hdrs}
99+
${ccr_proto_srcs}
100+
${ccr_proto_hdrs})
101+
target_link_libraries(clientservice-proto PRIVATE protobuf::libprotobuf gRPC::grpc++ absl::synchronization)
21102
target_include_directories(clientservice-proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR})

install_deps.sh

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ install_third_party_libraries() {
7676
pytest \
7777
pycryptodome \
7878
ecdsa \
79-
protobuf==3.15.8 \
80-
grpcio==1.37.1 \
81-
grpcio-tools==1.37.1
79+
protobuf==3.21.5 \
80+
grpcio==1.48.0 \
81+
grpcio-tools==1.48.0
8282
}
8383

8484

@@ -300,36 +300,20 @@ install_openssl() {
300300
# https://github.com/grpc/grpc/blob/master/test/distrib/cpp/run_distrib_test_cmake.sh
301301
install_grpc() {
302302
cd ${HOME}
303-
git clone -b v1.37.1 --depth 1 --recurse-submodules https://github.com/grpc/grpc && \
304-
cd grpc && \
305-
mkdir -p ${HOME}/grpc/third_party/abseil-cpp/cmake/build && \
306-
cd ${HOME}/grpc/third_party/abseil-cpp/cmake/build && \
307-
cmake -DCMAKE_BUILD_TYPE=Release \
308-
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
309-
-DCMAKE_INSTALL_PREFIX=/usr/local \
310-
../.. && \
311-
make -j$(nproc) install && \
312-
mkdir -p ${HOME}/grpc/third_party/protobuf/cmake/build && \
313-
cd ${HOME}/grpc/third_party/protobuf/cmake/build && \
314-
cmake -DBUILD_SHARED_LIBS=ON \
315-
-DCMAKE_BUILD_TYPE=Release \
316-
-DCMAKE_INSTALL_PREFIX=/usr/local \
317-
.. && \
318-
make -j$(nproc) install && \
319-
mkdir -p ${HOME}/grpc/cmake/build && \
320-
cd ${HOME}/grpc/cmake/build && \
321-
cmake -DgRPC_INSTALL=ON \
322-
-DgRPC_ABSL_PROVIDER=package \
323-
-DgRPC_PROTOBUF_PROVIDER=package \
324-
-DgRPC_SSL_PROVIDER=package \
325-
-DBUILD_SHARED_LIBS=ON \
326-
-DCMAKE_BUILD_TYPE=Release \
327-
-DCMAKE_INSTALL_PREFIX=/usr/local \
328-
../.. && \
329-
make -j$(nproc) install &&
330-
cd ${HOME} && \
331-
rm -r ${HOME}/grpc
332-
303+
git clone -b v1.48.x --depth 1 --recurse-submodules https://github.com/grpc/grpc && \
304+
mkdir -p ${HOME}/grpc/cmake/build && \
305+
cd ${HOME}/grpc/cmake/build && \
306+
cmake -DCMAKE_CXX_STANDARD=17 \
307+
-DCMAKE_BUILD_TYPE=Release \
308+
-DBUILD_SHARED_LIBS=ON \
309+
-DgRPC_INSTALL=ON \
310+
-DgRPC_BUILD_TESTS=OFF \
311+
-DgRPC_SSL_PROVIDER=package \
312+
-DCMAKE_INSTALL_PREFIX=/opt/grpc \
313+
../.. && \
314+
make -j$(nproc) install && \
315+
cd ${HOME} && \
316+
rm -r ${HOME}/grpc
333317
}
334318

335319
install_prometheus() {

kvbc/proto/CMakeLists.txt

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
1-
find_package(Protobuf REQUIRED)
1+
cmake_minimum_required(VERSION 3.5)
2+
set(CMAKE_CXX_STANDARD 17)
3+
4+
find_package(absl CONFIG REQUIRED)
5+
find_package(GRPC REQUIRED)
6+
find_package(Protobuf CONFIG REQUIRED)
7+
8+
# Proto file
9+
get_filename_component(concord_kvbc_proto "concord_kvbc.proto" ABSOLUTE)
10+
get_filename_component(concord_kvbc_proto_path "${concord_kvbc_proto}" PATH)
11+
12+
set(ck_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/concord_kvbc.pb.cc")
13+
set(ck_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/concord_kvbc.pb.h")
14+
15+
add_custom_command(
16+
OUTPUT "${ck_proto_srcs}" "${ck_proto_hdrs}"
17+
COMMAND protoc
18+
ARGS --proto_path="${concord_kvbc_proto_path}"
19+
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
20+
"${concord_kvbc_proto}"
21+
DEPENDS "${concord_kvbc_proto}")
222

3-
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_CURRENT_BINARY_DIR}
4-
concord_kvbc.proto
5-
)
623
message(STATUS "Concord KVBC protobuf generated - see " ${CMAKE_CURRENT_BINARY_DIR})
724

8-
add_library(concord-kvbc-proto STATIC ${PROTO_SRCS})
25+
add_library(concord-kvbc-proto STATIC ${ck_proto_srcs})
926
target_link_libraries(concord-kvbc-proto protobuf::libprotobuf)
1027
target_include_directories(concord-kvbc-proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,58 @@
1-
find_package(Protobuf REQUIRED)
1+
cmake_minimum_required(VERSION 3.5)
2+
set(CMAKE_CXX_STANDARD 17)
3+
24
find_package(GRPC REQUIRED)
5+
find_package(absl CONFIG REQUIRED)
6+
find_package(Protobuf CONFIG REQUIRED)
37

48
include_directories(${GRPC_INCLUDE_DIR})
59

6-
protobuf_generate_cpp(THIN_REPLICA_PROTO_SRCS THIN_REPLICA_PROTO_HDRS ${CMAKE_CURRENT_BINARY_DIR}
7-
thin_replica.proto
8-
)
9-
grpc_generate_cpp(THIN_REPLICA_GRPC_SRCS THIN_REPLICA_GRPC_HDRS ${CMAKE_CURRENT_BINARY_DIR}
10-
thin_replica.proto
11-
)
10+
get_filename_component(tr_proto "thin_replica.proto" ABSOLUTE)
11+
get_filename_component(tr_proto_path "${tr_proto}" PATH)
12+
13+
get_target_property(grpc_cpp_plugin_location gRPC::grpc_cpp_plugin LOCATION)
14+
15+
set(tr_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/thin_replica.pb.cc")
16+
set(tr_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/thin_replica.pb.h")
17+
set(tr_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/thin_replica.grpc.pb.cc")
18+
set(tr_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/thin_replica.grpc.pb.h")
19+
add_custom_command(
20+
OUTPUT "${tr_proto_srcs}" "${tr_proto_hdrs}" "${tr_grpc_srcs}" "${tr_grpc_hdrs}"
21+
COMMAND protoc
22+
ARGS --grpc_out=generate_mock_code=true:"${CMAKE_CURRENT_BINARY_DIR}"
23+
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
24+
-I "${tr_proto_path}"
25+
--plugin=protoc-gen-grpc="${grpc_cpp_plugin_location}"
26+
"${tr_proto}"
27+
DEPENDS "${tr_proto}")
28+
1229
message(STATUS "Thin replica gRPC/protobuf generated - see " ${CMAKE_CURRENT_BINARY_DIR})
1330

14-
protobuf_generate_cpp(REPLICA_STATE_SNAPSHOT_PROTO_SRCS REPLICA_STATE_SNAPSHOT_PROTO_HDRS ${CMAKE_CURRENT_BINARY_DIR}
15-
replica_state_snapshot.proto
16-
)
17-
grpc_generate_cpp(REPLICA_STATE_SNAPSHOT_GRPC_SRCS REPLICA_STATE_SNAPSHOT_GRPC_HDRS ${CMAKE_CURRENT_BINARY_DIR}
18-
replica_state_snapshot.proto
19-
)
31+
get_filename_component(ss_proto "replica_state_snapshot.proto" ABSOLUTE)
32+
get_filename_component(ss_proto_path "${ss_proto}" PATH)
33+
34+
set(ss_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/replica_state_snapshot.pb.cc")
35+
set(ss_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/replica_state_snapshot.pb.h")
36+
set(ss_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/replica_state_snapshot.grpc.pb.cc")
37+
set(ss_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/replica_state_snapshot.grpc.pb.h")
38+
add_custom_command(
39+
OUTPUT "${ss_proto_srcs}" "${ss_proto_hdrs}" "${ss_grpc_srcs}" "${ss_grpc_hdrs}"
40+
COMMAND protoc
41+
ARGS --grpc_out=generate_mock_code=true:"${CMAKE_CURRENT_BINARY_DIR}"
42+
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
43+
-I "${ss_proto_path}"
44+
--plugin=protoc-gen-grpc="${grpc_cpp_plugin_location}"
45+
"${ss_proto}"
46+
DEPENDS "${ss_proto}")
47+
2048
message(STATUS "State snapshot gRPC/protobuf generated - see " ${CMAKE_CURRENT_BINARY_DIR})
2149

22-
add_library(thin-replica-proto STATIC ${THIN_REPLICA_PROTO_SRCS} ${THIN_REPLICA_PROTO_HDRS}
23-
${THIN_REPLICA_GRPC_SRCS} ${THIN_REPLICA_GRPC_HDRS})
24-
target_link_libraries(thin-replica-proto protobuf::libprotobuf gRPC::grpc++)
50+
add_library(thin-replica-proto STATIC ${tr_proto_srcs} ${tr_proto_hdrs}
51+
${tr_grpc_srcs} ${tr_grpc_hdrs})
52+
target_link_libraries(thin-replica-proto protobuf::libprotobuf gRPC::grpc++ gRPC::grpc++_reflection)
2553
target_include_directories(thin-replica-proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
2654

27-
add_library(replica-state-snapshot-proto STATIC ${REPLICA_STATE_SNAPSHOT_PROTO_SRCS} ${REPLICA_STATE_SNAPSHOT_PROTO_HDRS}
28-
${REPLICA_STATE_SNAPSHOT_GRPC_SRCS} ${REPLICA_STATE_SNAPSHOT_GRPC_HDRS})
29-
target_link_libraries(replica-state-snapshot-proto protobuf::libprotobuf gRPC::grpc++)
55+
add_library(replica-state-snapshot-proto STATIC ${ss_proto_srcs} ${ss_proto_hdrs}
56+
${ss_grpc_srcs} ${ss_grpc_hdrs})
57+
target_link_libraries(replica-state-snapshot-proto protobuf::libprotobuf gRPC::grpc++ gRPC::grpc++_reflection)
3058
target_include_directories(replica-state-snapshot-proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,34 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
set(CMAKE_CXX_STANDARD 17)
3+
4+
project(concord)
5+
16
find_package(Protobuf REQUIRED)
27
find_package(GRPC REQUIRED)
38

49
include_directories(${GRPC_INCLUDE_DIR})
510

6-
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_CURRENT_BINARY_DIR}
7-
api/v1/api.proto
8-
)
9-
grpc_generate_cpp(GRPC_SRCS GRPC_HDRS ${CMAKE_CURRENT_BINARY_DIR}
10-
api/v1/api.proto
11-
)
11+
# Proto file
12+
get_filename_component(utt_wallet_api_proto "api/v1/api.proto" ABSOLUTE)
13+
get_filename_component(utt_wallet_api_proto_path "${utt_wallet_api_proto}" PATH)
14+
15+
get_target_property(grpc_cpp_plugin_location gRPC::grpc_cpp_plugin LOCATION)
16+
17+
set(utt_wallet_api_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/api.pb.cc")
18+
set(utt_wallet_api_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/api.pb.h")
19+
set(utt_wallet_api_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/api.grpc.pb.cc")
20+
set(utt_wallet_api_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/api.grpc.pb.h")
21+
22+
add_custom_command(
23+
OUTPUT "${utt_wallet_api_proto_srcs}" "${utt_wallet_api_proto_hdrs}" "${utt_wallet_api_grpc_srcs}" "${utt_wallet_api_grpc_hdrs}"
24+
COMMAND protoc
25+
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
26+
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
27+
-I "${utt_wallet_api_proto_path}"
28+
--plugin=protoc-gen-grpc="${grpc_cpp_plugin_location}"
29+
"${utt_wallet_api_proto}"
30+
DEPENDS "${utt_wallet_api_proto}")
1231

13-
add_library(utt-wallet-api-proto STATIC ${PROTO_SRCS} ${GRPC_SRCS})
32+
add_library(utt-wallet-api-proto STATIC ${utt_wallet_api_proto_srcs} ${utt_wallet_api_grpc_srcs})
1433
target_link_libraries(utt-wallet-api-proto PRIVATE protobuf::libprotobuf gRPC::grpc++)
15-
target_include_directories(utt-wallet-api-proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
34+
target_include_directories(utt-wallet-api-proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR})

0 commit comments

Comments
 (0)