コード例 #1
0
def test_send_claim_def_schema_and_claim_def_in_one_batch(
        looper, tconf, sdk_pool_handle, nodeSet, sdk_wallet_trustee):
    with max_3pc_batch_limits(tconf, size=2) as tconf:
        initial_seq_no = nodeSet[0].domainLedger.size
        wallet_handle, identifier = sdk_wallet_trustee

        # send SCHEMA
        _, schema_json = looper.loop.run_until_complete(
            issuer_create_schema(identifier, "name2", "2.0",
                                 json.dumps(["first", "last"])))
        schema_req_json = looper.loop.run_until_complete(
            build_schema_request(identifier, schema_json))
        schema_req = sdk_sign_and_submit_req(sdk_pool_handle,
                                             sdk_wallet_trustee,
                                             schema_req_json)

        # send CLAIM_DEF
        _, claim_def_json = looper.loop.run_until_complete(
            issuer_create_and_store_credential_def(
                wallet_handle, identifier, schema_json, "some_tag", "CL",
                json.dumps({"support_revocation": True})))
        claim_def_req_json = looper.loop.run_until_complete(
            build_cred_def_request(identifier, claim_def_json))
        claim_def_req_json = modify_field(claim_def_req_json,
                                          initial_seq_no + 1, OPERATION, REF)
        claim_def_req = sdk_sign_and_submit_req(sdk_pool_handle,
                                                sdk_wallet_trustee,
                                                claim_def_req_json)

        # check both are written
        sdk_get_and_check_replies(looper, [schema_req, claim_def_req])
def tconf(tconf):
    limit = tconf.REPLICA_STASH_LIMIT
    tconf.REPLICA_STASH_LIMIT = 6
    with max_3pc_batch_limits(tconf, size=1) as tconf:
        yield tconf

    tconf.REPLICA_STASH_LIMIT = limit
def tconf(tconf):
    with max_3pc_batch_limits(tconf, size=1) as tconf:
        old_cons_proof_timeout = tconf.ConsistencyProofsTimeout

        # Effectively disable resending cons proof requests after timeout
        tconf.ConsistencyProofsTimeout = 1000

        yield tconf
        tconf.ConsistencyProofsTimeout = old_cons_proof_timeout
コード例 #4
0
def tconf(tconf):
    with max_3pc_batch_limits(tconf, size=1) as tconf:
        old_catchup_txn_timeout = tconf.CatchupTransactionsTimeout
        old_catchup_batch_size = tconf.CATCHUP_BATCH_SIZE

        # Allow asking for CATCHUP_REQs earlier, so that test won't last too long
        # Since we are going to catch up 10 txns actual timeout will be 10 seconds
        tconf.CatchupTransactionsTimeout = 1

        # Make catchup batch size small to increase probability of hitting all nodes
        # with catchup requests
        tconf.CATCHUP_BATCH_SIZE = 1
        yield tconf
        tconf.CatchupTransactionsTimeout = old_catchup_txn_timeout
        tconf.CATCHUP_BATCH_SIZE = old_catchup_batch_size
def tconf(tconf):
    with max_3pc_batch_limits(tconf, size=1) as tconf:
        old_catchup_txn_timeout = tconf.CatchupTransactionsTimeout
        old_catchup_batch_size = tconf.CATCHUP_BATCH_SIZE

        # Effectively disable resending CATCHUP_REQs, so if node sends some requests that
        # cannot be processed catchup won't finish
        tconf.CatchupTransactionsTimeout = 1000

        # Make catchup batch size small to increase probability of hitting all nodes
        # with catchup requests
        tconf.CATCHUP_BATCH_SIZE = 1

        yield tconf
        tconf.CatchupTransactionsTimeout = old_catchup_txn_timeout
        tconf.CATCHUP_BATCH_SIZE = old_catchup_batch_size
コード例 #6
0
def test_send_same_txn_with_different_signatures_in_one_batch(
        looper, txnPoolNodeSet, sdk_pool_handle, two_requests, tconf):
    req1, req2 = two_requests

    lo_before = (txnPoolNodeSet[0].replicas[0].last_ordered_3pc[1],
                 txnPoolNodeSet[0].replicas[1].last_ordered_3pc[1])

    old_reqs = len(txnPoolNodeSet[0].requests)
    with max_3pc_batch_limits(tconf, size=2):
        sdk_send_signed_requests(sdk_pool_handle, [req1])
        sdk_send_signed_requests(sdk_pool_handle, [req2])

        # We need to check for ordering this way, cause sdk do not allow
        # track two requests with same reqId at the same time
        looper.run(eventually(wait_one_batch, txnPoolNodeSet[0], lo_before))

    assert len(txnPoolNodeSet[0].requests) == old_reqs + 2

    pps = txnPoolNodeSet[0].master_replica._ordering_service.sentPrePrepares
    pp = pps[pps.keys()[-1]]
    idrs = pp.reqIdr
    assert len(idrs) == 1
    assert Request(**json.loads(req1)).digest in idrs
コード例 #7
0
def tconf(tconf):
    with max_3pc_batch_limits(tconf, size=1) as tconf:
        with view_change_timeout(tconf, vc_timeout=420) as tconf:
            yield tconf
コード例 #8
0
def tconf(tconf):
    with max_3pc_batch_limits(tconf, size=3) as tconf:
        old_type = tconf.METRICS_COLLECTOR_TYPE
        tconf.METRICS_COLLECTOR_TYPE = 'kv'
        yield tconf
        tconf.METRICS_COLLECTOR_TYPE = old_type
コード例 #9
0
def tconf(tconf):
    with max_3pc_batch_limits(tconf, size=1) as tconf:
        yield tconf
def tconf(tconf):
    with patched_out_of_order_commits_interval(tconf) as tconf:
        with max_3pc_batch_limits(tconf, size=1) as tconf:
            yield tconf
コード例 #11
0
def tconf(tconf):
    with max_3pc_batch_limits(tconf, size=1) as tconf:
        old = tconf.Max3PCBatchesInFlight
        tconf.Max3PCBatchesInFlight = MAX_BATCHES_IN_FLIGHT
        yield tconf
        tconf.Max3PCBatchesInFlight = old
コード例 #12
0
def tconf(tconf):
    with max_3pc_batch_limits(tconf, size=1) as tconf:
        old_type = tconf.METRICS_COLLECTOR_TYPE
        tconf.METRICS_COLLECTOR_TYPE = 'kv'
        yield tconf
        tconf.METRICS_COLLECTOR_TYPE = old_type
コード例 #13
0
def tconf(tconf):
    with max_3pc_batch_limits(tconf, size=1) as tconf:
        old = tconf.CATCHUP_BATCH_SIZE
        tconf.CATCHUP_BATCH_SIZE = 1
        yield tconf
        tconf.CATCHUP_BATCH_SIZE = old