Skip to content

Commit 4e20228

Browse files
authored
fix: miscellaneous (#167)
* Update Candid interface * Redact absolute paths in logs
1 parent 9a04b36 commit 4e20228

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

candid/evm_rpc.did

+1-2
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,9 @@ type LogEntry = record {
8787
removed : bool;
8888
};
8989
type ManageProviderArgs = record {
90+
providerId : nat64;
9091
"service" : opt RpcService;
91-
owner : opt principal;
9292
primary : opt bool;
93-
providerId : nat64;
9493
};
9594
type Metrics = record {
9695
requests : vec record { record { text; text }; nat64 };

src/main.rs

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::ffi::OsStr;
2+
13
use candid::candid_method;
24
use cketh_common::eth_rpc::{Block, FeeHistory, LogEntry, RpcError, SendRawTransactionResult};
35

@@ -256,8 +258,24 @@ fn http_request(request: AssetHttpRequest) -> AssetHttpResponse {
256258
}
257259
}
258260

259-
log.entries
260-
.retain(|entry| entry.timestamp >= max_skip_timestamp);
261+
log.entries = log
262+
.entries
263+
.into_iter()
264+
.filter(|entry| entry.timestamp >= max_skip_timestamp)
265+
.map(|mut entry| {
266+
// Remove absolute file paths
267+
if !entry.file.starts_with("src/") {
268+
entry.file = format!(
269+
".../{}",
270+
std::path::Path::new(&OsStr::new(&entry.file))
271+
.file_name()
272+
.and_then(|s| s.to_str())
273+
.unwrap_or("<unknown>"),
274+
);
275+
}
276+
entry
277+
})
278+
.collect();
261279

262280
fn ordering_from_query_params(sort: Option<&str>, max_skip_timestamp: u64) -> Sort {
263281
match sort {

0 commit comments

Comments
 (0)