hotshot_types/traits/
node_implementation.rs1use std::{fmt::Debug, hash::Hash};
8
9use serde::Deserialize;
10
11use super::{
12 ValidatedState,
13 block_contents::{BlockHeader, Transaction},
14 signature_key::{
15 BuilderSignatureKey, LCV1StateSignatureKey, LCV2StateSignatureKey, LCV3StateSignatureKey,
16 StateSignatureKey,
17 },
18};
19use crate::{
20 constants::DEFAULT_UPGRADE_CONSTANTS,
21 traits::{
22 BlockPayload, election::Membership, signature_key::SignatureKey, states::InstanceState,
23 },
24 upgrade_config::UpgradeConstants,
25};
26
27pub trait NodeType:
29 Clone
30 + Copy
31 + Debug
32 + Hash
33 + PartialEq
34 + Eq
35 + Default
36 + serde::Serialize
37 + for<'de> Deserialize<'de>
38 + Send
39 + Sync
40 + 'static
41{
42 const UPGRADE_CONSTANTS: UpgradeConstants = DEFAULT_UPGRADE_CONSTANTS;
44 type BlockHeader: BlockHeader<Self>;
46 type BlockPayload: BlockPayload<
50 Self,
51 Instance = Self::InstanceState,
52 Transaction = Self::Transaction,
53 ValidatedState = Self::ValidatedState,
54 >;
55 type SignatureKey: SignatureKey;
57 type Transaction: Transaction;
61
62 type InstanceState: InstanceState;
64
65 type ValidatedState: ValidatedState<Self, Instance = Self::InstanceState>;
67
68 type Membership: Membership<Self>;
70
71 type BuilderSignatureKey: BuilderSignatureKey;
73
74 type StateSignatureKey: StateSignatureKey
76 + LCV1StateSignatureKey
77 + LCV2StateSignatureKey
78 + LCV3StateSignatureKey;
79}