fix(tree): disable state trie caching (#6239)

This commit is contained in:
Roman Krasiuk
2024-01-26 09:13:06 +01:00
committed by GitHub
parent ed575db3d0
commit 4ea4556209

View File

@ -167,7 +167,7 @@ impl AppendableChain {
parent_block: &SealedHeader, parent_block: &SealedHeader,
bundle_state_data_provider: BSDP, bundle_state_data_provider: BSDP,
externals: &TreeExternals<DB, EF>, externals: &TreeExternals<DB, EF>,
block_attachment: BlockAttachment, _block_attachment: BlockAttachment,
block_validation_kind: BlockValidationKind, block_validation_kind: BlockValidationKind,
) -> RethResult<(BundleStateWithReceipts, Option<TrieUpdates>)> ) -> RethResult<(BundleStateWithReceipts, Option<TrieUpdates>)>
where where
@ -194,13 +194,16 @@ impl AppendableChain {
// validation was requested. // validation was requested.
if block_validation_kind.is_exhaustive() { if block_validation_kind.is_exhaustive() {
// check state root // check state root
let (state_root, trie_updates) = if block_attachment.is_canonical() { // TODO: state root caching is disabled until debugged properly
provider // let (state_root, trie_updates) = if block_attachment.is_canonical() {
.state_root_with_updates(&bundle_state) // provider
.map(|(root, updates)| (root, Some(updates)))? // .state_root_with_updates(&bundle_state)
} else { // .map(|(root, updates)| (root, Some(updates)))?
(provider.state_root(&bundle_state)?, None)
}; // } else {
// (provider.state_root(&bundle_state)?, None)
// };
let state_root = provider.state_root(&bundle_state)?;
if block.state_root != state_root { if block.state_root != state_root {
return Err(ConsensusError::BodyStateRootDiff( return Err(ConsensusError::BodyStateRootDiff(
GotExpected { got: state_root, expected: block.state_root }.into(), GotExpected { got: state_root, expected: block.state_root }.into(),
@ -208,7 +211,7 @@ impl AppendableChain {
.into()) .into())
} }
Ok((bundle_state, trie_updates)) Ok((bundle_state, None))
} else { } else {
Ok((bundle_state, None)) Ok((bundle_state, None))
} }