def test_genesis_nodes(looper, txnPoolNodeSet,
                       sdk_pool_handle,
                       sdk_wallet_client):
    assert len(txnPoolNodeSet) == nodeCount
    for node in txnPoolNodeSet:
        assertEquality(node.poolLedger.size, nodeCount)
        stw_count = sum(1 for _, txn in node.domainLedger.getAllTxn() if
                        (get_type(txn) == NYM) and (get_payload_data(txn).get(ROLE) == STEWARD))
        assertEquality(stw_count, nodeCount)
    sdk_ensure_pool_functional(looper, txnPoolNodeSet, sdk_wallet_client, sdk_pool_handle)
예제 #2
0
def checkRequestCounts(nodes, req_count, batches_count):
    for node in nodes:
        assertEquality(len(node.requests), req_count)
        for r in node.replicas.values():
            assertEquality(len(r.commits), batches_count)
            assertEquality(len(r.prepares), batches_count)
            assertEquality(len(r.batches), batches_count)
예제 #3
0
def check_ledger_state(node, ledger_id, ledger_state):
    assertEquality(
        node.ledgerManager.getLedgerInfoByType(ledger_id).state, ledger_state)
예제 #4
0
 def chk():
     retrievedVerkey = senderWallet.getIdentity(idr).verkey
     assertEquality(retrievedVerkey, ownerWallet.getVerkey(idr))
     checkFullVerkeySize(retrievedVerkey)
예제 #5
0
def updateWalletIdrWithFullVerkeySigner(wallet, idr, signer):
    wallet.updateSigner(idr, signer)
    assertEquality(signer.verkey, wallet.getVerkey(idr))
    checkFullVerkeySize(wallet.getVerkey(idr))
예제 #6
0
def updateWalletIdrWithFullKeySigner(wallet, idr):
    newSigner = DidSigner(identifier=idr)
    wallet.updateSigner(idr, newSigner)
    assertEquality(newSigner.verkey, wallet.getVerkey(idr))
    checkFullVerkeySize(wallet.getVerkey(idr))
    return newSigner.verkey
def test_state_recovery_with_xfer(looper, tconf, tdir,
                                  sdk_pool_handle,
                                  sdk_wallet_trustee,
                                  allPluginsPath,
                                  do_post_node_creation,
                                  nodeSetWithIntegratedTokenPlugin,
                                  helpers,
                                  valid_upgrade,
                                  mint_tokens,
                                  addresses,
                                  fees_set, fees,
                                  monkeypatch):
    version1 = "1.1.50"
    version2 = "1.1.88"
    current_amount = get_amount_from_token_txn(mint_tokens)
    seq_no = 1
    node_set = nodeSetWithIntegratedTokenPlugin

    current_amount, seq_no, _ = send_and_check_nym_with_fees(helpers, fees_set, seq_no, looper, addresses,
                                                             current_amount)
    # send POOL_UPGRADE to write in a ledger
    last_ordered = node_set[0].master_last_ordered_3PC[1]
    sdk_ensure_upgrade_sent(looper, sdk_pool_handle, sdk_wallet_trustee,
                            valid_upgrade)
    looper.run(eventually(lambda: assertEquality(node_set[0].master_last_ordered_3PC[1],
                                                 last_ordered + 1)))

    send_node_upgrades(node_set, version1, looper)
    for n in node_set:
        handler = n.write_manager.request_handlers.get(XFER_PUBLIC)[0]
        handler_for_1_0_0 = n.write_manager._request_handlers_with_version.get((XFER_PUBLIC, "1.0.0"))[0]
        monkeypatch.setattr(handler, 'update_state',
                            handler_for_1_0_0.update_state)

    current_amount, seq_no, _ = send_and_check_transfer(helpers, [addresses[0], addresses[1]], fees_set, looper,
                                                        current_amount, seq_no,
                                                        transfer_summ=current_amount)
    send_node_upgrades(node_set, version2, looper)
    monkeypatch.undo()
    current_amount, seq_no, _ = send_and_check_transfer(helpers, [addresses[1], addresses[0]], fees_set, looper,
                                                        current_amount, seq_no,
                                                        transfer_summ=current_amount)

    node_to_stop = node_set[-1]
    state_db_pathes = [state._kv.db_path
                       for state in node_to_stop.states.values()]
    node_to_stop.cleanupOnStopping = False
    node_to_stop.stop()
    looper.removeProdable(node_to_stop)
    ensure_node_disconnected(looper, node_to_stop, node_set[:-1])

    for path in state_db_pathes:
        shutil.rmtree(path)
    config_helper = NodeConfigHelper(node_to_stop.name, tconf, chroot=tdir)
    restarted_node = TestNode(
        node_to_stop.name,
        config_helper=config_helper,
        config=tconf,
        pluginPaths=allPluginsPath,
        ha=node_to_stop.nodestack.ha,
        cliha=node_to_stop.clientstack.ha)
    do_post_node_creation(restarted_node)

    looper.add(restarted_node)
    node_set[-1] = restarted_node

    looper.run(checkNodesConnected(node_set))
    waitNodeDataEquality(looper, restarted_node, *node_set[:-1], exclude_from_check=['check_last_ordered_3pc_backup'])
    current_amount, seq_no, _ = send_and_check_transfer(helpers, [addresses[0], addresses[1]], {}, looper,
                                                        current_amount, seq_no,
                                                        transfer_summ=1)
    waitNodeDataEquality(looper, restarted_node, *node_set[:-1], exclude_from_check=['check_last_ordered_3pc_backup'])
def newAbbrvKey(wallet, abbrevIdr):
    newSigner = DidSigner(identifier=abbrevIdr)
    wallet.updateSigner(abbrevIdr, newSigner)
    assertEquality(newSigner.verkey, wallet.getVerkey(abbrevIdr))
    return newSigner.verkey
 def chk5():
     # Once catchup was done, need of other catchup was not found
     assertEquality(is_catchup_needed_count(), old_cn_count)
예제 #10
0
def check_ledger_state(node, ledger_id, ledger_state):
    assertEquality(node.ledgerManager._node_leecher._leechers[ledger_id].state,
                   ledger_state)
예제 #11
0
 def chk():
     retrievedVerkey = senderWallet.getIdentity(idr).verkey
     assertEquality(retrievedVerkey, ownerWallet.getVerkey(idr))
     checkFullVerkeySize(retrievedVerkey)
예제 #12
0
def updateWalletIdrWithFullVerkeySigner(wallet, idr, signer):
    wallet.updateSigner(idr, signer)
    assertEquality(signer.verkey, wallet.getVerkey(idr))
    checkFullVerkeySize(wallet.getVerkey(idr))
예제 #13
0
def updateWalletIdrWithFullKeySigner(wallet, idr):
    newSigner = DidSigner(identifier=idr)
    wallet.updateSigner(idr, newSigner)
    assertEquality(newSigner.verkey, wallet.getVerkey(idr))
    checkFullVerkeySize(wallet.getVerkey(idr))
    return newSigner.verkey
예제 #14
0
파일: helper.py 프로젝트: qyynuaa/plenum
def checkClientPoolLedgerSameAsNodes(client: TestClient,
                                     *nodes: Iterable[TestNode]):
    for n in nodes:
        assertLength(client.ledger, n.poolLedger.size)
        assertEquality(client.ledger.root_hash, n.poolLedger.root_hash)
예제 #15
0
 def chk():
     retrievedVerkey = trustAnchorWallet.getIdentity(abbrevIdr).verkey
     assertEquality(retrievedVerkey, wallet.getVerkey(abbrevIdr))
     checkAbbrVerkeySize(retrievedVerkey)
예제 #16
0
def check_ledger_state(node, ledger_id, ledger_state):
    assertEquality(node.ledgerManager.getLedgerInfoByType(ledger_id).state,
                   ledger_state)
예제 #17
0
def newAbbrvKey(wallet, abbrevIdr):
    newSigner = DidSigner(identifier=abbrevIdr)
    wallet.updateSigner(abbrevIdr, newSigner)
    assertEquality(newSigner.verkey, wallet.getVerkey(abbrevIdr))
    return newSigner.verkey
 def chk1():
     # `slow_node` has prepared all 3PC messages which
     # `other_nodes` have ordered
     assertEquality(slow_master_replica.last_prepared_before_view_change,
                    lst_3pc)
 def chk():
     retrievedVerkey = trustAnchorWallet.getIdentity(abbrevIdr).verkey
     assertEquality(retrievedVerkey, wallet.getVerkey(abbrevIdr))
     checkAbbrVerkeySize(retrievedVerkey)
 def chk1():
     # `slow_node` has prepared all 3PC messages which
     # `other_nodes` have ordered
     assertEquality(slow_master_replica.last_prepared_before_view_change, lst_3pc)