def __init__(self, event_list):
        """
        Convert an event list into an object that is similar to the previous
        state delta event for compatibility.

        Raises
            KeyError
                An event was missing from the event list or an attribute was
                missing from an event.
        """
        block_commit = self._get_event("sawtooth/block-commit", event_list)
        self.block_id = self._get_attr(block_commit, "block_id")
        self.block_num = self._get_attr(block_commit, "block_num")
        self.previous_block_id = self._get_attr(block_commit,
                                                "previous_block_id")

        state_delta = self._get_event("sawtooth/state-delta", event_list)
        state_change_list = transaction_receipt_pb2.StateChangeList()
        state_change_list.ParseFromString(state_delta.data)
        self.state_changes = state_change_list.state_changes
 def assert_state_event(self, event, address_prefix):
     self.assertEqual(event.event_type, "sawtooth/state-delta")
     state_change_list = transaction_receipt_pb2.StateChangeList()
     state_change_list.ParseFromString(event.data)
     for change in state_change_list.state_changes:
         self.assertTrue(change.address.startswith(address_prefix))