def setup(startedNodes):
    A = startedNodes.Alpha
    B = startedNodes.Beta
    for node in A, B:
        makeNodeFaulty(node, changesRequest)
        node.delaySelfNomination(10)
    return adict(faulties=(A, B))
def setup(startedNodes):
    A = startedNodes.Alpha
    B = startedNodes.Beta
    for node in A, B:
        makeNodeFaulty(node,
                       partial(delaysPrePrepareProcessing, delay=60))
        node.delaySelfNomination(10)
    return adict(faulties=(A, B))
Ejemplo n.º 3
0
def setup(nodeSet, up):
    primaryRep, nonPrimaryReps = getPrimaryReplica(nodeSet, 0), \
                                 getNonPrimaryReplicas(nodeSet, 0)

    # The primary replica would send PRE-PREPARE messages with incorrect digest
    makeNodeFaulty(primaryRep.node, partial(send3PhaseMsgWithIncorrectDigest,
                                            msgType=PrePrepare))

    return adict(primaryRep=primaryRep, nonPrimaryReps=nonPrimaryReps)
def setup(startedNodes):
    A = startedNodes.Alpha
    B = startedNodes.Beta
    G = startedNodes.Gamma
    for node in A, B, G:
        makeNodeFaulty(node,
                       changesRequest,
                       partial(delaysPrePrepareProcessing, delay=60))
        node.delaySelfNomination(10)
    return adict(faulties=(A, B, G))
def setup(startedNodes):
    A = startedNodes.Alpha
    B = startedNodes.Beta
    # Delay processing of PRE-PREPARE messages by Alpha and Beta for 90
    # seconds since the timeout for checking sufficient commits is 60 seconds
    makeNodeFaulty(A, partial(delaysPrePrepareProcessing, delay=90))
    makeNodeFaulty(B, partial(delaysPrePrepareProcessing, delay=90))
    A.delaySelfNomination(10)
    B.delaySelfNomination(10)
    return adict(faulties=(A, B))
def nodeChangesRequest(nodeSet):
    alpha = nodeSet.Alpha

    # Alpha should not be blacklisted for Invalid Signature by all other nodes
    # for node in nodeSet:
    #     if node != alpha:
    #         node.whitelistNode(alpha.name, 100)
    whitelistNode(alpha.name,
                  [node for node in nodeSet if node != alpha],
                  100)
    makeNodeFaulty(alpha, changesRequest,)
Ejemplo n.º 7
0
def setup(nodeSet, up):
    primaryRep, nonPrimaryReps = getPrimaryReplica(nodeSet, 0), \
                                 getNonPrimaryReplicas(nodeSet, 0)

    # A non primary replica sends PREPARE messages with incorrect digest

    faultyRep = nonPrimaryReps[0]
    makeNodeFaulty(faultyRep.node, partial(send3PhaseMsgWithIncorrectDigest,
                                           msgType=Prepare, instId=0))

    return adict(primaryRep=primaryRep, nonPrimaryReps=nonPrimaryReps,
                 faultyRep=faultyRep)
def setup(nodeSet, up):
    primaryRep, nonPrimaryReps = getPrimaryReplica(nodeSet, 0), \
                                 getNonPrimaryReplicas(nodeSet, 0)

    # The primary replica would send 3 duplicate PRE-PREPARE requests to
    # non primary replicas
    makeNodeFaulty(primaryRep.node, partial(sendDuplicate3PhaseMsg,
                                            msgType=PrePrepare, count=3))

    # The node of the primary replica above should not be blacklisted by any
    # other node since we are simulating multiple PRE-PREPARE messages and
    # want to check for a particular suspicion
    # for node in nodeSet:
    #     if node != primaryRep.node:
    #         node.whitelistNode(primaryRep.node.name,
    #                            Suspicions.DUPLICATE_PPR_SENT.code)


    return adict(primaryRep=primaryRep, nonPrimaryReps=nonPrimaryReps)
Ejemplo n.º 9
0
def setup(nodeSet, up):
    primaryRep, nonPrimaryReps = getPrimaryReplica(nodeSet, 0), \
                                 getNonPrimaryReplicas(nodeSet, 0)

    # A non primary replica sends duplicate PREPARE requests to all other
    # replicas
    faultyRep = nonPrimaryReps[0]
    makeNodeFaulty(faultyRep.node, partial(sendDuplicate3PhaseMsg,
                                           msgType=Prepare, count=3,
                                           instId=0))

    # The node of the primary replica above should not be blacklisted by any
    # other node since we are simulating multiple PREPARE messages and
    # want to check for a particular suspicion

    whitelistNode(faultyRep.node.name,
                  [node for node in nodeSet if node != faultyRep.node],
                  Suspicions.DUPLICATE_PR_SENT.code)

    return adict(primaryRep=primaryRep, nonPrimaryReps=nonPrimaryReps,
                 faultyRep=faultyRep)
def setup(startedNodes):
    A = startedNodes.Alpha
    A.delaySelfNomination(10)
    makeNodeFaulty(A,
                   partial(delaysPrePrepareProcessing, delay=60))
    return adict(faulty=A)
Ejemplo n.º 11
0
def evilAlpha(nodeSet):
    makeNodeFaulty(nodeSet.Alpha, changesRequest)
def evilAlpha(nodeSet):
    # Delay processing of PRE-PREPARE messages by Alpha for 90
    # seconds since the timeout for checking sufficient commits is 60 seconds
    makeNodeFaulty(nodeSet.Alpha, partial(delaysPrePrepareProcessing, delay=90))
Ejemplo n.º 13
0
        """
        print("Reply: {}\n".format(reply))
        print("Status: {}\n".format(status))

        """
        See the reply details of a request.
        """
        client.showReplyDetails(request.reqId)

        """
        As we are using 4 nodes, we have an f-value of 1, which means that
        consensus can be still achieved with one faulty node. In this example,
        we're going to cause Beta to be malicious, altering a client's request
        before propagating to other nodes.
        """
        makeNodeFaulty(beta, changesRequest)

        """
        Create a new message.
        """
        msg = {"type": "sell", "amount": 101}

        """
        And submit it.
        """
        request2, = client.submit(msg)

        """
        Allow time for the message to be executed.
        """
        looper.runFor(3)