Fudge persistent legacy hexary db edge case (#1817)
details: Persistent pruning would not restore the `emptyRlp` value for the root node when the database becomes empty. This effects to an assertion exception next time the DB is accessed. As most unit tests run on the memory DB, this case slipped through unnoticed for a while (see also issue #9.)
This commit is contained in:
parent
786263c0b8
commit
1ffac5b2ea
|
@ -45,7 +45,7 @@ proc toGenesisHeader*(
|
||||||
#
|
#
|
||||||
# This kludge also fixes the initial crash described in
|
# This kludge also fixes the initial crash described in
|
||||||
# https://github.com/status-im/nimbus-eth1/issues/932.
|
# https://github.com/status-im/nimbus-eth1/issues/932.
|
||||||
if sdb.pruneTrie and 0 < account.storage.len:
|
if sdb.pruneTrie:
|
||||||
sdb.db.compensateLegacySetup() # <-- kludge
|
sdb.db.compensateLegacySetup() # <-- kludge
|
||||||
|
|
||||||
for k, v in account.storage:
|
for k, v in account.storage:
|
||||||
|
|
|
@ -141,10 +141,20 @@ proc coreDbMain*(noisy = defined(debug)) =
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
const
|
const
|
||||||
noisy = defined(debug) or true
|
noisy = defined(debug) or true
|
||||||
|
persDb = true
|
||||||
|
|
||||||
setErrorLevel()
|
setErrorLevel()
|
||||||
|
|
||||||
noisy.legacyRunner()
|
# This one uses the readily available dump: `bulkTest0` and some huge replay
|
||||||
|
# dumps `bulkTest2`, `bulkTest3`, .. from the `nimbus-eth1-blobs` package.
|
||||||
|
# For specs see `tests/test_coredb/bulk_test_xx.nim`.
|
||||||
|
var testList = @[bulkTest0]
|
||||||
|
testList = @[bulkTest1] # This test supersedes `bulkTest0`
|
||||||
|
when true and false:
|
||||||
|
testList = @[bulkTest1, bulkTest2, bulkTest3]
|
||||||
|
|
||||||
|
for n,capture in testList:
|
||||||
|
noisy.legacyRunner(capture=capture, persistent=persDb)
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -281,8 +281,8 @@ when isMainModule:
|
||||||
setErrorLevel()
|
setErrorLevel()
|
||||||
|
|
||||||
# This one uses the readily available dump: `bulkTest0` and some huge replay
|
# This one uses the readily available dump: `bulkTest0` and some huge replay
|
||||||
# dumps `bulkTest1`, `bulkTest2`, .. from the `nimbus-eth1-blobs` package.
|
# dumps `bulkTest2`, `bulkTest3`, .. from the `nimbus-eth1-blobs` package.
|
||||||
# For specs see `tests/test_sync_snap/bulk_test_xx.nim`.
|
# For specs see `tests/test_rocksdb_timing/bulk_test_xx.nim`.
|
||||||
var testList = @[bulkTest0]
|
var testList = @[bulkTest0]
|
||||||
when true and false:
|
when true and false:
|
||||||
testList &= @[bulkTest1, bulkTest2, bulkTest3]
|
testList &= @[bulkTest1, bulkTest2, bulkTest3]
|
||||||
|
|
Loading…
Reference in New Issue