#protocols #round #manul

no-std manul

Generic library for round-based protocols

4 releases (2 breaking)

new 0.2.1 May 5, 2025
0.2.0 Apr 7, 2025
0.1.0 Nov 19, 2024
0.0.1 Oct 12, 2024

#1002 in Cryptography

Download history 128/week @ 2025-01-15 40/week @ 2025-01-22 54/week @ 2025-01-29 18/week @ 2025-02-05 8/week @ 2025-02-12 1/week @ 2025-03-12 159/week @ 2025-04-02 50/week @ 2025-04-09 8/week @ 2025-04-16 22/week @ 2025-04-23 193/week @ 2025-04-30

310 downloads per month
Used in synedrion

AGPL-3.0-or-later

235KB
4.5K SLoC

Round-based distributed protocols

crate Docs License Build Status Coveralls

The body is round

Goals

  • Sans-I/O API. That is, bring your own async libraries, or don't.
  • Generic over signer/verifier/signature types, so you can use whatever your blockchain uses.
  • Support parallelization where possible, to offload expensive cryptographic operations into spawned tasks (but since it's Sans-I/O, it's up to you to make use of that functionality).
  • Provide tools for unit and integration testing of the protocols.
  • Support generating malicious behavior proofs with bundled signed messages.
  • Support caching messages intended for the next round and then applying them when it starts (since some nodes can finalize a round before others and send out a new batch of messages).

Assumptions

We try to find the balance between supporting the majority of protocols and keeping the API simple. Currently we operate under the following assumptions:

  • A protocol consists of several rounds.
  • A round generates messages to send out without any additional external input, then waits for messages from other parties. When it receives enough messages, it can be finalized.
  • On finalization, a round can return the result, halt with an error, or continue to another round.
  • Each round declares a set of parties it sends messages to. Then it can optionally send a direct message to each party in the set, send a regular broadcast to all parties in the set, or send an echo-broadcast to all parties in the set (that is, a broadcast where it is ensured that all parties received the same thing). Any number of these options can be picked.

Dependencies

~1.9–8.5MB
~86K SLoC