Skip to content

Commit 89ffdbf

Browse files
committed
catch up with main branch changes
1 parent 78f5eda commit 89ffdbf

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

crates/ibc/src/mock/context.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pub struct MockContextConfig {
231231
block_time: Duration,
232232

233233
#[builder(default = 5)]
234-
max_history_size: usize,
234+
max_history_size: u64,
235235

236236
latest_height: Height,
237237

@@ -254,7 +254,7 @@ impl From<MockContextConfig> for MockContext {
254254

255255
// Compute the number of blocks to store.
256256
let n = min(
257-
params.max_history_size as u64,
257+
params.max_history_size,
258258
params.latest_height.revision_height(),
259259
);
260260

@@ -420,7 +420,7 @@ impl MockContext {
420420
validator_history: &[Vec<TestgenValidator>],
421421
latest_height: Height,
422422
) -> Self {
423-
let max_history_size = validator_history.len() - 1;
423+
let max_history_size = validator_history.len() as u64 - 1;
424424

425425
assert_ne!(
426426
max_history_size, 0,
@@ -434,7 +434,7 @@ impl MockContext {
434434
);
435435

436436
assert!(
437-
max_history_size as u64 <= latest_height.revision_height(),
437+
max_history_size <= latest_height.revision_height(),
438438
"The number of blocks must be greater than the number of validator set histories"
439439
);
440440

@@ -455,25 +455,20 @@ impl MockContext {
455455
HostBlock::generate_block_with_validators(
456456
host_id.clone(),
457457
host_type,
458-
latest_height
459-
.sub(i as u64)
460-
.expect("Never fails")
461-
.revision_height(),
458+
latest_height.sub(i).expect("Never fails").revision_height(),
462459
next_block_timestamp
463-
.sub(Duration::from_secs(
464-
DEFAULT_BLOCK_TIME_SECS * (i as u64 + 1),
465-
))
460+
.sub(Duration::from_secs(DEFAULT_BLOCK_TIME_SECS * (i + 1)))
466461
.expect("Never fails"),
467-
&validator_history[max_history_size - 1 - i],
468-
&validator_history[max_history_size - i],
462+
&validator_history[(max_history_size - i) as usize - 1],
463+
&validator_history[(max_history_size - i) as usize],
469464
)
470465
})
471466
.collect();
472467

473468
MockContext {
474469
host_chain_type: host_type,
475470
host_chain_id: host_id.clone(),
476-
max_history_size: max_history_size as u64,
471+
max_history_size,
477472
history,
478473
block_time,
479474
ibc_store: Arc::new(Mutex::new(MockIbcStore::default())),

0 commit comments

Comments
 (0)