Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CDN] Rate limiting - DDoS protection #3774

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
70 changes: 25 additions & 45 deletions Cargo.lock

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

27 changes: 13 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version = "0.5.79" # same as `hotshot`, but workspace subcrate can also release its own version
authors = ["Espresso Systems <hello@espressosys.com>"]
edition = "2021"
rust-version = "1.76.0"
rust-version = "1.80.0"
homepage = "https://github.com/EspressoSystems/HotShot"
documentation = "https://hotshot.docs.espressosys.com"
repository = "https://github.com/EspressoSystems/HotShot"
Expand All @@ -12,21 +12,21 @@ repository = "https://github.com/EspressoSystems/HotShot"
# when implementing traits externally
[workspace]
members = [
"crates/builder-api",
"crates/example-types",
"crates/examples",
"crates/fakeapi",
"crates/hotshot",
"crates/hotshot-stake-table",
"crates/libp2p-networking",
"crates/macros",
"crates/orchestrator"
,
"crates/task",
"crates/task-impls",
"crates/testing",
"crates/examples",
"crates/example-types",
"crates/types",
"crates/builder-api",
"crates/fakeapi",
"crates/utils",
"crates/orchestrator"
]
"crates/utils"]
resolver = "2"

[workspace.dependencies]
Expand Down Expand Up @@ -55,7 +55,7 @@ espresso-systems-common = { git = "https://github.com/espressosystems/espresso-s
ethereum-types = { version = "0.14", default-features = false, features = [
"serialize",
] }
derive_more = { version = "1.0", features = ["from"] }
derive_more = { version = "1.0", features = ["from", "deref"] }
futures = { version = "0.3", default-features = false }
jf-crhf = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5" }
jf-vid = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5" }
Expand Down Expand Up @@ -114,12 +114,11 @@ tokio = { version = "1", default-features = false, features = [
] }
anyhow = "1"


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

### Profiles
###
Expand Down
5 changes: 2 additions & 3 deletions crates/builder-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
name = "hotshot-builder-api"
version = "0.1.7"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
async-trait = { workspace = true }
clap = { workspace = true }
committable = { workspace = true }
derive_more = { workspace = true }
futures = { workspace = true }
hotshot-types = { path = "../types" }
serde = { workspace = true }
thiserror = { workspace = true }
tagged-base64 = { workspace = true }
thiserror = { workspace = true }
tide-disco = { workspace = true }
toml = { workspace = true }
Comment on lines 8 to 18
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cargo-sort did this

committable = { workspace = true }
vbs = { workspace = true }
18 changes: 9 additions & 9 deletions crates/example-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ slow-tests = []
gpu-vid = ["hotshot-task-impls/gpu-vid"]

[dependencies]
async-trait = { workspace = true }
anyhow = { workspace = true }
sha3 = "^0.10"
async-lock = { workspace = true }
async-trait = { workspace = true }
committable = { workspace = true }
hotshot = { path = "../hotshot" }
hotshot-types = { path = "../types" }
hotshot-task-impls = { path = "../task-impls", version = "0.5.36", default-features = false }
hotshot-types = { path = "../types" }
jf-vid = { workspace = true }
rand = { workspace = true }
thiserror = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true }
sha2 = { workspace = true }
sha3 = "^0.10"
thiserror = { workspace = true }
time = { workspace = true }
async-lock = { workspace = true }
jf-vid = { workspace = true }
vbs = { workspace = true }
url = { workspace = true }
reqwest = { workspace = true }
tokio = { workspace = true }
url = { workspace = true }
vbs = { workspace = true }
Comment on lines -15 to +32
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also cargo-sort

4 changes: 2 additions & 2 deletions crates/examples/combined/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use cdn_broker::{reexports::def::hook::NoMessageHook, Broker};
use cdn_marshal::Marshal;
use hotshot::{
helpers::initialize_logging,
traits::implementations::{KeyPair, TestingDef, WrappedSignatureKey},
traits::implementations::{HotShotMessageHook, KeyPair, TestingDef, WrappedSignatureKey},
types::SignatureKey,
};
use hotshot_example_types::{node_types::TestVersions, state_types::TestTypes};
Expand Down Expand Up @@ -82,7 +82,7 @@ async fn main() {
private_key: broker_private_key.clone(),
},

user_message_hook: NoMessageHook,
user_message_hook: HotShotMessageHook::default(),
broker_message_hook: NoMessageHook,

metrics_bind_endpoint: None,
Expand Down
5 changes: 2 additions & 3 deletions crates/examples/push-cdn/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ use cdn_broker::{
reexports::{crypto::signature::KeyPair, def::hook::NoMessageHook},
Broker,
};

use cdn_marshal::Marshal;
use hotshot::{
helpers::initialize_logging,
traits::implementations::{TestingDef, WrappedSignatureKey},
traits::implementations::{HotShotMessageHook, TestingDef, WrappedSignatureKey},
types::SignatureKey,
};
use hotshot_example_types::{node_types::TestVersions, state_types::TestTypes};
Expand Down Expand Up @@ -94,7 +93,7 @@ async fn main() {
private_key: broker_private_key.clone(),
},

user_message_hook: NoMessageHook,
user_message_hook: HotShotMessageHook::default(),
broker_message_hook: NoMessageHook,

metrics_bind_endpoint: None,
Expand Down
6 changes: 4 additions & 2 deletions crates/examples/push-cdn/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use anyhow::Result;
use cdn_broker::{reexports::def::hook::NoMessageHook, Broker, Config};
use clap::Parser;
use hotshot::traits::implementations::{KeyPair, ProductionDef, WrappedSignatureKey};
use hotshot::traits::implementations::{
HotShotMessageHook, KeyPair, ProductionDef, WrappedSignatureKey,
};
use hotshot_example_types::node_types::TestTypes;
use hotshot_types::traits::{node_implementation::NodeType, signature_key::SignatureKey};
use sha2::Digest;
Expand Down Expand Up @@ -103,7 +105,7 @@ async fn main() -> Result<()> {
private_key,
},

user_message_hook: NoMessageHook,
user_message_hook: HotShotMessageHook::default(),
broker_message_hook: NoMessageHook,

public_bind_endpoint: args.public_bind_endpoint,
Expand Down
1 change: 1 addition & 0 deletions crates/hotshot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ url = { workspace = true }
num_enum = "0.7"
parking_lot = "0.12"
utils = { path = "../utils" }
gcr = "0.1"

tokio = { workspace = true }
cdn-client = { workspace = true }
Expand Down
6 changes: 4 additions & 2 deletions crates/hotshot/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ pub mod implementations {
},
memory_network::{MasterMap, MemoryNetwork},
push_cdn_network::{
CdnMetricsValue, KeyPair, ProductionDef, PushCdnNetwork, TestingDef, Topic as CdnTopic,
WrappedSignatureKey,
definition::message_hook::HotShotMessageHook,
definition::signature_key::WrappedSignatureKey, definition::ProductionDef,
definition::TestingDef, definition::Topic as CdnTopic, metrics::CdnMetricsValue,
KeyPair, PushCdnNetwork,
},
};
}
Loading