diff --git a/crates/cli/commands/src/init_state/mod.rs b/crates/cli/commands/src/init_state/mod.rs index c8038c14e3c79..57cf78c1f7507 100644 --- a/crates/cli/commands/src/init_state/mod.rs +++ b/crates/cli/commands/src/init_state/mod.rs @@ -128,10 +128,9 @@ impl> InitStateC let hash = init_from_state_dump(reader, provider_rw.clone(), config.stages.etl)?; - match Arc::try_unwrap(provider_rw) { - Ok(provider) => provider.commit()?, - Err(_) => eyre::bail!("could not unwrap provider"), - }; + let provider = + Arc::into_inner(provider_rw).ok_or_else(|| eyre::eyre!("could not unwrap provider"))?; + provider.commit()?; info!(target: "reth::cli", hash = ?hash, "Genesis block written"); Ok(()) diff --git a/crates/cli/commands/src/recover/storage_tries.rs b/crates/cli/commands/src/recover/storage_tries.rs index 59ebb32ea920f..57d2e624609e6 100644 --- a/crates/cli/commands/src/recover/storage_tries.rs +++ b/crates/cli/commands/src/recover/storage_tries.rs @@ -64,10 +64,10 @@ impl> Command ); } - match Arc::try_unwrap(provider) { - Ok(provider) => provider.commit()?, - Err(_) => eyre::bail!("could not unwrap provider"), - }; + let provider = + Arc::into_inner(provider).ok_or_else(|| eyre::eyre!("could not unwrap provider"))?; + provider.commit()?; + info!(target: "reth::cli", deleted = deleted_tries, "Finished recovery"); Ok(()) diff --git a/crates/cli/commands/src/stage/dump/execution.rs b/crates/cli/commands/src/stage/dump/execution.rs index fe32337b10539..3daa4eef47c39 100644 --- a/crates/cli/commands/src/stage/dump/execution.rs +++ b/crates/cli/commands/src/stage/dump/execution.rs @@ -151,8 +151,10 @@ fn unwind_and_copy( }, )?; - let unwind_inner_tx = Arc::try_unwrap(provider) - .unwrap_or(db_tool.provider_factory.database_provider_rw()?) + let unwind_inner_tx = Arc::into_inner(provider) + .unwrap_or_else(|| { + db_tool.provider_factory.database_provider_rw().expect("failed to create new provider") + }) .into_tx(); output_db diff --git a/crates/cli/commands/src/stage/dump/hashing_account.rs b/crates/cli/commands/src/stage/dump/hashing_account.rs index 1e31533b4bb35..3a8595c566963 100644 --- a/crates/cli/commands/src/stage/dump/hashing_account.rs +++ b/crates/cli/commands/src/stage/dump/hashing_account.rs @@ -67,8 +67,10 @@ fn unwind_and_copy( bad_block: None, }, )?; - let unwind_inner_tx = Arc::try_unwrap(provider) - .unwrap_or(db_tool.provider_factory.database_provider_rw()?) + let unwind_inner_tx = Arc::into_inner(provider) + .unwrap_or_else(|| { + db_tool.provider_factory.database_provider_rw().expect("failed to create new provider") + }) .into_tx(); output_db.update(|tx| tx.import_table::(&unwind_inner_tx))??; diff --git a/crates/cli/commands/src/stage/dump/hashing_storage.rs b/crates/cli/commands/src/stage/dump/hashing_storage.rs index bc900ade491df..f77ca632cb63e 100644 --- a/crates/cli/commands/src/stage/dump/hashing_storage.rs +++ b/crates/cli/commands/src/stage/dump/hashing_storage.rs @@ -58,8 +58,10 @@ fn unwind_and_copy( bad_block: None, }, )?; - let unwind_inner_tx = Arc::try_unwrap(provider) - .unwrap_or(db_tool.provider_factory.database_provider_rw()?) + let unwind_inner_tx = Arc::into_inner(provider) + .unwrap_or_else(|| { + db_tool.provider_factory.database_provider_rw().expect("failed to create new provider") + }) .into_tx(); // TODO optimize we can actually just get the entries we need for both these tables diff --git a/crates/cli/commands/src/stage/dump/merkle.rs b/crates/cli/commands/src/stage/dump/merkle.rs index ea93b935370a5..dc38423280459 100644 --- a/crates/cli/commands/src/stage/dump/merkle.rs +++ b/crates/cli/commands/src/stage/dump/merkle.rs @@ -133,8 +133,10 @@ fn unwind_and_copy( .execute(provider.clone(), execute_input) .unwrap(); - let unwind_inner_tx = Arc::try_unwrap(provider) - .unwrap_or(db_tool.provider_factory.database_provider_rw()?) + let unwind_inner_tx = Arc::into_inner(provider) + .unwrap_or_else(|| { + db_tool.provider_factory.database_provider_rw().expect("failed to create new provider") + }) .into_tx(); // TODO optimize we can actually just get the entries we need diff --git a/crates/cli/commands/src/stage/unwind.rs b/crates/cli/commands/src/stage/unwind.rs index aed23ecead6b8..3bf5a48201c67 100644 --- a/crates/cli/commands/src/stage/unwind.rs +++ b/crates/cli/commands/src/stage/unwind.rs @@ -100,10 +100,9 @@ impl> Command provider.save_finalized_block_number(target)?; } - match Arc::try_unwrap(provider) { - Ok(provider) => provider.commit()?, - Err(_) => eyre::bail!("could not unwrap provider"), - }; + let provider = Arc::into_inner(provider) + .ok_or_else(|| eyre::eyre!("could not unwrap provider"))?; + provider.commit()?; } info!(target: "reth::cli", ?target, "Unwound blocks"); diff --git a/crates/optimism/cli/src/commands/init_state.rs b/crates/optimism/cli/src/commands/init_state.rs index 2b12988f067be..b8a1c626b3ba7 100644 --- a/crates/optimism/cli/src/commands/init_state.rs +++ b/crates/optimism/cli/src/commands/init_state.rs @@ -81,10 +81,9 @@ impl> InitStateCommandOp { let reader = BufReader::new(reth_fs_util::open(self.init_state.state)?); let hash = init_from_state_dump(reader, provider_rw.clone(), config.stages.etl)?; - match Arc::try_unwrap(provider_rw) { - Ok(provider) => provider.commit()?, - Err(_) => eyre::bail!("could not unwrap provider"), - }; + let provider = + Arc::into_inner(provider_rw).ok_or_else(|| eyre::eyre!("could not unwrap provider"))?; + provider.commit()?; info!(target: "reth::cli", hash = ?hash, "Genesis block written"); Ok(()) diff --git a/crates/prune/prune/src/pruner.rs b/crates/prune/prune/src/pruner.rs index 69ac5f1b23df1..2f2e7d59b37ed 100644 --- a/crates/prune/prune/src/pruner.rs +++ b/crates/prune/prune/src/pruner.rs @@ -332,12 +332,9 @@ where pub fn run(&mut self, tip_block_number: BlockNumber) -> PrunerResult { let provider = Arc::new(self.provider_factory.database_provider_rw()?); let result = self.run_with_provider(provider.clone(), tip_block_number); - match Arc::try_unwrap(provider) { - Ok(provider) => provider.commit()?, - Err(_) => { - return Err(PrunerError::Provider(reth_errors::ProviderError::Commit)); - } - }; + let provider = Arc::into_inner(provider) + .ok_or(PrunerError::Provider(reth_errors::ProviderError::Commit))?; + provider.commit()?; result } } diff --git a/crates/prune/prune/src/segments/receipts.rs b/crates/prune/prune/src/segments/receipts.rs index b615433b3db82..2c589910e5298 100644 --- a/crates/prune/prune/src/segments/receipts.rs +++ b/crates/prune/prune/src/segments/receipts.rs @@ -184,7 +184,7 @@ mod tests { result.checkpoint.unwrap().as_prune_checkpoint(prune_mode), ) .unwrap(); - Arc::try_unwrap(provider).unwrap().commit().expect("commit"); + Arc::into_inner(provider).unwrap().commit().expect("commit"); let last_pruned_block_number = blocks .iter() diff --git a/crates/prune/prune/src/segments/static_file/headers.rs b/crates/prune/prune/src/segments/static_file/headers.rs index 01ce002f7cba3..907fa1ef1e134 100644 --- a/crates/prune/prune/src/segments/static_file/headers.rs +++ b/crates/prune/prune/src/segments/static_file/headers.rs @@ -285,7 +285,7 @@ mod tests { result.checkpoint.unwrap().as_prune_checkpoint(prune_mode), ) .unwrap(); - Arc::try_unwrap(provider).unwrap().commit().expect("commit"); + Arc::into_inner(provider).unwrap().commit().expect("commit"); let last_pruned_block_number = to_block.min( next_block_number_to_prune + diff --git a/crates/prune/prune/src/segments/static_file/transactions.rs b/crates/prune/prune/src/segments/static_file/transactions.rs index 77d7ade16bc17..fde01b1100b61 100644 --- a/crates/prune/prune/src/segments/static_file/transactions.rs +++ b/crates/prune/prune/src/segments/static_file/transactions.rs @@ -176,7 +176,7 @@ mod tests { result.checkpoint.unwrap().as_prune_checkpoint(prune_mode), ) .unwrap(); - Arc::try_unwrap(provider).unwrap().commit().expect("commit"); + Arc::into_inner(provider).unwrap().commit().expect("commit"); let last_pruned_tx_number = blocks .iter() diff --git a/crates/prune/prune/src/segments/user/account_history.rs b/crates/prune/prune/src/segments/user/account_history.rs index 64c37db788012..2393998a6ebce 100644 --- a/crates/prune/prune/src/segments/user/account_history.rs +++ b/crates/prune/prune/src/segments/user/account_history.rs @@ -225,7 +225,7 @@ mod tests { result.checkpoint.unwrap().as_prune_checkpoint(prune_mode), ) .unwrap(); - Arc::try_unwrap(provider).unwrap().commit().expect("commit"); + Arc::into_inner(provider).unwrap().commit().expect("commit"); let changesets = changesets .iter() diff --git a/crates/prune/prune/src/segments/user/receipts_by_logs.rs b/crates/prune/prune/src/segments/user/receipts_by_logs.rs index 4b105ce8539d8..831aea1d4d22e 100644 --- a/crates/prune/prune/src/segments/user/receipts_by_logs.rs +++ b/crates/prune/prune/src/segments/user/receipts_by_logs.rs @@ -326,7 +326,7 @@ mod tests { limiter, }, ); - Arc::try_unwrap(provider).unwrap().commit().expect("commit"); + Arc::into_inner(provider).unwrap().commit().expect("commit"); assert_matches!(result, Ok(_)); let output = result.unwrap(); diff --git a/crates/prune/prune/src/segments/user/sender_recovery.rs b/crates/prune/prune/src/segments/user/sender_recovery.rs index 78bb672c95a2f..c20f678f79166 100644 --- a/crates/prune/prune/src/segments/user/sender_recovery.rs +++ b/crates/prune/prune/src/segments/user/sender_recovery.rs @@ -204,7 +204,7 @@ mod tests { result.checkpoint.unwrap().as_prune_checkpoint(prune_mode), ) .unwrap(); - Arc::try_unwrap(provider).unwrap().commit().expect("commit"); + Arc::into_inner(provider).unwrap().commit().expect("commit"); let last_pruned_block_number = last_pruned_block_number .checked_sub(if result.progress.is_finished() { 0 } else { 1 }); diff --git a/crates/prune/prune/src/segments/user/storage_history.rs b/crates/prune/prune/src/segments/user/storage_history.rs index bf6aaeaa6c3c5..e38f8389a5347 100644 --- a/crates/prune/prune/src/segments/user/storage_history.rs +++ b/crates/prune/prune/src/segments/user/storage_history.rs @@ -227,7 +227,7 @@ mod tests { result.checkpoint.unwrap().as_prune_checkpoint(prune_mode), ) .unwrap(); - Arc::try_unwrap(provider).unwrap().commit().expect("commit"); + Arc::into_inner(provider).unwrap().commit().expect("commit"); let changesets = changesets .iter() diff --git a/crates/prune/prune/src/segments/user/transaction_lookup.rs b/crates/prune/prune/src/segments/user/transaction_lookup.rs index aa650303aae8a..8241f4bd55124 100644 --- a/crates/prune/prune/src/segments/user/transaction_lookup.rs +++ b/crates/prune/prune/src/segments/user/transaction_lookup.rs @@ -229,7 +229,7 @@ mod tests { result.checkpoint.unwrap().as_prune_checkpoint(prune_mode), ) .unwrap(); - Arc::try_unwrap(provider).unwrap().commit().expect("commit"); + Arc::into_inner(provider).unwrap().commit().expect("commit"); let last_pruned_block_number = last_pruned_block_number .checked_sub(if result.progress.is_finished() { 0 } else { 1 }); diff --git a/crates/stages/stages/benches/criterion.rs b/crates/stages/stages/benches/criterion.rs index 3c42e88575944..418eaf3b6b555 100644 --- a/crates/stages/stages/benches/criterion.rs +++ b/crates/stages/stages/benches/criterion.rs @@ -185,7 +185,7 @@ fn measure_stage( .await .and_then(|_| stage.execute(provider.clone(), input)) .unwrap(); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); }, ) }); diff --git a/crates/stages/stages/benches/setup/mod.rs b/crates/stages/stages/benches/setup/mod.rs index 5f8f40aa0f49a..6c474f7149700 100644 --- a/crates/stages/stages/benches/setup/mod.rs +++ b/crates/stages/stages/benches/setup/mod.rs @@ -61,7 +61,7 @@ pub(crate) fn stage_unwind< }) .unwrap(); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); }) }); } @@ -85,7 +85,7 @@ where AccountHashingStage::default().execute(provider.clone(), input).unwrap(); StorageHashingStage::default().execute(provider.clone(), input).unwrap(); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); } // Helper for generating testdata for the benchmarks. @@ -184,7 +184,7 @@ pub(crate) fn txs_testdata(num_blocks: u64) -> TestStageDB { let root = { let provider = Arc::new(db.factory.provider_rw().unwrap()); let root = StateRoot::from_provider(provider.clone()).root().unwrap(); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); root }; diff --git a/crates/stages/stages/src/stages/execution.rs b/crates/stages/stages/src/stages/execution.rs index 95cd3f09cc218..d405be0fd3f29 100644 --- a/crates/stages/stages/src/stages/execution.rs +++ b/crates/stages/stages/src/stages/execution.rs @@ -854,7 +854,7 @@ mod tests { receipts_writer.increment_block(0).unwrap(); receipts_writer.commit().unwrap(); } - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); // insert pre state let provider = factory.provider_rw().unwrap(); @@ -902,7 +902,7 @@ mod tests { let provider = Arc::new(provider); let output = execution_stage.execute(provider.clone(), input).unwrap(); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); assert_matches!(output, ExecOutput { checkpoint: StageCheckpoint { @@ -969,7 +969,7 @@ mod tests { UnwindInput { checkpoint: output.checkpoint, unwind_to: 0, bad_block: None }, ) .unwrap(); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); } } @@ -1038,7 +1038,7 @@ mod tests { let provider = Arc::new(provider); let result = execution_stage.execute(provider.clone(), input).unwrap(); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); // Test Unwind let mut provider = factory.database_provider_rw().unwrap(); @@ -1054,7 +1054,7 @@ mod tests { ) .unwrap(); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); assert_matches!(result, UnwindOutput { checkpoint: StageCheckpoint { @@ -1158,7 +1158,7 @@ mod tests { let provider = Arc::new(test_db.factory.database_provider_rw().unwrap()); let mut execution_stage = stage(); let _ = execution_stage.execute(provider.clone(), input).unwrap(); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); // assert unwind stage let provider = test_db.factory.database_provider_rw().unwrap(); diff --git a/crates/stages/stages/src/stages/index_account_history.rs b/crates/stages/stages/src/stages/index_account_history.rs index a51625a3ee8e8..74c8cdc5de6c3 100644 --- a/crates/stages/stages/src/stages/index_account_history.rs +++ b/crates/stages/stages/src/stages/index_account_history.rs @@ -225,7 +225,7 @@ mod tests { let provider = Arc::new(db.factory.database_provider_rw().unwrap()); let out = stage.execute(provider.clone(), input).unwrap(); assert_eq!(out, ExecOutput { checkpoint: StageCheckpoint::new(run_to), done: true }); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); } fn unwind(db: &TestStageDB, unwind_from: u64, unwind_to: u64) { @@ -238,7 +238,7 @@ mod tests { let provider = Arc::new(db.factory.database_provider_rw().unwrap()); let out = stage.unwind(provider.clone(), input).unwrap(); assert_eq!(out, UnwindOutput { checkpoint: StageCheckpoint::new(unwind_to) }); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); } #[tokio::test] @@ -485,7 +485,7 @@ mod tests { let provider = Arc::new(db.factory.database_provider_rw().unwrap()); let out = stage.execute(provider.clone(), input).unwrap(); assert_eq!(out, ExecOutput { checkpoint: StageCheckpoint::new(20000), done: true }); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); // verify let table = cast(db.table::().unwrap()); diff --git a/crates/stages/stages/src/stages/index_storage_history.rs b/crates/stages/stages/src/stages/index_storage_history.rs index 5fc27fad7bc0f..814394b2e2ab3 100644 --- a/crates/stages/stages/src/stages/index_storage_history.rs +++ b/crates/stages/stages/src/stages/index_storage_history.rs @@ -244,7 +244,7 @@ mod tests { let provider = Arc::new(db.factory.database_provider_rw().unwrap()); let out = stage.execute(provider.clone(), input).unwrap(); assert_eq!(out, ExecOutput { checkpoint: StageCheckpoint::new(run_to), done: true }); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); } fn unwind(db: &TestStageDB, unwind_from: u64, unwind_to: u64) { @@ -257,7 +257,7 @@ mod tests { let provider = Arc::new(db.factory.database_provider_rw().unwrap()); let out = stage.unwind(provider.clone(), input).unwrap(); assert_eq!(out, UnwindOutput { checkpoint: StageCheckpoint::new(unwind_to) }); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); } #[tokio::test] @@ -507,7 +507,7 @@ mod tests { let provider = Arc::new(db.factory.database_provider_rw().unwrap()); let out = stage.execute(provider.clone(), input).unwrap(); assert_eq!(out, ExecOutput { checkpoint: StageCheckpoint::new(20000), done: true }); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); // verify let table = cast(db.table::().unwrap()); diff --git a/crates/stages/stages/src/test_utils/runner.rs b/crates/stages/stages/src/test_utils/runner.rs index d918846a00392..90409c7070c54 100644 --- a/crates/stages/stages/src/test_utils/runner.rs +++ b/crates/stages/stages/src/test_utils/runner.rs @@ -55,7 +55,7 @@ pub(crate) trait ExecuteStageTestRunner: StageTestRunner { let result = stage.execute_ready(input).await.and_then(|_| { let provider_rw = Arc::new(db.database_provider_rw().unwrap()); let result = stage.execute(provider_rw.clone(), input); - Arc::try_unwrap(provider_rw).unwrap().commit().expect("failed to commit"); + Arc::into_inner(provider_rw).unwrap().commit().expect("failed to commit"); result }); tx.send(result).expect("failed to send message") @@ -80,7 +80,7 @@ pub(crate) trait UnwindStageTestRunner: StageTestRunner { tokio::spawn(async move { let provider = Arc::new(db.database_provider_rw().unwrap()); let result = stage.unwind(provider.clone(), input); - Arc::try_unwrap(provider).unwrap().commit().expect("failed to commit"); + Arc::into_inner(provider).unwrap().commit().expect("failed to commit"); tx.send(result).expect("failed to send result"); }); rx.await.unwrap() diff --git a/crates/storage/provider/src/test_utils/mod.rs b/crates/storage/provider/src/test_utils/mod.rs index 6d3c13f15a17e..b4a460daa2627 100644 --- a/crates/storage/provider/src/test_utils/mod.rs +++ b/crates/storage/provider/src/test_utils/mod.rs @@ -92,14 +92,9 @@ pub fn insert_genesis>( // get the inner provider by consuming the Arc // this is safe because we know we have the only reference at this point - match Arc::try_unwrap(provider) { - Ok(provider) => { - provider.commit()?; - Ok(root) - } - Err(_) => { - // this should never happen in practice since we have the only Arc, - Err(reth_db::DatabaseError::Other("Failed to unwrap Arc".into()).into()) - } - } + let provider = Arc::into_inner(provider) + // this should never happen in practice since we have the only Arc, + .ok_or_else(|| reth_db::DatabaseError::Other("Failed to unwrap Arc".into()))?; + provider.commit()?; + Ok(root) } diff --git a/crates/storage/provider/src/writer/mod.rs b/crates/storage/provider/src/writer/mod.rs index 7b02469781d80..6ed56d508ba61 100644 --- a/crates/storage/provider/src/writer/mod.rs +++ b/crates/storage/provider/src/writer/mod.rs @@ -90,13 +90,15 @@ impl UnifiedStorageWriter<(), ()> { static_file.commit()?; // Get the inner provider by consuming the Arc // This is safe because we know we have the only reference at this point - match Arc::try_unwrap(provider) { - Ok(provider) => { - provider.commit()?; - Ok(()) - } - Err(_) => Err(reth_db::DatabaseError::Other("could not commit".into()).into()), - } + debug_assert!( + Arc::strong_count(&provider) == 1, + "provider should have no other references" + ); + let provider = Arc::into_inner(provider).ok_or_else(|| { + reth_db::DatabaseError::Other("Failed to unwrap Arc".into()) + })?; + provider.commit()?; + Ok(()) } /// Commits both storage types in the right order for an unwind operation. @@ -112,16 +114,14 @@ impl UnifiedStorageWriter<(), ()> { P: DBProvider + StaticFileProviderFactory, { let static_file = provider.static_file_provider(); - match Arc::try_unwrap(provider) { - Ok(provider) => { - provider.commit()?; - } - Err(_) => { - return Err( - reth_db::DatabaseError::Other("Failed to unwrap Arc".into()).into() - ); - } - } + debug_assert!( + Arc::strong_count(&provider) == 1, + "provider should have no other references" + ); + let provider = Arc::into_inner(provider).ok_or_else(|| { + reth_db::DatabaseError::Other("Failed to unwrap Arc".into()) + })?; + provider.commit()?; static_file.commit()?; Ok(()) } diff --git a/crates/trie/db/tests/trie.rs b/crates/trie/db/tests/trie.rs index 335a98d17237d..c890210a60dcf 100644 --- a/crates/trie/db/tests/trie.rs +++ b/crates/trie/db/tests/trie.rs @@ -491,7 +491,7 @@ fn account_and_storage_trie() { let (nibbles2b, node2b) = account_updates.last().unwrap(); assert_eq!(nibbles2b[..], [0xB, 0x0]); assert_eq!(node2a, node2b); - Arc::try_unwrap(provider).unwrap().commit().unwrap(); + Arc::into_inner(provider).unwrap().commit().unwrap(); { let provider = factory.provider_rw().unwrap(); diff --git a/crates/trie/parallel/benches/root.rs b/crates/trie/parallel/benches/root.rs index d949524bc4dc4..06fc528fd7975 100644 --- a/crates/trie/parallel/benches/root.rs +++ b/crates/trie/parallel/benches/root.rs @@ -37,7 +37,7 @@ pub fn calculate_state_root(c: &mut Criterion) { let (_, updates) = StateRoot::from_provider(provider_rw.clone()).root_with_updates().unwrap(); provider_rw.write_trie_updates(&updates).unwrap(); - Arc::try_unwrap(provider_rw).unwrap().commit().unwrap(); + Arc::into_inner(provider_rw).unwrap().commit().unwrap(); } let view = ConsistentDbView::new(provider_factory.clone(), None);