def test_add_bls_three_nodes(looper, txnPoolNodeSet, sdk_pool_handle, sdk_wallet_stewards, sdk_wallet_client): ''' Added BLS key for 1st, 2d and 3d Nodes; expect that BLS multi-sigs are applied since we have consensus now (3=n-f) ''' # make sure that we have commits from all nodes, and have 3 of 4 (n-f) BLS sigs there is enough # otherwise we may have 3 commits, but 1 of them may be without BLS, so we will Order this txn, but without multi-sig def patched_set_validators(self, validators): ConsensusSharedData.set_validators(self, validators) self.quorums.commit = Quorum(nodeCount) for node in txnPoolNodeSet: for r in node.replicas.values(): r._consensus_data.quorums.commit = Quorum(nodeCount) r._consensus_data.set_validators = functools.partial( patched_set_validators, r._consensus_data) node.quorums.commit = Quorum(nodeCount) check_update_bls_key(node_num=2, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle)
def test_update_bls_all_nodes(looper, txnPoolNodeSet, tdirWithPoolTxns, poolTxnClientData, stewards_and_wallets): ''' Eventually added BLS key for all Nodes; expect that BLS multi-sigs are applied since we have consensus now (4 > n-f) ''' check_update_bls_key(node_num=3, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, tdirWithPoolTxns=tdirWithPoolTxns, poolTxnClientData=poolTxnClientData, stewards_and_wallets=stewards_and_wallets)
def test_update_bls_two_nodes(looper, txnPoolNodeSet, tdirWithPoolTxns, poolTxnClientData, stewards_and_wallets): ''' Added BLS key for 1st and 2d Nodes; do not expect that BLS multi-sigs are applied since no consensus (n-f) ''' check_update_bls_key(node_num=1, saved_multi_sigs_count=0, looper=looper, txnPoolNodeSet=txnPoolNodeSet, tdirWithPoolTxns=tdirWithPoolTxns, poolTxnClientData=poolTxnClientData, stewards_and_wallets=stewards_and_wallets)
def test_update_bls_one_node(looper, txnPoolNodeSet, sdk_wallet_stewards, sdk_wallet_client, sdk_pool_handle): ''' Rotated BLS key for 1st node; BLS multi-signatures must be calculated for all Nodes. ''' check_update_bls_key(node_num=0, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle)
def test_update_bls_one_node(looper, txnPoolNodeSet, client_tdir, poolTxnClientData, stewards_and_wallets): ''' Rotated BLS key for 1st node; BLS multi-signatures must be calculated for all Nodes. ''' check_update_bls_key(node_num=0, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, client_tdir=client_tdir, poolTxnClientData=poolTxnClientData, stewards_and_wallets=stewards_and_wallets)
def test_update_incorrect_bls_two_nodes(looper, txnPoolNodeSet, client_tdir, poolTxnClientData, stewards_and_wallets): ''' Updated with wrong BLS key for 1st and 2d Nodes; do not expect that BLS multi-sigs are applied (we have less than n-f correct BLS sigs) ''' check_update_bls_key(node_num=1, saved_multi_sigs_count=0, looper=looper, txnPoolNodeSet=txnPoolNodeSet, client_tdir=client_tdir, poolTxnClientData=poolTxnClientData, stewards_and_wallets=stewards_and_wallets, add_wrong=True)
def test_add_bls_all_nodes(looper, txnPoolNodeSet, sdk_pool_handle, sdk_wallet_stewards, sdk_wallet_client): ''' Eventually added BLS key for all Nodes; expect that BLS multi-sigs are applied since we have consensus now (4 > n-f) ''' check_update_bls_key(node_num=3, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle)
def test_add_bls_one_node(looper, txnPoolNodeSet, client_tdir, poolTxnClientData, stewards_and_wallets): ''' Added BLS key for 1st Node; do not expect that BLS multi-sigs are applied since no consensus (n-f) ''' check_update_bls_key(node_num=0, saved_multi_sigs_count=0, looper=looper, txnPoolNodeSet=txnPoolNodeSet, client_tdir=client_tdir, poolTxnClientData=poolTxnClientData, stewards_and_wallets=stewards_and_wallets)
def test_update_bls_all_nodes(looper, txnPoolNodeSet, tdirWithPoolTxns, poolTxnClientData, stewards_and_wallets): ''' Updated with wrong BLS keys all Nodes; do not expect that BLS multi-sigs are applied (we have less than n-f correct BLS sigs) ''' check_update_bls_key(node_num=3, saved_multi_sigs_count=0, looper=looper, txnPoolNodeSet=txnPoolNodeSet, tdirWithPoolTxns=tdirWithPoolTxns, poolTxnClientData=poolTxnClientData, stewards_and_wallets=stewards_and_wallets, add_wrong=True)
def test_add_incorrect_bls_all_nodes(looper, txnPoolNodeSet, tdirWithPoolTxns, poolTxnClientData, stewards_and_wallets): ''' Added wrong BLS key for all Nodes; Still do not expect that BLS multi-sigs are applied ''' check_update_bls_key(node_num=3, saved_multi_sigs_count=0, looper=looper, txnPoolNodeSet=txnPoolNodeSet, tdirWithPoolTxns=tdirWithPoolTxns, poolTxnClientData=poolTxnClientData, stewards_and_wallets=stewards_and_wallets, add_wrong=True)
def test_add_bls_two_nodes(looper, txnPoolNodeSet, sdk_pool_handle, sdk_wallet_stewards, sdk_wallet_client): ''' Added BLS key for 1st and 2d Nodes; do not expect that BLS multi-sigs are applied since no consensus (n-f) ''' check_update_bls_key(node_num=1, saved_multi_sigs_count=0, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle)
def test_update_bls_all_nodes(looper, txnPoolNodeSet, tdirWithPoolTxns, poolTxnClientData, stewards_and_wallets): ''' Rotated BLS key for all Nodes; BLS multi-signatures must be calculated for all Nodes. ''' check_update_bls_key(node_num=3, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, tdirWithPoolTxns=tdirWithPoolTxns, poolTxnClientData=poolTxnClientData, stewards_and_wallets=stewards_and_wallets)
def test_add_bls_one_node(looper, txnPoolNodeSet, sdk_pool_handle, sdk_wallet_stewards, sdk_wallet_client): ''' Added BLS key for 1st Node; do not expect that BLS multi-sigs are applied since no consensus (n-f) ''' check_update_bls_key(node_num=0, saved_multi_sigs_count=0, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle)
def test_update_incorrect_bls_all_nodes(looper, txnPoolNodeSet, sdk_wallet_stewards, sdk_wallet_client, sdk_pool_handle): ''' Updated with wrong BLS keys all Nodes; do not expect that BLS multi-sigs are applied (we have less than n-f correct BLS sigs) ''' check_update_bls_key(node_num=3, saved_multi_sigs_count=0, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle, add_wrong=True)
def test_add_incorrect_bls_all_nodes(looper, txnPoolNodeSet, sdk_pool_handle, sdk_wallet_stewards, sdk_wallet_client): ''' Added wrong BLS key for all Nodes; Still do not expect that BLS multi-sigs are applied ''' check_update_bls_key(node_num=3, saved_multi_sigs_count=0, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle, add_wrong=True)
def test_add_incorrect_bls_one_node(looper, txnPoolNodeSet, client_tdir, poolTxnClientData, stewards_and_wallets): ''' Added wrong BLS key for 1st Node; do not expect that BLS multi-sigs are applied ''' check_update_bls_key(node_num=0, saved_multi_sigs_count=0, looper=looper, txnPoolNodeSet=txnPoolNodeSet, client_tdir=client_tdir, poolTxnClientData=poolTxnClientData, stewards_and_wallets=stewards_and_wallets, add_wrong=True)
def test_update_bls_three_nodes(looper, txnPoolNodeSet, tdirWithPoolTxns, poolTxnClientData, stewards_and_wallets): ''' Added BLS key for 1st, 2d and 3d Nodes; expect that BLS multi-sigs are applied since we have consensus now (3=n-f) ''' # make sure that we have commits from all nodes, and have 3 of 4 (n-f) BLS sigs there is enough # otherwise we may have 3 commits, but 1 of them may be without BLS, so we will Order this txn, but without multi-sig for node in txnPoolNodeSet: node.quorums.commit = Quorum(nodeCount) check_update_bls_key(node_num=2, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, tdirWithPoolTxns=tdirWithPoolTxns, poolTxnClientData=poolTxnClientData, stewards_and_wallets=stewards_and_wallets)
def test_add_incorrect_bls_one_node(looper, txnPoolNodeSet, tdirWithPoolTxns, poolTxnClientData, stewards_and_wallets): ''' Updated with wrong BLS key for 1st Node; Expect that BLS multi-sigs are applied since we have 3 correct signatures ''' # make sure that we have commits from all nodes, and have 3 of 4 (n-f) BLS sigs there is enough # otherwise we may have 3 commits, but 1 of them may be without BLS, so we will Order this txn, but without multi-sig for node in txnPoolNodeSet: node.quorums.commit = Quorum(nodeCount) check_update_bls_key(node_num=0, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, tdirWithPoolTxns=tdirWithPoolTxns, poolTxnClientData=poolTxnClientData, stewards_and_wallets=stewards_and_wallets, add_wrong=True)
def test_add_incorrect_bls_three_nodes(looper, txnPoolNodeSet, sdk_pool_handle, sdk_wallet_stewards, sdk_wallet_client): ''' Added wrong BLS key for 1-3 Nodes; do not expect that BLS multi-sigs are applied ''' # make sure that we have commits from all nodes, and have 3 of 4 (n-f) BLS sigs there is enough # otherwise we may have 3 commits, but 1 of them may be without BLS, so we will Order this txn, but without multi-sig for node in txnPoolNodeSet: node.quorums.commit = Quorum(nodeCount) check_update_bls_key(node_num=2, saved_multi_sigs_count=0, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle, add_wrong=True)
def test_update_incorrect_bls_one_node(looper, txnPoolNodeSet, sdk_wallet_stewards, sdk_wallet_client, sdk_pool_handle): ''' Updated with wrong BLS key for 1st Node; Expect that BLS multi-sigs are applied since we have 3 correct signatures ''' # make sure that we have commits from all nodes, and have 3 of 4 (n-f) BLS sigs there is enough # otherwise we may have 3 commits, but 1 of them may be without BLS, so we will Order this txn, but without multi-sig for node in txnPoolNodeSet: node.quorums.commit = Quorum(nodeCount) check_update_bls_key(node_num=0, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle, add_wrong=True)
def test_add_bls_three_nodes(looper, txnPoolNodeSet, sdk_pool_handle, sdk_wallet_stewards, sdk_wallet_client): ''' Added BLS key for 1st, 2d and 3d Nodes; expect that BLS multi-sigs are applied since we have consensus now (3=n-f) ''' # make sure that we have commits from all nodes, and have 3 of 4 (n-f) BLS sigs there is enough # otherwise we may have 3 commits, but 1 of them may be without BLS, so we will Order this txn, but without multi-sig for node in txnPoolNodeSet: node.quorums.commit = Quorum(nodeCount) check_update_bls_key(node_num=2, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle)
def test_get_txn_after_bls_key_rotation(looper, txnPoolNodeSet, sdk_wallet_stewards, sdk_wallet_trustee, sdk_wallet_client, sdk_pool_handle): check_update_bls_key(node_num=0, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle, pool_refresh=False) check_update_bls_key(node_num=1, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle, pool_refresh=False) check_update_bls_key(node_num=2, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle, pool_refresh=False) check_update_bls_key(node_num=3, saved_multi_sigs_count=4, looper=looper, txnPoolNodeSet=txnPoolNodeSet, sdk_wallet_stewards=sdk_wallet_stewards, sdk_wallet_client=sdk_wallet_client, sdk_pool_handle=sdk_pool_handle, pool_refresh=False) # Stop receiving of commits in a circle, so all nodes will have different sets of multi signatures with delay_rules_without_processing(txnPoolNodeSet[0].nodeIbStasher, cDelay(delay=1200, sender_filter=txnPoolNodeSet[3].name)): with delay_rules_without_processing(txnPoolNodeSet[1].nodeIbStasher, cDelay(delay=1200, sender_filter=txnPoolNodeSet[0].name)): with delay_rules_without_processing(txnPoolNodeSet[2].nodeIbStasher, cDelay(delay=1200, sender_filter=txnPoolNodeSet[1].name)): with delay_rules_without_processing(txnPoolNodeSet[3].nodeIbStasher, cDelay(delay=1200, sender_filter=txnPoolNodeSet[2].name)): did_future = create_and_store_my_did(sdk_wallet_client[0], "{}") did, verkey = looper.loop.run_until_complete(did_future) nym_request_future = ledger.build_nym_request(sdk_wallet_trustee[1], did, verkey, None, None) nym_request = looper.loop.run_until_complete(nym_request_future) nym_response_future = ledger.sign_and_submit_request(sdk_pool_handle, sdk_wallet_trustee[0], sdk_wallet_trustee[1], nym_request) looper.loop.run_until_complete(nym_response_future) get_txn_request_future = ledger.build_get_txn_request(sdk_wallet_client[1], "DOMAIN", 1) get_txn_request = looper.loop.run_until_complete(get_txn_request_future) get_txn_response_future = ledger.submit_request(sdk_pool_handle, get_txn_request) looper.loop.run_until_complete(get_txn_response_future)