From 7bdfca47e1014f323802690340c61d1a9988ea2c Mon Sep 17 00:00:00 2001 From: iceseer Date: Mon, 1 Apr 2024 10:15:09 +0300 Subject: [PATCH] build fix Signed-off-by: iceseer --- core/network/impl/peer_manager_impl.cpp | 52 +++++++++---------- .../runtime/common/runtime_instances_pool.hpp | 5 -- core/runtime/module_factory.hpp | 4 -- test/mock/core/network/peer_manager_mock.hpp | 5 ++ .../mock/core/runtime/module_factory_mock.hpp | 2 - 5 files changed, 31 insertions(+), 37 deletions(-) diff --git a/core/network/impl/peer_manager_impl.cpp b/core/network/impl/peer_manager_impl.cpp index ed6a7f2c50..8f40e3ac62 100644 --- a/core/network/impl/peer_manager_impl.cpp +++ b/core/network/impl/peer_manager_impl.cpp @@ -735,30 +735,29 @@ namespace kagome::network { log_->trace("Try to open outgoing validation protocol.(peer={})", peer_info.id); - openOutgoing( - stream_engine_, - validation_protocol, - peer_info, - [validation_protocol, peer_info, wptr{weak_from_this()}]( - outcome::result> stream_result) { - auto self = wptr.lock(); - if (not self) { - return; - } - - auto &peer_id = peer_info.id; - if (!stream_result.has_value()) { - SL_TRACE(self->log_, - "Unable to create stream {} with {}: {}", - validation_protocol->protocolName(), - peer_id, - stream_result.error().message()); - return; - } - - self->stream_engine_->addOutgoing(stream_result.value(), - validation_protocol); - }); + openOutgoing(stream_engine_, + validation_protocol, + peer_info, + [validation_protocol, peer_info, wptr{weak_from_this()}]( + outcome::result> stream_result) { + auto self = wptr.lock(); + if (not self) { + return; + } + + auto &peer_id = peer_info.id; + if (!stream_result.has_value()) { + SL_TRACE(self->log_, + "Unable to create stream {} with {}: {}", + validation_protocol->protocolName(), + peer_id, + stream_result.error().message()); + return; + } + + self->stream_engine_->addOutgoing(stream_result.value(), + validation_protocol); + }); } } @@ -837,10 +836,11 @@ namespace kagome::network { } void PeerManagerImpl::reserveStatusStreams(const PeerId &peer_id) const { - if (auto ps = getPeerState(peer_id); ps && ps->get().roles.flags.authority) { + if (auto ps = getPeerState(peer_id); + ps && ps->get().roles.flags.authority) { auto proto_val_vstaging = router_->getValidationProtocolVStaging(); BOOST_ASSERT_MSG(proto_val_vstaging, - "Router did not provide validation protocol vstaging"); + "Router did not provide validation protocol vstaging"); stream_engine_->reserveStreams(peer_id, proto_val_vstaging); } diff --git a/core/runtime/common/runtime_instances_pool.hpp b/core/runtime/common/runtime_instances_pool.hpp index 7b4039acd4..1ccdb7ccdf 100644 --- a/core/runtime/common/runtime_instances_pool.hpp +++ b/core/runtime/common/runtime_instances_pool.hpp @@ -14,7 +14,6 @@ #include #include -#include "injector/inject.hpp" #include "runtime/common/stack_limiter.hpp" #include "runtime/module_factory.hpp" #include "utils/lru.hpp" @@ -34,10 +33,6 @@ namespace kagome::runtime { std::shared_ptr instrument, size_t capacity = DEFAULT_MODULES_CACHE_SIZE); - explicit RuntimeInstancesPoolImpl( - Inject, std::shared_ptr module_factory, ...) - : RuntimeInstancesPoolImpl{std::move(module_factory)} {} - outcome::result> instantiateFromCode( const CodeHash &code_hash, common::BufferView code_zstd, diff --git a/core/runtime/module_factory.hpp b/core/runtime/module_factory.hpp index 914f5d7062..4dacc8f63a 100644 --- a/core/runtime/module_factory.hpp +++ b/core/runtime/module_factory.hpp @@ -40,10 +40,6 @@ namespace kagome::runtime { virtual outcome::result, CompilationError> make( common::BufferView code) const = 0; - - virtual bool testDontInstrument() const { - return false; - } }; } // namespace kagome::runtime diff --git a/test/mock/core/network/peer_manager_mock.hpp b/test/mock/core/network/peer_manager_mock.hpp index 86e2273a2d..0271d3e7e6 100644 --- a/test/mock/core/network/peer_manager_mock.hpp +++ b/test/mock/core/network/peer_manager_mock.hpp @@ -61,6 +61,11 @@ namespace kagome::network { (const PeerId &), (override)); + MOCK_METHOD(std::optional>, + getPeerState, + (const PeerId &), + (const, override)); + MOCK_METHOD(size_t, activePeersNumber, (), (const, override)); MOCK_METHOD(void, diff --git a/test/mock/core/runtime/module_factory_mock.hpp b/test/mock/core/runtime/module_factory_mock.hpp index 1535b04b9d..f54c2ac1d0 100644 --- a/test/mock/core/runtime/module_factory_mock.hpp +++ b/test/mock/core/runtime/module_factory_mock.hpp @@ -20,7 +20,5 @@ namespace kagome::runtime { make, (common::BufferView), (const, override)); - - MOCK_METHOD(bool, testDontInstrument, (), (const, override)); }; } // namespace kagome::runtime