pub struct KeyManager<LI, S> { /* private fields */ }

Implementations§

source§

impl<LI, S> KeyManager<LI, S>where LI: DiemInterface, S: KVStorage + CryptoStorage,

source

pub fn new( diem: LI, storage: S, time_service: TimeService, rotation_period_secs: u64, sleep_period_secs: u64, txn_expiration_secs: u64, chain_id: ChainId ) -> Self

source

pub fn execute(&mut self) -> Result<(), Error>

Begins execution of the key manager by running an infinite loop where the key manager will periodically wake up, verify the state of the validator keys (e.g., the consensus key), and initiate a key rotation when required. If something goes wrong that we can’t handle, an error will be returned by this method, upon which the key manager will flag the error and stop execution.

source

pub fn execute_once(&mut self) -> Result<(), Error>

Checks the current state of the validator keys and performs any actions that might be required (e.g., performing a key rotation).

source

pub fn compare_storage_to_config(&self) -> Result<(), Error>

source

pub fn compare_info_to_config(&self) -> Result<(), Error>

source

pub fn last_reconfiguration(&self) -> Result<u64, Error>

source

pub fn last_rotation(&self) -> Result<u64, Error>

source

pub fn diem_timestamp(&self) -> Result<u64, Error>

source

pub fn resubmit_consensus_key_transaction(&mut self) -> Result<(), Error>

source

pub fn rotate_consensus_key(&mut self) -> Result<Ed25519PublicKey, Error>

source

pub fn submit_key_rotation_transaction( &mut self, consensus_key: Ed25519PublicKey ) -> Result<Ed25519PublicKey, Error>

source

pub fn evaluate_status(&mut self) -> Result<Action, Error>

Evaluates the current status of the key manager by performing various state checks between secure storage and the blockchain.

Note: every time this function is called, the diem_timestamp registered on-chain must be strictly monotonically increasing. This helps to ensure that the blockchain is making progress. Otherwise, if no progress is being made on-chain, a reconfiguration event is unlikely, and the key manager will be unable to rotate keys.

source

pub fn perform_action(&mut self, action: Action) -> Result<(), Error>

Auto Trait Implementations§

§

impl<LI, S> RefUnwindSafe for KeyManager<LI, S>where LI: RefUnwindSafe, S: RefUnwindSafe,

§

impl<LI, S> Send for KeyManager<LI, S>where LI: Send, S: Send,

§

impl<LI, S> Sync for KeyManager<LI, S>where LI: Sync, S: Sync,

§

impl<LI, S> Unpin for KeyManager<LI, S>where LI: Unpin, S: Unpin,

§

impl<LI, S> UnwindSafe for KeyManager<LI, S>where LI: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more