message: [VMValidator] Do not use update_to_latest_ledger to find latest state root hash
  The current way to find the latest state root and version is a bit
  hacky, use the proper API to get them.
  Closes:
  Approved by: dmitri-perelman
diff: // Copyright (c) The Libra Core Contributors
  // SPDX-License-Identifier: Apache-2.0
  -use anyhow::{bail, format_err, Error, Result};
  +use anyhow::{bail, Error, Result};
  use futures::future::{err, ok, Future};
  use libra_config::config::NodeConfig;
  use libra_types::{
  - account_address::{AccountAddress, ADDRESS_LENGTH},
  + account_address::AccountAddress,
  account_config::get_account_resource_or_default,
  get_with_proof::{RequestItem, ResponseItem},
  transaction::SignedTransaction,
  @@ -51,52 +51,17 @@ impl TransactionValidation for VMValidator {
  &self,
  txn: SignedTransaction,
  ) -> Box<dyn Future<Item = Option<VMStatus>, Error = Error> + Send> {
  - // TODO: For transaction validation, there are two options to go:
  - // 1. Trust storage: there is no need to get root hash from storage here. We will
  - // create another struct similar to `VerifiedStateView` that implements `StateView`
  - // but does not do verification.
  - // 2. Don't trust storage. This requires more work:
  - // 1) AC must have validator set information
  - // 2) Get state_root from transaction info which can be verified with signatures of
  - // validator set.
  - // 3) Create VerifiedStateView with verified state
  - // root.
  -
  - // Just ask something from storage. It doesn't matter what it is -- we just need the
  - // transaction info object in account state proof which contains the state root hash.
  - let address = AccountAddress::new([0xff; ADDRESS_LENGTH]);
  - let item = RequestItem::GetAccountState { address };
  -
  - match self
  - .storage_read_client
  - .update_to_latest_ledger(/* client_known_version = */ 0, vec![item])
  - {
  - Ok((mut items, ledger_info_with_sigs, _, _)) => {
  - if items.len() != 1 {
  - return Box::new(err(format_err!(
  - "Unexpected number of items ({}).",
  - items.len()
  - )));
  - }
  -
  - match items.remove(0) {
  - ResponseItem::GetAccountState {
  - account_state_with_proof,
  - } => {
  - let transaction_info = account_state_with_proof.proof.transaction_info();
  - let state_root = transaction_info.state_root_hash();
  + match self.storage_read_client.get_latest_state_root() {
  + Ok((version, state_root)) => {
  let smt = SparseMerkleTree::new(state_root);
  let state_view = VerifiedStateView::new(
  Arc::clone(&self.storage_read_client),
  - Some(ledger_info_with_sigs.ledger_info().version()),
  + Some(version),
  state_root,
  &smt,
  );
  Box::new(ok(self.vm.validate_transaction(txn, &state_view)))
  }
  - _ => panic!("Unexpected item in response."),
  - }
  - }
  Err(e) => Box::new(err(e)),
  }
  }
  