diff --git a/execution/executor/src/block_executor/block_tree/mod.rs b/execution/executor/src/block_executor/block_tree/mod.rs index 013a5c58235dc..6c13788fd51ff 100644 --- a/execution/executor/src/block_executor/block_tree/mod.rs +++ b/execution/executor/src/block_executor/block_tree/mod.rs @@ -207,12 +207,12 @@ impl BlockTree { fn root_from_db(block_lookup: &Arc, db: &Arc) -> Result> { let ledger_info_with_sigs = db.get_latest_ledger_info()?; let ledger_info = ledger_info_with_sigs.ledger_info(); - let ledger_view = db.get_latest_executed_trees()?; + let ledger_summary = db.get_pre_committed_ledger_summary()?; ensure!( - ledger_view.version() == Some(ledger_info.version()), + ledger_summary.version() == Some(ledger_info.version()), "Missing ledger info at the end of the ledger. latest version {:?}, LI version {}", - ledger_view.version(), + ledger_summary.version(), ledger_info.version(), ); @@ -223,8 +223,8 @@ impl BlockTree { }; let output = PartialStateComputeResult::new_empty( - ledger_view.state().clone(), - ledger_view.txn_accumulator().clone(), + ledger_summary.state().clone(), + ledger_summary.txn_accumulator().clone(), ); block_lookup.fetch_or_add_block(id, output, None) diff --git a/execution/executor/src/block_executor/block_tree/test.rs b/execution/executor/src/block_executor/block_tree/test.rs index f69df868eafa0..060cab8dd228e 100644 --- a/execution/executor/src/block_executor/block_tree/test.rs +++ b/execution/executor/src/block_executor/block_tree/test.rs @@ -8,7 +8,7 @@ use crate::{ }; use aptos_crypto::{hash::PRE_GENESIS_BLOCK_ID, HashValue}; use aptos_infallible::Mutex; -use aptos_storage_interface::ExecutedTrees; +use aptos_storage_interface::LedgerSummary; use aptos_types::{block_info::BlockInfo, epoch_state::EpochState, ledger_info::LedgerInfo}; use std::sync::Arc; @@ -39,7 +39,7 @@ fn id(index: u64) -> HashValue { } fn empty_block() -> PartialStateComputeResult { - let result_view = ExecutedTrees::new_empty(); + let result_view = LedgerSummary::new_empty(); PartialStateComputeResult::new_empty( result_view.state().clone(), result_view.transaction_accumulator.clone(), diff --git a/execution/executor/src/chunk_executor/chunk_commit_queue.rs b/execution/executor/src/chunk_executor/chunk_commit_queue.rs index c5794399e7586..14586ce250721 100644 --- a/execution/executor/src/chunk_executor/chunk_commit_queue.rs +++ b/execution/executor/src/chunk_executor/chunk_commit_queue.rs @@ -11,7 +11,7 @@ use crate::{ }, }; use anyhow::{anyhow, ensure, Result}; -use aptos_storage_interface::{state_store::state_delta::StateDelta, DbReader, ExecutedTrees}; +use aptos_storage_interface::{state_store::state_delta::StateDelta, DbReader, LedgerSummary}; use aptos_types::{proof::accumulator::InMemoryTransactionAccumulator, transaction::Version}; use std::{collections::VecDeque, sync::Arc}; @@ -41,10 +41,10 @@ pub struct ChunkCommitQueue { impl ChunkCommitQueue { pub(crate) fn new_from_db(db: &Arc) -> Result { - let ExecutedTrees { + let LedgerSummary { state, transaction_accumulator, - } = db.get_latest_executed_trees()?; + } = db.get_pre_committed_ledger_summary()?; Ok(Self { latest_state: state, latest_txn_accumulator: transaction_accumulator, diff --git a/execution/executor/src/db_bootstrapper/mod.rs b/execution/executor/src/db_bootstrapper/mod.rs index 76380637cb834..577d9b5997f5b 100644 --- a/execution/executor/src/db_bootstrapper/mod.rs +++ b/execution/executor/src/db_bootstrapper/mod.rs @@ -15,7 +15,7 @@ use aptos_storage_interface::{ state_store::state_view::{ async_proof_fetcher::AsyncProofFetcher, cached_state_view::CachedStateView, }, - DbReaderWriter, DbWriter, ExecutedTrees, + DbReaderWriter, DbWriter, LedgerSummary, }; use aptos_types::{ account_config::CORE_CODE_ADDRESS, @@ -39,9 +39,9 @@ pub fn generate_waypoint( db: &DbReaderWriter, genesis_txn: &Transaction, ) -> Result { - let executed_trees = db.reader.get_latest_executed_trees()?; + let ledger_summary = db.reader.get_pre_committed_ledger_summary()?; - let committer = calculate_genesis::(db, executed_trees, genesis_txn)?; + let committer = calculate_genesis::(db, ledger_summary, genesis_txn)?; Ok(committer.waypoint) } @@ -53,15 +53,15 @@ pub fn maybe_bootstrap( genesis_txn: &Transaction, waypoint: Waypoint, ) -> Result> { - let executed_trees = db.reader.get_latest_executed_trees()?; + let ledger_summary = db.reader.get_pre_committed_ledger_summary()?; // if the waypoint is not targeted with the genesis txn, it may be either already bootstrapped, or // aiming for state sync to catch up. - if executed_trees.version().map_or(0, |v| v + 1) != waypoint.version() { + if ledger_summary.version().map_or(0, |v| v + 1) != waypoint.version() { info!(waypoint = %waypoint, "Skip genesis txn."); return Ok(None); } - let committer = calculate_genesis::(db, executed_trees, genesis_txn)?; + let committer = calculate_genesis::(db, ledger_summary, genesis_txn)?; ensure!( waypoint == committer.waypoint(), "Waypoint verification failed. Expected {:?}, got {:?}.", @@ -117,14 +117,14 @@ impl GenesisCommitter { pub fn calculate_genesis( db: &DbReaderWriter, - executed_trees: ExecutedTrees, + ledger_summary: LedgerSummary, genesis_txn: &Transaction, ) -> Result { // DB bootstrapper works on either an empty transaction accumulator or an existing block chain. // In the very extreme and sad situation of losing quorum among validators, we refer to the // second use case said above. - let genesis_version = executed_trees.version().map_or(0, |v| v + 1); - let base_state_view = executed_trees.verified_state_view( + let genesis_version = ledger_summary.version().map_or(0, |v| v + 1); + let base_state_view = ledger_summary.verified_state_view( StateViewId::Miscellaneous, Arc::clone(&db.reader), Arc::new(AsyncProofFetcher::new(db.reader.clone())), @@ -152,7 +152,7 @@ pub fn calculate_genesis( "Genesis txn didn't output reconfig event." ); - let output = ApplyExecutionOutput::run(execution_output, &executed_trees)?; + let output = ApplyExecutionOutput::run(execution_output, &ledger_summary)?; let timestamp_usecs = if genesis_version == 0 { // TODO(aldenhu): fix existing tests before using real timestamp and check on-chain epoch. GENESIS_TIMESTAMP_USECS diff --git a/execution/executor/src/tests/mod.rs b/execution/executor/src/tests/mod.rs index 0a599682eac87..d27c2fed3629d 100644 --- a/execution/executor/src/tests/mod.rs +++ b/execution/executor/src/tests/mod.rs @@ -13,7 +13,7 @@ use aptos_executor_types::{ BlockExecutorTrait, ChunkExecutorTrait, TransactionReplayer, VerifyExecutionMode, }; use aptos_storage_interface::{ - state_store::state_view::async_proof_fetcher::AsyncProofFetcher, DbReaderWriter, ExecutedTrees, + state_store::state_view::async_proof_fetcher::AsyncProofFetcher, DbReaderWriter, LedgerSummary, Result, }; use aptos_types::{ @@ -457,7 +457,7 @@ fn apply_transaction_by_writeset( db: &DbReaderWriter, transactions_and_writesets: Vec<(Transaction, WriteSet)>, ) { - let ledger_view: ExecutedTrees = db.reader.get_latest_executed_trees().unwrap(); + let ledger_summary: LedgerSummary = db.reader.get_pre_committed_ledger_summary().unwrap(); let (txns, txn_outs) = transactions_and_writesets .iter() @@ -485,7 +485,7 @@ fn apply_transaction_by_writeset( ))) .unzip(); - let state_view = ledger_view + let state_view = ledger_summary .verified_state_view( StateViewId::Miscellaneous, Arc::clone(&db.reader), @@ -496,7 +496,7 @@ fn apply_transaction_by_writeset( let chunk_output = DoGetExecutionOutput::by_transaction_output(txns, txn_outs, state_view).unwrap(); - let output = ApplyExecutionOutput::run(chunk_output, &ledger_view).unwrap(); + let output = ApplyExecutionOutput::run(chunk_output, &ledger_summary).unwrap(); db.writer .save_transactions( @@ -681,11 +681,11 @@ fn run_transactions_naive( let db = &executor.db; for txn in transactions { - let ledger_view: ExecutedTrees = db.reader.get_latest_executed_trees().unwrap(); + let ledger_summary: LedgerSummary = db.reader.get_pre_committed_ledger_summary().unwrap(); let out = DoGetExecutionOutput::by_transaction_execution( &MockVM::new(), vec![txn].into(), - ledger_view + ledger_summary .verified_state_view( StateViewId::Miscellaneous, Arc::clone(&db.reader), @@ -696,7 +696,7 @@ fn run_transactions_naive( TransactionSliceMetadata::unknown(), ) .unwrap(); - let output = ApplyExecutionOutput::run(out, &ledger_view).unwrap(); + let output = ApplyExecutionOutput::run(out, &ledger_summary).unwrap(); db.writer .save_transactions( output.expect_complete_result().as_chunk_to_commit(), @@ -706,7 +706,7 @@ fn run_transactions_naive( .unwrap(); } db.reader - .get_latest_executed_trees() + .get_pre_committed_ledger_summary() .unwrap() .transaction_accumulator .root_hash() diff --git a/execution/executor/src/workflow/mod.rs b/execution/executor/src/workflow/mod.rs index deef85de89d53..9ea524d1eb8b7 100644 --- a/execution/executor/src/workflow/mod.rs +++ b/execution/executor/src/workflow/mod.rs @@ -7,7 +7,7 @@ use crate::types::partial_state_compute_result::PartialStateComputeResult; use anyhow::Result; use aptos_executor_types::execution_output::ExecutionOutput; -use aptos_storage_interface::ExecutedTrees; +use aptos_storage_interface::LedgerSummary; use do_ledger_update::DoLedgerUpdate; use do_state_checkpoint::DoStateCheckpoint; @@ -20,7 +20,7 @@ pub struct ApplyExecutionOutput; impl ApplyExecutionOutput { pub fn run( execution_output: ExecutionOutput, - base_view: &ExecutedTrees, + base_view: &LedgerSummary, ) -> Result { let state_checkpoint_output = DoStateCheckpoint::run( &execution_output, diff --git a/peer-monitoring-service/server/src/tests.rs b/peer-monitoring-service/server/src/tests.rs index 00a213e046d25..d97702ce1d53d 100644 --- a/peer-monitoring-service/server/src/tests.rs +++ b/peer-monitoring-service/server/src/tests.rs @@ -37,7 +37,7 @@ use aptos_peer_monitoring_service_types::{ }, PeerMonitoringMetadata, PeerMonitoringServiceError, PeerMonitoringServiceMessage, }; -use aptos_storage_interface::{DbReader, ExecutedTrees, Order}; +use aptos_storage_interface::{DbReader, LedgerSummary, Order}; use aptos_time_service::{MockTimeService, TimeService}; use aptos_types::{ account_address::AccountAddress, @@ -718,7 +718,7 @@ mod database_mock { version: Version, ) -> Result<(Option, SparseMerkleProof)>; - fn get_latest_executed_trees(&self) -> Result; + fn get_pre_committed_ledger_summary(&self) -> Result; fn get_epoch_ending_ledger_info(&self, known_version: u64) -> Result; diff --git a/state-sync/state-sync-driver/src/tests/mocks.rs b/state-sync/state-sync-driver/src/tests/mocks.rs index 246a8b68602ef..b0349ff6566c5 100644 --- a/state-sync/state-sync-driver/src/tests/mocks.rs +++ b/state-sync/state-sync-driver/src/tests/mocks.rs @@ -16,7 +16,7 @@ use aptos_data_streaming_service::{ }; use aptos_executor_types::{ChunkCommitNotification, ChunkExecutorTrait}; use aptos_storage_interface::{ - chunk_to_commit::ChunkToCommit, DbReader, DbReaderWriter, DbWriter, ExecutedTrees, Order, + chunk_to_commit::ChunkToCommit, DbReader, DbReaderWriter, DbWriter, LedgerSummary, Order, Result, StateSnapshotReceiver, }; use aptos_types::{ @@ -276,7 +276,7 @@ mock! { version: Version, ) -> Result<(Option, SparseMerkleProof)>; - fn get_latest_executed_trees(&self) -> Result; + fn get_pre_committed_ledger_summary(&self) -> Result; fn get_epoch_ending_ledger_info(&self, known_version: u64) -> Result; diff --git a/state-sync/storage-service/server/src/tests/mock.rs b/state-sync/storage-service/server/src/tests/mock.rs index 2bb41b9cee1aa..ea620242320a9 100644 --- a/state-sync/storage-service/server/src/tests/mock.rs +++ b/state-sync/storage-service/server/src/tests/mock.rs @@ -22,7 +22,7 @@ use aptos_network::{ }, }, }; -use aptos_storage_interface::{DbReader, ExecutedTrees, Order}; +use aptos_storage_interface::{DbReader, LedgerSummary, Order}; use aptos_storage_service_notifications::StorageServiceNotifier; use aptos_storage_service_types::{ requests::StorageServiceRequest, responses::StorageServiceResponse, StorageServiceError, @@ -325,7 +325,7 @@ mock! { version: Version, ) -> aptos_storage_interface::Result<(Option, SparseMerkleProof)>; - fn get_latest_executed_trees(&self) -> aptos_storage_interface::Result; + fn get_pre_committed_ledger_summary(&self) -> aptos_storage_interface::Result; fn get_epoch_ending_ledger_info(&self, known_version: u64) ->aptos_storage_interface::Result; diff --git a/storage/aptosdb/src/db/aptosdb_test.rs b/storage/aptosdb/src/db/aptosdb_test.rs index 81ecfcd74b0f6..68d32147edd3a 100644 --- a/storage/aptosdb/src/db/aptosdb_test.rs +++ b/storage/aptosdb/src/db/aptosdb_test.rs @@ -19,7 +19,7 @@ use aptos_config::config::{ DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, }; use aptos_crypto::{hash::CryptoHash, HashValue}; -use aptos_storage_interface::{DbReader, ExecutedTrees, Order}; +use aptos_storage_interface::{DbReader, LedgerSummary, Order}; use aptos_temppath::TempPath; use aptos_types::{ ledger_info::LedgerInfoWithSignatures, @@ -181,8 +181,8 @@ fn test_get_latest_executed_trees() { let db = AptosDB::new_for_test(&tmp_dir); // entirely empty db - let empty = db.get_latest_executed_trees().unwrap(); - assert!(empty.is_same_view(&ExecutedTrees::new_empty())); + let empty = db.get_pre_committed_ledger_summary().unwrap(); + assert!(empty.is_same_view(&LedgerSummary::new_empty())); // bootstrapped db (any transaction info is in) let key = StateKey::raw(b"test_key"); @@ -199,9 +199,9 @@ fn test_get_latest_executed_trees() { ); put_transaction_infos(&db, 0, &[txn_info.clone()]); - let bootstrapped = db.get_latest_executed_trees().unwrap(); + let bootstrapped = db.get_pre_committed_ledger_summary().unwrap(); assert!( - bootstrapped.is_same_view(&ExecutedTrees::new_at_state_checkpoint( + bootstrapped.is_same_view(&LedgerSummary::new_at_state_checkpoint( txn_info.state_checkpoint_hash().unwrap(), StateStorageUsage::new_untracked(), vec![txn_info.hash()], diff --git a/storage/aptosdb/src/db/fake_aptosdb.rs b/storage/aptosdb/src/db/fake_aptosdb.rs index 2f3477765addb..c3faf81301baa 100644 --- a/storage/aptosdb/src/db/fake_aptosdb.rs +++ b/storage/aptosdb/src/db/fake_aptosdb.rs @@ -21,7 +21,7 @@ use aptos_storage_interface::{ sharded_state_updates::ShardedStateUpdates, state_delta::StateDelta, state_view::cached_state_view::ShardedStateCache, }, - AptosDbError, DbReader, DbWriter, ExecutedTrees, MAX_REQUEST_LIMIT, + AptosDbError, DbReader, DbWriter, LedgerSummary, MAX_REQUEST_LIMIT, }; use aptos_types::{ access_path::AccessPath, @@ -200,7 +200,7 @@ impl FakeAptosDB { first_version, /* num_existing_leaves */ &txn_hashes, )?; - // Store the transaction hash by position to serve [DbReader::get_latest_executed_trees] calls + // Store the transaction hash by position to serve [DbReader::get_pre_committed_ledger_summary] calls writes.iter().for_each(|(pos, hash)| { self.txn_hash_by_position.insert(*pos, *hash); }); @@ -833,16 +833,16 @@ impl DbReader for FakeAptosDB { .get_state_value_with_proof_by_version_ext(state_key, version, root_depth) } - fn get_latest_executed_trees(&self) -> Result { + fn get_pre_committed_ledger_summary(&self) -> Result { // If the genesis is not executed yet, we need to get the executed trees from the inner AptosDB // This is because when we call save_transactions for the genesis block, we call [AptosDB::save_transactions] // where there is an expectation that the root of the SMTs are the same pointers. Here, // we get from the inner AptosDB which ensures that the pointers match when save_transactions is called. if self.ensure_synced_version().unwrap_or_default() == 0 { - return self.inner.get_latest_executed_trees(); + return self.inner.get_pre_committed_ledger_summary(); } - gauged_api("get_latest_executed_trees", || { + gauged_api("get_pre_committed_ledger_summary", || { let buffered_state = self.buffered_state.lock(); let num_txns = buffered_state .current_state() @@ -852,11 +852,11 @@ impl DbReader for FakeAptosDB { let frozen_subtrees = self.get_frozen_subtree_hashes(num_txns)?; let transaction_accumulator = Arc::new(InMemoryAccumulator::new(frozen_subtrees, num_txns)?); - let executed_trees = ExecutedTrees::new( + let ledger_summary = LedgerSummary::new( buffered_state.current_state().clone(), transaction_accumulator, ); - Ok(executed_trees) + Ok(ledger_summary) }) } @@ -946,7 +946,7 @@ impl DbReader for FakeAptosDB { } } -/// This is necessary for constructing the [ExecutedTrees] to serve [DbReader::get_latest_executed_trees] +/// This is necessary for constructing the [LedgerSummary] to serve [DbReader::get_pre_committed_ledger_summary] /// requests. impl HashReader for FakeAptosDB { fn get(&self, position: Position) -> anyhow::Result { @@ -999,7 +999,7 @@ mod tests { let mut in_memory_state = db .inner - .get_latest_executed_trees().state; + .get_pre_committed_ledger_summary().state; let mut cur_ver: Version = 0; for (txns_to_commit, ledger_info_with_sigs) in input.iter() { diff --git a/storage/aptosdb/src/db/include/aptosdb_reader.rs b/storage/aptosdb/src/db/include/aptosdb_reader.rs index b4dccd2bf34a8..f4cd864c909cf 100644 --- a/storage/aptosdb/src/db/include/aptosdb_reader.rs +++ b/storage/aptosdb/src/db/include/aptosdb_reader.rs @@ -527,8 +527,8 @@ impl DbReader for AptosDB { }) } - fn get_latest_executed_trees(&self) -> Result { - gauged_api("get_latest_executed_trees", || { + fn get_pre_committed_ledger_summary(&self) -> Result { + gauged_api("get_pre_committed_ledger_summary", || { let current_state = self.state_store.current_state_cloned(); let num_txns = current_state.next_version(); @@ -538,11 +538,11 @@ impl DbReader for AptosDB { .get_frozen_subtree_hashes(num_txns)?; let transaction_accumulator = Arc::new(InMemoryAccumulator::new(frozen_subtrees, num_txns)?); - let executed_trees = ExecutedTrees::new( + let ledger_summary = LedgerSummary::new( Arc::new(current_state), transaction_accumulator, ); - Ok(executed_trees) + Ok(ledger_summary) }) } diff --git a/storage/aptosdb/src/db/mod.rs b/storage/aptosdb/src/db/mod.rs index 04a5e9bc539a5..5a70281687533 100644 --- a/storage/aptosdb/src/db/mod.rs +++ b/storage/aptosdb/src/db/mod.rs @@ -42,7 +42,7 @@ use aptos_scratchpad::SparseMerkleTree; use aptos_storage_interface::{ db_ensure as ensure, db_other_bail as bail, state_store::sharded_state_updates::ShardedStateUpdates, AptosDbError, DbReader, DbWriter, - ExecutedTrees, Order, Result, StateSnapshotReceiver, MAX_REQUEST_LIMIT, + LedgerSummary, Order, Result, StateSnapshotReceiver, MAX_REQUEST_LIMIT, }; use aptos_types::{ account_address::AccountAddress, diff --git a/storage/backup/backup-cli/src/utils/test_utils.rs b/storage/backup/backup-cli/src/utils/test_utils.rs index 0b6d83655ad5e..a5a9a9102743f 100644 --- a/storage/backup/backup-cli/src/utils/test_utils.rs +++ b/storage/backup/backup-cli/src/utils/test_utils.rs @@ -36,7 +36,7 @@ pub fn tmp_db_with_random_content() -> ( let (tmpdir, db) = tmp_db_empty(); let mut cur_ver: Version = 0; let mut in_memory_state = db - .get_latest_executed_trees() + .get_pre_committed_ledger_summary() .unwrap() .state .as_ref() diff --git a/storage/db-tool/src/bootstrap.rs b/storage/db-tool/src/bootstrap.rs index 5989ececfdcfb..9557ee076dceb 100644 --- a/storage/db-tool/src/bootstrap.rs +++ b/storage/db-tool/src/bootstrap.rs @@ -62,22 +62,22 @@ impl Command { .expect("Failed to open DB."); let db = DbReaderWriter::new(db); - let executed_trees = db + let ledger_summary = db .reader - .get_latest_executed_trees() + .get_pre_committed_ledger_summary() .with_context(|| format_err!("Failed to get latest tree state."))?; - println!("Db has {} transactions", executed_trees.num_transactions()); + println!("Db has {} transactions", ledger_summary.num_transactions()); if let Some(waypoint) = self.waypoint_to_verify { ensure!( - waypoint.version() == executed_trees.num_transactions(), + waypoint.version() == ledger_summary.num_transactions(), "Trying to generate waypoint at version {}, but DB has {} transactions.", waypoint.version(), - executed_trees.num_transactions(), + ledger_summary.num_transactions(), ) } let committer = - calculate_genesis::(&db, executed_trees, &genesis_txn) + calculate_genesis::(&db, ledger_summary, &genesis_txn) .with_context(|| format_err!("Failed to calculate genesis."))?; println!( "Successfully calculated genesis. Got waypoint: {}", diff --git a/storage/storage-interface/src/executed_trees.rs b/storage/storage-interface/src/ledger_summary.rs similarity index 92% rename from storage/storage-interface/src/executed_trees.rs rename to storage/storage-interface/src/ledger_summary.rs index 9f3ad490c7f51..db0daa5a848fe 100644 --- a/storage/storage-interface/src/executed_trees.rs +++ b/storage/storage-interface/src/ledger_summary.rs @@ -8,20 +8,19 @@ use crate::{ }, DbReader, }; +use anyhow::Result; use aptos_crypto::HashValue; use aptos_types::{ proof::accumulator::{InMemoryAccumulator, InMemoryTransactionAccumulator}, - state_store::{errors::StateViewError, state_storage_usage::StateStorageUsage, StateViewId}, + state_store::{state_storage_usage::StateStorageUsage, StateViewId}, transaction::Version, }; use std::sync::Arc; -type Result = std::result::Result; - /// A wrapper of the in-memory state sparse merkle tree and the transaction accumulator that /// represent a specific state collectively. Usually it is a state after executing a block. #[derive(Clone, Debug)] -pub struct ExecutedTrees { +pub struct LedgerSummary { /// The in-memory representation of state after execution. pub state: Arc, @@ -30,7 +29,7 @@ pub struct ExecutedTrees { pub transaction_accumulator: Arc, } -impl ExecutedTrees { +impl LedgerSummary { pub fn state(&self) -> &Arc { &self.state } @@ -102,17 +101,17 @@ impl ExecutedTrees { reader: Arc, proof_fetcher: Arc, ) -> Result { - CachedStateView::new( + Ok(CachedStateView::new( id, reader, self.transaction_accumulator.num_leaves(), self.state.current.clone(), proof_fetcher, - ) + )?) } } -impl Default for ExecutedTrees { +impl Default for LedgerSummary { fn default() -> Self { Self::new_empty() } diff --git a/storage/storage-interface/src/lib.rs b/storage/storage-interface/src/lib.rs index ac92e5e39f663..9c6c66cf4c3f0 100644 --- a/storage/storage-interface/src/lib.rs +++ b/storage/storage-interface/src/lib.rs @@ -37,7 +37,7 @@ use thiserror::Error; pub mod block_info; pub mod chunk_to_commit; pub mod errors; -mod executed_trees; +mod ledger_summary; mod metrics; #[cfg(any(test, feature = "fuzzing"))] pub mod mock; @@ -48,7 +48,7 @@ use aptos_scratchpad::SparseMerkleTree; pub use aptos_types::block_info::BlockHeight; use aptos_types::state_store::state_key::prefix::StateKeyPrefix; pub use errors::AptosDbError; -pub use executed_trees::ExecutedTrees; +pub use ledger_summary::LedgerSummary; pub type Result = std::result::Result; // This is last line of defense against large queries slipping through external facing interfaces, @@ -374,9 +374,9 @@ pub trait DbReader: Send + Sync { root_depth: usize, ) -> Result<(Option, SparseMerkleProofExt)>; - /// Gets the latest ExecutedTrees no matter if db has been bootstrapped. + /// Gets the latest LedgerView no matter if db has been bootstrapped. /// Used by the Db-bootstrapper. - fn get_latest_executed_trees(&self) -> Result; + fn get_pre_committed_ledger_summary(&self) -> Result; /// Get the oldest in memory state tree. fn get_buffered_state_base(&self) -> Result>;