Skip to content

Commit

Permalink
ABC: AccountDatabaseAPI's state_root made writable.
Browse files Browse the repository at this point in the history
AccountDB (from eth/db/account.py) has a setter for the `state_root`
property, and `BaseState` (from eth/vm/state.py) forcibly sets the
state root in its revert() function.

This helps silence `mypy` error:

    eth/vm/state.py:170: error: Property "state_root" defined in "AccountDatabaseAPI" is read-only
  • Loading branch information
veox committed Dec 11, 2019
1 parent 97cc8db commit 7350ac3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions eth/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1633,6 +1633,16 @@ def state_root(self) -> Hash32:
"""
...

@state_root.setter
def state_root(self, value: Hash32) -> None:
"""
Force-set the state root hash.
"""
# See: https://github.com/python/mypy/issues/4165
# Since we can't also decorate this with abstract method we want to be
# sure that the setter doesn't actually get used as a noop.
raise NotImplementedError

@abstractmethod
def has_root(self, state_root: bytes) -> bool:
"""
Expand Down

0 comments on commit 7350ac3

Please sign in to comment.