Skip to content

Commit

Permalink
Merge branch 'release-3.10.0' into release-3.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wenlinlee authored Jul 19, 2024
2 parents 3f57b47 + 02d9bee commit 6396975
Show file tree
Hide file tree
Showing 26 changed files with 103 additions and 220 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ include(BuildInfoGenerator)

include(IncludeDirectories)
include(TargetSettings)
include(PrecompiledHeaders)

add_subdirectory(bcos-boostssl)
add_subdirectory(bcos-framework)
Expand Down
8 changes: 1 addition & 7 deletions bcos-framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ add_library(bcos-framework INTERFACE)
target_include_directories(bcos-framework INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/bcos-framework>)

if (PRECOMPILED_HEADER)
target_link_libraries(bcos-framework INTERFACE bcos-task Microsoft.GSL::GSL precompiled-headers)
target_precompile_headers(bcos-framework REUSE_FROM precompiled-headers)
else()
target_link_libraries(bcos-framework INTERFACE bcos-task Microsoft.GSL::GSL fmt::fmt)
endif()
target_link_libraries(bcos-framework INTERFACE bcos-task Microsoft.GSL::GSL fmt::fmt)

if (TESTS)
enable_testing()
Expand Down
1 change: 0 additions & 1 deletion bcos-framework/bcos-framework/ledger/LedgerInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "../storage/StorageInterface.h"
#include "LedgerTypeDef.h"
#include <bcos-crypto/interfaces/crypto/CommonType.h>
#include <bcos-task/Coroutine.h>
#include <bcos-task/Task.h>
#include <bcos-utilities/Error.h>
#include <gsl/span>
Expand Down
4 changes: 2 additions & 2 deletions bcos-framework/bcos-framework/storage/LegacyStorageMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inline task::Task<std::optional<Entry>> tag_invoke(storage2::tag_t<storage2::rea
std::variant<std::monostate, std::optional<Entry>, std::exception_ptr> m_result;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_storage.asyncGetRow(m_table, m_key,
[this, handle](Error::UniquePtr error, std::optional<Entry> entry) mutable {
Expand Down Expand Up @@ -98,7 +98,7 @@ inline task::Task<void> tag_invoke(storage2::tag_t<storage2::writeOne> /*unused*
std::variant<std::monostate, std::exception_ptr> m_result;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_storage.asyncSetRow(
m_table, m_key, std::move(m_entry), [this, handle](Error::UniquePtr error) mutable {
Expand Down
4 changes: 2 additions & 2 deletions bcos-front/bcos-front/FrontImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FrontImpl : public bcos::concepts::front::FrontBase<FrontImpl>
{}

constexpr bool await_ready() const noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
bcos::concepts::getRef(m_gateway).asyncGetPeers(
[this, m_handle = handle](Error::Ptr error, const gateway::GatewayInfo::Ptr&,
Expand Down Expand Up @@ -123,7 +123,7 @@ class FrontImpl : public bcos::concepts::front::FrontBase<FrontImpl>
{
constexpr bool await_ready() const { return false; }

void await_suspend(CO_STD::coroutine_handle<task::Task<void>::promise_type> handle)
void await_suspend(std::coroutine_handle<task::Task<void>::promise_type> handle)
{
FRONT_LOG(DEBUG) << "P2P client send message: " << m_moduleID << " | "
<< m_nodeID->hex() << " | " << m_requestBuffer.size();
Expand Down
20 changes: 10 additions & 10 deletions bcos-ledger/src/libledger/LedgerMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ bcos::task::Task<void> bcos::ledger::prewriteBlockToStorage(LedgerInterface& led
Error::Ptr m_error;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_ledger.asyncPrewriteBlock(
m_storage, std::move(m_transactions), std::move(m_block),
Expand Down Expand Up @@ -74,7 +74,7 @@ bcos::task::Task<bcos::protocol::Block::Ptr> bcos::ledger::tag_invoke(
std::variant<Error::Ptr, bcos::protocol::Block::Ptr> m_result;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_ledger.asyncGetBlockDataByNumber(m_blockNumber, m_blockFlag,
[this, handle](Error::Ptr error, bcos::protocol::Block::Ptr block) {
Expand Down Expand Up @@ -113,7 +113,7 @@ bcos::task::Task<bcos::ledger::TransactionCount> bcos::ledger::tag_invoke(
std::variant<Error::Ptr, TransactionCount> m_result;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_ledger.asyncGetTotalTransactionCount(
[this, handle](Error::Ptr error, int64_t total, int64_t failed,
Expand Down Expand Up @@ -155,7 +155,7 @@ bcos::task::Task<bcos::protocol::BlockNumber> bcos::ledger::tag_invoke(
std::variant<Error::Ptr, protocol::BlockNumber> m_result;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_ledger.asyncGetBlockNumber(
[this, handle](Error::Ptr error, bcos::protocol::BlockNumber blockNumber) {
Expand Down Expand Up @@ -195,7 +195,7 @@ bcos::task::Task<bcos::crypto::HashType> bcos::ledger::tag_invoke(
std::variant<Error::Ptr, crypto::HashType> m_result;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_ledger.asyncGetBlockHashByNumber(
m_blockNumber, [this, handle](Error::Ptr error, crypto::HashType hash) {
Expand Down Expand Up @@ -236,7 +236,7 @@ bcos::task::Task<bcos::protocol::BlockNumber> bcos::ledger::tag_invoke(
std::variant<bcos::Error::Ptr, bcos::protocol::BlockNumber> m_result;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_ledger.asyncGetBlockNumberByHash(
m_hash, [this, handle](bcos::Error::Ptr error, bcos::protocol::BlockNumber number) {
Expand Down Expand Up @@ -275,7 +275,7 @@ bcos::task::Task<std::optional<bcos::ledger::SystemConfigEntry>> bcos::ledger::t
std::variant<Error::Ptr, std::optional<SystemConfigEntry>> m_result;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_ledger.asyncGetSystemConfigByKey(
m_key, [this, handle](Error::Ptr error, std::string value,
Expand Down Expand Up @@ -325,7 +325,7 @@ bcos::task::Task<bcos::consensus::ConsensusNodeList> bcos::ledger::tag_invoke(
std::variant<Error::Ptr, consensus::ConsensusNodeList> m_result;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_ledger.asyncGetNodeListByType(
m_type, [this, handle](Error::Ptr error,
Expand Down Expand Up @@ -485,7 +485,7 @@ bcos::task::Task<bcos::protocol::TransactionReceipt::ConstPtr> bcos::ledger::tag
std::variant<bcos::Error::Ptr, bcos::protocol::TransactionReceipt::ConstPtr> m_result;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_ledger.asyncGetTransactionReceiptByHash(m_hash, false,
[this, handle](bcos::Error::Ptr error,
Expand Down Expand Up @@ -526,7 +526,7 @@ bcos::task::Task<bcos::protocol::TransactionsConstPtr> bcos::ledger::tag_invoke(
std::variant<bcos::Error::Ptr, bcos::protocol::TransactionsConstPtr> m_result;

constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_ledger.asyncGetBatchTxsByHashList(
std::move(m_hashes), false, [this, handle](auto&& error, auto&& txs, auto&&) {
Expand Down
4 changes: 2 additions & 2 deletions bcos-rpc/bcos-rpc/web3jsonrpc/endpoints/EthEndpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ task::Task<void> EthEndpoint::getCode(const Json::Value& request, Json::Value& r
std::string m_address;
std::variant<Error::Ptr, bcos::bytes> m_result{};
constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle) noexcept
void await_suspend(std::coroutine_handle<> handle) noexcept
{
m_scheduler->getCode(m_address, [this, handle](auto&& error, auto&& code) {
if (error)
Expand Down Expand Up @@ -497,7 +497,7 @@ task::Task<void> EthEndpoint::call(const Json::Value& request, Json::Value& resp
bcos::protocol::Transaction::Ptr m_tx;
std::variant<Error::Ptr, protocol::TransactionReceipt::Ptr> m_result{};
constexpr static bool await_ready() noexcept { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle) noexcept
void await_suspend(std::coroutine_handle<> handle) noexcept
{
m_scheduler.call(m_tx, [this, handle](Error::Ptr&& error, auto&& result) {
if (error)
Expand Down
10 changes: 5 additions & 5 deletions bcos-sdk/bcos-cpp-sdk/tarsRPC/CoRPCClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
class CoCallback : public bcos::sdk::Callback
{
private:
CO_STD::coroutine_handle<> m_handle;
std::coroutine_handle<> m_handle;

public:
CoCallback(CO_STD::coroutine_handle<> handle) : m_handle(handle) {}
CoCallback(std::coroutine_handle<> handle) : m_handle(handle) {}
void onMessage([[maybe_unused]] int seq) override
{
// Make sure we are in the io thread of tars!
Expand All @@ -18,7 +18,7 @@ class CoCallback : public bcos::sdk::Callback
bcos::sdk::async::Awaitable<bcos::sdk::SendTransaction> bcos::sdk::async::sendTransaction(
RPCClient& rpcClient, const bcos::protocol::Transaction& transaction)
{
return {[&](CO_STD::coroutine_handle<> handle) {
return {[&](std::coroutine_handle<> handle) {
bcos::sdk::SendTransaction sendTransaction(rpcClient);
sendTransaction.setCallback(std::make_shared<CoCallback>(handle));
sendTransaction.send(transaction);
Expand All @@ -29,7 +29,7 @@ bcos::sdk::async::Awaitable<bcos::sdk::SendTransaction> bcos::sdk::async::sendTr
bcos::sdk::async::Awaitable<bcos::sdk::Call> bcos::sdk::async::call(
RPCClient& rpcClient, const bcos::protocol::Transaction& transaction)
{
return {[&](CO_STD::coroutine_handle<> handle) {
return {[&](std::coroutine_handle<> handle) {
bcos::sdk::Call call(rpcClient);
call.setCallback(std::make_shared<CoCallback>(handle));
call.send(transaction);
Expand All @@ -40,7 +40,7 @@ bcos::sdk::async::Awaitable<bcos::sdk::Call> bcos::sdk::async::call(
bcos::sdk::async::Awaitable<bcos::sdk::BlockNumber> bcos::sdk::async::blockNumber(
RPCClient& rpcClient)
{
return {[&](CO_STD::coroutine_handle<> handle) {
return {[&](std::coroutine_handle<> handle) {
bcos::sdk::BlockNumber blockNumber(rpcClient);
blockNumber.setCallback(std::make_shared<CoCallback>(handle));
blockNumber.send();
Expand Down
9 changes: 3 additions & 6 deletions bcos-sdk/bcos-cpp-sdk/tarsRPC/CoRPCClient.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#pragma once
#include "RPCClient.h"
#include <bcos-task/Coroutine.h>
#include <exception>
#include <type_traits>
#include <variant>
#include <coroutine>

namespace bcos::sdk::async
{
Expand All @@ -12,14 +9,14 @@ template <class Handle>
class Awaitable
{
private:
std::function<Handle(CO_STD::coroutine_handle<>)> m_applyCall;
std::function<Handle(std::coroutine_handle<>)> m_applyCall;
std::optional<Handle> m_handle;

public:
Awaitable(decltype(m_applyCall) applyCall) : m_applyCall(std::move(applyCall)) {}

constexpr bool await_ready() const { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle) { m_handle.emplace(m_applyCall(handle)); }
void await_suspend(std::coroutine_handle<> handle) { m_handle.emplace(m_applyCall(handle)); }
Handle await_resume() { return std::move(*m_handle); }
};

Expand Down
4 changes: 2 additions & 2 deletions bcos-sync/bcos-sync/state/SyncPeerStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class PeerStatus

private:
bcos::crypto::PublicPtr m_nodeId;
bcos::protocol::BlockNumber m_number;
bcos::protocol::BlockNumber m_archivedNumber;
bcos::protocol::BlockNumber m_number{};
bcos::protocol::BlockNumber m_archivedNumber{};
bcos::crypto::HashType m_hash;
bcos::crypto::HashType m_genesisHash;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class TxPoolServiceClient : public bcos::txpool::TxPoolInterface
m_handle.resume();
}

CO_STD::coroutine_handle<> m_handle;
std::coroutine_handle<> m_handle;
std::variant<std::monostate, bcos::Error::Ptr,
bcostars::protocol::TransactionSubmitResultImpl::Ptr>
m_submitResult;
Expand All @@ -67,7 +67,7 @@ class TxPoolServiceClient : public bcos::txpool::TxPoolInterface
struct Awaitable
{
constexpr bool await_ready() { return false; }
void await_suspend(CO_STD::coroutine_handle<> handle)
void await_suspend(std::coroutine_handle<> handle)
{
m_callback->m_handle = handle;
m_proxy->tars_set_timeout(600000)->async_submit(m_callback,
Expand Down
4 changes: 2 additions & 2 deletions bcos-txpool/bcos-txpool/txpool/storage/MemoryStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ task::Task<protocol::TransactionSubmitResult::Ptr> MemoryStorage::submitTransact
struct Awaitable
{
[[maybe_unused]] constexpr bool await_ready() { return false; }
[[maybe_unused]] void await_suspend(CO_STD::coroutine_handle<> handle)
[[maybe_unused]] void await_suspend(std::coroutine_handle<> handle)
{
try
{
Expand Down Expand Up @@ -180,7 +180,7 @@ task::Task<protocol::TransactionSubmitResult::Ptr> MemoryStorage::submitTransact
struct Awaitable
{
[[maybe_unused]] constexpr bool await_ready() { return false; }
[[maybe_unused]] void await_suspend(CO_STD::coroutine_handle<> handle)
[[maybe_unused]] void await_suspend(std::coroutine_handle<> handle)
{
try
{
Expand Down
10 changes: 6 additions & 4 deletions cmake/CompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR("${CMAKE_CXX_COMPILER_ID}" MATC

add_compile_options(-fstack-protector-strong)
add_compile_options(-fstack-protector)
add_compile_options(-fno-omit-frame-pointer)

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0)
add_compile_options(-fcoroutines)
Expand All @@ -116,7 +115,7 @@ if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR("${CMAKE_CXX_COMPILER_ID}" MATC

add_compile_options(-fPIC)
add_compile_options(-Wno-error=nonnull)
add_compile_options(-foptimize-sibling-calls)
# add_compile_options(-foptimize-sibling-calls)
add_compile_options(-Wno-stringop-overflow)
add_compile_options(-Wno-restrict)
add_compile_options(-Wno-error=format-truncation)
Expand All @@ -127,7 +126,11 @@ if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR("${CMAKE_CXX_COMPILER_ID}" MATC
add_compile_options(-Wno-array-bounds)
add_compile_options(-Wno-aggressive-loop-optimizations)
endif()
# add_compile_options(-fconcepts-diagnostics-depth=10)

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0)
set(CMAKE_CXX_STANDARD 23)
add_compile_options(-Wno-error=uninitialized)
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_CXX_FLAGS_DEBUG "-O -g")
Expand Down Expand Up @@ -172,7 +175,6 @@ if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR("${CMAKE_CXX_COMPILER_ID}" MATC
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
add_compile_definitions(NOMINMAX)
#add_definitions(-DUSE_STD_RANGES)
add_compile_options(/std:c++latest)
add_compile_options(-bigobj)

Expand Down
2 changes: 0 additions & 2 deletions cmake/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ macro(configure_project)
default_option(SANITIZE_ADDRESS OFF)
default_option(SANITIZE_THREAD OFF)
default_option(IPO OFF)
default_option(PRECOMPILED_HEADER OFF)
if(IPO)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
Expand Down Expand Up @@ -156,7 +155,6 @@ macro(print_config NAME)
message("-- TESTS Build tests ${TESTS}")
message("-- NATIVE Build native binary ${NATIVE}")
message("-- IPO Enable IPO optimization ${IPO}")
message("-- PRECOMPILED_HEADER Enable precompiled header ${PRECOMPILED_HEADER}")
message("-- SANITIZE_ADDRESS Enable sanitize ${SANITIZE_ADDRESS}")
message("-- SANITIZE_THREAD Enable sanitize ${SANITIZE_THREAD}")
message("-- TOOLCHAIN_FILE CMake toolchain file ${CMAKE_TOOLCHAIN_FILE}")
Expand Down
Loading

0 comments on commit 6396975

Please sign in to comment.