Skip to content
Closed
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
6 changes: 6 additions & 0 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ hunter_config(
SECP256K1_ENABLE_MODULE_RECOVERY=ON
)

hunter_config(
scale
URL https://github.com/qdrvm/scale-codec-cpp/archive/975e6bb1531949d02ee27a13b76cd906e6fc71e9.zip
SHA1 7d7a371edf9fa45d07360c306ee62453fe940490
)

hunter_config(
wabt
URL https://github.com/qdrvm/wabt/archive/2e9d30c4a67c1b884a8162bf3f3a5a8585cfdb94.tar.gz
Expand Down
8 changes: 5 additions & 3 deletions core/consensus/grandpa/impl/authority_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ namespace kagome::consensus::grandpa {
std::shared_ptr<const AuthoritySet> prev_state;
[[unlikely]] if (info.number == 0) {
OUTCOME_TRY(list, grandpa_api_->authorities(info.hash));
auto genesis = std::make_shared<AuthoritySet>(0, std::move(list));
auto genesis =
std::make_shared<AuthoritySet>(AuthoritySet{0, std::move(list)});
GrandpaIndexedValue value{
.next_set_id = genesis->id,
.state = genesis,
Expand Down Expand Up @@ -197,12 +198,13 @@ namespace kagome::consensus::grandpa {
AuthoritySetId set_id,
const HasAuthoritySetChange &digests) const {
BOOST_ASSERT(digests);
return std::make_shared<AuthoritySet>(
return std::make_shared<AuthoritySet>(AuthoritySet{
set_id,
isKusamaHardFork(block_tree_->getGenesisBlockHash(), block)
? kusamaHardForksAuthorities()
: digests.forced ? digests.forced->authorities
: digests.scheduled->authorities);
: digests.scheduled->authorities,
});
}

outcome::result<void> AuthorityManagerImpl::load(
Expand Down
3 changes: 2 additions & 1 deletion core/network/types/collator_messages.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <type_traits>
#include <vector>

#include <scale/tie_cmp.hpp>
#include "common/blob.hpp"
#include "consensus/grandpa/common.hpp"
#include "crypto/hasher.hpp"
Expand Down Expand Up @@ -382,7 +383,7 @@ namespace kagome::network {
/// The collator required to author the block, if any.
std::optional<CollatorId> collator;

auto operator<=>(const ScheduledCore &) const = default;
SCALE_TIE_CMP(ScheduledCore);
};

inline const CandidateHash &candidateHash(const CompactStatement &val) {
Expand Down
3 changes: 2 additions & 1 deletion core/runtime/common/runtime_upgrade_tracker_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ namespace kagome::runtime {
== runtime_upgrades_.end();

if (is_new_upgrade) {
runtime_upgrades_.emplace_back(block_info, header.state_root);
runtime_upgrades_.emplace_back(
RuntimeUpgradeData{block_info, header.state_root});

std::ranges::sort(runtime_upgrades_,
[](const auto &lhs, const auto &rhs) {
Expand Down
25 changes: 25 additions & 0 deletions core/scale/tie_cmp.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright Quadrivium LLC
* All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <scale/detail/decomposable.hpp>

namespace scale {
auto decomposeTie(const auto &value) {
return ::scale::detail::decompose_and_apply(value, [](auto &&...a) {
return std::tie(std::forward<decltype(a)>(a)...);
});
}
} // namespace scale

#define SCALE_TIE_CMP(type) \
friend bool operator==(const type &l, const type &r) { \
return ::scale::decomposeTie(l) == ::scale::decomposeTie(r); \
} \
friend bool operator<(const type &l, const type &r) { \
return ::scale::decomposeTie(l) < ::scale::decomposeTie(r); \
}
5 changes: 4 additions & 1 deletion core/utils/kagome_db_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@ Kagome DB Editor - a storage pruner. Allows to reduce occupied disk space.
std::vector<runtime::RuntimeUpgradeTrackerImpl::RuntimeUpgradeData>
runtime_upgrade_data{};
runtime_upgrade_data.emplace_back(
last_finalized_block, last_finalized_block_header.state_root);
runtime::RuntimeUpgradeTrackerImpl::RuntimeUpgradeData{
last_finalized_block,
last_finalized_block_header.state_root,
});
auto encoded_res = check(scale::encode(runtime_upgrade_data));
check(buffer_storage->put(storage::kRuntimeHashesLookupKey,
common::Buffer(encoded_res.value())))
Expand Down
Loading