Skip to content

Commit

Permalink
feature/candidates tests (#2314)
Browse files Browse the repository at this point in the history
* [feature] `candidates` tests

Signed-off-by: iceseer <[email protected]>

---------

Signed-off-by: iceseer <[email protected]>
  • Loading branch information
iceseer authored Dec 17, 2024
1 parent d056f23 commit 3e07094
Show file tree
Hide file tree
Showing 5 changed files with 762 additions and 115 deletions.
12 changes: 7 additions & 5 deletions core/parachain/validator/impl/candidates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,13 @@ namespace kagome::parachain {
boost::variant<UnconfirmedCandidate, ConfirmedCandidate>;

struct Candidates {
std::unordered_map<CandidateHash, CandidateState> candidates;
std::unordered_map<
Hash,
std::unordered_map<ParachainId, std::unordered_set<CandidateHash>>>
by_parent;
using ByParaId =
std::unordered_map<ParachainId, std::unordered_set<CandidateHash>>;
using ByRelayParent = std::unordered_map<Hash, ByParaId>;
using StateByCandidate = std::unordered_map<CandidateHash, CandidateState>;

StateByCandidate candidates;
ByRelayParent by_parent;
log::Logger logger = log::createLogger("Candidates", "parachain");

std::vector<HypotheticalCandidate> frontier_hypotheticals(
Expand Down
13 changes: 13 additions & 0 deletions test/core/parachain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ target_link_libraries(scope_test
logger
)

addtest(candidates_test
candidates.cpp
)

target_link_libraries(candidates_test
prospective_parachains
validator_parachain
log_configurator
base_fs_test
key_store
logger
)

addtest(fragment_chain_test
fragment_chain.cpp
)
Expand Down
Loading

0 comments on commit 3e07094

Please sign in to comment.