mirror of
https://github.com/akula-bft/akula.git
synced 2026-04-19 03:00:13 -04:00
Misc fixes
This commit is contained in:
@@ -658,8 +658,8 @@ impl TableEncode for AccountChange {
|
||||
|
||||
impl TableDecode for AccountChange {
|
||||
fn decode(b: &[u8]) -> anyhow::Result<Self> {
|
||||
if b.len() < ADDRESS_LENGTH + 1 {
|
||||
return Err(TooShort::<{ ADDRESS_LENGTH + 1 }> { got: b.len() }.into());
|
||||
if b.len() < ADDRESS_LENGTH {
|
||||
return Err(TooShort::<{ ADDRESS_LENGTH }> { got: b.len() }.into());
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
|
||||
@@ -89,7 +89,7 @@ async fn execute_batch_of_blocks<'db, Tx: MutableTransaction<'db>>(
|
||||
let stage_complete = block_number == max_block;
|
||||
|
||||
let end_of_batch = stage_complete
|
||||
|| gas_since_start > batch_size
|
||||
|| gas_since_start >= batch_size
|
||||
|| commit_every
|
||||
.map(|commit_every| now - batch_started_at > commit_every)
|
||||
.unwrap_or(false);
|
||||
|
||||
@@ -618,20 +618,21 @@ where
|
||||
|
||||
let block_state_root = accessors::chain::header::read(
|
||||
tx,
|
||||
accessors::chain::canonical_hash::read(tx, past_progress)
|
||||
accessors::chain::canonical_hash::read(tx, prev_progress)
|
||||
.await?
|
||||
.ok_or_else(|| anyhow!("No canonical hash for block {}", past_progress))?,
|
||||
past_progress,
|
||||
.ok_or_else(|| anyhow!("No canonical hash for block {}", prev_progress))?,
|
||||
prev_progress,
|
||||
)
|
||||
.await?
|
||||
.ok_or_else(|| anyhow!("No header for block {}", past_progress))?
|
||||
.ok_or_else(|| anyhow!("No header for block {}", prev_progress))?
|
||||
.state_root;
|
||||
|
||||
if block_state_root == trie_root {
|
||||
info!("Block #{} state root OK: {:?}", past_progress, trie_root)
|
||||
info!("Block #{} state root OK: {:?}", prev_progress, trie_root)
|
||||
} else {
|
||||
bail!(
|
||||
"State root mismatch: {:?} != {:?}",
|
||||
"Block #{} state root mismatch: {:?} != {:?}",
|
||||
prev_progress,
|
||||
trie_root,
|
||||
block_state_root
|
||||
)
|
||||
@@ -643,10 +644,9 @@ where
|
||||
storage_collector.load(&mut storage_write_cursor).await?
|
||||
};
|
||||
|
||||
info!("Processed");
|
||||
Ok(ExecOutput::Progress {
|
||||
stage_progress: cmp::max(prev_progress, past_progress),
|
||||
done: false,
|
||||
done: true,
|
||||
must_commit: true,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user