Skip to content

Commit db0d02b

Browse files
committed
Remove unnecessary null check
1 parent 8e14f6e commit db0d02b

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

packages/statemanager/src/stateManager.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ export class DefaultStateManager implements EVMStateManagerInterface {
966966
const stream = trie.createReadStream()
967967

968968
for await (const chunk of stream) {
969-
if (chunk !== null) storage[bytesToHex(chunk.key)] = bytesToHex(chunk.value)
969+
storage[bytesToHex(chunk.key)] = bytesToHex(chunk.value)
970970
}
971971

972972
return storage
@@ -999,26 +999,28 @@ export class DefaultStateManager implements EVMStateManagerInterface {
999999
const storageMap: StorageRange['storage'] = {}
10001000
const stream = trie.createReadStream()
10011001
for await (const chunk of stream) {
1002-
if (chunk !== null) {
1003-
if (!inRange) {
1004-
// Check if the key is already in the correct range.
1005-
if (bytesToBigInt(chunk.key) >= startKey) {
1006-
inRange = true
1007-
} else {
1008-
continue
1009-
}
1002+
if (!inRange) {
1003+
// Check if the key is already in the correct range.
1004+
if (bytesToBigInt(chunk.key) >= startKey) {
1005+
inRange = true
1006+
} else {
1007+
continue
10101008
}
1011-
if (i < limit) {
1012-
storageMap[bytesToHex(chunk.key)] = { key: null, value: bytesToHex(chunk.value) }
1013-
i++
1014-
} else if (i === limit) {
1015-
return {
1016-
storage: storageMap,
1017-
nextKey: bytesToHex(chunk.key),
1018-
}
1009+
}
1010+
if (i < limit) {
1011+
storageMap[bytesToHex(chunk.key)] = { key: null, value: bytesToHex(chunk.value) }
1012+
i++
1013+
} else if (i === limit) {
1014+
return {
1015+
storage: storageMap,
1016+
nextKey: bytesToHex(chunk.key),
10191017
}
10201018
}
10211019
}
1020+
return {
1021+
storage: storageMap,
1022+
nextKey: null,
1023+
}
10221024
}
10231025

10241026
/**

0 commit comments

Comments
 (0)