Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit c1fc7b7

Browse files
committed
ABC: AccountDatabaseAPI's state_root made writable.
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 This commit has been cherry-picked from the previous PR: 7350ac3
1 parent 6bd7737 commit c1fc7b7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

eth/abc.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,6 +1769,16 @@ def state_root(self) -> Hash32:
17691769
"""
17701770
...
17711771

1772+
@state_root.setter
1773+
def state_root(self, value: Hash32) -> None:
1774+
"""
1775+
Force-set the state root hash.
1776+
"""
1777+
# See: https://github.com/python/mypy/issues/4165
1778+
# Since we can't also decorate this with abstract method we want to be
1779+
# sure that the setter doesn't actually get used as a noop.
1780+
raise NotImplementedError
1781+
17721782
@abstractmethod
17731783
def has_root(self, state_root: bytes) -> bool:
17741784
"""

0 commit comments

Comments
 (0)