def __init__(self, tx_id: str) -> None: """Initializes the SymbolicCalldata object. :param tx_id: Id of the transaction that the calldata is for. """ self._size = symbol_factory.BitVecSym(str(tx_id) + "_calldatasize", 256) self._calldata = Array("{}_calldata".format(tx_id), 256, 8) super().__init__(tx_id)
def __init__(self, transaction_sequence=None, annotations: List[StateAnnotation] = None) -> None: """Constructor for the world state. Initializes the accounts record. :param transaction_sequence: :param annotations: """ self._accounts = {} # type: Dict[int, Account] self.balances = Array("balance", 256, 256) self.node = None # type: Optional['Node'] self.transaction_sequence = transaction_sequence or [] self._annotations = annotations or []
def __init__(self, concrete=False, address=None, dynamic_loader=None) -> None: """Constructor for Storage. :param concrete: bool indicating whether to interpret uninitialized storage as concrete versus symbolic """ if concrete: self._standard_storage = K(256, 256, 0) # type: BaseArray else: self._standard_storage = Array("Storage", 256, 256) self._map_storage = {} # type: Dict[BitVec, BaseArray] self.printable_storage = {} # type: Dict[BitVec, BitVec] self.dynld = dynamic_loader self.storage_keys_loaded = set() # type: Set[int] self.address = address
def _get_corresponding_storage(self, key: BitVec) -> Tuple[BaseArray, bool]: index = self.get_map_index(key) if index is None: storage = self._standard_storage is_keccak_storage = False else: storage_map = self._map_storage try: storage = storage_map[index] except KeyError: if isinstance(self._standard_storage, Array): storage_map[index] = Array("Storage", 512, 256) else: storage_map[index] = K(512, 256, 0) storage = storage_map[index] is_keccak_storage = True return storage, is_keccak_storage