Skip to content

Commit f0fc841

Browse files
committed
chore: fix warnings
1 parent 0fd0036 commit f0fc841

File tree

26 files changed

+155
-194
lines changed

26 files changed

+155
-194
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ jobs:
161161
run: |
162162
set -eo pipefail
163163
target="${{ matrix.target }}"
164-
164+
flags=()
165+
166+
if [[ "$target" != *msvc* && "$target" != "aarch64-unknown-linux-gnu" ]]; then
167+
flags+=(--features jemalloc)
168+
fi
169+
165170
[[ "$target" == *windows* ]] && exe=".exe"
166171
167172
if [[ "$target" == *windows* ]]; then
@@ -171,9 +176,9 @@ jobs:
171176
fi
172177
173178
if [[ "${{ env.BUILD_TYPE }}" == "release" ]]; then
174-
RUST_BACKTRACE=1 CMAKE_TOOLCHAIN_FILE="$CMAKE_TOOLCHAIN_FILE" cargo build --release --target "$target" -vv
179+
RUST_BACKTRACE=1 CMAKE_TOOLCHAIN_FILE="$CMAKE_TOOLCHAIN_FILE" cargo build --release --target "$target" "${flags[@]}" -vv
175180
else
176-
RUST_BACKTRACE=1 CMAKE_TOOLCHAIN_FILE="$CMAKE_TOOLCHAIN_FILE" cargo build --target "$target" -vv
181+
RUST_BACKTRACE=1 CMAKE_TOOLCHAIN_FILE="$CMAKE_TOOLCHAIN_FILE" cargo build --target "$target" "${flags[@]}" -vv
177182
fi
178183
179184
- name: Smoke Test
@@ -603,8 +608,6 @@ jobs:
603608
604609
if [[ "$target" != *msvc* && "$target" != "aarch64-unknown-linux-gnu" ]]; then
605610
flags+=(--features jemalloc)
606-
else
607-
flags+=(--features reth)
608611
fi
609612
610613
if [[ "$target" == *windows* ]]; then

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,14 @@ anyhow = "1.0.98"
1515
alloy = { version = "1.0.36", features = ["full", "signer-mnemonic", "signer-keystore", "eips", "eip712"] }
1616
alloy-rlp = "0.3.12"
1717
alloy-eips = "1.0.36"
18+
19+
[profile.release]
20+
lto = "fat"
21+
codegen-units = 1
22+
incremental = false
23+
24+
[profile.maxperf]
25+
inherits = "release"
26+
lto = "fat"
27+
codegen-units = 1
28+
incremental = false

crates/cli/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,5 @@ tikv-jemalloc-ctl = { version = "0.6.0", optional = true }
3232
tikv-jemallocator = { version = "0.6.0", optional = true }
3333
rand = "0.8.5"
3434

35-
36-
[profile.release]
37-
lto = "fat"
38-
codegen-units = 1
39-
incremental = false
40-
4135
[features]
4236
jemalloc = ["dep:tikv-jemallocator", "dep:tikv-jemalloc-ctl"]

crates/cli/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ config_pause:
4444
cargo run -- config --path $(CURDIR)/../../playground/example pause --relayer-id 7ed18611-1739-4a5f-99e3-e70356029984
4545
config_unpause:
4646
cargo run -- config --path $(CURDIR)/../../playground/example unpause --relayer-id 7ed18611-1739-4a5f-99e3-e70356029984
47-
# TODO: How to set back to EIP-1559
4847
config_gas_latest:
4948
cargo run -- config --path $(CURDIR)/../../playground/example gas --relayer-id 7ed18611-1739-4a5f-99e3-e70356029984 latest
5049
config_gas_legacy:

crates/core/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,3 @@ hmac = "0.12"
4949
sha2 = "0.10"
5050
p256 = { version = "0.13", features = ["ecdsa"] }
5151
tower = "0.5.2"
52-
53-
[profile.maxperf]
54-
inherits = "release"
55-
lto = "fat"
56-
codegen-units = 1
57-
incremental = false

crates/core/src/authentication/basic_auth.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ impl BasicAuthCredentials {
8080

8181
/// Authenticated marker - just indicates that basic auth passed
8282
#[derive(Debug)]
83+
#[allow(dead_code)]
8384
pub struct Authenticated;
8485

8586
/// Basic auth extractor that validates server-wide credentials

crates/core/src/logger.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ pub fn setup_info_logger() {
9393
setup_logger(LevelFilter::INFO);
9494
}
9595

96+
#[allow(dead_code)]
9697
pub fn mark_shutdown_started() {
9798
SHUTDOWN_IN_PROGRESS.store(true, Ordering::Relaxed);
9899
}
99100

101+
#[allow(dead_code)]
100102
pub struct LoggerGuard;
101103

102104
impl Drop for LoggerGuard {

crates/core/src/middleware/authenticated.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use tracing::error;
1717
/// }
1818
/// ```
1919
#[derive(Clone)]
20+
#[allow(dead_code)]
2021
pub struct Authenticated;
2122

2223
#[async_trait]
Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use crate::common_types::EvmAddress;
22
use axum::http::HeaderMap;
33

4-
use super::types::{
5-
RateLimitDetectContext, RateLimitDetectMethod, RateLimitError, TransactionType,
6-
};
4+
use super::types::{RateLimitDetectContext, RateLimitError};
75

86
pub const RATE_LIMIT_HEADER_NAME: &str = "x-rrelayer-rate-limit-key";
97

@@ -24,57 +22,13 @@ impl RateLimitDetector {
2422
if let Some(header_value) =
2523
headers.get(RATE_LIMIT_HEADER_NAME).and_then(|v| v.to_str().ok())
2624
{
27-
return Ok(RateLimitDetectContext {
28-
key: header_value.to_string(),
29-
detection_method: RateLimitDetectMethod::Header,
30-
transaction_type: TransactionType::Direct,
31-
});
25+
return Ok(RateLimitDetectContext { key: header_value.to_string() });
3226
}
3327

3428
if self.fallback_to_relayer {
35-
return Ok(RateLimitDetectContext {
36-
key: relayer_address.hex(),
37-
detection_method: RateLimitDetectMethod::Fallback,
38-
transaction_type: TransactionType::Direct,
39-
});
29+
return Ok(RateLimitDetectContext { key: relayer_address.hex() });
4030
}
4131

4232
Err(RateLimitError::NoRateLimitKey)
4333
}
4434
}
45-
46-
#[cfg(test)]
47-
mod tests {
48-
use super::*;
49-
use axum::http::HeaderMap;
50-
use std::str::FromStr;
51-
52-
#[test]
53-
fn test_header_detection() {
54-
let detector = RateLimitDetector::new(false);
55-
56-
let mut headers = HeaderMap::new();
57-
headers.insert("x-rrelayer-rate-limit-key", "user-123".parse().unwrap());
58-
59-
let relayer_address =
60-
EvmAddress::from_str("0x742d35Cc6aF6C5C8c3C4B4C8e1A36F1c57F1b8Ff").unwrap();
61-
let result = detector.detect(&headers, &relayer_address).unwrap();
62-
63-
assert_eq!(result.key, "user-123");
64-
assert!(matches!(result.detection_method, RateLimitDetectMethod::Header));
65-
}
66-
67-
#[test]
68-
fn test_fallback_detection() {
69-
let detector = RateLimitDetector::new(true);
70-
71-
let headers = HeaderMap::new();
72-
let relayer_address =
73-
EvmAddress::from_str("0x1234567890123456789012345678901234567890").unwrap();
74-
75-
let result = detector.detect(&headers, &relayer_address).unwrap();
76-
77-
assert_eq!(result.key, format!("{:?}", relayer_address));
78-
assert!(matches!(result.detection_method, RateLimitDetectMethod::Fallback));
79-
}
80-
}

crates/core/src/rate_limiting/rate_limiter.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::{
22
detection::RateLimitDetector,
3-
types::{RateLimitDetectContext, RateLimitError, RateLimitOperation, RateLimitResult},
3+
types::{RateLimitError, RateLimitOperation, RateLimitResult},
44
};
55
use crate::app_state::AppState;
66
use crate::relayer::get_relayer;
@@ -165,7 +165,6 @@ impl RateLimiter {
165165
rate_limiter: self,
166166
user_key: user_key.clone(),
167167
operation,
168-
context,
169168
relayer_address: *relayer_address,
170169
reserved: true,
171170
})
@@ -499,7 +498,6 @@ pub struct RateLimitReservation<'a> {
499498
rate_limiter: &'a RateLimiter,
500499
user_key: String,
501500
operation: RateLimitOperation,
502-
context: RateLimitDetectContext,
503501
relayer_address: EvmAddress,
504502
reserved: bool,
505503
}

0 commit comments

Comments
 (0)