py-evm
py-evm copied to clipboard
Stop silently swallowing KeyError in DBDiff
What is wrong?
Right now, DBDiff drops any KeyErrors that are raised when it tries to delete values in the underlying database. This is mildly annoying because MissingTrieNode extends KeyError (an unfortunate holdover from an old py-trie version). But also it's unnecessary and might hide issues when we delete the wrong (missing) key, and never get notified.
How can it be fixed
Don't catch the KeyError here: https://github.com/ethereum/py-evm/blob/master/eth/db/diff.py#L198
There is likely follow-up work to do:
- fix anything that breaks in current tests
- update any current tests on the
DBDiffAPI that depend on this behavior - (making sure there are new tests that demonstrate a
KeyErrorbeing raised if it was missing when applied to a DB)
(Note this will make the re-raise in #1778 unnecessary)