Skip to content

Commit

Permalink
consensus: change CertificateInfo to use RatificationResult
Browse files Browse the repository at this point in the history
  • Loading branch information
herr-seppia committed Feb 12, 2024
1 parent 3e39b3e commit 02f0f8d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions consensus/src/commons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ impl QuorumMsgSender {
Payload::Quorum(q)
if !q.validation.is_empty()
&& !q.ratification.is_empty()
&& q.vote != Vote::NoCandidate =>
&& q.vote() != &Vote::NoCandidate =>
{
tracing::debug!(
event = "send quorum_msg",
vote = %q.vote,
vote = %q.vote(),
round = msg.header.round,
iteration = msg.header.iteration,
validation = ?q.validation,
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/execution_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl<'a, DB: Database, T: Operations + 'static> ExecutionCtx<'a, DB, T> {
event = "quorum",
src = "prev_step",
msg_step = m.get_step(),
vote = %q.vote,
vote = %q.vote(),
);

self.quorum_sender.send_quorum(m).await;
Expand Down
4 changes: 2 additions & 2 deletions consensus/src/quorum/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ impl<'p, D: Database> Executor<'p, D> {
// Publish the quorum
self.publish(msg.clone()).await;

if let Vote::Valid(hash) = quorum.vote {
if let Vote::Valid(hash) = quorum.vote() {
// Create winning block
debug!("generate block from quorum msg");
let cert = quorum.generate_certificate();
return self.create_winning_block(&hash, &cert).await;
return self.create_winning_block(hash, &cert).await;
}
}

Expand Down
4 changes: 2 additions & 2 deletions consensus/src/quorum/verifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub async fn verify_quorum(
// Verify validation
verify_step_votes(
&quorum.header,
&quorum.vote,
quorum.vote(),
&quorum.validation,
committees_set,
seed,
Expand All @@ -47,7 +47,7 @@ pub async fn verify_quorum(
// Verify ratification
verify_step_votes(
&quorum.header,
&quorum.vote,
quorum.vote(),
&quorum.ratification,
committees_set,
seed,
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/ratification/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl RatificationHandler {

let quorum = payload::Quorum {
header,
vote,
result: vote.into(),
validation,
ratification,
};
Expand Down
12 changes: 6 additions & 6 deletions consensus/src/step_votes_reg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use crate::commons::RoundUpdate;
use node_data::bls::PublicKeyBytes;
use node_data::ledger::{Certificate, IterationInfo, StepVotes};
use node_data::message::payload::Vote;
use node_data::message::payload::{RatificationResult, Vote};
use node_data::message::{payload, Message};
use node_data::StepName;
use std::collections::HashMap;
Expand All @@ -18,7 +18,7 @@ use tracing::{debug, warn};

#[derive(Clone)]
struct CertificateInfo {
vote: Vote,
result: RatificationResult,
cert: Certificate,

quorum_reached_validation: bool,
Expand All @@ -29,8 +29,8 @@ impl fmt::Display for CertificateInfo {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"cert_info: {}, validation: ({:?},{:?}), ratification: ({:?},{:?}) ",
self.vote,
"cert_info: {:?}, validation: ({:?},{:?}), ratification: ({:?},{:?}) ",
self.result,
self.cert.validation,
self.quorum_reached_validation,
self.cert.ratification,
Expand All @@ -42,7 +42,7 @@ impl fmt::Display for CertificateInfo {
impl CertificateInfo {
pub(crate) fn new(vote: Vote) -> Self {
CertificateInfo {
vote,
result: vote.into(),
cert: Certificate::default(),
quorum_reached_validation: false,
quorum_reached_ratification: false,
Expand Down Expand Up @@ -185,7 +185,7 @@ impl CertInfoRegistry {

let payload = payload::Quorum {
header,
vote: result.vote.clone(),
result: result.result.clone(),
validation: result.cert.validation,
ratification: result.cert.ratification,
};
Expand Down

0 comments on commit 02f0f8d

Please sign in to comment.