Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use libp2p with fix attempt for closeOnError crash #2367

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,8 @@ hunter_config(
KEEP_PACKAGE_SOURCES
)

hunter_config(
libp2p
URL https://github.com/libp2p/cpp-libp2p/archive/fc02b0c6ed24375de80ca5f4a5e9d965bbfe5c2d.tar.gz
SHA1 b56bc184c8bd6fc16e98b6ce7b057cf46f405735
)
25 changes: 2 additions & 23 deletions core/parachain/validator/impl/parachain_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,6 @@ namespace kagome::parachain {
self->pvf_precheck_->start();
});

// Subscribe to the chain events engine
chain_sub_.onDeactivate(
[WEAK_SELF](
const primitives::events::RemoveAfterFinalizationParams &event) {
WEAK_LOCK(self);
self->onDeactivateBlocks(event);
});

// Set the callback for the my view observable
// This callback is triggered when the kViewUpdate event is fired.
// It updates the active leaves, checks if parachains can be processed,
Expand Down Expand Up @@ -402,21 +394,6 @@ namespace kagome::parachain {
printStoragesLoad();
}

void ParachainProcessorImpl::onDeactivateBlocks(
const primitives::events::RemoveAfterFinalizationParams &event) {
REINVOKE(*main_pool_handler_, onDeactivateBlocks, event);

for (const auto &lost : event.removed) {
SL_TRACE(logger_,
"Remove from storages.(relay parent={}, number={})",
lost.hash,
lost.number);

backing_store_->onDeactivateLeaf(lost.hash);
bitfield_store_->remove(lost.hash);
}
}

outcome::result<std::optional<ValidatorSigner>>
ParachainProcessorImpl::isParachainValidator(
const primitives::BlockHash &relay_parent) const {
Expand Down Expand Up @@ -667,6 +644,8 @@ namespace kagome::parachain {
for (const auto &l : lost) {
our_current_state_.per_leaf.erase(l);
pruned = our_current_state_.implicit_view->deactivate_leaf(l);
backing_store_->onDeactivateLeaf(l);
bitfield_store_->remove(l);
}

std::vector<
Expand Down
2 changes: 0 additions & 2 deletions core/parachain/validator/parachain_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,6 @@ namespace kagome::parachain {
const RelayHash &relay_parent,
const SignedFullStatementWithPVD &statement);

void onDeactivateBlocks(
const primitives::events::RemoveAfterFinalizationParams &event);
void handle_active_leaves_update_for_validator(const network::ExView &event,
std::vector<Hash> pruned);
void onViewUpdated(const network::ExView &event);
Expand Down
5 changes: 4 additions & 1 deletion core/primitives/event_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ namespace kagome::primitives::events {
kAllHeads = 3,
kFinalizedRuntimeVersion = 4,
kNewRuntime = 5,
kDeactivateAfterFinalization = 6,
kDeactivateAfterFinalization = 6, // TODO(kamilsa): #2369 might not be
// triggered on every leaf deactivated
};

enum struct PeerEventType : uint8_t {
Expand Down Expand Up @@ -325,6 +326,8 @@ namespace kagome::primitives::events {
void onHead(auto f) {
onBlock(ChainEventType::kNewHeads, std::move(f));
}

// TODO(kamilsa): #2369 not all deactivated leaves end up in this event
void onDeactivate(auto f) {
subscribe(*sub,
ChainEventType::kDeactivateAfterFinalization,
Expand Down
Loading