From a2287c68a696610824f15b118313addd8bc50271 Mon Sep 17 00:00:00 2001 From: rakita Date: Fri, 2 Jun 2023 14:50:19 +0200 Subject: [PATCH] chore: dont get plain state if not shard is there (#2959) --- crates/storage/provider/src/providers/state/historical.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/storage/provider/src/providers/state/historical.rs b/crates/storage/provider/src/providers/state/historical.rs index b453926a8..74f58037c 100644 --- a/crates/storage/provider/src/providers/state/historical.rs +++ b/crates/storage/provider/src/providers/state/historical.rs @@ -64,6 +64,9 @@ impl<'a, 'b, TX: DbTx<'a>> AccountProvider for HistoricalStateProviderRef<'a, 'b address, })?; Ok(account.info) + } else if None == changeset_block_number { + // if there is no shard, return empty account. + Ok(None) } else { // if changeset is not present that means that there was history shard but we need to // use newest value from plain state. Or zero if none. @@ -126,6 +129,9 @@ impl<'a, 'b, TX: DbTx<'a>> StateProvider for HistoricalStateProviderRef<'a, 'b, storage_key, })?; Ok(Some(storage_entry.value)) + } else if changeset_block_number == None { + // if there is no shards, return empty account. + return Ok(None); } else { // if changeset is not present that means that there was history shard but we need to // use newest value from plain state