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

Commit 966ef5a

Browse files
committed
ABC,eth/vm/state: replace occurences of UUID with JournalDBCheckpoint.
Silences errors: eth/vm/state.py:165: error: Incompatible return value type (got "Tuple[Hash32, JournalDBCheckpoint]", expected "Tuple[Hash32, UUID]") eth/vm/state.py:173: error: Argument 1 to "discard" of "AccountDatabaseAPI" has incompatible type "UUID"; expected "JournalDBCheckpoint" eth/vm/state.py:177: error: Argument 1 to "commit" of "AccountDatabaseAPI" has incompatible type "UUID"; expected "JournalDBCheckpoint"
1 parent 857bef4 commit 966ef5a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

eth/abc.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
TypeVar,
2121
Union,
2222
)
23-
from uuid import UUID
2423

2524
import rlp
2625

@@ -2301,7 +2300,7 @@ def account_is_empty(self, address: Address) -> bool:
23012300
# Access self._chaindb
23022301
#
23032302
@abstractmethod
2304-
def snapshot(self) -> Tuple[Hash32, UUID]:
2303+
def snapshot(self) -> Tuple[Hash32, JournalDBCheckpoint]:
23052304
"""
23062305
Perform a full snapshot of the current state.
23072306
@@ -2311,14 +2310,14 @@ def snapshot(self) -> Tuple[Hash32, UUID]:
23112310
...
23122311

23132312
@abstractmethod
2314-
def revert(self, snapshot: Tuple[Hash32, UUID]) -> None:
2313+
def revert(self, snapshot: Tuple[Hash32, JournalDBCheckpoint]) -> None:
23152314
"""
23162315
Revert the VM to the state at the snapshot
23172316
"""
23182317
...
23192318

23202319
@abstractmethod
2321-
def commit(self, snapshot: Tuple[Hash32, UUID]) -> None:
2320+
def commit(self, snapshot: Tuple[Hash32, JournalDBCheckpoint]) -> None:
23222321
"""
23232322
Commit the journal to the point where the snapshot was taken. This
23242323
merges in any changes that were recorded since the snapshot.

eth/vm/state.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Tuple,
55
Type,
66
)
7-
from uuid import UUID
87

98
from eth_typing import (
109
Address,
@@ -32,6 +31,7 @@
3231
from eth.constants import (
3332
MAX_PREV_HEADER_DEPTH,
3433
)
34+
from eth.typing import JournalDBCheckpoint
3535
from eth._utils.datatypes import (
3636
Configurable,
3737
)
@@ -161,18 +161,18 @@ def account_is_empty(self, address: Address) -> bool:
161161
#
162162
# Access self._chaindb
163163
#
164-
def snapshot(self) -> Tuple[Hash32, UUID]:
164+
def snapshot(self) -> Tuple[Hash32, JournalDBCheckpoint]:
165165
return self.state_root, self._account_db.record()
166166

167-
def revert(self, snapshot: Tuple[Hash32, UUID]) -> None:
167+
def revert(self, snapshot: Tuple[Hash32, JournalDBCheckpoint]) -> None:
168168
state_root, account_snapshot = snapshot
169169

170170
# first revert the database state root.
171171
self._account_db.state_root = state_root
172172
# now roll the underlying database back
173173
self._account_db.discard(account_snapshot)
174174

175-
def commit(self, snapshot: Tuple[Hash32, UUID]) -> None:
175+
def commit(self, snapshot: Tuple[Hash32, JournalDBCheckpoint]) -> None:
176176
_, account_snapshot = snapshot
177177
self._account_db.commit(account_snapshot)
178178

0 commit comments

Comments
 (0)