Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
Signed-off-by: iceseer <[email protected]>
  • Loading branch information
iceseer committed Apr 1, 2024
1 parent 70cfba1 commit 7bdfca4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 37 deletions.
52 changes: 26 additions & 26 deletions core/network/impl/peer_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::shared_ptr<Stream>> 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<std::shared_ptr<Stream>> 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);
});
}
}

Expand Down Expand Up @@ -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);
}
Expand Down
5 changes: 0 additions & 5 deletions core/runtime/common/runtime_instances_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <shared_mutex>
#include <unordered_set>

#include "injector/inject.hpp"
#include "runtime/common/stack_limiter.hpp"
#include "runtime/module_factory.hpp"
#include "utils/lru.hpp"
Expand All @@ -34,10 +33,6 @@ namespace kagome::runtime {
std::shared_ptr<InstrumentWasm> instrument,
size_t capacity = DEFAULT_MODULES_CACHE_SIZE);

explicit RuntimeInstancesPoolImpl(
Inject, std::shared_ptr<ModuleFactory> module_factory, ...)
: RuntimeInstancesPoolImpl{std::move(module_factory)} {}

outcome::result<std::shared_ptr<ModuleInstance>> instantiateFromCode(
const CodeHash &code_hash,
common::BufferView code_zstd,
Expand Down
4 changes: 0 additions & 4 deletions core/runtime/module_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ namespace kagome::runtime {

virtual outcome::result<std::shared_ptr<Module>, CompilationError> make(
common::BufferView code) const = 0;

virtual bool testDontInstrument() const {
return false;
}
};

} // namespace kagome::runtime
5 changes: 5 additions & 0 deletions test/mock/core/network/peer_manager_mock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ namespace kagome::network {
(const PeerId &),
(override));

MOCK_METHOD(std::optional<std::reference_wrapper<const PeerState>>,
getPeerState,
(const PeerId &),
(const, override));

MOCK_METHOD(size_t, activePeersNumber, (), (const, override));

MOCK_METHOD(void,
Expand Down
2 changes: 0 additions & 2 deletions test/mock/core/runtime/module_factory_mock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@ namespace kagome::runtime {
make,
(common::BufferView),
(const, override));

MOCK_METHOD(bool, testDontInstrument, (), (const, override));
};
} // namespace kagome::runtime

0 comments on commit 7bdfca4

Please sign in to comment.