Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Governance: refactor #719

Merged
merged 20 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
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
11 changes: 11 additions & 0 deletions apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,17 @@ pub async fn query_proposal(_ctx: Context, args: args::QueryProposal) {
println!("{:4}Status: pending", "");
} else if start_epoch <= current_epoch && current_epoch <= end_epoch
{
let votes = get_proposal_votes(client, start_epoch, id).await;
let partial_proposal_result =
compute_tally(client, start_epoch, votes).await;
println!(
"{:4}Yay votes: {}",
"", partial_proposal_result.total_yay_power
);
println!(
"{:4}Nay votes: {}",
"", partial_proposal_result.total_nay_power
);
println!("{:4}Status: on-going", "");
} else {
let votes = get_proposal_votes(client, start_epoch, id).await;
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/client/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ async fn is_safe_voting_window(

match proposal_end_epoch {
Some(proposal_end_epoch) => {
!namada::ledger::governance::vp::is_valid_validator_voting_period(
!namada::ledger::governance::utils::is_valid_validator_voting_period(
current_epoch,
proposal_start_epoch,
proposal_end_epoch,
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/node/ledger/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub enum Error {
#[error("IBC Token native VP: {0}")]
IbcTokenNativeVpError(namada::ledger::ibc::vp::IbcTokenError),
#[error("Governance native VP error: {0}")]
GovernanceNativeVpError(namada::ledger::governance::vp::Error),
GovernanceNativeVpError(namada::ledger::governance::Error),
#[error("SlashFund native VP error: {0}")]
SlashFundNativeVpError(namada::ledger::slash_fund::Error),
#[error("Ethereum bridge native VP error: {0}")]
Expand Down
5 changes: 3 additions & 2 deletions apps/src/lib/node/ledger/shell/governance.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use namada::ledger::governance::storage as gov_storage;
use namada::ledger::governance::utils::{
compute_tally, get_proposal_votes, ProposalEvent,
};
use namada::ledger::governance::vp::ADDRESS as gov_address;
use namada::ledger::governance::{
storage as gov_storage, ADDRESS as gov_address,
};
use namada::ledger::slash_fund::ADDRESS as slash_fund_address;
use namada::ledger::storage::types::encode;
use namada::ledger::storage::{DBIter, StorageHasher, DB};
Expand Down
4 changes: 2 additions & 2 deletions apps/src/lib/wallet/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn addresses_from_genesis(genesis: GenesisConfig) -> Vec<(Alias, Address)> {
let mut addresses: Vec<(Alias, Address)> = vec![
("pos".into(), pos::ADDRESS),
("pos_slash_pool".into(), pos::SLASH_POOL_ADDRESS),
("governance".into(), governance::vp::ADDRESS),
("governance".into(), governance::ADDRESS),
("eth_bridge".into(), eth_bridge::vp::ADDRESS),
];
// Genesis validators
Expand Down Expand Up @@ -113,7 +113,7 @@ mod dev {
let mut addresses: Vec<(Alias, Address)> = vec![
("pos".into(), pos::ADDRESS),
("pos_slash_pool".into(), pos::SLASH_POOL_ADDRESS),
("governance".into(), governance::vp::ADDRESS),
("governance".into(), governance::ADDRESS),
("validator".into(), validator_address()),
("albert".into(), albert_address()),
("bertha".into(), bertha_address()),
Expand Down
Loading