hotshot_types/vid/
avidm.rs

1// Copyright (c) 2021-2024 Espresso Systems (espressosys.com)
2// This file is part of the HotShot repository.
3
4// You should have received a copy of the MIT License
5// along with the HotShot repository. If not, see <https://mit-license.org/>.
6
7//! Provides the implementation for AVID-M scheme
8
9use hotshot_utils::anytrace::*;
10
11pub type AvidMScheme = vid::avid_m::namespaced::NsAvidMScheme;
12pub type AvidMParam = vid::avid_m::namespaced::NsAvidMParam;
13pub type AvidMCommitment = vid::avid_m::namespaced::NsAvidMCommit;
14pub type AvidMShare = vid::avid_m::namespaced::NsAvidMShare;
15pub type AvidMCommon = AvidMParam;
16
17pub fn init_avidm_param(total_weight: usize) -> Result<AvidMParam> {
18    let recovery_threshold = total_weight.div_ceil(3);
19    AvidMParam::new(recovery_threshold, total_weight)
20        .map_err(|err| error!("Failed to initialize VID: {}", err.to_string()))
21}