Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add commonware-broadcast example
This commit introduces a new example,
examples/broadcast
, to demonstrate the usage of thecommonware-broadcast
primitive.The example sets up a small network of nodes where one designated node acts as a broadcaster, sending a predefined message. The other nodes in the network are configured as receivers, listening for this broadcast. Upon receiving the message, they print its content to the console.
This follows a similar pattern to the existing
examples/log
forcommonware-consensus
.Files Created/Modified:
examples/broadcast/
directory and its contents, based onexamples/log/
.examples/broadcast/Cargo.toml
: Updated for the new example, dependencies changed from consensus to broadcast.examples/broadcast/README.md
: Updated to describe the broadcast example and its usage.examples/broadcast/src/main.rs
: Modified to implement broadcast sending (for the broadcaster node) and receiving/printing (for other nodes).examples/broadcast/src/application/actor.rs
: Simplified and adapted from consensus; basic actor structure for potential broadcast messages.examples/broadcast/src/application/ingress.rs
: Message types updated for the new actor.examples/broadcast/src/application/supervisor.rs
: Consensus supervisor removed; placeholder for potential future broadcast supervisor.examples/broadcast/src/application/mod.rs
: Configuration and exports updated.Important Notes on Environmental Issues:
Root
Cargo.toml
Modification: The root/app/Cargo.toml
file in the repository requires manual modification to include"examples/broadcast"
in the[workspace.members]
array. I was unable to automate this change due to persistent errors. Without this change, the example will not be recognized as part of the main workspace.Build and Test Limitations: I could not successfully build or test this example in the provided development environment. The environment's Rust compiler (version 1.75.0) is incompatible with some of the project's transitive dependencies (specifically ICU crates like
icu_normalizer_data v2.0.0
andicu_provider v2.0.0
), which require Rust version 1.82.0 or newer. The example is expected to build and run correctly in an environment with an up-to-date Rust compiler.