def test_forge_accusation(self, sandbox: Sandbox, session: dict):
        """Forge and inject a double endorsement evidence operation"""
        client = sandbox.client(1)
        head_hash = client.get_head()['hash']

        # Extract the `Endorsement` ops and the slot out of the
        # `Endorsement_with_slot` ops
        endorsement1 = session['endorsement1']['contents'][0]['endorsement']
        endorsement2 = session['endorsement2']['contents'][0]['endorsement']
        slot = session['endorsement1']['contents'][0]['slot']

        operation = {
            'branch':
            head_hash,
            'contents': [{
                'kind': 'double_endorsement_evidence',
                'op1': endorsement1,
                'op2': endorsement2,
                'slot': slot,
            }],
        }

        path_forge_operation = (
            '/chains/main/blocks/head/helpers/forge/operations')
        operation_hex_string = client.rpc('post',
                                          path_forge_operation,
                                          data=operation)
        assert isinstance(operation_hex_string, str)
        sender_sk_long = constants.IDENTITIES['bootstrap1']['secret']
        sender_sk = sender_sk_long[len('unencrypted:'):]
        signed_op = utils.sign_operation(operation_hex_string, sender_sk)
        op_hash = client.rpc('post', 'injection/operation', signed_op)
        assert isinstance(op_hash, str)
        session['operation'] = op_hash
    def test_forge_accusation(self, sandbox, session):
        """Forge and inject a double endorsement evidence operation"""
        client = sandbox.client(1)
        head_hash = client.get_head()['hash']

        def transform_endorsement(end):
            return {
                'branch': end['branch'],
                'operations': end['contents'][0],
                'signature': end['signature']
            }

        endorsement1 = transform_endorsement(session['endorsement1'])
        endorsement2 = transform_endorsement(session['endorsement2'])
        operation = {
            'branch':
            head_hash,
            'contents': [{
                'kind': 'double_endorsement_evidence',
                'op1': endorsement1,
                'op2': endorsement2
            }]
        }

        path_forge_operation = ('/chains/main/blocks/head/helpers/forge/'
                                'operations')
        operation_hex_string = client.rpc('post',
                                          path_forge_operation,
                                          data=operation)
        assert isinstance(operation_hex_string, str)
        sender_sk_long = constants.IDENTITIES['bootstrap1']['secret']
        sender_sk = sender_sk_long[len('unencrypted:'):]
        signed_op = utils.sign_operation(operation_hex_string, sender_sk)
        op_hash = client.rpc('post', 'injection/operation', signed_op)
        assert isinstance(op_hash, str)
        session['operation'] = op_hash