Пример #1
0
    def __init__(self, tx_id: str, calldata: list) -> None:
        """Initializes the ConcreteCalldata object.

        :param tx_id: Id of the transaction that the calldata is for.
        :param calldata: The concrete calldata content
        """
        self._concrete_calldata = calldata
        self._calldata = K(256, 8, 0)
        for i, element in enumerate(calldata, 0):
            element = (symbol_factory.BitVecVal(element, 8) if isinstance(
                element, int) else element)
            self._calldata[symbol_factory.BitVecVal(i, 256)] = element

        super().__init__(tx_id)
Пример #2
0
    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
Пример #3
0
 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