arcium-core-utils 0.4.1

Arcium core utils
Documentation
use serde::{Deserialize, Serialize};
use wincode::{SchemaRead, SchemaWrite};

/// Upper bound on the number of peers supported for the MXE key recovery.
/// The block length n of the Reed-Solomon code is at most N.
pub const MXE_KEY_RECOVERY_N: usize = 100;

/// Upper bound on the message length k of the Reed-Solomon code.
/// If an adversary controls k or more peers then he can reconstruct the key shares.
/// If the number of controlled peers is greater than (d-1)/2 then the adversary can
/// sabotage the key recovery and the peers will never get caught.
pub const MXE_KEY_RECOVERY_K: usize = (MXE_KEY_RECOVERY_N - 1) / 3 + 1;

/// Upper bound on the distance d of the Reed-Solomon code.
/// The key recovery can identify and correct up to (d-1)/2 corrupt peers.
/// If n mod 3 = 0 then k = (d-1)/2, i.e., if an adversary controls k peers then
/// the key is recoverable (the corrupt peers can be identified), but the MXE is
/// expected to be compromised.
pub const MXE_KEY_RECOVERY_D: usize = MXE_KEY_RECOVERY_N - MXE_KEY_RECOVERY_K + 1;

#[derive(
    Debug, Clone, PartialEq, Serialize, Deserialize, SchemaRead, SchemaWrite, thiserror::Error,
)]
pub enum KeyRecoveryError {
    #[error("Invalid input: {0}")]
    InvalidInput(String),
    #[error("Failed recovery: {0}")]
    FailedRecovery(String),
}

pub mod compute_errors;