Skip to content
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f00fbcf
continue on updated codec
patrick-ogrady Apr 15, 2025
1c9e1be
progress
patrick-ogrady Apr 15, 2025
b595449
add range bounds
patrick-ogrady Apr 15, 2025
3cb809c
progress
patrick-ogrady Apr 15, 2025
4a046dc
types compiles
patrick-ogrady Apr 15, 2025
42a2454
use usize as config
patrick-ogrady Apr 15, 2025
dfc21f5
voter compiles
patrick-ogrady Apr 15, 2025
dde58ac
remove [
patrick-ogrady Apr 15, 2025
95d49e3
voter test passing
patrick-ogrady Apr 15, 2025
11b677e
add TODO
patrick-ogrady Apr 15, 2025
25d46aa
resolver compiles
patrick-ogrady Apr 15, 2025
d8885df
only parse fetch limit in one place
patrick-ogrady Apr 15, 2025
605c396
code compiles
patrick-ogrady Apr 15, 2025
3056ae6
fix insert() usage
patrick-ogrady Apr 15, 2025
0cfa6e6
[consensus] Migrate `ordered-broadcast` (#737)
patrick-ogrady Apr 15, 2025
4e8a6e2
[consensus/threshold-simplex] Add `sign()` (#742)
patrick-ogrady Apr 15, 2025
12d86d7
[consensus] Migrate `simplex` (#743)
patrick-ogrady Apr 17, 2025
2c549a3
[examples] Passing (#758)
patrick-ogrady Apr 17, 2025
02bbca5
[consensus] Simplify `namespace` Usage (#761)
patrick-ogrady Apr 17, 2025
33345eb
[consensus] Remove Duplicate Data from Conflicting Encoding (#763)
patrick-ogrady Apr 17, 2025
6ae6ce8
[consensus/types] Add comments (#766)
patrick-ogrady Apr 17, 2025
773d375
Merge branch 'main' into consensus-codec-migration
patrick-ogrady Apr 17, 2025
dcfb179
fix merge conflicts
patrick-ogrady Apr 17, 2025
b5a1a32
add debug + display to underlying bls types
patrick-ogrady Apr 17, 2025
3790e57
add comment for proposal
patrick-ogrady Apr 17, 2025
94b9813
use other-public
patrick-ogrady Apr 17, 2025
0b9ae71
[consensus] `codec` Migration Nits (#772)
patrick-ogrady Apr 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ commonware-codec = { workspace = true }
commonware-cryptography = { workspace = true }
commonware-utils = { workspace = true }
bytes = { workspace = true }
prost = { workspace = true }
cfg-if = { workspace = true }
thiserror = { workspace = true }
futures = { workspace = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
commonware-macros = { workspace = true }
Expand All @@ -26,14 +26,10 @@ commonware-runtime = { workspace = true }
commonware-storage = { workspace = true }
prometheus-client = { workspace = true }
governor = { workspace = true }
futures = { workspace = true }
rand = { workspace = true }
rand_distr = { workspace = true }
tracing = { workspace = true }

[build-dependencies]
prost-build = { workspace = true }

[dev-dependencies]
tracing-subscriber = { workspace = true }

Expand Down
23 changes: 0 additions & 23 deletions consensus/build.rs

This file was deleted.

48 changes: 11 additions & 37 deletions consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,10 @@
//! `commonware-consensus` is **ALPHA** software and is not yet recommended for production use. Developers should
//! expect breaking changes and occasional instability.

use bytes::Bytes;

pub mod ordered_broadcast;
pub mod simplex;
pub mod threshold_simplex;

/// Activity is specified by the underlying consensus implementation and can be interpreted if desired.
///
/// Examples of activity would be "vote", "finalize", or "fault". Various consensus implementations may
/// want to reward (or penalize) participation in different ways and in different places. For example,
/// validators could be required to send multiple types of messages (i.e. vote and finalize) and rewarding
/// both equally may better align incentives with desired behavior.
pub type Activity = u8;

/// Proof is a blob that attests to some data.
pub type Proof = Bytes;

cfg_if::cfg_if! {
if #[cfg(not(target_arch = "wasm32"))] {
use commonware_utils::Array;
Expand All @@ -35,16 +22,6 @@ cfg_if::cfg_if! {
0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 3.0,
];

/// Parsed is a wrapper around a message that has a parsable digest.
#[derive(Clone)]
struct Parsed<Message, Digest> {
/// Raw message that has some field that can be parsed into a digest.
pub message: Message,

/// Parsed digest.
pub digest: Digest,
}

/// Automaton is the interface responsible for driving the consensus forward by proposing new payloads
/// and verifying payloads proposed by other participants.
pub trait Automaton: Clone + Send + 'static {
Expand Down Expand Up @@ -96,18 +73,18 @@ cfg_if::cfg_if! {
fn broadcast(&mut self, payload: Self::Digest) -> impl Future<Output = ()> + Send;
}

/// Committer is the interface responsible for handling notifications of payload status.
pub trait Committer: Clone + Send + 'static {
/// Hash of an arbitrary payload.
type Digest: Digest;

/// Event that a payload has made some progress towards finalization but is not yet finalized.
/// Reporter is the interface responsible for reporting activity to some external actor.
pub trait Reporter: Clone + Send + 'static {
/// Activity is specified by the underlying consensus implementation and can be interpreted if desired.
///
/// This is often used to provide an early ("best guess") confirmation to users.
fn prepared(&mut self, proof: Proof, payload: Self::Digest) -> impl Future<Output = ()> + Send;
/// Examples of activity would be "vote", "finalize", or "fault". Various consensus implementations may
/// want to reward (or penalize) participation in different ways and in different places. For example,
/// validators could be required to send multiple types of messages (i.e. vote and finalize) and rewarding
/// both equally may better align incentives with desired behavior.
type Activity;

/// Event indicating the container has been finalized.
fn finalized(&mut self, proof: Proof, payload: Self::Digest) -> impl Future<Output = ()> + Send;
/// Report some activity observed by the consensus implementation.
fn report(&mut self, activity: Self::Activity) -> impl Future<Output = ()> + Send;
}

/// Supervisor is the interface responsible for managing which participants are active at a given time.
Expand Down Expand Up @@ -140,9 +117,6 @@ cfg_if::cfg_if! {

// Indicate whether some candidate is a participant at the given view.
fn is_participant(&self, index: Self::Index, candidate: &Self::PublicKey) -> Option<u32>;

/// Report some activity observed by the consensus implementation.
fn report(&self, activity: Activity, proof: Proof) -> impl Future<Output = ()> + Send;
}

/// ThresholdSupervisor is the interface responsible for managing which `identity` (typically a group polynomial with
Expand Down Expand Up @@ -180,7 +154,7 @@ cfg_if::cfg_if! {
/// Monitor is used to implement mechanisms that share the same set of active participants as consensus and/or
/// perform some activity that requires some synchronization with the progress of consensus.
///
/// Monitor can be implemented using [`Committer`](crate::Committer) to avoid introducing complexity
/// Monitor can be implemented using [`Reporter`](crate::Reporter) to avoid introducing complexity
/// into any particular consensus implementation.
pub trait Monitor: Clone + Send + 'static {
/// Index is the type used to indicate the in-progress consensus decision.
Expand Down
Loading