Assessment reports>Chainflip Backend>Threat Model>Function: witness_at_epoch

Function: witness_at_epoch

This is the main entry point for witnessers to acknowledge a call on chain in the multi-sig.

Votes are stored in the Votes pallet storage at a specific index for each voter. A voter can only vote once, and once the threshold of voters has been reached, the call is either made using the dispatch_call function or the call is scheduled in WitnessCallsScheduledForDispatch if the SafeMode pallet specifies not to dispatch the call.

If the epoch_index of the witnessed call is less than or equal to the last expired epoch, the witnessed call does not execute. The following code also constrains epoch_index to ensure it is less than or equal to the current epoch index:

let index = T::EpochInfo::authority_index(epoch_index, &who.into()) .ok_or(Error::::UnauthorisedWitness)? as usize;

Scheduled calls are executed in the on_idle if sufficient weight remains at the end of each block and SafeMode permits it.

Zellic © 2024Back to top ↑