Skip to content

Commit 9258365

Browse files
committed
propagate cache_size as u64
1 parent 699a21a commit 9258365

4 files changed

Lines changed: 7 additions & 9 deletions

File tree

crates/balance-overrides/src/approval/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,13 @@ impl Detector {
203203
web3: Web3,
204204
probing_depth: u8,
205205
verification_timeout: Duration,
206-
cache_size: usize,
206+
cache_size: u64,
207207
) -> Self {
208-
let max_capacity = u64::try_from(cache_size).expect("cache_size is not a valid u64");
209208
Self {
210209
web3,
211210
probing_depth,
212211
verification_timeout,
213-
cache: Cache::builder().max_capacity(max_capacity).build(),
212+
cache: Cache::builder().max_capacity(cache_size).build(),
214213
}
215214
}
216215

crates/balance-overrides/src/balance/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,13 @@ impl Detector {
245245
web3: Web3,
246246
probing_depth: u8,
247247
verification_timeout: Duration,
248-
cache_size: usize,
248+
cache_size: u64,
249249
) -> Self {
250-
let max_capacity = u64::try_from(cache_size).expect("cache_size is not a valid u64");
251250
Self {
252251
web3,
253252
probing_depth,
254253
verification_timeout,
255-
cache: Cache::builder().max_capacity(max_capacity).build(),
254+
cache: Cache::builder().max_capacity(cache_size).build(),
256255
}
257256
}
258257

crates/balance-overrides/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl StateOverrides {
4444
web3: ethrpc::Web3,
4545
probing_depth: u8,
4646
verification_timeout: std::time::Duration,
47-
cache_size: usize,
47+
cache_size: u64,
4848
) -> Self {
4949
Self {
5050
balance_detector: balance::Detector::new(

crates/configs/src/price_estimation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ const fn default_probing_depth() -> u8 {
214214
60
215215
}
216216

217-
const fn default_cache_size() -> usize {
217+
const fn default_cache_size() -> u64 {
218218
1000
219219
}
220220

@@ -234,7 +234,7 @@ pub struct BalanceOverridesConfig {
234234
/// Controls for how many tokens we store the result of the automatic
235235
/// balance override detection before evicting less used entries.
236236
#[serde(default = "default_cache_size")]
237-
pub cache_size: usize,
237+
pub cache_size: u64,
238238

239239
/// Maximum time to wait for each balance override strategy verification
240240
/// before giving up. Some tokens (e.g. reflection tokens) can cause the

0 commit comments

Comments
 (0)