fvm_shared/consensus/mod.rs
1// Copyright 2021-2023 Protocol Labs
2// SPDX-License-Identifier: Apache-2.0, MIT
3use num_derive::FromPrimitive;
4
5use super::{Address, ChainEpoch};
6
7/// Result of checking two headers for a consensus fault.
8#[derive(Clone, Debug)]
9pub struct ConsensusFault {
10 /// Address of the miner at fault (always an ID address).
11 pub target: Address,
12 /// Epoch of the fault, which is the higher epoch of the two blocks causing it.
13 pub epoch: ChainEpoch,
14 /// Type of fault.
15 pub fault_type: ConsensusFaultType,
16}
17
18/// Consensus fault types in VM.
19#[derive(FromPrimitive, Clone, Copy, Debug)]
20#[repr(u8)]
21pub enum ConsensusFaultType {
22 DoubleForkMining = 1,
23 ParentGrinding = 2,
24 TimeOffsetMining = 3,
25}