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

Fix governance bugs #2133

Merged
merged 5 commits into from
Nov 11, 2023
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
2 changes: 1 addition & 1 deletion proof_of_stake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ pub fn is_delegator<S>(
epoch: Option<namada_core::types::storage::Epoch>,
) -> storage_api::Result<bool>
where
S: StorageRead + StorageWrite,
S: StorageRead,
{
let prefix = bonds_for_source_prefix(address);
match epoch {
Expand Down
18 changes: 5 additions & 13 deletions shared/src/ledger/governance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,21 +669,13 @@ where
epoch: Epoch,
verifiers: &BTreeSet<Address>,
address: &Address,
delegation_address: &Address,
_delegation_address: &Address,
) -> Result<bool> {
let bond_handle = pos::namada_proof_of_stake::bond_handle(
Ok(pos::namada_proof_of_stake::is_delegator(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could also add a check if address != delegation_address

&self.ctx.pre(),
address,
delegation_address,
);
let params =
pos::namada_proof_of_stake::read_pos_params(&self.ctx.pre())?;
let bond = bond_handle.get_sum(&self.ctx.pre(), epoch, &params)?;

if bond.is_some() && verifiers.contains(address) {
Ok(true)
} else {
Ok(false)
}
Some(epoch),
)? && verifiers.contains(address))
}
}

Expand Down
Loading