Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: quick workaround for flat storage memtrie comparison #12592

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions integration-tests/src/test_loop/tests/resharding_v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use near_primitives::test_utils::create_user_test_signer;
use near_primitives::transaction::SignedTransaction;
use near_primitives::trie_key::TrieKey;
use near_primitives::views::FinalExecutionStatus;
use near_store::flat::FlatStorageStatus;
use std::cell::Cell;
use std::u64;

Expand Down Expand Up @@ -661,11 +662,25 @@ fn assert_state_sanity(
trie.lock_for_iter().iter().unwrap().collect::<Result<HashSet<_>, _>>().unwrap();
assert_state_equal(&memtrie_state, &trie_state, shard_uid, "memtrie and trie");

let Some(flat_store_chunk_view) = client
.chain
.runtime_adapter
.get_flat_storage_manager()
.chunk_view(shard_uid, final_head.last_block_hash)
let flat_storage_manager = client.chain.runtime_adapter.get_flat_storage_manager();
// FlatStorageChunkView::iter_range() used below to retrieve all key-value pairs in Flat
// Storage only looks at the data committed into the DB. For this reasons comparing Flat
// Storage and Memtries makes sense only if we can retrieve a view at the same height from
// both.
if let FlatStorageStatus::Ready(status) =
flat_storage_manager.get_flat_storage_status(shard_uid)
{
if status.flat_head.hash != final_head.prev_block_hash {
tracing::warn!(target: "test", "skipping flat storage - memtrie state check");
continue;
} else {
tracing::debug!(target: "test", "checking flat storage - memtrie state");
}
} else {
continue;
};
let Some(flat_store_chunk_view) =
flat_storage_manager.chunk_view(shard_uid, final_head.last_block_hash)
else {
continue;
};
Expand Down
Loading