Skip to content

Commit

Permalink
send_cluster_candidate_statements
Browse files Browse the repository at this point in the history
Signed-off-by: iceseer <[email protected]>
  • Loading branch information
iceseer committed Mar 31, 2024
1 parent a962179 commit 7621937
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/network/types/collator_messages_vstaging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ namespace kagome::network::vstaging {
scale::BitVec validated_in_group;

StatementFilter() = default;
StatementFilter(size_t len) {
seconded_in_group.bits.assign(len, false);
validated_in_group.bits.assign(len, false);
StatementFilter(size_t len, bool val = false) {
seconded_in_group.bits.assign(len, val);
validated_in_group.bits.assign(len, val);
}

bool has_len(size_t len) const {
Expand Down
30 changes: 29 additions & 1 deletion core/parachain/validator/impl/parachain_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,11 +912,16 @@ namespace kagome::parachain {
validator->validatorIndex(),
relay_parent);

std::optional<GroupIndex> our_group;
if (groups_p) {
our_group = groups_p->byValidatorIndex(validator->validatorIndex());
}
return RelayParentState{
.prospective_parachains_mode = mode,
.assignment = assignment,
.seconded = {},
.our_index = validator->validatorIndex(),
.our_group = our_group,
.required_collator = required_collator,
.collations = {},
.table_context =
Expand Down Expand Up @@ -2146,7 +2151,30 @@ namespace kagome::parachain {
}

void ParachainProcessorImpl::send_cluster_candidate_statements(
const CandidateHash &candidate_hash, const RelayHash &relay_parent) {}
const CandidateHash &candidate_hash, const RelayHash &relay_parent) {
auto relay_parent_state = tryGetStateByRelayParent(relay_parent);
if (!relay_parent_state) {
return;
}

auto local_group = relay_parent_state->get().our_group;
if (!local_group) {
return;
}

auto group = relay_parent_state->get().groups->get(*local_group);
if (!group) {
return;
}
auto group_size = group->size();

relay_parent_state->get().statement_store->groupStatements(
*group,
candidate_hash,
network::vstaging::StatementFilter(group_size, true),
[&](const IndexedAndSigned<network::vstaging::CompactStatement>
&statement) { circulate_statement(relay_parent, statement); });
}

void ParachainProcessorImpl::apply_post_confirmation(
const PostConfirmation &post_confirmation) {
Expand Down
1 change: 1 addition & 0 deletions core/parachain/validator/parachain_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ namespace kagome::parachain {
std::optional<network::ParachainId> assignment;
std::optional<primitives::BlockHash> seconded;
std::optional<network::ValidatorIndex> our_index;
std::optional<network::GroupIndex> our_group;
std::optional<network::CollatorPublicKey> required_collator;

Collations collations;
Expand Down

0 comments on commit 7621937

Please sign in to comment.