From 529a47513eee0246ff05712f6cbccc64b06a3a11 Mon Sep 17 00:00:00 2001 From: iceseer Date: Sat, 28 Sep 2024 15:34:46 +0300 Subject: [PATCH] revert Signed-off-by: iceseer --- core/authority_discovery/query/query_impl.cpp | 4 +- .../protocols/fetch_attested_candidate.hpp | 24 +-- .../protocol_fetch_available_data.hpp | 53 +++--- .../impl/protocols/protocol_req_pov.cpp | 24 +-- .../approval/approval_distribution.cpp | 89 +++-------- .../approval/approval_distribution.hpp | 6 - .../availability/store/store_impl.cpp | 9 -- .../validator/impl/parachain_processor.cpp | 11 +- .../functional/0001-parachains-pvf.toml | 151 +++++++----------- 9 files changed, 137 insertions(+), 234 deletions(-) diff --git a/core/authority_discovery/query/query_impl.cpp b/core/authority_discovery/query/query_impl.cpp index 11b686446c..edbf9d6aba 100644 --- a/core/authority_discovery/query/query_impl.cpp +++ b/core/authority_discovery/query/query_impl.cpp @@ -108,9 +108,7 @@ namespace kagome::authority_discovery { } auto r = add(*id, value); if (not r) { - SL_WARN(log_, "Can't add: {}", r.error()); - } else { - SL_INFO(log_, "Added or updated success: {}", *id); + SL_DEBUG(log_, "Can't add: {}", r.error()); } return r; } diff --git a/core/network/impl/protocols/fetch_attested_candidate.hpp b/core/network/impl/protocols/fetch_attested_candidate.hpp index 8475841d52..fcdeafe7d4 100644 --- a/core/network/impl/protocols/fetch_attested_candidate.hpp +++ b/core/network/impl/protocols/fetch_attested_candidate.hpp @@ -36,17 +36,17 @@ namespace kagome::network { const blockchain::GenesisBlockHash &genesis_hash, std::shared_ptr pp) : RequestResponseProtocolImpl< - vstaging::AttestedCandidateRequest, - vstaging::AttestedCandidateResponse, - ScaleMessageReadWriter>{kFetchAttestedCandidateProtocolName, - host, - make_protocols( - kFetchAttestedCandidateProtocol, - genesis_hash, - kProtocolPrefixPolkadot), - log::createLogger( - kFetchAttestedCandidateProtocolName, - "req_attested_candidate_protocol")}, + vstaging::AttestedCandidateRequest, + vstaging::AttestedCandidateResponse, + ScaleMessageReadWriter>{kFetchAttestedCandidateProtocolName, + host, + make_protocols( + kFetchAttestedCandidateProtocol, + genesis_hash, + kProtocolPrefixPolkadot), + log::createLogger( + kFetchAttestedCandidateProtocolName, + "req_attested_candidate_protocol")}, pp_{std::move(pp)} { BOOST_ASSERT(pp_); } @@ -64,7 +64,7 @@ namespace kagome::network { "Fetching attested candidate response failed.(error={})", res.error()); } else { - base().logger()->trace("Fetching attested candidate response."); + SL_TRACE(base().logger(), "Fetching attested candidate response."); } return res; } diff --git a/core/network/impl/protocols/protocol_fetch_available_data.hpp b/core/network/impl/protocols/protocol_fetch_available_data.hpp index 81fe91740f..429c62eeb0 100644 --- a/core/network/impl/protocols/protocol_fetch_available_data.hpp +++ b/core/network/impl/protocols/protocol_fetch_available_data.hpp @@ -35,22 +35,25 @@ namespace kagome::network { const blockchain::GenesisBlockHash &genesis_hash, std::shared_ptr av_store) : RequestResponseProtocolImpl< - FetchAvailableDataRequest, - FetchAvailableDataResponse, - ScaleMessageReadWriter>{kName, - host, - make_protocols(kFetchAvailableDataProtocol, - genesis_hash, - kProtocolPrefixPolkadot), - log::createLogger( - kName, "req_available_data_protocol")}, + FetchAvailableDataRequest, + FetchAvailableDataResponse, + ScaleMessageReadWriter>{kName, + host, + make_protocols( + kFetchAvailableDataProtocol, + genesis_hash, + kProtocolPrefixPolkadot), + log::createLogger( + kName, + "req_available_data_protocol")}, av_store_{std::move(av_store)} {} private: std::optional> onRxRequest( RequestType candidate_hash, std::shared_ptr) override { - base().logger()->trace("Fetch available data .(candidate hash={})", - candidate_hash); + SL_TRACE(base().logger(), + "Fetch available data .(candidate hash={})", + candidate_hash); if (auto r = av_store_->getPovAndData(candidate_hash)) { return std::move(*r); @@ -76,25 +79,25 @@ namespace kagome::network { const blockchain::GenesisBlockHash &genesis_hash, std::shared_ptr backing_store) : RequestResponseProtocolImpl< - FetchStatementRequest, - FetchStatementResponse, - ScaleMessageReadWriter>{kName, - host, - make_protocols(kFetchStatementProtocol, - genesis_hash, - kProtocolPrefixPolkadot), - log::createLogger( - kName, "req_statement_protocol")}, + FetchStatementRequest, + FetchStatementResponse, + ScaleMessageReadWriter>{kName, + host, + make_protocols(kFetchStatementProtocol, + genesis_hash, + kProtocolPrefixPolkadot), + log::createLogger( + kName, "req_statement_protocol")}, backing_store_{std::move(backing_store)} {} private: std::optional> onRxRequest( RequestType req, std::shared_ptr) override { - base().logger()->trace( - "Statement fetch request received.(relay parent={}, candidate " - "hash={})", - req.relay_parent, - req.candidate_hash); + SL_TRACE(base().logger(), + "Statement fetch request received.(relay parent={}, candidate " + "hash={})", + req.relay_parent, + req.candidate_hash); if (auto res = backing_store_->getCadidateInfo(req.relay_parent, req.candidate_hash)) { diff --git a/core/network/impl/protocols/protocol_req_pov.cpp b/core/network/impl/protocols/protocol_req_pov.cpp index a551eef5f8..4a1828eef7 100644 --- a/core/network/impl/protocols/protocol_req_pov.cpp +++ b/core/network/impl/protocols/protocol_req_pov.cpp @@ -24,15 +24,15 @@ namespace kagome::network { const blockchain::GenesisBlockHash &genesis_hash, std::shared_ptr observer) : RequestResponseProtocolImpl< - RequestPov, - ResponsePov, - ScaleMessageReadWriter>{kReqPovProtocolName, - host, - make_protocols(kReqPovProtocol, - genesis_hash, - kProtocolPrefixPolkadot), - log::createLogger(kReqPovProtocolName, - "req_pov_protocol")}, + RequestPov, + ResponsePov, + ScaleMessageReadWriter>{kReqPovProtocolName, + host, + make_protocols(kReqPovProtocol, + genesis_hash, + kProtocolPrefixPolkadot), + log::createLogger(kReqPovProtocolName, + "req_pov_protocol")}, observer_{std::move(observer)} {} protected: @@ -57,8 +57,8 @@ namespace kagome::network { } void onTxRequest(const RequestPov &request) override { - base().logger()->trace("Transmit PoV request(candidate hash={})", - request); + SL_TRACE( + base().logger(), "Transmit PoV request(candidate hash={})", request); } private: @@ -72,7 +72,7 @@ namespace kagome::network { const blockchain::GenesisBlockHash &genesis_hash, std::shared_ptr observer) : impl_{std::make_shared( - host, chain_spec, genesis_hash, std::move(observer))} {} + host, chain_spec, genesis_hash, std::move(observer))} {} const Protocol &ReqPovProtocol::protocolName() const { BOOST_ASSERT(impl_ && !!"ReqPovProtocolImpl must be initialized!"); diff --git a/core/parachain/approval/approval_distribution.cpp b/core/parachain/approval/approval_distribution.cpp index d23322b3c8..8f2cbde739 100644 --- a/core/parachain/approval/approval_distribution.cpp +++ b/core/parachain/approval/approval_distribution.cpp @@ -2572,57 +2572,6 @@ namespace kagome::parachain { [&](const auto &) { UNREACHABLE; }); } - void ApprovalDistribution::broadcastToAllPeers( - const Hash &block_hash, - const std::shared_ptr< - network::WireMessage> - &msg) { - auto se = pm_->getStreamEngine(); - BOOST_ASSERT(se); - - const auto header = block_tree_->getBlockHeader(block_hash); - if (header.has_value()) { - const auto session_index = - parachain_host_->session_index_for_child(header.value().parent_hash); - if (session_index.has_value()) { - const auto session = parachain_host_->session_info( - header.value().parent_hash, session_index.value()); - if (session.has_value() && session.value()) { - for (const auto &id : session.value()->discovery_keys) { - if (auto peer = parachain_processor_->get_audi()->get(id)) { - parachain_processor_->tryOpenOutgoingValidationStream( - peer->id, - network::CollationVersion::VStaging, - [WEAK_SELF, peer{peer->id}, se, msg]() { - WEAK_LOCK(self); - se->send(peer, - self->router_->getValidationProtocolVStaging(), - msg); - }); - } else { - SL_TRACE(logger_, "No audi for {}.", id); - } - } - } else { - SL_TRACE(logger_, - "No session. (block hash={}, error={})", - block_hash, - session.error()); - } - } else { - SL_TRACE(logger_, - "No session index. (block hash={}, error={})", - block_hash, - session_index.error()); - } - } else { - SL_TRACE(logger_, - "No block header in block tree. (block hash={}, error={})", - block_hash, - header.error()); - } - } - void ApprovalDistribution::runDistributeAssignment( const approval::IndirectAssignmentCertV2 &indirect_cert, const scale::BitVec &candidate_indices, @@ -2637,15 +2586,17 @@ namespace kagome::parachain { "Distributing assignment on candidate (block hash={})", indirect_cert.block_hash); - auto msg = std::make_shared< - network::WireMessage>( - network::vstaging::ApprovalDistributionMessage{ - network::vstaging::Assignments{ - .assignments = {network::vstaging::Assignment{ - .indirect_assignment_cert = indirect_cert, - .candidate_bitfield = candidate_indices, - }}}}); - broadcastToAllPeers(indirect_cert.block_hash, msg); + se->broadcast( + router_->getValidationProtocolVStaging(), + std::make_shared< + network::WireMessage>( + network::vstaging::ApprovalDistributionMessage{ + network::vstaging::Assignments{ + .assignments = {network::vstaging::Assignment{ + .indirect_assignment_cert = indirect_cert, + .candidate_bitfield = candidate_indices, + }}}}), + [&](const libp2p::peer::PeerId &p) { return peers.contains(p); }); } void ApprovalDistribution::send_assignments_batched( @@ -2753,13 +2704,17 @@ namespace kagome::parachain { vote.payload.payload.block_hash, peers.size()); - auto msg = std::make_shared< - network::WireMessage>( - network::vstaging::ApprovalDistributionMessage{ - network::vstaging::Approvals{ - .approvals = {vote}, - }}); - broadcastToAllPeers(vote.payload.payload.block_hash, msg); + se->broadcast( + router_->getValidationProtocolVStaging(), + std::make_shared< + network::WireMessage>( + network::vstaging::ApprovalDistributionMessage{ + network::vstaging::Assignments{ + .assignments = {network::vstaging::Assignment{ + .indirect_assignment_cert = indirect_cert, + .candidate_bitfield = candidate_indices, + }}}}), + [&](const libp2p::peer::PeerId &p) { return peers.contains(p); }); } void ApprovalDistribution::issue_approval(const CandidateHash &candidate_hash, diff --git a/core/parachain/approval/approval_distribution.hpp b/core/parachain/approval/approval_distribution.hpp index d8bab66ca1..c03ca5581f 100644 --- a/core/parachain/approval/approval_distribution.hpp +++ b/core/parachain/approval/approval_distribution.hpp @@ -801,12 +801,6 @@ namespace kagome::parachain { const scale::BitVec &candidate_indices, std::unordered_set &&peers); - void broadcastToAllPeers( - const Hash &block_hash, - const std::shared_ptr< - network::WireMessage> - &msg); - void send_assignments_batched( std::deque &&assignments, const libp2p::peer::PeerId &peer_id); diff --git a/core/parachain/availability/store/store_impl.cpp b/core/parachain/availability/store/store_impl.cpp index 274ff30fc3..1bf6d61946 100644 --- a/core/parachain/availability/store/store_impl.cpp +++ b/core/parachain/availability/store/store_impl.cpp @@ -74,8 +74,6 @@ namespace kagome::parachain { std::optional AvailabilityStoreImpl::getPovAndData( const CandidateHash &candidate_hash) const { - SL_DEBUG(logger, "{}. candidate: {})", __PRETTY_FUNCTION__, candidate_hash); - return state_.sharedAccess( [&](const auto &state) -> std::optional { @@ -120,8 +118,6 @@ namespace kagome::parachain { std::vector &&chunks, const ParachainBlock &pov, const PersistedValidationData &data) { - SL_DEBUG(logger, "{}. candidate: {})", __PRETTY_FUNCTION__, candidate_hash); - state_.exclusiveAccess([&](auto &state) { state.candidates_[relay_parent].insert(candidate_hash); auto &candidate_data = state.per_candidate_[candidate_hash]; @@ -136,9 +132,6 @@ namespace kagome::parachain { void AvailabilityStoreImpl::putChunk(const network::RelayHash &relay_parent, const CandidateHash &candidate_hash, ErasureChunk &&chunk) { - // SL_DEBUG(logger, "{}. candidate: {})", __PRETTY_FUNCTION__, - // candidate_hash); - state_.exclusiveAccess([&](auto &state) { state.candidates_[relay_parent].insert(candidate_hash); state.per_candidate_[candidate_hash].chunks[chunk.index] = @@ -151,8 +144,6 @@ namespace kagome::parachain { if (auto it = state.candidates_.find(relay_parent); it != state.candidates_.end()) { for (auto const &l : it->second) { - SL_DEBUG(logger, "{}. candidate: {})", __PRETTY_FUNCTION__, l); - state.per_candidate_.erase(l); } state.candidates_.erase(it); diff --git a/core/parachain/validator/impl/parachain_processor.cpp b/core/parachain/validator/impl/parachain_processor.cpp index dc614122a8..632b69cf6e 100644 --- a/core/parachain/validator/impl/parachain_processor.cpp +++ b/core/parachain/validator/impl/parachain_processor.cpp @@ -674,8 +674,6 @@ namespace kagome::parachain { av_store_->remove(lost); our_current_state_.per_leaf.erase(lost); our_current_state_.state_by_relay_parent.erase(lost); - - av_store_->remove(lost); } our_current_state_.active_leaves[relay_parent] = prospective_parachains_->prospectiveParachainsMode(relay_parent); @@ -1143,12 +1141,7 @@ namespace kagome::parachain { /// update peers in grid view const auto &grid_view = *per_session_state->value().grid_view; - SL_TRACE(logger_, "++>>> groups={}", grid_view.size()); for (const auto &view : grid_view) { - SL_TRACE(logger_, - "++>>> group_size(s)={}, group_size(r)={}", - view.sending.size(), - view.receiving.size()); for (const auto vi : view.sending) { spawn_and_update_peer(peers_sent, session_info->discovery_keys[vi]); } @@ -4490,7 +4483,9 @@ namespace kagome::parachain { const libp2p::peer::PeerId &peer_id, const std::shared_ptr &protocol) { BOOST_ASSERT(protocol); - logger_->info("Send my view.(peer={}, protocol={})", + CHECK_OR_RET(canProcessParachains().has_value()); + + SL_INFO(logger_, "Send my view.(peer={}, protocol={})", peer_id, protocol->protocolName()); pm_->getStreamEngine()->send( diff --git a/zombienet/polkadot/functional/0001-parachains-pvf.toml b/zombienet/polkadot/functional/0001-parachains-pvf.toml index 2886bcb168..8723051607 100644 --- a/zombienet/polkadot/functional/0001-parachains-pvf.toml +++ b/zombienet/polkadot/functional/0001-parachains-pvf.toml @@ -8,78 +8,45 @@ chain = "rococo-local" limits = { memory = "4G", cpu = "2" } requests = { memory = "2G", cpu = "1" } -# [[relaychain.nodes]] -# name = "alice" -# args = [ "--alice", "-lparachain=debug,runtime=debug" ] + [[relaychain.nodes]] + name = "alice" + args = [ "--alice", "-lparachain=debug,runtime=debug" ] -# [[relaychain.nodes]] -# name = "bob" -# command = "kagome" -# prometheus_prefix = "kagome" -# args = [ "--bob", "--wasm-execution Compiled", "--parachain-single-process", "-lparachain=trace", "-ldispute=trace", "-lnetwork=debug"] + [[relaychain.nodes]] + name = "bob" + args = [ "--bob", "-lparachain=debug,runtime=debug" ] + [[relaychain.nodes]] + name = "charlie" + args = [ "--charlie", "-lparachain=debug,runtime=debug" ] -# [[relaychain.nodes]] -# name = "bob" -# args = [ "--bob", "-lparachain=debug,runtime=debug" ] + [[relaychain.nodes]] + name = "dave" + args = [ "--dave", "-lparachain=debug,runtime=debug" ] [[relaychain.nodes]] - name = "alice" + name = "ferdie" command = "kagome" prometheus_prefix = "kagome" - args = [ "--alice", "--wasm-execution Compiled", "--parachain-single-process", "-lparachain=trace", "-ldispute=trace", "-lnetwork=trace", "-lgrandpa=trace"] + args = [ "--ferdie", "--wasm-execution Compiled", "-lparachain=debug", "-lnetwork=debug"] [[relaychain.nodes]] - name = "bob" + name = "eve" command = "kagome" prometheus_prefix = "kagome" - args = [ "--bob", "--wasm-execution Compiled", "--parachain-single-process", "-lparachain=trace", "-ldispute=trace", "-lnetwork=trace", "-lgrandpa=trace"] + args = [ "--eve", "--wasm-execution Compiled", "-lparachain=debug", "-lnetwork=debug"] [[relaychain.nodes]] - name = "charlie" + name = "one" command = "kagome" prometheus_prefix = "kagome" - args = [ "--charlie", "--wasm-execution Compiled", "--parachain-single-process", "-lparachain=trace", "-ldispute=trace", "-lnetwork=trace", "-lgrandpa=trace"] + args = [ "--one", "--wasm-execution Compiled", "-lparachain=debug", "-lnetwork=debug"] [[relaychain.nodes]] - name = "dave" + name = "two" command = "kagome" prometheus_prefix = "kagome" - args = [ "--dave", "--wasm-execution Compiled", "--parachain-single-process", "-lparachain=trace", "-ldispute=trace", "-lnetwork=trace", "-lgrandpa=trace"] - - - -# [[relaychain.nodes]] -# name = "charlie" -# args = [ "--charlie", "-lparachain=debug,runtime=debug" ] -# -# [[relaychain.nodes]] -# name = "dave" -# args = [ "--dave", "-lparachain=debug,runtime=debug" ] -# -# [[relaychain.nodes]] -# name = "ferdie" -# command = "kagome" -# prometheus_prefix = "kagome" -# args = [ "--ferdie", "--wasm-execution Compiled", "--parachain-single-process", "-lparachain=debug", "-lnetwork=debug"] -# -# [[relaychain.nodes]] -# name = "eve" -# command = "kagome" -# prometheus_prefix = "kagome" -# args = [ "--eve", "--wasm-execution Compiled", "--parachain-single-process", "-lparachain=debug", "-lnetwork=debug"] -# -# [[relaychain.nodes]] -# name = "one" -# command = "kagome" -# prometheus_prefix = "kagome" -# args = [ "--one", "--wasm-execution Compiled", "--parachain-single-process", "-lparachain=trace", "-ldispute=trace" ] -# -# [[relaychain.nodes]] -# name = "two" -# command = "kagome" -# prometheus_prefix = "kagome" -# args = [ "--two", "--wasm-execution Compiled", "--parachain-single-process", "-lparachain=debug", "-lruntime=debug", "-lreq_chunk_protocol=trace"] + args = [ "--two", "--wasm-execution Compiled", "-lparachain=debug", "-lruntime=debug", "-lreq_chunk_protocol=trace"] [[parachains]] id = 2000 @@ -121,45 +88,45 @@ genesis_state_generator = "undying-collator export-genesis-state --pov-size=2000 command = "undying-collator" args = ["-lparachain=debug", "--pov-size=20000", "--parachain-id=2003", "--pvf-complexity=300"] -#[[parachains]] -#id = 2004 -#addToGenesis = true -#genesis_state_generator = "undying-collator export-genesis-state --pov-size=100000 --pvf-complexity=300" -# -# [parachains.collator] -# name = "collator05" -# command = "undying-collator" -# args = ["-lparachain=debug", "--pov-size=100000", "--parachain-id=2004", "--pvf-complexity=300"] -# -#[[parachains]] -#id = 2005 -#addToGenesis = true -#genesis_state_generator = "undying-collator export-genesis-state --pov-size=20000 --pvf-complexity=400" -# -# [parachains.collator] -# name = "collator06" -# command = "undying-collator" -# args = ["-lparachain=debug", "--pov-size=20000", "--pvf-complexity=400", "--parachain-id=2005"] -# -#[[parachains]] -#id = 2006 -#addToGenesis = true -#genesis_state_generator = "undying-collator export-genesis-state --pov-size=100000 --pvf-complexity=300" -# -# [parachains.collator] -# name = "collator07" -# command = "undying-collator" -# args = ["-lparachain=debug", "--pov-size=100000", "--pvf-complexity=300", "--parachain-id=2006"] -# -#[[parachains]] -#id = 2007 -#addToGenesis = true -#genesis_state_generator = "undying-collator export-genesis-state --pov-size=100000 --pvf-complexity=300" -# -# [parachains.collator] -# name = "collator08" -# command = "undying-collator" -# args = ["-lparachain=debug", "--pov-size=100000", "--pvf-complexity=300", "--parachain-id=2007"] +[[parachains]] +id = 2004 +addToGenesis = true +genesis_state_generator = "undying-collator export-genesis-state --pov-size=100000 --pvf-complexity=300" + + [parachains.collator] + name = "collator05" + command = "undying-collator" + args = ["-lparachain=debug", "--pov-size=100000", "--parachain-id=2004", "--pvf-complexity=300"] + +[[parachains]] +id = 2005 +addToGenesis = true +genesis_state_generator = "undying-collator export-genesis-state --pov-size=20000 --pvf-complexity=400" + + [parachains.collator] + name = "collator06" + command = "undying-collator" + args = ["-lparachain=debug", "--pov-size=20000", "--pvf-complexity=400", "--parachain-id=2005"] + +[[parachains]] +id = 2006 +addToGenesis = true +genesis_state_generator = "undying-collator export-genesis-state --pov-size=100000 --pvf-complexity=300" + + [parachains.collator] + name = "collator07" + command = "undying-collator" + args = ["-lparachain=debug", "--pov-size=100000", "--pvf-complexity=300", "--parachain-id=2006"] + +[[parachains]] +id = 2007 +addToGenesis = true +genesis_state_generator = "undying-collator export-genesis-state --pov-size=100000 --pvf-complexity=300" + + [parachains.collator] + name = "collator08" + command = "undying-collator" + args = ["-lparachain=debug", "--pov-size=100000", "--pvf-complexity=300", "--parachain-id=2007"] [types.Header] number = "u64"