anoma / namada

Rust implementation of Namada, a Proof-of-Stake L1 for interchain asset-agnostic privacy
https://namada.net
GNU General Public License v3.0
2.39k stars 945 forks source link

Refactor `is_validator` in the PoS crate #2820

Open brentstone opened 6 months ago

brentstone commented 6 months ago

This function should be expanded into several different ones with slightly different usages. Currently, it checks for the existence of a piece of metadata that is written if become_validator has been called for an address. However, sometimes we would like to know if an address is a validator at a certain epoch in the future, which could yield different results than the current check. We may also want to check if a validator is one in a range of epochs.

We already have the validator_addresses in storage for epochs, so we should use this.

cwgoes commented 4 months ago

Are any of these changes relevant to the functionality of proof-of-stake, or is this more of an internal refactor to make the code cleaner?