Crate noble_im_online[][src]

I’m online Module

If the local node is a validator (i.e. contains an authority key), this module gossips a heartbeat transaction with each new session. The heartbeat functions as a simple mechanism to signal that the node is online in the current era.

Received heartbeats are tracked for one era and reset with each new era. The module exposes two public functions to query if a heartbeat has been received in the current era or session.

The heartbeat is a signed transaction, which was signed using the session key and includes the recent best block number of the local validators chain as well as the NetworkState. It is submitted as an Unsigned Transaction via off-chain workers.

Interface

Public Functions

  • is_online - True if the validator sent a heartbeat in the current session.

Usage

use fabric_support::{decl_module, dispatch};
use fabric_system::ensure_signed;
use noble_im_online::{self as im_online};

pub trait Config: im_online::Config {}

decl_module! {
	pub struct Module<T: Config> for enum Call where origin: T::Origin {
		#[weight = 0]
		pub fn is_online(origin, authority_index: u32) -> dispatch::DispatchResult {
			let _sender = ensure_signed(origin)?;
			let _is_online = <im_online::Module<T>>::is_online(authority_index);
			Ok(())
		}
	}
}

Dependencies

This module depends on the Session module.

Re-exports

pub use weights::WeightInfo;
pub use $crate::traits::GetNobleVersion as _;

Modules

ed25519
sr25519
weights

Weights for noble_im_online THIS FILE WAS AUTO-GENERATED USING THE TETCORE BENCHMARK CLI VERSION 2.0.0 DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some(“dev”), DB CACHE: 128

Structs

GenesisConfig

Genesis config for the module, allow to build genesis storage.

Heartbeat

Heartbeat which is sent/received.

Module
UnresponsivenessOffence

An offence that is filed if a validator didn’t send a heartbeat message.

Enums

Call

Dispatchable calls.

Error

Error for the im-online module.

RawEvent

Events for this module.

Traits

Config

Type Definitions

AuthIndex
Event

RawEvent specialized for the configuration Config