Skip to content

Commit

Permalink
build: upgrade grpc to 1.54.3 (#1619)
Browse files Browse the repository at this point in the history
Co-authored-by: battlmonstr <[email protected]>
  • Loading branch information
yperbasis and battlmonstr authored Jun 17, 2024
1 parent c398249 commit 8b45d35
Show file tree
Hide file tree
Showing 54 changed files with 603 additions and 736 deletions.
2 changes: 2 additions & 0 deletions cmake/cmake_format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ parse:
PATH_OR_REFERENCE: '*'
INSTALL_FOLDER: '*'
BUILD: '*'
OPTIONS: '*'
PROFILE: '*'
CONF: '*'
silkworm_library:
flags:
- NO_TEST
Expand Down
7 changes: 3 additions & 4 deletions cmake/compiler_settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
limitations under the License.
]]

include(${CMAKE_CURRENT_LIST_DIR}/compiler_settings_sanitize.cmake)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")

message("MSVC_VERSION = ${MSVC_VERSION}")
Expand Down Expand Up @@ -91,10 +93,7 @@ else()
message(WARNING "${CMAKE_CXX_COMPILER_ID} is not a supported compiler. Use at your own risk.")
endif()

if(SILKWORM_SANITIZE)
set(SILKWORM_SANITIZE_COMPILER_OPTIONS -fno-omit-frame-pointer -fno-sanitize-recover=all
-fsanitize=${SILKWORM_SANITIZE}
)
if(SILKWORM_SANITIZE_COMPILER_OPTIONS)
add_compile_options(${SILKWORM_SANITIZE_COMPILER_OPTIONS})
add_link_options(${SILKWORM_SANITIZE_COMPILER_OPTIONS})
add_compile_definitions(SILKWORM_SANITIZE)
Expand Down
25 changes: 25 additions & 0 deletions cmake/compiler_settings_sanitize.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#[[
Copyright 2024 The Silkworm Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]

if(SILKWORM_SANITIZE)
# cmake-format: off
set(SILKWORM_SANITIZE_COMPILER_OPTIONS
-fno-omit-frame-pointer
-fno-sanitize-recover=all
-fsanitize=${SILKWORM_SANITIZE}
)
# cmake-format: on
endif()
36 changes: 34 additions & 2 deletions cmake/conan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
limitations under the License.
]]

include(${CMAKE_CURRENT_LIST_DIR}/compiler_settings_sanitize.cmake)

function(guess_conan_profile)
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "")
set(ARCH_NAME "")
Expand Down Expand Up @@ -64,9 +66,39 @@ if(NOT DEFINED CONAN_PROFILE)
endif()
message(STATUS "CONAN_PROFILE: ${CONAN_PROFILE}")

set(CONAN_BUILD "missing")
set(CONAN_CXXFLAGS_ARG)
set(CONAN_OPTIONS)

if(SILKWORM_SANITIZE_COMPILER_OPTIONS)
set(CONAN_CXXFLAGS ${SILKWORM_SANITIZE_COMPILER_OPTIONS})

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(APPEND CONAN_CXXFLAGS "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()

list(JOIN CONAN_CXXFLAGS "\", \"" CONAN_CXXFLAGS_STR)
set(CONAN_CXXFLAGS_STR "[\"${CONAN_CXXFLAGS_STR}\"]")
set(CONAN_CXXFLAGS_ARG "tools.build:cxxflags=${CONAN_CXXFLAGS_STR}")

list(APPEND CONAN_OPTIONS "boost:zlib=False")

# libraries that needs to be rebuilt with sanitize flags
# cmake-format: off
set(CONAN_BUILD
abseil
boost
grpc
protobuf
)
# cmake-format: on
endif()

conan_cmake_install(
PATH_OR_REFERENCE "${CONAN_BINARY_DIR}"
INSTALL_FOLDER "${CONAN_BINARY_DIR}"
BUILD missing
PROFILE "${CMAKE_SOURCE_DIR}/cmake/profiles/${CONAN_PROFILE}" OPTIONS "${CMAKE_CONAN_OPTIONS}"
BUILD ${CONAN_BUILD}
OPTIONS ${CONAN_OPTIONS}
PROFILE "${CMAKE_SOURCE_DIR}/cmake/profiles/${CONAN_PROFILE}"
CONF "${CONAN_CXXFLAGS_ARG}"
)
18 changes: 11 additions & 7 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ def requirements(self):
self.requires('ms-gsl/4.0.0')
self.requires('nlohmann_json/3.11.3')
self.requires('tl-expected/1.1.0')
self.requires('zlib/1.2.13')
self.requires('zlib/1.3.1')
if self.settings.arch == 'wasm':
return

self.requires('abseil/20220623.0')
self.requires('asio-grpc/2.4.0')
self.requires('abseil/20230125.3')
self.requires('asio-grpc/2.9.2')
self.requires('benchmark/1.6.1')
self.requires('boost/1.81.0')
self.requires('boost/1.83.0')
self.requires('cli11/2.2.0')
self.requires('gmp/6.2.1')
self.requires('grpc/1.48.0')
self.requires('grpc/1.54.3')
self.requires('gtest/1.12.1')
self.requires('jwt-cpp/0.6.0')
self.requires('mimalloc/2.1.2')
self.requires('openssl/1.1.1s')
self.requires('protobuf/3.21.4')
self.requires('openssl/3.2.1')
self.requires('protobuf/3.21.12')
self.requires('roaring/1.1.2')
self.requires('snappy/1.1.7')
self.requires('spdlog/1.12.0')
Expand All @@ -63,6 +63,10 @@ def configure(self):
self.options['mimalloc'].override = True

self.options['boost'].asio_no_deprecated = True
if self.settings.os == 'Macos':
CMAKE_OSX_DEPLOYMENT_TARGET = '10.13'
os_version_min_flag = f'-mmacosx-version-min={CMAKE_OSX_DEPLOYMENT_TARGET}'
self.options['boost'].extra_b2_flags = f'cxxflags="{os_version_min_flag}" linkflags="{os_version_min_flag}"'

# Disable building unused boost components
# note: changing default options above forces a boost rebuild anyway
Expand Down
2 changes: 2 additions & 0 deletions silkworm/core/execution/evm_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ TEST_CASE("Smart contract with storage", "[core][execution]") {
CHECK(state.get_current_storage(contract_address, key0) == new_val);
}

#if !(defined(SILKWORM_SANITIZE) && defined(__APPLE__))
TEST_CASE("Maximum call depth", "[core][execution]") {
Block block{};
block.header.number = 1'431'916;
Expand Down Expand Up @@ -317,6 +318,7 @@ TEST_CASE("Maximum call depth", "[core][execution]") {
CHECK(res.status == EVMC_INVALID_INSTRUCTION);
CHECK(res.data.empty());
}
#endif // SILKWORM_SANITIZE

TEST_CASE("DELEGATECALL", "[core][execution]") {
Block block{};
Expand Down
12 changes: 3 additions & 9 deletions silkworm/infra/concurrency/awaitable_future.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AwaitableFuture {
AwaitableFuture(AwaitableFuture&&) noexcept = default;
AwaitableFuture& operator=(AwaitableFuture&&) noexcept = default;

Task<T> get_async() {
Task<T> get() {
try {
std::optional<T> result = co_await channel_->async_receive(boost::asio::use_awaitable);
co_return std::move(result.value());
Expand All @@ -54,14 +54,8 @@ class AwaitableFuture {
}
}

T get() {
try {
std::optional<T> result = channel_->async_receive(boost::asio::use_future).get();
return std::move(result.value());
} catch (const boost::system::system_error& ex) {
close_and_throw_if_cancelled(ex);
throw ex;
}
Task<T> get_async() {
return get();
}

private:
Expand Down
Loading

0 comments on commit 8b45d35

Please sign in to comment.