Skip to content

Commit

Permalink
Add ValidatorOperatorConfigResource
Browse files Browse the repository at this point in the history
Closes: aptos-labs#5388
Approved by: dmitri-perelman
  • Loading branch information
moeziniaf authored and bors-libra committed Jul 30, 2020
1 parent 5727a7e commit 7f141c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion types/src/account_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
event::EventHandle,
libra_timestamp::LibraTimestampResource,
on_chain_config::{ConfigurationResource, OnChainConfig, RegisteredCurrencies, ValidatorSet},
validator_config::ValidatorConfigResource,
validator_config::{ValidatorConfigResource, ValidatorOperatorConfigResource},
};
use anyhow::{bail, Error, Result};
use move_core_types::{identifier::Identifier, move_resource::MoveResource};
Expand Down Expand Up @@ -79,6 +79,12 @@ impl AccountState {
self.get_resource(&ValidatorConfigResource::resource_path())
}

pub fn get_validator_operator_config_resource(
&self,
) -> Result<Option<ValidatorOperatorConfigResource>> {
self.get_resource(&ValidatorOperatorConfigResource::resource_path())
}

pub fn get_freezing_bit(&self) -> Result<Option<FreezingBit>> {
self.get_resource(&FreezingBit::resource_path())
}
Expand Down
12 changes: 11 additions & 1 deletion types/src/validator_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use move_core_types::move_resource::MoveResource;
use proptest_derive::Arbitrary;
use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, Serialize, Clone, Eq, PartialEq)]
#[derive(Debug, Deserialize, Serialize, Clone, Eq, PartialEq, Default)]
pub struct ValidatorConfigResource {
pub validator_config: Option<ValidatorConfig>,
pub delegated_account: Option<AccountAddress>,
Expand All @@ -21,6 +21,16 @@ impl MoveResource for ValidatorConfigResource {
const STRUCT_NAME: &'static str = "ValidatorConfig";
}

#[derive(Debug, Deserialize, Serialize, Clone, Eq, PartialEq, Default)]
pub struct ValidatorOperatorConfigResource {
pub human_name: Vec<u8>,
}

impl MoveResource for ValidatorOperatorConfigResource {
const MODULE_NAME: &'static str = "ValidatorOperatorConfig";
const STRUCT_NAME: &'static str = "ValidatorOperatorConfig";
}

#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[cfg_attr(any(test, feature = "fuzzing"), derive(Arbitrary))]
pub struct ValidatorConfig {
Expand Down

0 comments on commit 7f141c7

Please sign in to comment.