From 74f44e21d464fa67069a6da6cad808b9fd76a29d Mon Sep 17 00:00:00 2001 From: Peter Zhang Date: Tue, 8 Jul 2025 16:53:49 +0800 Subject: [PATCH] fill all middle seqs --- .github/actions/setup-rust/action.yml | 4 ++-- node/storage/src/log_store/log_manager.rs | 13 +++++++------ tests/utility/utils.py | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml index 8589dea..632bef4 100644 --- a/.github/actions/setup-rust/action.yml +++ b/.github/actions/setup-rust/action.yml @@ -8,11 +8,11 @@ runs: sudo apt-get update sudo apt-get install -y protobuf-compiler - - name: Install toolchain 1.80.0 + - name: Install toolchain 1.78.0 uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.80.0 + toolchain: 1.78.0 components: rustfmt, clippy - uses: Swatinem/rust-cache@v2 \ No newline at end of file diff --git a/node/storage/src/log_store/log_manager.rs b/node/storage/src/log_store/log_manager.rs index 6c2575f..b0c0d5e 100644 --- a/node/storage/src/log_store/log_manager.rs +++ b/node/storage/src/log_store/log_manager.rs @@ -319,11 +319,11 @@ impl LogStoreWrite for LogManager { // If this is the first tx with this data root, copy and finalize all same-root txs. self.copy_tx_and_finalize(tx_seq, same_root_seq_list[1..].to_vec())?; } else { - // If this is not the first tx with this data root, copy and finalize the first one. + // If this is not the first tx with this data root, and the first one is not finalized. let maybe_first_seq = same_root_seq_list.first().cloned(); if let Some(first_seq) = maybe_first_seq { if !self.check_tx_completed(first_seq)? { - self.copy_tx_and_finalize(tx_seq, vec![first_seq])?; + self.copy_tx_and_finalize(tx_seq, same_root_seq_list)?; } } } @@ -357,7 +357,6 @@ impl LogStoreWrite for LogManager { // TODO: Should we double check the tx merkle root? let tx_end_index = tx.start_entry_index + bytes_to_entries(tx.size); if self.check_data_completed(tx.start_entry_index, tx_end_index)? { - self.tx_store.finalize_tx(tx_seq)?; let same_root_seq_list = self .tx_store .get_tx_seq_list_by_data_root(&tx.data_merkle_root)?; @@ -370,11 +369,13 @@ impl LogStoreWrite for LogManager { let maybe_first_seq = same_root_seq_list.first().cloned(); if let Some(first_seq) = maybe_first_seq { if !self.check_tx_completed(first_seq)? { - self.copy_tx_and_finalize(tx_seq, vec![first_seq])?; + self.copy_tx_and_finalize(tx_seq, same_root_seq_list)?; } } } + self.tx_store.finalize_tx(tx_seq)?; + metrics::FINALIZE_TX_WITH_HASH.update_since(start_time); Ok(true) } else { @@ -1194,8 +1195,8 @@ impl LogManager { let mut to_tx_offset_list = Vec::with_capacity(to_tx_seq_list.len()); for seq in to_tx_seq_list { - // No need to copy data for completed tx. - if self.check_tx_completed(seq)? { + // No need to copy data for completed tx and itself + if self.check_tx_completed(seq)? || from_tx_seq == seq { continue; } let tx = self diff --git a/tests/utility/utils.py b/tests/utility/utils.py index f1d7373..9a5b5a0 100644 --- a/tests/utility/utils.py +++ b/tests/utility/utils.py @@ -11,7 +11,7 @@ class PortMin: n = 11000 -MAX_NODES = 100 +MAX_NODES = 50 MAX_BLOCKCHAIN_NODES = 50