mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-18 16:55:16 +00:00
Document a pair of panics requiring 256 GB of RAM/4 GB of a context
This commit is contained in:
parent
7a8f8c2d3d
commit
09d96822ca
3 changed files with 6 additions and 0 deletions
|
@ -31,6 +31,8 @@ pub fn clone_without<K: Clone + std::cmp::Eq + std::hash::Hash, V: Clone>(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Recover the secret from a collection of keys.
|
/// Recover the secret from a collection of keys.
|
||||||
|
///
|
||||||
|
/// This will panic if no keys, an insufficient amount of keys, or the wrong keys are provided.
|
||||||
pub fn recover_key<C: Ciphersuite>(keys: &HashMap<Participant, ThresholdKeys<C>>) -> C::F {
|
pub fn recover_key<C: Ciphersuite>(keys: &HashMap<Participant, ThresholdKeys<C>>) -> C::F {
|
||||||
let first = keys.values().next().expect("no keys provided");
|
let first = keys.values().next().expect("no keys provided");
|
||||||
assert!(keys.len() >= first.params().t().into(), "not enough keys provided");
|
assert!(keys.len() >= first.params().t().into(), "not enough keys provided");
|
||||||
|
|
|
@ -89,6 +89,8 @@ impl<C: Ciphersuite> SchnorrAggregate<C> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write a SchnorrAggregate to something implementing Write.
|
/// Write a SchnorrAggregate to something implementing Write.
|
||||||
|
///
|
||||||
|
/// This will panic if more than 4 billion signatures were aggregated.
|
||||||
pub fn write<W: Write>(&self, writer: &mut W) -> io::Result<()> {
|
pub fn write<W: Write>(&self, writer: &mut W) -> io::Result<()> {
|
||||||
writer.write_all(
|
writer.write_all(
|
||||||
&u32::try_from(self.Rs.len())
|
&u32::try_from(self.Rs.len())
|
||||||
|
|
|
@ -60,6 +60,8 @@ pub struct Schnorrkel {
|
||||||
|
|
||||||
impl Schnorrkel {
|
impl Schnorrkel {
|
||||||
/// Create a new algorithm with the specified context.
|
/// Create a new algorithm with the specified context.
|
||||||
|
///
|
||||||
|
/// If the context is greater than or equal to 4 GB in size, this will panic.
|
||||||
pub fn new(context: &'static [u8]) -> Schnorrkel {
|
pub fn new(context: &'static [u8]) -> Schnorrkel {
|
||||||
Schnorrkel {
|
Schnorrkel {
|
||||||
context,
|
context,
|
||||||
|
|
Loading…
Reference in a new issue