Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
msmouse committed Oct 22, 2024
1 parent e5a87bd commit bdb7125
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 25 deletions.
3 changes: 1 addition & 2 deletions execution/executor/src/block_executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ where
DoStateCheckpoint::run(
&execution_output,
&parent_output.expect_state_checkpoint_output().result_state,
None,
Option::<Vec<_>>::None,
)
})?;
(execution_output, state_checkpoint_output)
Expand Down Expand Up @@ -326,7 +326,6 @@ where
return Ok(complete_result);
}

// FIXME(aldenhu): re-think how to detect reconfig suffix
let output =
if parent_block_id != committed_block_id && parent_block.output.has_reconfiguration() {
info!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0

use anyhow::{ensure, Result};
use aptos_crypto::HashValue;
use aptos_executor_types::LedgerUpdateOutput;
use aptos_experimental_runtimes::thread_manager::THREAD_MANAGER;
use aptos_types::{
Expand All @@ -21,14 +20,6 @@ pub trait ChunkResultVerifier {

fn transaction_infos(&self) -> &[TransactionInfo];

fn state_checkpoint_hashes(&self) -> Vec<Option<HashValue>> {
// FIXME(aldenhu): avoid cloning hashes
self.transaction_infos()
.iter()
.map(|t| t.state_checkpoint_hash())
.collect()
}

fn maybe_select_chunk_ending_ledger_info(
&self,
ledger_update_output: &LedgerUpdateOutput,
Expand Down
7 changes: 6 additions & 1 deletion execution/executor/src/chunk_executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,12 @@ impl<V: VMExecutor> ChunkExecutorInner<V> {
let state_checkpoint_output = DoStateCheckpoint::run(
&execution_output,
&self.commit_queue.lock().latest_state(),
Some(&chunk_verifier.state_checkpoint_hashes()),
Some(
chunk_verifier
.transaction_infos()
.iter()
.map(|t| t.state_checkpoint_hash()),
),
)?;
let output = PartialStateComputeResult::new(execution_output);
output.set_state_checkpoint_output(state_checkpoint_output);
Expand Down
18 changes: 8 additions & 10 deletions execution/executor/src/types/in_memory_state_calculator_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl InMemoryStateCalculatorV2 {
pub fn calculate_for_transactions(
execution_output: &ExecutionOutput,
parent_state: &Arc<StateDelta>,
known_state_checkpoints: Option<&[Option<HashValue>]>,
known_state_checkpoints: Option<impl IntoIterator<Item = Option<HashValue>>>,
) -> Result<StateCheckpointOutput> {
if execution_output.is_block {
Self::validate_input_for_block(parent_state, &execution_output.to_commit)?;
Expand Down Expand Up @@ -75,17 +75,17 @@ impl InMemoryStateCalculatorV2 {
state_updates_vec,
last_checkpoint_index,
false,
Option::<&[_]>::None,
Option::<Vec<_>>::None,
)
}

fn calculate_impl<'a>(
parent_state: &'a Arc<StateDelta>,
state_cache: &'a StateCache,
fn calculate_impl(
parent_state: &Arc<StateDelta>,
state_cache: &StateCache,
state_updates_vec: Vec<ShardedStateUpdates>,
last_checkpoint_index: Option<usize>,
is_block: bool,
known_state_checkpoint_hashes: Option<impl IntoIterator<Item = &'a Option<HashValue>>>,
known_state_checkpoints: Option<impl IntoIterator<Item = Option<HashValue>>>,
) -> Result<StateCheckpointOutput> {
let StateCache {
// This makes sure all in-mem nodes seen while proofs were fetched stays in mem during the
Expand Down Expand Up @@ -136,10 +136,8 @@ impl InMemoryStateCalculatorV2 {
};

let mut latest_checkpoint_version = parent_state.base_version;
let mut state_checkpoint_hashes = known_state_checkpoint_hashes.map_or_else(
|| vec![None; num_txns],
|v| v.into_iter().cloned().collect(),
);
let mut state_checkpoint_hashes = known_state_checkpoints
.map_or_else(|| vec![None; num_txns], |v| v.into_iter().collect());
ensure!(
state_checkpoint_hashes.len() == num_txns,
"Bad number of known hashes."
Expand Down
1 change: 0 additions & 1 deletion execution/executor/src/workflow/do_get_execution_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ impl DoGetExecutionOutput {
transaction_outputs: Vec<TransactionOutput>,
state_view: CachedStateView,
) -> Result<ExecutionOutput> {
// FIXME(aldenhu): is this the right place?
update_counters_for_processed_chunk(&transactions, &transaction_outputs, "output");

// collect all accounts touched and dedup
Expand Down
2 changes: 1 addition & 1 deletion execution/executor/src/workflow/do_state_checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl DoStateCheckpoint {
pub fn run(
execution_output: &ExecutionOutput,
parent_state: &Arc<StateDelta>,
known_state_checkpoints: Option<&[Option<HashValue>]>,
known_state_checkpoints: Option<impl IntoIterator<Item = Option<HashValue>>>,
) -> Result<StateCheckpointOutput> {
// Apply the write set, get the latest state.
InMemoryStateCalculatorV2::calculate_for_transactions(
Expand Down
2 changes: 1 addition & 1 deletion execution/executor/src/workflow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl ApplyExecutionOutput {
let state_checkpoint_output = DoStateCheckpoint::run(
&execution_output,
base_view.state(),
None, // known_state_checkpoint_hashes
Option::<Vec<_>>::None, // known_state_checkpoint_hashes
)?;
let ledger_update_output = DoLedgerUpdate::run(
&execution_output,
Expand Down

0 comments on commit bdb7125

Please sign in to comment.