From 28d321941c552a08ff1a2ba1d2e9bcd1ecd7c5aa Mon Sep 17 00:00:00 2001 From: Dmitriy Khaustov aka xDimon Date: Thu, 20 Feb 2025 12:44:47 +0800 Subject: [PATCH] fix: make CandidateReceipt custom decomposable Signed-off-by: Dmitriy Khaustov aka xDimon --- core/parachain/types.hpp | 6 ++++-- core/scale/encoder/concepts.hpp | 21 --------------------- 2 files changed, 4 insertions(+), 23 deletions(-) delete mode 100644 core/scale/encoder/concepts.hpp diff --git a/core/parachain/types.hpp b/core/parachain/types.hpp index 274e82d914..545fc77016 100644 --- a/core/parachain/types.hpp +++ b/core/parachain/types.hpp @@ -181,8 +181,6 @@ namespace kagome::network { struct CandidateReceipt { CandidateDescriptor descriptor; /// Candidate descriptor parachain::Hash commitments_hash; /// Hash of candidate commitments - mutable std::optional hash_{}; - const parachain::Hash &hash(const crypto::Hasher &hasher) const { if (not hash_.has_value()) { hash_.emplace(hasher.blake2b_256( @@ -192,6 +190,10 @@ namespace kagome::network { } CUSTOM_EQUALITY(CandidateReceipt, descriptor, commitments_hash); + SCALE_CUSTOM_DECOMPOSITION(CandidateReceipt, descriptor, commitments_hash) + + private: + mutable std::optional hash_{}; }; struct CommittedCandidateReceipt { diff --git a/core/scale/encoder/concepts.hpp b/core/scale/encoder/concepts.hpp deleted file mode 100644 index 10d5800299..0000000000 --- a/core/scale/encoder/concepts.hpp +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright Quadrivium LLC - * All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include -#include - -namespace kagome::scale { - template - concept Invocable = std::is_invocable_v; - - template - concept IsEnum = std::is_enum_v>; - - template - concept IsNotEnum = !std::is_enum_v>; -} // namespace kagome::scale