diff --git a/consensus/src/tests/context.rs b/consensus/src/tests/context.rs index f254c04f..bbf7bb0d 100644 --- a/consensus/src/tests/context.rs +++ b/consensus/src/tests/context.rs @@ -32,7 +32,7 @@ async fn context_invalidated_on_new_block() -> Result<(), tower::BoxError> { const BLOCKCHAIN_HEIGHT: usize = 6000; let mut runner = TestRunner::default(); - let db = arb_dummy_database(BLOCKCHAIN_HEIGHT.try_into().unwrap()) + let db = arb_dummy_database(BLOCKCHAIN_HEIGHT) .new_tree(&mut runner) .unwrap() .current(); @@ -74,7 +74,7 @@ async fn context_height_correct() -> Result<(), tower::BoxError> { const BLOCKCHAIN_HEIGHT: usize = 6000; let mut runner = TestRunner::default(); - let db = arb_dummy_database(BLOCKCHAIN_HEIGHT.try_into().unwrap()) + let db = arb_dummy_database(BLOCKCHAIN_HEIGHT) .new_tree(&mut runner) .unwrap() .current(); diff --git a/consensus/src/tests/context/difficulty.rs b/consensus/src/tests/context/difficulty.rs index a855ed89..a79ae9b7 100644 --- a/consensus/src/tests/context/difficulty.rs +++ b/consensus/src/tests/context/difficulty.rs @@ -101,7 +101,7 @@ prop_compose! { let (timestamps, mut cumulative_difficulties): (Vec<_>, Vec<_>) = blocks.into_iter().unzip(); cumulative_difficulties.sort_unstable(); DifficultyCache { - last_accounted_height: timestamps.len().try_into().unwrap(), + last_accounted_height: timestamps.len(), config: TEST_DIFFICULTY_CONFIG, timestamps: timestamps.into(), // we generate cumulative_difficulties in range 0..u64::MAX as if the generated values are close to u128::MAX @@ -162,7 +162,7 @@ proptest! { let mut timestamps: VecDeque = timestamps.into(); let diff_cache = DifficultyCache { - last_accounted_height: (TEST_WINDOW -1).try_into().unwrap(), + last_accounted_height: TEST_WINDOW -1, config: TEST_DIFFICULTY_CONFIG, timestamps: timestamps.clone(), // we dont need cumulative_difficulties diff --git a/consensus/src/tests/mock_db.rs b/consensus/src/tests/mock_db.rs index 8dc97e60..4af99c89 100644 --- a/consensus/src/tests/mock_db.rs +++ b/consensus/src/tests/mock_db.rs @@ -150,7 +150,7 @@ impl Service for DummyDatabase { async move { Ok(match req { BCReadRequest::BlockExtendedHeader(id) => { - let mut id = usize::try_from(id).unwrap(); + let mut id = id; if let Some(dummy_height) = dummy_height { let block_len = blocks.read().unwrap().len();