Skip to content

Commit

Permalink
add rpc limiter & ip blocklist (#2584)
Browse files Browse the repository at this point in the history
* add rpc limiter & ip blocklist

* add rpc limiter & ip blocklist

* test ci

* fix test

* fix test
  • Loading branch information
wow-sven authored Sep 8, 2024
1 parent 57ebcfd commit 69e03e7
Show file tree
Hide file tree
Showing 22 changed files with 1,042 additions and 235 deletions.
112 changes: 112 additions & 0 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ thiserror = "1.0.63"
tiny-keccak = { version = "2", features = ["keccak", "sha3"] }
tiny-bip39 = "1.0.0"
tokio = { version = "1.40.0", features = ["full"] }
tokio-util = "0.7.10"
tonic = { version = "0.8", features = ["gzip"] }
tracing = "0.1.37"
tracing-appender = "0.2.2"
Expand All @@ -237,16 +238,19 @@ prometheus-http-query = { version = "0.6.6", default_features = false, features
] }
prometheus-parse = { git = "https://github.com/asonnino/prometheus-parser.git", rev = "75334db" }
coarsetime = "0.1.22"
hyper = { version = "0.14.12", features = ["full"] }
hyper = { version = "1.0.0", features = ["full"] }
num_enum = "0.7.3"
libc = "^0.2"
include_dir = { version = "0.6.2" }
nostr = "0.22"
serde-reflection = "0.3.6"
serde-generate = "0.25.1"
bcs-ext = { path = "moveos/moveos-commons/bcs_ext" }
http = "1.0.0"
tower = { version = "0.4.13", features = ["full", "util", "timeout", "load-shed", "limit"] }
tower-http = { version = "0.5.2", features = ["cors", "full", "trace", "set-header", "propagate-header"] }
tower_governor = "0.4.2"
pin-project = "1.0.12"
mirai-annotations = "1.12.0"
lru = "0.11.0"
bs58 = "0.5.1"
Expand Down
8 changes: 8 additions & 0 deletions crates/rooch-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ pub struct RoochOpt {
#[clap(long, default_value_t, value_enum)]
pub service_status: ServiceStatus,

#[clap(long)]
pub traffic_burst_size: Option<u32>,

#[clap(long)]
pub traffic_per_second: Option<u64>,

#[serde(skip)]
#[clap(skip)]
base: Option<Arc<BaseConfig>>,
Expand Down Expand Up @@ -168,6 +174,8 @@ impl RoochOpt {
proposer_account: None,
da: DAConfig::default(),
service_status: ServiceStatus::default(),
traffic_per_second: None,
traffic_burst_size: None,
base: None,
};
opt.init()?;
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-open-rpc-spec-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ rand = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
rooch-rpc-api = { workspace = true }
rooch-open-rpc = { workspace = true }
rooch-open-rpc = { workspace = true }
10 changes: 8 additions & 2 deletions crates/rooch-rpc-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rust-version = { workspace = true }
anyhow = { workspace = true }
bcs = { workspace = true }
coerce = { workspace = true }
dashmap = { workspace = true }
hex = { workspace = true }
jsonrpsee = { workspace = true }
serde_json = { workspace = true }
Expand All @@ -26,9 +27,14 @@ axum = { workspace = true }
log = { workspace = true }
prometheus = { workspace = true }
bitcoincore-rpc = { workspace = true }

tokio = { workspace = true }
tokio-util = { workspace = true }
hyper = { workspace = true }
tower_governor = { workspace = true }
http = { workspace = true }
move-core-types = { workspace = true }
move-resource-viewer = { workspace = true }
pin-project = { workspace = true }

moveos = { workspace = true }
moveos-types = { workspace = true }
Expand All @@ -51,4 +57,4 @@ rooch-db = { workspace = true }
rooch-open-rpc = { workspace = true }
rooch-open-rpc-spec-builder = { workspace = true }
rooch-event = { workspace = true }
tokio = { workspace = true }
futures = "0.3.30"
Loading

0 comments on commit 69e03e7

Please sign in to comment.