py-evm icon indicating copy to clipboard operation
py-evm copied to clipboard

Stop silently swallowing KeyError in DBDiff

Open carver opened this issue 6 years ago • 0 comments

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 DBDiff API that depend on this behavior
  • (making sure there are new tests that demonstrate a KeyError being raised if it was missing when applied to a DB)

(Note this will make the re-raise in #1778 unnecessary)

carver avatar May 15 '19 22:05 carver