Trait penumbra_governance::component::StateReadExt

source ·
pub trait StateReadExt: StateRead + StateReadExt {
Show 34 methods // Provided methods fn is_upgrade_height<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn get_governance_params<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<GovernanceParameters>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn next_proposal_id<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn proposal_definition<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<Proposal>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn proposal_payload<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<ProposalPayload>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn proposal_deposit_amount<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<Amount>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn proposal_state<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<ProposalState>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn unfinished_proposals<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<BTreeSet<u64>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn validator_vote<'life0, 'async_trait>( &'life0 self, proposal_id: u64, identity_key: IdentityKey ) -> Pin<Box<dyn Future<Output = Result<Option<Vote>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn proposal_voting_start<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn proposal_voting_end<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn proposal_voting_start_position<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<Position>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn total_voting_power_at_proposal_start<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn check_nullifier_unvoted_for_proposal<'life0, 'life1, 'async_trait>( &'life0 self, proposal_id: u64, nullifier: &'life1 Nullifier ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn rate_data_at_proposal_start<'life0, 'async_trait>( &'life0 self, proposal_id: u64, identity_key: IdentityKey ) -> Pin<Box<dyn Future<Output = Result<Option<RateData>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn check_proposal_votable<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn check_proposal_started_at_position<'life0, 'async_trait>( &'life0 self, proposal_id: u64, claimed_position: Position ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn check_nullifier_unspent_before_start_block_height<'life0, 'life1, 'async_trait>( &'life0 self, proposal_id: u64, nullifier: &'life1 Nullifier ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn validator_by_delegation_asset<'life0, 'async_trait>( &'life0 self, asset_id: Id ) -> Pin<Box<dyn Future<Output = Result<IdentityKey>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn check_unbonded_amount_correct_exchange_for_proposal<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, proposal_id: u64, value: &'life1 Value, unbonded_amount: &'life2 Amount ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn check_height_in_future_of_voting_end<'life0, 'async_trait>( &'life0 self, height: u64 ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn check_validator_has_not_voted<'life0, 'life1, 'async_trait>( &'life0 self, proposal_id: u64, identity_key: &'life1 IdentityKey ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn check_governance_key_matches_validator<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, identity_key: &'life1 IdentityKey, governance_key: &'life2 GovernanceKey ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn check_proposal_claimable<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn check_proposal_claim_valid_deposit<'life0, 'async_trait>( &'life0 self, proposal_id: u64, claim_deposit_amount: Amount ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn validator_voting_power_at_proposal_start<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<IdentityKey, u64>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn check_validator_active_at_proposal_start<'life0, 'life1, 'async_trait>( &'life0 self, proposal_id: u64, identity_key: &'life1 IdentityKey ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn validator_votes<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<IdentityKey, Vote>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn tallied_delegator_votes<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<IdentityKey, Tally>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn current_tally<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Tally>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn param_changes_for_height<'life0, 'async_trait>( &'life0 self, height: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<ParameterChange>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn proposal_started(&self) -> bool { ... } fn is_chain_halted<'life0, 'async_trait>( &'life0 self, total_halt_count: u64 ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn halt_count<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... }
}
Available on crate feature component only.

Provided Methods§

source

fn is_upgrade_height<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Returns true if the next height is an upgrade height. We look-ahead to the next height because we want to halt the chain immediately after committing the block.

source

fn get_governance_params<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<GovernanceParameters>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Gets the governance parameters from the JMT.

source

fn next_proposal_id<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the id of the next proposal in the sequence of ids.

source

fn proposal_definition<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<Proposal>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the proposal definition for a proposal.

source

fn proposal_payload<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<ProposalPayload>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the proposal payload for a proposal.

source

fn proposal_deposit_amount<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<Amount>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the proposal deposit amount for a proposal.

source

fn proposal_state<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<ProposalState>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the state of a proposal.

source

fn unfinished_proposals<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<BTreeSet<u64>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get all the unfinished proposal ids.

source

fn validator_vote<'life0, 'async_trait>( &'life0 self, proposal_id: u64, identity_key: IdentityKey ) -> Pin<Box<dyn Future<Output = Result<Option<Vote>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the vote of a validator on a particular proposal.

source

fn proposal_voting_start<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the proposal voting start block for a given proposal.

source

fn proposal_voting_end<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the proposal voting end block for a given proposal.

source

fn proposal_voting_start_position<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<Position>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the proposal voting start block for a given proposal.

source

fn total_voting_power_at_proposal_start<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the total voting power across all validators.

source

fn check_nullifier_unvoted_for_proposal<'life0, 'life1, 'async_trait>( &'life0 self, proposal_id: u64, nullifier: &'life1 Nullifier ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check whether a nullifier was spent for a given proposal.

source

fn rate_data_at_proposal_start<'life0, 'async_trait>( &'life0 self, proposal_id: u64, identity_key: IdentityKey ) -> Pin<Box<dyn Future<Output = Result<Option<RateData>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get the RateData for a validator at the start height of a given proposal.

source

fn check_proposal_votable<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Throw an error if the proposal is not votable.

source

fn check_proposal_started_at_position<'life0, 'async_trait>( &'life0 self, proposal_id: u64, claimed_position: Position ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Throw an error if the proposal was not started at the claimed position.

source

fn check_nullifier_unspent_before_start_block_height<'life0, 'life1, 'async_trait>( &'life0 self, proposal_id: u64, nullifier: &'life1 Nullifier ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Throw an error if the nullifier was spent before the proposal started.

source

fn validator_by_delegation_asset<'life0, 'async_trait>( &'life0 self, asset_id: Id ) -> Pin<Box<dyn Future<Output = Result<IdentityKey>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Look up the validator for a given asset ID, if it is a delegation token.

source

fn check_unbonded_amount_correct_exchange_for_proposal<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, proposal_id: u64, value: &'life1 Value, unbonded_amount: &'life2 Amount ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Throw an error if the exchange between the value and the unbonded amount isn’t correct for the proposal given.

source

fn check_height_in_future_of_voting_end<'life0, 'async_trait>( &'life0 self, height: u64 ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

source

fn check_validator_has_not_voted<'life0, 'life1, 'async_trait>( &'life0 self, proposal_id: u64, identity_key: &'life1 IdentityKey ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check that the validator has not voted on the proposal.

source

fn check_governance_key_matches_validator<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, identity_key: &'life1 IdentityKey, governance_key: &'life2 GovernanceKey ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Check that the governance key matches the validator’s identity key.

source

fn check_proposal_claimable<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Check that a deposit claim could be made on the proposal.

source

fn check_proposal_claim_valid_deposit<'life0, 'async_trait>( &'life0 self, proposal_id: u64, claim_deposit_amount: Amount ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Check that the deposit claim amount matches the proposal’s deposit amount.

source

fn validator_voting_power_at_proposal_start<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<IdentityKey, u64>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get all the active validator voting power for the proposal.

source

fn check_validator_active_at_proposal_start<'life0, 'life1, 'async_trait>( &'life0 self, proposal_id: u64, identity_key: &'life1 IdentityKey ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check whether a validator was active at the start of a proposal, and fail if not.

source

fn validator_votes<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<IdentityKey, Vote>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get all the validator votes for the proposal.

source

fn tallied_delegator_votes<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<IdentityKey, Tally>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get all the tallied delegator votes for the proposal (excluding those which have been cast but not tallied).

source

fn current_tally<'life0, 'async_trait>( &'life0 self, proposal_id: u64 ) -> Pin<Box<dyn Future<Output = Result<Tally>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Add up all the currently tallied votes (without tallying any cast votes that haven’t been tallied yet).

source

fn param_changes_for_height<'life0, 'async_trait>( &'life0 self, height: u64 ) -> Pin<Box<dyn Future<Output = Result<Option<ParameterChange>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Gets the parameter changes scheduled for the given height, if any.

source

fn proposal_started(&self) -> bool

Check if any proposal is started in this block.

source

fn is_chain_halted<'life0, 'async_trait>( &'life0 self, total_halt_count: u64 ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

source

fn halt_count<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Object Safety§

This trait is not object safe.

Implementors§