Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'master' of github.com:paritytech/substrate into dharjee…
…zy/beefy-metrics
  • Loading branch information
acatangiu committed Feb 13, 2023
commit 215f9eb89f3480c3d2e0671aba61463d6eff7971
8 changes: 2 additions & 6 deletions client/beefy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,8 @@ impl TestNetFactory for BeefyTestNet {
let validator_set = ValidatorSet::new(make_beefy_ids(keys), 0).unwrap();
let api = Arc::new(TestApi::with_validator_set(&validator_set));
let inner = BlockImportAdapter::new(client.clone());
let (block_import, voter_links, rpc_links) = beefy_block_import_and_links(
inner,
client.as_backend(),
Arc::new(two_validators::TestApi {}),
None,
);
let (block_import, voter_links, rpc_links) =
beefy_block_import_and_links(inner, client.as_backend(), api, None);
let peer_data = PeerData {
beefy_rpc_links: Mutex::new(Some(rpc_links)),
beefy_voter_links: Mutex::new(Some(voter_links)),
Expand Down
29 changes: 12 additions & 17 deletions client/beefy/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{
keystore::BeefyKeystore,
metric_get, metric_inc, metric_set,
metrics::VoterMetrics,
round::Rounds,
round::{Rounds, VoteImportResult},
BeefyVoterLinks, LOG_TARGET,
};
use beefy_primitives::{
Expand Down Expand Up @@ -560,20 +560,10 @@ where
.active_rounds_mut()
.ok_or(Error::UninitSession)?;

if rounds.add_vote(&round, vote, self_vote) {
if let Some(signatures) = rounds.should_conclude(&round) {
self.gossip_validator.conclude_round(round.1);

let block_num = round.1;
let commitment = Commitment {
payload: round.0,
block_number: block_num,
validator_set_id: rounds.validator_set_id(),
};

let finality_proof =
VersionedFinalityProof::V1(SignedCommitment { commitment, signatures });

let block_number = vote.commitment.block_number;
match rounds.add_vote(vote) {
VoteImportResult::RoundConcluded(signed_commitment) => {
let finality_proof = VersionedFinalityProof::V1(signed_commitment);
info!(
target: LOG_TARGET,
"🥩 Round #{} concluded, finality_proof: {:?}.", block_number, finality_proof
Expand All @@ -593,8 +583,13 @@ where
crate::aux_schema::write_voter_state(&*self.backend, &self.persisted_state)
.map_err(|e| Error::Backend(e.to_string()))?;
}
}
}
},
VoteImportResult::Equivocation => {
// TODO: report returned `EquivocationProof` to chain through `pallet-beefy`.
()
},
VoteImportResult::Invalid | VoteImportResult::Stale => (),
};
metric_inc!(self, beefy_successful_handled_votes);
Ok(())
}
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.