Skip to content

Commit

Permalink
node: rename VoterWithCredits to Voter
Browse files Browse the repository at this point in the history
  • Loading branch information
fed-franz committed Jul 23, 2024
1 parent e44e617 commit 47d8718
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
6 changes: 3 additions & 3 deletions node/src/chain/acceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use node_data::ledger::{
use node_data::message::AsyncQueue;
use node_data::message::Payload;

use dusk_consensus::operations::VoterWithCredits;
use dusk_consensus::operations::Voter;
use execution_core::stake::Withdraw;
use metrics::{counter, gauge, histogram};
use node_data::message::payload::Vote;
Expand Down Expand Up @@ -193,7 +193,7 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network> Acceptor<N, DB, VM> {
&self,
provisioners_list: &Provisioners,
tip: &Block,
) -> Vec<VoterWithCredits> {
) -> Vec<Voter> {
if tip.header().height == 0 {
return vec![];
};
Expand Down Expand Up @@ -1026,7 +1026,7 @@ pub(crate) async fn verify_block_header<DB: database::DB>(
prev_header: &ledger::Header,
provisioners: &ContextProvisioners,
header: &ledger::Header,
) -> anyhow::Result<(u8, Vec<VoterWithCredits>, Vec<VoterWithCredits>)> {
) -> anyhow::Result<(u8, Vec<Voter>, Vec<Voter>)> {
let validator = Validator::new(db, prev_header, provisioners);
validator.execute_checks(header, false).await
}
9 changes: 4 additions & 5 deletions node/src/chain/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ use async_trait::async_trait;
use dusk_consensus::commons::{ConsensusError, RoundUpdate, TimeoutSet};
use dusk_consensus::consensus::Consensus;
use dusk_consensus::operations::{
self, CallParams, Error, Operations, Output, VerificationOutput,
VoterWithCredits,
self, CallParams, Error, Operations, Output, VerificationOutput, Voter,
};
use dusk_consensus::queue::MsgRegistry;
use dusk_consensus::user::provisioners::ContextProvisioners;
Expand Down Expand Up @@ -87,7 +86,7 @@ impl Task {
db: &Arc<RwLock<D>>,
vm: &Arc<RwLock<VM>>,
base_timeout: TimeoutSet,
voters: Vec<VoterWithCredits>,
voters: Vec<Voter>,
) {
let current = provisioners_list.to_current();
let consensus_task = Consensus::new(
Expand Down Expand Up @@ -248,7 +247,7 @@ impl<DB: database::DB, VM: vm::VMExecution> Operations for Executor<DB, VM> {
&self,
candidate_header: &Header,
disable_winning_att_check: bool,
) -> Result<(u8, Vec<VoterWithCredits>, Vec<VoterWithCredits>), Error> {
) -> Result<(u8, Vec<Voter>, Vec<Voter>), Error> {
let validator = Validator::new(
self.db.clone(),
&self.tip_header,
Expand Down Expand Up @@ -277,7 +276,7 @@ impl<DB: database::DB, VM: vm::VMExecution> Operations for Executor<DB, VM> {
async fn verify_state_transition(
&self,
blk: &Block,
voters: &[VoterWithCredits],
voters: &[Voter],
) -> Result<VerificationOutput, dusk_consensus::operations::Error> {
info!("verifying state");

Expand Down
14 changes: 7 additions & 7 deletions node/src/chain/header_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::database::Ledger;
use anyhow::anyhow;
use dusk_bytes::Serializable;
use dusk_consensus::config::MINIMUM_BLOCK_TIME;
use dusk_consensus::operations::VoterWithCredits;
use dusk_consensus::operations::Voter;
use dusk_consensus::quorum::verifiers;
use dusk_consensus::quorum::verifiers::QuorumResult;
use dusk_consensus::user::committee::{Committee, CommitteeSet};
Expand Down Expand Up @@ -63,7 +63,7 @@ impl<'a, DB: database::DB> Validator<'a, DB> {
&self,
candidate_block: &ledger::Header,
disable_winner_att_check: bool,
) -> anyhow::Result<(u8, Vec<VoterWithCredits>, Vec<VoterWithCredits>)>
) -> anyhow::Result<(u8, Vec<Voter>, Vec<Voter>)>
{
self.verify_basic_fields(candidate_block).await?;
let prev_block_voters =
Expand Down Expand Up @@ -162,7 +162,7 @@ impl<'a, DB: database::DB> Validator<'a, DB> {
pub async fn verify_prev_block_cert(
&self,
candidate_block: &'a ledger::Header,
) -> anyhow::Result<Vec<VoterWithCredits>> {
) -> anyhow::Result<Vec<Voter>> {
if self.prev_header.height == 0 {
return Ok(vec![]);
}
Expand Down Expand Up @@ -246,7 +246,7 @@ impl<'a, DB: database::DB> Validator<'a, DB> {
pub async fn verify_success_att(
&self,
candidate_block: &'a ledger::Header,
) -> anyhow::Result<Vec<VoterWithCredits>> {
) -> anyhow::Result<Vec<Voter>> {
let (_, _, voters) = verify_att(
&candidate_block.att,
candidate_block.get_consensus_header(),
Expand All @@ -266,7 +266,7 @@ impl<'a, DB: database::DB> Validator<'a, DB> {
blk: &'a ledger::Header,
provisioners: &Provisioners,
prev_block_seed: Seed,
) -> anyhow::Result<Vec<VoterWithCredits>> {
) -> anyhow::Result<Vec<Voter>> {
let (_, _, voters) = verify_att(
&blk.att,
blk.get_consensus_header(),
Expand Down Expand Up @@ -326,7 +326,7 @@ pub async fn verify_att(
consensus_header: ConsensusHeader,
curr_seed: Signature,
curr_eligible_provisioners: &Provisioners,
) -> anyhow::Result<(QuorumResult, QuorumResult, Vec<VoterWithCredits>)> {
) -> anyhow::Result<(QuorumResult, QuorumResult, Vec<Voter>)> {
let committee = RwLock::new(CommitteeSet::new(curr_eligible_provisioners));

let mut result = (QuorumResult::default(), QuorumResult::default());
Expand Down Expand Up @@ -396,7 +396,7 @@ pub async fn verify_att(
}

/// Merges two committees into a vector
fn merge_committees(a: &Committee, b: &Committee) -> Vec<VoterWithCredits> {
fn merge_committees(a: &Committee, b: &Committee) -> Vec<Voter> {
let mut members = a.members().clone();
for (key, value) in b.members() {
// Keeps track of the number of occurrences for each member.
Expand Down
6 changes: 3 additions & 3 deletions node/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

use dusk_consensus::operations::VoterWithCredits;
use dusk_consensus::operations::Voter;
use dusk_consensus::{
operations::{CallParams, VerificationOutput},
user::{provisioners::Provisioners, stake::Stake},
Expand All @@ -29,13 +29,13 @@ pub trait VMExecution: Send + Sync + 'static {
fn verify_state_transition(
&self,
blk: &Block,
voters: Option<&[VoterWithCredits]>,
voters: Option<&[Voter]>,
) -> anyhow::Result<VerificationOutput>;

fn accept(
&self,
blk: &Block,
voters: Option<&[VoterWithCredits]>,
voters: Option<&[Voter]>,
) -> anyhow::Result<(Vec<SpentTransaction>, VerificationOutput)>;

fn finalize_state(
Expand Down

0 comments on commit 47d8718

Please sign in to comment.