From 7ddbdc7709a5b83a1a43d303b9c69b7b869809f4 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Mon, 22 Jul 2019 10:23:44 +0530 Subject: [PATCH] Use a dict over list --- mythril/laser/ethereum/state/account.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mythril/laser/ethereum/state/account.py b/mythril/laser/ethereum/state/account.py index 71928a92..0e7be11a 100644 --- a/mythril/laser/ethereum/state/account.py +++ b/mythril/laser/ethereum/state/account.py @@ -135,20 +135,20 @@ class IteStorageRegion(StorageRegion): def __init__(self) -> None: """Constructor for Storage. """ - self.itelist = [] # type: List[Tuple[BitVecFunc, Any]] + self.itedict = {} # type: Dict[BitVecFunc, Tuple[BitVecFunc, Any]] def __getitem__(self, item: BitVecFunc): storage = symbol_factory.BitVecVal(0, 256) - for key, val in self.itelist[::-1]: + for key, val in self.itedict.items(): storage = If(item == key, val, storage) return storage def __setitem__(self, key: BitVecFunc, value): - self.itelist.append((key, value)) + self.itedict[key] = (key, value) def __deepcopy__(self, memodict={}): ite_copy = IteStorageRegion() - ite_copy.itelist = copy(self.itelist) + ite_copy.itedict = copy(self.itedict) return ite_copy