1
))), 0, 1)
req2 = Request((ClientRequest(0, 189276399, Operation(
    "APPEND",
    2
))), 0, 2)
req3 = Request((ClientRequest(0, 189276402, Operation(
    "APPEND",
    3
))), 0, 3)

for i in range(N):
    start_state[str(i)] = {
        "REPLICATION_MODULE": {
            "rep": [
                ReplicaStructure(0, rep_state=[1],r_log=[{REQUEST: req1, X_SET:{0,2,3,5}}], prim=0),
                ReplicaStructure(1, rep_state=[1], r_log=[{REQUEST: req1, X_SET:{1,2,3,0}}], prim=0),
                ReplicaStructure(2, rep_state=[2], r_log=[{REQUEST: req2, X_SET:{1,2,3,4}}], prim=0),
                ReplicaStructure(3, rep_state=[3], r_log=[{REQUEST: req3, X_SET:{0,2,3,5}}], prim=0),
                ReplicaStructure(4, rep_state=[2], r_log=[{REQUEST: req2, X_SET:{0,2,3,4}}], prim=0),
                ReplicaStructure(5, rep_state=[3], r_log=[{REQUEST: req3, X_SET:{0,2,3,5}}], prim=0),
            ]
        }
    }

args = { "FORCE_VIEW": "0", "ALLOW_SERVICE": "1", "FORCE_NO_VIEW_CHANGE": "1", "NON_SELF_STAB": "1" }

class TestNonConsistentRLogLeadToReset(AbstractIntegrationTest):
    """Checks that a Byzantine node can not trick some nodes to do a view change."""

    async def bootstrap(self):
start_state = {}

for i in range(N):
    start_state[str(i)] = {
        "VIEW_ESTABLISHMENT_MODULE": {
            "views": views,
            "phs": phases,
            "vChange": vChanges,
            "witnesses": witnesses
        },
        "REPLICATION_MODULE": {
            "rep": [
                ReplicaStructure(
                    j,
                    number_of_clients=2,
                    pend_reqs=[
                        ClientRequest(0, i, Operation("APPEND", i))
                        for i in range(10)
                    ],
                ) for j in range(N)
            ]
        }
    }

args = {"BYZANTINE": {"NODES": [0], "BEHAVIOR": "UNRESPONSIVE_TO_HALF"}}

target_rep = [i for i in range(10)]


class TestByzNodeSendingDifferentViews(AbstractIntegrationTest):
    """Checks that a Byzantine primary being unresponsive to some is detected."""
    async def bootstrap(self):
Ejemplo n.º 3
0
client_req_1 = ClientRequest(0, 0, Operation("APPEND", 1))
client_req_2 = ClientRequest(0, 1, Operation("APPEND", 2))
client_req_3 = ClientRequest(0, 3, Operation("APPEND", 3))
req_1 = Request(client_req_1, 0, 1)

for i in range(N):
    start_state[str(i)] = {
        "REPLICATION_MODULE": {
            "rep": [
                ReplicaStructure(j,
                                 rep_state=[1],
                                 r_log=[{
                                     REQUEST: req_1,
                                     X_SET: {0, 1, 2, 3, 4, 5}
                                 }],
                                 pend_reqs=[client_req_2, client_req_3],
                                 last_req={0: {
                                     REQUEST: req_1,
                                     REPLY: [1]
                                 }}) for j in range(N)
            ]
        }
    }
for s in start_state:
    start_state[s]["REPLICATION_MODULE"]["rep"][0].set_seq_num(1)

args = {
    "FORCE_VIEW": "0",
    "ALLOW_SERVICE": "1",
    "FORCE_NO_VIEW_CHANGE": "1",
Ejemplo n.º 4
0
start_state = {}

req = ClientRequest(0, 189276398, Operation("APPEND", 1))

for i in range(N):
    start_state[str(i)] = {
        # force stable view_pair for all nodes
        "VIEW_ESTABLISHMENT_MODULE": {
            "views": [{
                "current": 0,
                "next": 0
            } for i in range(N)]
        },
        "REPLICATION_MODULE": {
            "rep":
            [ReplicaStructure(j, pend_reqs=[req], prim=0) for j in range(N)]
        }
    }

args = {"FORCE_VIEW": "0", "ALLOW_SERVICE": "1", "FORCE_NO_VIEW_CHANGE": "1"}


class TestReqIsAppliedInMalFreeExecution(AbstractIntegrationTest):
    """Checks that a Byzantine node can not trick some nodes to do a view change."""
    async def bootstrap(self):
        """Sets up BFTList for the test."""
        helpers.write_state_conf_file(start_state)
        return await helpers.launch_bftlist(__name__, N, F, args)

    async def validate(self):
        calls_left = helpers.MAX_NODE_CALLS
Ejemplo n.º 5
0
logger = logging.getLogger(__name__)
start_state = {}

client_req_1 = ClientRequest(0, 0, Operation("APPEND", 1))

for i in range(N):
    start_state[str(i)] = {
        # force stable view_pair for all nodes
        "VIEW_ESTABLISHMENT_MODULE": {
            "views": [{"current": 0, "next": 0} for i in range(N)]
        },
        "REPLICATION_MODULE": {
            "rep": [
                ReplicaStructure(
                    j,
                    pend_reqs=[client_req_1],
                    prim = 0
                ) for j in range(N)
            ]
        },
        "PRIMARY_MONITORING_MODULE": {
            "prim": 0
        },
        "FAILURE_DETECTOR_MODULE": {
            "prim": 0,
            "cur_check_req":[client_req_1]
        }
    }

args = {
    "BYZANTINE": {
Ejemplo n.º 6
0
# globals
F = 1
N = 6
logger = logging.getLogger(__name__)
start_state = {}

client_reqs = [ClientRequest(0, i, Operation("APPEND", i)) for i in range(20)]
reqs = [Request(client_reqs[i], 0, i) for i in range(20)]
r_logs = [{REQUEST: reqs[i], X_SET: {0, 1, 2, 3, 4}} for i in range(20)]

for i in range(N):
    start_state[str(i)] = {
        "REPLICATION_MODULE": {
            "rep": [
                ReplicaStructure(j,
                                 rep_state=[k for k in range(20)],
                                 r_log=r_logs[-15:],
                                 pend_reqs=[]) for j in range(N - 1)
            ] + [
                ReplicaStructure(
                    5, rep_state=[0], r_log=[r_logs[0]], pend_reqs=[])
            ]
        }
    }
for s in start_state:
    start_state[s]["REPLICATION_MODULE"]["rep"][0].set_seq_num(17)

args = {
    "FORCE_VIEW": "0",
    "ALLOW_SERVICE": "1",
    "FORCE_NO_VIEW_CHANGE": "1",
}
Ejemplo n.º 7
0
client_req_1 = ClientRequest(0, 0, Operation("APPEND", 1))
client_req_2 = ClientRequest(0, 1, Operation("APPEND", 2))
client_req_3 = ClientRequest(0, 3, Operation("APPEND", 3))
req_1 = Request(client_req_1, 0, 1)
req_2 = Request(client_req_2, 0, 2)

for i in range(N):
    start_state[str(i)] = {
        "REPLICATION_MODULE": {
            "rep": [
                ReplicaStructure(
                    j,
                    rep_state=[1],
                    r_log=[{REQUEST: req_1, X_SET: {0,1,2,3,4,5}}],
                    pend_reqs=[client_req_2, client_req_3],
                    req_q=[{REQUEST: req_2, STATUS:{enums.PRE_PREP}}],
                    last_req=[{0: {REQUEST: req_1, REPLY: [1]}}],
                    seq_num=1,
                    prim=0
                ) for j in range(N)
            ]
        }
    }
for s in start_state:
    start_state[s]["REPLICATION_MODULE"]["rep"][0].set_seq_num(1)

args = {
    "FORCE_VIEW": "1",
    "ALLOW_SERVICE": "1",
    "FORCE_NO_VIEW_CHANGE": "1",
}
for i in range(N):
    start_state[str(i)] = {
        # force stable view_pair for all nodes
        "VIEW_ESTABLISHMENT_MODULE": {
            "views": [{
                "current": 0,
                "next": 0
            } for i in range(N)]
        },
        "REPLICATION_MODULE": {
            "rep": [
                ReplicaStructure(0,
                                 rep_state=[1],
                                 r_log=[{
                                     REQUEST: req1,
                                     X_SET: {0, 1, 2, 3}
                                 }],
                                 pend_reqs=[client_req2, client_req3],
                                 prim=0,
                                 seq_num=0),
                ReplicaStructure(1,
                                 rep_state=[1, 2],
                                 r_log=[{
                                     REQUEST: req1,
                                     X_SET: {0, 1, 2, 3}
                                 }],
                                 pend_reqs=[client_req2, client_req3],
                                 prim=0),
                ReplicaStructure(2,
                                 rep_state=[1],
                                 r_log=[{
     "views": [{
         "current": 0,
         "next": 0
     } for i in range(N)]
 },
 "REPLICATION_MODULE": {
     "rep": [
         ReplicaStructure(0,
                          rep_state=[1, 2, 3],
                          r_log=[
                              {
                                  REQUEST: req1,
                                  X_SET: {0, 1, 2, 3, 4, 5}
                              },
                              {
                                  REQUEST: req2,
                                  X_SET: {0, 1, 2, 3, 4, 5}
                              },
                              {
                                  REQUEST: req3,
                                  X_SET: {0, 1}
                              },
                          ],
                          prim=0),
         ReplicaStructure(1,
                          rep_state=target_rep_state,
                          r_log=target_r_log,
                          req_q=[{
                              REQUEST: req3,
                              STATUS: {re.PRE_PREP, re.PREP, re.COMMIT}
                          }],
Ejemplo n.º 10
0
for i in range(N):
    start_state[str(i)] = {
        # force stable view_pair for all nodes
        "VIEW_ESTABLISHMENT_MODULE": {
            "views": [{
                "current": 0,
                "next": 0
            } for i in range(N)]
        },
        "REPLICATION_MODULE": {
            "rep": [
                ReplicaStructure(0,
                                 rep_state=[1],
                                 r_log=[{
                                     REQUEST: req1,
                                     X_SET: {0, 1, 2, 3, 4, 5, 6, 7}
                                 }],
                                 pend_reqs=[client_req2, client_req3],
                                 prim=0,
                                 seq_num=0),
                ReplicaStructure(1,
                                 rep_state=[1],
                                 r_log=[{
                                     REQUEST: req1,
                                     X_SET: {0, 1, 2, 3, 4, 5, 6, 7}
                                 }],
                                 pend_reqs=[client_req2, client_req3],
                                 prim=0),
                ReplicaStructure(2,
                                 rep_state=[1],
                                 r_log=[{