diff --git a/core/parachain/availability/recovery/recovery_impl.cpp b/core/parachain/availability/recovery/recovery_impl.cpp index f58af6dc84..783c0aa284 100644 --- a/core/parachain/availability/recovery/recovery_impl.cpp +++ b/core/parachain/availability/recovery/recovery_impl.cpp @@ -196,20 +196,21 @@ namespace kagome::parachain { if (auto indexed_key_pair_opt = session_keys_->getParaKeyPair(session->validators); indexed_key_pair_opt.has_value()) { - auto out_validator_index = indexed_key_pair_opt->second; - auto index_of_our_chunk = val2chunk(out_validator_index); + auto our_validator_index = indexed_key_pair_opt->second; + auto index_of_our_chunk = val2chunk(our_validator_index); auto min_chunks = _min.value(); auto our_chunk = av_store_->getChunk(candidate_hash, index_of_our_chunk); - if (not our_chunk.has_value()) { SL_WARN(logger_, - "Our node does not have a chunk which it must be have"); + "Our chunk {}:{} not found", + candidate_hash, + index_of_our_chunk); } else { available_data_size = our_chunk->chunk.size() * min_chunks; } } else { - SL_WARN(logger_, "Cannot retrieve out validator index"); + SL_WARN(logger_, "Cannot retrieve our validator index"); } // Do recovery from backers strategy iff available diff --git a/core/parachain/availability/store/store_impl.cpp b/core/parachain/availability/store/store_impl.cpp index b8a421683a..c62fb59a6d 100644 --- a/core/parachain/availability/store/store_impl.cpp +++ b/core/parachain/availability/store/store_impl.cpp @@ -259,6 +259,8 @@ namespace kagome::parachain { std::vector &&chunks, const ParachainBlock &pov, const PersistedValidationData &data) { + SL_TRACE(logger, "Attempt to store all chunks of {}", candidate_hash); + state_.exclusiveAccess([&](auto &state) { prune_candidates_no_lock(state); state.candidates_[relay_parent].insert(candidate_hash); @@ -287,6 +289,11 @@ namespace kagome::parachain { candidate_hash, chunk_index, res.error()); + } else { + SL_TRACE(logger, + "Chunk {}:{} is saved by storeData()", + candidate_hash, + chunk.index); } } candidate_data.pov = pov; @@ -299,6 +306,8 @@ namespace kagome::parachain { void AvailabilityStoreImpl::putChunk(const network::RelayHash &relay_parent, const CandidateHash &candidate_hash, ErasureChunk &&chunk) { + SL_TRACE(logger, "Attempt to put chunk {}:{}", candidate_hash, chunk.index); + auto encoded_chunk = scale::encode(chunk); const auto chunk_index = chunk.index; state_.exclusiveAccess([&](auto &state) { @@ -331,6 +340,11 @@ namespace kagome::parachain { chunk_index, res.error()); } + + SL_TRACE(logger, + "Chunk {}:{} is saved by putChunk()", + candidate_hash, + chunk.index); } void AvailabilityStoreImpl::remove_no_lock( @@ -338,21 +352,6 @@ namespace kagome::parachain { if (auto it = state.candidates_.find(relay_parent); it != state.candidates_.end()) { for (const auto &l : it->second) { - auto space = storage_->getSpace(storage::Space::kAvaliabilityStorage); - if (space) { - for (const auto &chunk : state.per_candidate_[l].chunks) { - if (not space->remove( - CandidateChunkKey::encode(l, chunk.second.index))) { - SL_ERROR(logger, - "Failed to remove chunk candidate {} index {}", - l, - chunk.second.index); - } - } - } else { - SL_CRITICAL(logger, - "Failed to get AvaliabilityStorage space in remove"); - } state.per_candidate_.erase(l); } state.candidates_.erase(it);