Skip to content

Commit 6f527f3

Browse files
committed
wip: dump state tools
1 parent b811685 commit 6f527f3

File tree

18 files changed

+1011
-278
lines changed

18 files changed

+1011
-278
lines changed

block-util/src/state/shard_state_stuff.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl ShardStateStuff {
137137
state.gen_utime as u64 * 1000 + state.gen_utime_ms as u64
138138
}
139139

140-
pub fn get_top_shards(&self) -> Result<Vec<ShardIdent>> {
140+
pub fn get_all_top_shards(&self) -> Result<Vec<ShardIdent>> {
141141
let mut res = vec![self.block_id().shard];
142142

143143
for item in self.shards()?.latest_blocks() {
@@ -147,6 +147,20 @@ impl ShardStateStuff {
147147

148148
Ok(res)
149149
}
150+
151+
pub fn get_top_shard_blocks_info(&self) -> Result<Vec<(BlockId, bool)>> {
152+
let mut res = vec![];
153+
154+
for item in self.shards()?.iter() {
155+
let (shard_id, shard_descr) = item?;
156+
res.push((
157+
shard_descr.as_block_id(shard_id),
158+
shard_descr.top_sc_block_updated,
159+
));
160+
}
161+
162+
Ok(res)
163+
}
150164
}
151165

152166
impl AsRef<ShardStateUnsplit> for ShardStateStuff {

cli/src/node/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ impl Node {
327327

328328
// We should clear uncommitted queue state because it may contain incorrect diffs
329329
// that were created before node restart. We will restore queue strictly above last committed state
330-
let top_shards = mc_state.get_top_shards()?;
330+
let top_shards = mc_state.get_all_top_shards()?;
331331
message_queue_adapter.clear_uncommitted_state(&top_shards)?;
332332

333333
let validator = ValidatorStdImpl::new(

collator/src/collator/do_collate/finalize.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ impl Phase<FinalizeState> {
156156
let finalize_message_reader_res = messages_reader.finalize(
157157
self.extra.executor.min_next_lt(),
158158
&other_updated_top_shard_diffs_info,
159+
true,
159160
)?;
160161
create_queue_diff_elapsed = histogram_create_queue_diff.finish();
161162
finalize_message_reader_res

collator/src/collator/messages_reader/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ impl<V: InternalMessageValue> MessagesReader<V> {
435435
ShardIdent,
436436
(PartitionRouter, DiffStatistics),
437437
>,
438+
check_for_unprocessed_messages: bool,
438439
) -> Result<FinalizedMessagesReader<V>> {
439440
let mut has_unprocessed_messages = self.has_messages_in_buffers()
440441
|| self.has_pending_new_messages()
@@ -444,7 +445,7 @@ impl<V: InternalMessageValue> MessagesReader<V> {
444445
let mut internals_reader_state = InternalsReaderState::default();
445446
for (_par_id, par_reader) in self.internals_partition_readers.iter_mut() {
446447
// check pending internals in iterators
447-
if !has_unprocessed_messages {
448+
if !has_unprocessed_messages && check_for_unprocessed_messages {
448449
has_unprocessed_messages = par_reader.check_has_pending_internals_in_iterators()?;
449450
}
450451

0 commit comments

Comments
 (0)