Skip to content

Commit

Permalink
[Push CDN] Add whitelist update binary (#2815)
Browse files Browse the repository at this point in the history
* update pcdn, add whitelist adapter

* remove capnproto dependency

* remove self hosted ARM

* add self-hosted arm back

* use other orchestrator function
  • Loading branch information
rob-maron authored Mar 21, 2024
1 parent 573a54a commit 98ac462
Show file tree
Hide file tree
Showing 22 changed files with 194 additions and 121 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,5 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler capnproto
- name: Audit Dependencies
run: cargo audit
5 changes: 0 additions & 5 deletions .github/workflows/build-and-test-self-hosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ jobs:
runs-on: [self-hosted]
container: ghcr.io/espressosystems/devops-rust:stable
steps:
- name: Install Cap'n'Proto
run: |
apt-get update
apt-get install -y capnproto
- uses: actions/checkout@v4
name: Checkout Repository

Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ jobs:
shared-key: ""
prefix-key: ${{ matrix.just_variants }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler capnproto
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
Expand Down Expand Up @@ -84,11 +79,6 @@ jobs:
steps:
- uses: actions/checkout@v4
name: Checkout Repository

- name: Install Cap'n'Proto
run: |
apt-get update
apt-get install -y capnproto

- uses: Swatinem/rust-cache@v2
name: Enable Rust Caching
Expand Down Expand Up @@ -262,10 +252,6 @@ jobs:
shared-key: ""
prefix-key: ${{ matrix.just_variants }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler capnproto
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler capnproto
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/lint-self-hosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ jobs:
runs-on: [self-hosted]
container: ghcr.io/espressosystems/devops-rust:stable
steps:
- name: Install Cap'n'Proto
run: |
apt-get update
apt-get install -y capnproto
- uses: actions/checkout@v4
name: Checkout Repository

Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ jobs:
shared-key: ""
prefix-key: ${{ matrix.just_variants }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler capnproto
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
Expand Down
22 changes: 5 additions & 17 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ anyhow = "1.0.81"


# Push CDN imports
cdn-client = { git = "https://github.com/EspressoSystems/Push-CDN", tag = "0.1.9" }
cdn-broker = { git = "https://github.com/EspressoSystems/Push-CDN", tag = "0.1.9" }
cdn-marshal = { git = "https://github.com/EspressoSystems/Push-CDN", tag = "0.1.9" }
cdn-client = { git = "https://github.com/EspressoSystems/Push-CDN", tag = "0.1.11" }
cdn-broker = { git = "https://github.com/EspressoSystems/Push-CDN", tag = "0.1.11" }
cdn-marshal = { git = "https://github.com/EspressoSystems/Push-CDN", tag = "0.1.11" }

### Profiles
###
Expand Down
6 changes: 4 additions & 2 deletions crates/examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ path = "push-cdn/broker.rs"
name = "marshal-push-cdn"
path = "push-cdn/marshal.rs"

[[example]]
name = "whitelist-push-cdn"
path = "push-cdn/whitelist-adapter.rs"

[dependencies]
async-broadcast = { workspace = true }
async-compatibility-layer = { workspace = true }
Expand Down Expand Up @@ -137,7 +141,6 @@ cdn-broker = { workspace = true, features = [
"insecure",
"runtime-tokio",
"strong_consistency",
"local_discovery",
] }
cdn-marshal = { workspace = true, features = ["insecure", "runtime-tokio"] }

Expand All @@ -148,7 +151,6 @@ cdn-broker = { workspace = true, features = [
"insecure",
"runtime-async-std",
"strong_consistency",
"local_discovery",
] }
cdn-marshal = { workspace = true, features = ["insecure", "runtime-async-std"] }

Expand Down
18 changes: 6 additions & 12 deletions crates/examples/push-cdn/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ pub mod types;
use crate::infra::{read_orchestrator_init_config, run_orchestrator, OrchestratorArgs};
use crate::types::{DANetwork, NodeImpl, QuorumNetwork, ThisRun};
use async_compatibility_layer::art::async_spawn;
use cdn_broker::reexports::connection::protocols::{Quic, Tcp};
use cdn_broker::reexports::crypto::signature::KeyPair;
use cdn_broker::Broker;
use cdn_marshal::Marshal;
use hotshot::traits::implementations::WrappedSignatureKey;
use hotshot::traits::implementations::{TestingDef, WrappedSignatureKey};
use hotshot::types::SignatureKey;
use hotshot_example_types::state_types::TestTypes;
use hotshot_orchestrator::client::ValidatorArgs;
Expand Down Expand Up @@ -79,12 +78,8 @@ async fn main() {

// Create and spawn the broker
async_spawn(async move {
let broker: Broker<
WrappedSignatureKey<<TestTypes as NodeType>::SignatureKey>,
WrappedSignatureKey<<TestTypes as NodeType>::SignatureKey>,
Tcp,
Quic,
> = Broker::new(config).await.expect("broker failed to start");
let broker: Broker<TestingDef<TestTypes>> =
Broker::new(config).await.expect("broker failed to start");

// Error if we stopped unexpectedly
if let Err(err) = broker.start().await {
Expand All @@ -106,10 +101,9 @@ async fn main() {

// Spawn the marshal
async_spawn(async move {
let marshal: Marshal<WrappedSignatureKey<<TestTypes as NodeType>::SignatureKey>, Quic> =
Marshal::new(marshal_config)
.await
.expect("failed to spawn marshal");
let marshal: Marshal<TestingDef<TestTypes>> = Marshal::new(marshal_config)
.await
.expect("failed to spawn marshal");

// Error if we stopped unexpectedly
if let Err(err) = marshal.start().await {
Expand Down
11 changes: 2 additions & 9 deletions crates/examples/push-cdn/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
//! a `Broker` object.
use anyhow::{Context, Result};
use cdn_broker::reexports::connection::protocols::{Quic, Tcp};
use cdn_broker::{reexports::crypto::signature::KeyPair, Broker, Config, ConfigBuilder};
use clap::Parser;
use hotshot::traits::implementations::WrappedSignatureKey;
use hotshot::traits::implementations::{ProductionDef, WrappedSignatureKey};
use hotshot::types::SignatureKey;
use hotshot_example_types::node_types::TestTypes;
use hotshot_types::traits::node_implementation::NodeType;
Expand Down Expand Up @@ -80,13 +79,7 @@ async fn main() -> Result<()> {

// Create new `Broker`
// Uses TCP from broker connections and Quic for user connections.
let broker = Broker::<
WrappedSignatureKey<<TestTypes as NodeType>::SignatureKey>,
WrappedSignatureKey<<TestTypes as NodeType>::SignatureKey>,
Tcp,
Quic,
>::new(broker_config)
.await?;
let broker = Broker::<ProductionDef<TestTypes>>::new(broker_config).await?;

// Start the main loop, consuming it
broker.start().await?;
Expand Down
8 changes: 2 additions & 6 deletions crates/examples/push-cdn/marshal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
//! a `Marshal` object with the `HotShot` types.
//!
use anyhow::{Context, Result};
use cdn_broker::reexports::connection::protocols::Quic;
use cdn_marshal::{ConfigBuilder, Marshal};
use clap::Parser;
use hotshot::traits::implementations::WrappedSignatureKey;
use hotshot::traits::implementations::ProductionDef;
use hotshot_example_types::node_types::TestTypes;
use hotshot_types::traits::node_implementation::NodeType;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
Expand Down Expand Up @@ -41,9 +39,7 @@ async fn main() -> Result<()> {
.with_context(|| "failed to build Marshal config")?;

// Create new `Marshal` from the config
let marshal =
Marshal::<WrappedSignatureKey<<TestTypes as NodeType>::SignatureKey>, Quic>::new(config)
.await?;
let marshal = Marshal::<ProductionDef<TestTypes>>::new(config).await?;

// Start the main loop, consuming it
marshal.start().await?;
Expand Down
3 changes: 1 addition & 2 deletions crates/examples/push-cdn/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::infra::PushCdnDaRun;
use hotshot::traits::implementations::PushCdnNetwork;
use hotshot::traits::{implementations::PushCdnNetwork, NodeImplementation};
use hotshot_example_types::{state_types::TestTypes, storage_types::TestStorage};
use hotshot_types::traits::node_implementation::NodeImplementation;
use serde::{Deserialize, Serialize};

#[derive(Clone, Deserialize, Serialize, Hash, PartialEq, Eq)]
Expand Down
Loading

0 comments on commit 98ac462

Please sign in to comment.