From 10aee5bb24692203dcca16197ae897e0e71a10a0 Mon Sep 17 00:00:00 2001 From: Marco Granelli Date: Wed, 8 Feb 2023 17:27:58 +0100 Subject: [PATCH] Fmt --- apps/src/lib/cli.rs | 4 +- .../lib/node/ledger/shell/finalize_block.rs | 9 +++-- .../src/ledger/native_vp/governance/utils.rs | 37 ++++++++++++------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/apps/src/lib/cli.rs b/apps/src/lib/cli.rs index 0520ff6c77..2c106d20a2 100644 --- a/apps/src/lib/cli.rs +++ b/apps/src/lib/cli.rs @@ -2349,8 +2349,8 @@ pub mod args { .about( "The list of proposed councils and spending \ caps:\n$council1 $cap1 $council2 $cap2 ... \ - (council is bech32m encoded address, cap is expressed in \ - microNAM", + (council is bech32m encoded address, cap is \ + expressed in microNAM", ) .requires(PROPOSAL_ID.name) .conflicts_with(PROPOSAL_VOTE_ETH_OPT.name), diff --git a/apps/src/lib/node/ledger/shell/finalize_block.rs b/apps/src/lib/node/ledger/shell/finalize_block.rs index 52be8f425b..c1983e8b7d 100644 --- a/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -843,7 +843,7 @@ mod test_finalize_block { use namada::types::storage::Epoch; use namada::types::time::DurationSecs; use namada::types::transaction::governance::{ - InitProposalData, VoteProposalData, + InitProposalData, ProposalType, VoteProposalData, }; use namada::types::transaction::{EncryptionKey, Fee, WrapperTx, MIN_FEE}; use rust_decimal_macros::dec; @@ -1232,7 +1232,7 @@ mod test_finalize_block { voting_start_epoch: Epoch::default(), voting_end_epoch: Epoch::default().next(), grace_epoch: Epoch::default().next(), - proposal_code: None, + r#type: ProposalType::Default(None), }; storage_api::governance::init_proposal( @@ -1254,7 +1254,10 @@ mod test_finalize_block { }; // Add a proposal to be accepted and one to be rejected. - add_proposal(0, ProposalVote::Yay); + add_proposal( + 0, + ProposalVote::Yay(namada::types::governance::VoteType::Default), + ); add_proposal(1, ProposalVote::Nay); // Commit the genesis state diff --git a/shared/src/ledger/native_vp/governance/utils.rs b/shared/src/ledger/native_vp/governance/utils.rs index 18debd1c5a..2511db46c9 100644 --- a/shared/src/ledger/native_vp/governance/utils.rs +++ b/shared/src/ledger/native_vp/governance/utils.rs @@ -168,7 +168,7 @@ pub fn compute_tally( return Err(Error::Tally(format!( "Unexpected proposal type: {}", proposal_type - ))) + ))); } }; @@ -238,7 +238,14 @@ pub fn compute_tally( { *power -= vote_power; } else { - return Err(Error::Tally(format!("Expected PGF vote {:?} was not in tally", vote))); + return Err(Error::Tally( + format!( + "Expected PGF \ + vote {:?} was \ + not in tally", + vote + ), + )); } } else { // Validator didn't vote for @@ -251,9 +258,10 @@ pub fn compute_tally( } else { // Log the error and continue tracing::error!( - "Unexpected vote type. Expected: PGFCouncil, Found: {}", - validator_vote - ); + "Unexpected vote type. Expected: \ + PGFCouncil, Found: {}", + validator_vote + ); continue; } } @@ -291,9 +299,8 @@ pub fn compute_tally( } else { return Err(Error::Tally( format!( - "Expected PGF \ - vote {:?} was \ - not in tally", + "Expected PGF vote \ + {:?} was not in tally", vote ), )); @@ -302,9 +309,10 @@ pub fn compute_tally( } else { // Log the error and continue tracing::error!( - "Unexpected vote type. Expected: PGFCouncil, Found: {}", - validator_vote - ); + "Unexpected vote type. Expected: \ + PGFCouncil, Found: {}", + validator_vote + ); continue; } } @@ -313,9 +321,10 @@ pub fn compute_tally( _ => { // Log the error and continue tracing::error!( - "Unexpected vote type. Expected: PGFCouncil, Found: {}", - delegator_vote - ); + "Unexpected vote type. Expected: PGFCouncil, \ + Found: {}", + delegator_vote + ); continue; } }