Skip to content

Commit

Permalink
[executor] log the first different txn_info and version
Browse files Browse the repository at this point in the history
  • Loading branch information
msmouse authored and aptos-bot committed Apr 29, 2022
1 parent 77a0430 commit 7ffedbe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion execution/executor-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ edition = "2018"

[dependencies]
anyhow = "1.0.52"
bcs = "0.1.2"
itertools = "0.10.0"
serde = { version = "1.0.124", default-features = false }
thiserror = "1.0.24"

bcs = "0.1.2"
aptos-crypto = { path = "../../crates/aptos-crypto" }
aptos-secure-net = { path = "../../secure/net" }
aptos-state-view = { path = "../../storage/state-view" }
Expand Down
26 changes: 20 additions & 6 deletions execution/executor-types/src/executed_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![forbid(unsafe_code)]

use crate::{ExecutedTrees, StateComputeResult, TransactionData};
use anyhow::{ensure, Result};
use anyhow::{bail, ensure, Result};
use aptos_crypto::hash::{CryptoHash, TransactionAccumulatorHasher};
use aptos_types::{
contract_event::ContractEvent,
Expand Down Expand Up @@ -93,11 +93,25 @@ impl ExecutedChunk {
.iter()
.map(CryptoHash::hash)
.collect::<Vec<_>>();
ensure!(
txn_info_hashes == expected_txn_info_hashes,
"Transaction infos don't match",
);
Ok(())

if txn_info_hashes != expected_txn_info_hashes {
for (idx, ((_, txn_data), expected_txn_info)) in
itertools::zip_eq(self.to_commit.iter(), transaction_infos.iter()).enumerate()
{
if &txn_data.txn_info != expected_txn_info {
bail!(
"Transaction infos don't match. version: {}, txn_info:{}, expected_txn_info:{}",
self.result_view.transaction_accumulator.version() + 1 + idx as u64
- self.to_commit.len() as u64,
&txn_data.txn_info,
expected_txn_info,
)
}
}
unreachable!()
} else {
Ok(())
}
}

pub fn maybe_select_chunk_ending_ledger_info(
Expand Down

0 comments on commit 7ffedbe

Please sign in to comment.