Skip to content

Commit

Permalink
remove debs, update dockerfiles to use new hyperledger deb repo.
Browse files Browse the repository at this point in the history
Signed-off-by: Devin Smith <[email protected]>
  • Loading branch information
devinleighsmith committed Apr 20, 2021
1 parent 62f68c4 commit fe91271
Show file tree
Hide file tree
Showing 31 changed files with 146 additions and 162 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build/Dockerfile.ubuntu-20-04
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,16 @@ RUN mv /usr/lib/ursa/* /usr/lib && rm -rf /usr/lib/ursa
# RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 || \
# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CE7709D068DB5E88 && \
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88 \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9692C00E657DDE61 \
&& add-apt-repository "deb https://hyperledger.jfrog.io/artifactory/indy focal dev" \
&& add-apt-repository "deb https://repo.sovrin.org/deb xenial master" \
&& add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial master" \
&& add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic master" \
&& add-apt-repository "deb http://archive.ubuntu.com/ubuntu xenial universe main" \
&& apt-get update -y && apt-get install -y \
libindy=1.15.0~1625-bionic \
indy-plenum=1.12.4.dev.0 \
indy-node=1.12.4.dev.0 \
libsodium23

# pypi based packages
Expand Down Expand Up @@ -126,9 +130,7 @@ RUN pip3 install -U \
# python-rocksdb==0.7

COPY ./deps .
RUN dpkg -i indy-plenum_9.9.9_amd64.deb \
&& dpkg -i indy-node_9.9.9_amd64.deb \
&& dpkg -i libsovtoken_1.0.2_amd64.deb
RUN dpkg -i libsovtoken_1.0.2_amd64.deb

RUN mkdir -p /etc/indy && echo "ENABLED_PLUGINS = ['sovtoken', 'sovtokenfees']" > /etc/indy/indy_config.py

Expand Down
Binary file removed deps/indy-node_9.9.9_amd64.deb
Binary file not shown.
Binary file removed deps/indy-plenum_9.9.9_amd64.deb
Binary file not shown.
8 changes: 5 additions & 3 deletions devops/docker/ci/focal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,16 @@ RUN mv /usr/lib/ursa/* /usr/lib && rm -rf /usr/lib/ursa
# RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 || \
# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CE7709D068DB5E88 && \
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88 \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9692C00E657DDE61 \
&& add-apt-repository "deb https://hyperledger.jfrog.io/artifactory/indy focal dev" \
&& add-apt-repository "deb https://repo.sovrin.org/deb xenial master" \
&& add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial master" \
&& add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic master" \
&& add-apt-repository "deb http://archive.ubuntu.com/ubuntu xenial universe main" \
&& apt-get update -y && apt-get install -y \
libindy=1.15.0~1625-bionic \
indy-plenum=1.12.4.dev.0 \
indy-node=1.12.4.dev.0 \
libsodium23

# pypi based packages
Expand Down Expand Up @@ -126,9 +130,7 @@ RUN pip3 install -U \
# python-rocksdb==0.7

COPY ./deps .
RUN dpkg -i indy-plenum_9.9.9_amd64.deb \
&& dpkg -i indy-node_9.9.9_amd64.deb \
&& dpkg -i libsovtoken_1.0.2_amd64.deb
RUN dpkg -i libsovtoken_1.0.2_amd64.deb

RUN mkdir -p /etc/indy && echo "ENABLED_PLUGINS = ['sovtoken', 'sovtokenfees']" > /etc/indy/indy_config.py

Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion install_payment_plugins.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
echo -e "\nENABLED_PLUGINS = ['sovtoken', 'sovtokenfees']" >> /etc/indy/indy_config.py
pip3 install -e --force sovtoken/
pip3 install -e sovtoken/
pip3 install -e sovtokenfees/
2 changes: 1 addition & 1 deletion sovtoken/sovtoken/messages/txn_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def txn_mint_public_validate(request: Request):
operation = request.operation
if operation[TXN_TYPE] == MINT_PUBLIC:
error = outputs_validate(request)
if not error and len(operation[OUTPUTS]) is 0:
if not error and len(operation[OUTPUTS]) == 0:
error = "Outputs for a mint request can't be empty."
raise InvalidClientRequest(request.identifier, request.reqId, error)

Expand Down
1 change: 1 addition & 0 deletions sovtoken/sovtoken/test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import pytest

from plenum.client.wallet import Wallet
from plenum.common.constants import STEWARD, TARGET_NYM, TRUSTEE_STRING, VERKEY
Expand Down
8 changes: 4 additions & 4 deletions sovtoken/sovtoken/test/test_client_authnr.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_verify_success(node, user2_token_wallet, user2_address, user1_address):
msg = b'identifier:24xHHVDRq97Hss5BxiTciEDsve7nYNx1pxAMi9RAvcWMouviSY|operation:extra:|inputs:24xHHVDRq97Hss5Bx' \
b'iTciEDsve7nYNx1pxAMi9RAvcWMouviSY,1|outputs:2jS4PHWQJKcawRxdW6GVsjnZBa1ecGdCssn7KhWYJZGTXgL7Es,10,24xHH' \
b'VDRq97Hss5BxiTciEDsve7nYNx1pxAMi9RAvcWMouviSY,10|type:10001|reqId:1525258251652534'
assert True == addressSigVerifier_obj.verify(sig, msg)
assert addressSigVerifier_obj.verify(sig, msg)


# This test that the verKey can't verify the signature. The hardcoded values come from debug mode of running
Expand All @@ -105,7 +105,7 @@ def test_verify_fail():
ser_data = b'identifier:24xHHVDRq97Hss5BxiTciEDsve7nYNx1pxAMi9RAvcWMouviSY|operation:extra:|inputs:24xHHVDRq97H' \
b'ss5BxiTciEDsve7nYNx1pxAMi9RAvcWMouviSY,2|outputs:2jS4PHWQJKcawRxdW6GVsjnZBa1ecGdCssn7KhWYJZGTXgL7E' \
b's,10,24xHHVDRq97Hss5BxiTciEDsve7nYNx1pxAMi9RAvcWMouviSY,10|type:10001|reqId:1525258344537237'
assert False == addressSigVerifier_obj.verify(sig, ser_data)
assert addressSigVerifier_obj.verify(sig, ser_data) is False


# -------------------------Test authenticate method---------------------------------------------------------------------
Expand Down Expand Up @@ -305,7 +305,7 @@ def test_serializeForSig_XFER_PUBLIC_path(node, user2_token_wallet, user2_addres
request = xfer_request(inputs, outputs)
msg = request.as_dict
serialize_for_sig_called = token_authnr.serializeForSig(msg, VALID_IDENTIFIER, None)
assert serialize_for_sig_called == True
assert serialize_for_sig_called


# This test that the serializeForSig method is being called when a MINT_PUBLIC request is submitted
Expand All @@ -319,7 +319,7 @@ def test_serializeForSig_MINT_PUBLIC_path(helpers, node, addresses):
outputs = [[SF_address, 30], [user1_address, 30]]
request = helpers.request.mint(outputs)
msg = request.as_dict
serialize_for_sig_called = token_authnr.serializeForSig(msg, VALID_IDENTIFIER, None)
token_authnr.serializeForSig(msg, VALID_IDENTIFIER, None)
token_authnr.serializeForSig.assert_called()


Expand Down
2 changes: 1 addition & 1 deletion sovtoken/sovtoken/test/test_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create_addresses(helpers):


def mint_tokens(helpers, addresses):
result = helpers.general.do_mint([{"address": addresses[SOVRIN], "amount": NEW_TOKENS}])
helpers.general.do_mint([{"address": addresses[SOVRIN], "amount": NEW_TOKENS}])
template = "Minted {} sovatoms to {}."
demo_logger.log_blue(template.format(NEW_TOKENS, SOVRIN))

Expand Down
6 changes: 1 addition & 5 deletions sovtoken/sovtoken/test/test_get_utxo.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ def test_address_utxos(helpers, addresses):

address = addresses[0]
outputs = [{"address": address, "amount": 1000}]
mint_result = helpers.general.do_mint(outputs)
helpers.general.do_mint(outputs)

mint_seq_no = get_seq_no(mint_result)
get_utxo_result = helpers.general.get_utxo_addresses([address])[0]

assert get_utxo_result[0][PAYMENT_ADDRESS] == address
Expand Down Expand Up @@ -169,9 +168,6 @@ def test_get_more_then_thousand_utxos_with_from(helpers, addresses, nodeSetWithI
state.set(key, str(amount).encode())

# NB: this transaction is needed just to update bls_store with new root hash
total = 1000
outputs = [{"address": address_1, "amount": total}]
mint_result = helpers.general.do_mint(outputs)

shift = 50
request = helpers.request.get_utxo(address_2, utxos[shift][2])
Expand Down
12 changes: 3 additions & 9 deletions sovtoken/sovtoken/test/test_public_mint.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ def test_more_than_min_trustee(capsys, helpers, addresses):

result = helpers.sdk.send_and_check_request_objects([request])
result = helpers.sdk.get_first_result(result)
seq_no = get_seq_no(result)

[address1_utxos, *_] = helpers.general.get_utxo_addresses(addresses)

Expand Down Expand Up @@ -231,7 +230,6 @@ def test_trustee_valid_minting(helpers, addresses):
remaining = total_mint - sf_master_gets
outputs = [{ADDRESS: address1, AMOUNT: sf_master_gets}, {ADDRESS: address2, AMOUNT: remaining}]
result = helpers.general.do_mint(outputs)
mint_seq_no = get_seq_no(result)

[
address1_utxos,
Expand Down Expand Up @@ -311,9 +309,8 @@ def test_repeat_mint(helpers, addresses):
request = helpers.request.mint(outputs)

helpers.sdk.send_and_check_request_objects([request])
result = helpers.sdk.send_and_check_request_objects([request])
helpers.sdk.send_and_check_request_objects([request])

seq_no_1 = get_seq_no(helpers.sdk.get_first_result(result))
utxos = helpers.general.get_utxo_addresses([address])[0]

assert utxos[0][PAYMENT_ADDRESS] == address
Expand All @@ -326,11 +323,8 @@ def test_different_mint_amounts(helpers):
def assert_valid_minting(helpers, amount):
address = helpers.wallet.create_address()
outputs = [{ADDRESS: address, AMOUNT: amount}]
result = helpers.general.do_mint(outputs)
utxos = helpers.general.get_utxo_addresses([address])[0]

expected = {ADDRESS: address, SEQNO: get_seq_no(result), AMOUNT: amount}
matches = [utxo for utxo in utxos if utxo is expected]
helpers.general.do_mint(outputs)
helpers.general.get_utxo_addresses([address])[0]

# 1 sovatom
assert_valid_minting(helpers, 1)
Expand Down
11 changes: 2 additions & 9 deletions sovtoken/sovtoken/test/test_public_xfer_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def test_multiple_inputs_with_1_incorrect_input_sig( # noqa
addresses,
initial_mint,
):
mint_seq_no = get_seq_no(initial_mint)
[address1, address2, address3, *_] = addresses

# Multiple inputs are used in a transaction but one of the inputs
Expand All @@ -82,7 +81,6 @@ def test_multiple_inputs_with_1_missing_sig( # noqa
):
# Multiple inputs are used in a transaction but one of the inputs's
# signature is missing, so there are 3 inputs but only 2 signatures.
mint_seq_no = get_seq_no(initial_mint)
[address1, address2, address3, *_] = addresses

inputs = helpers.general.get_utxo_addresses([address1, address2])
Expand Down Expand Up @@ -226,7 +224,6 @@ def test_multiple_inputs_outputs_without_change(
initial_mint
):
[address1, address2, address3, address4, address5] = addresses
mint_seq_no = get_seq_no(initial_mint)

inputs = helpers.general.get_utxo_addresses([address1, address2, address3])
inputs = [utxo for utxos in inputs for utxo in utxos]
Expand All @@ -239,8 +236,7 @@ def test_multiple_inputs_outputs_without_change(
request = helpers.request.transfer(inputs, outputs)
response = helpers.sdk.send_and_check_request_objects([request])
assert response[0][1]["result"]["reqSignature"] != {}
result = helpers.sdk.get_first_result(response)
xfer_seq_no = get_seq_no(result)
helpers.sdk.get_first_result(response)

[
address1_utxos,
Expand All @@ -267,10 +263,8 @@ def test_multiple_inputs_outputs_with_change(
helpers,
addresses,
initial_mint,
user1_token_wallet,
):
[address1, address2, address3, address4, address5] = addresses
mint_seq_no = get_seq_no(initial_mint)

inputs = helpers.general.get_utxo_addresses([address1, address2, address3])
inputs = [utxo for utxos in inputs for utxo in utxos]
Expand All @@ -284,8 +278,7 @@ def test_multiple_inputs_outputs_with_change(
request = helpers.request.transfer(inputs, outputs)
response = helpers.sdk.send_and_check_request_objects([request])
assert response[0][1]["result"]["reqSignature"] != {}
result = helpers.sdk.get_first_result(response)
xfer_seq_no = get_seq_no(result)
helpers.sdk.get_first_result(response)

[
address1_utxos,
Expand Down
12 changes: 5 additions & 7 deletions sovtoken/sovtoken/test/test_public_xfer_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ def _test_invalid_address(address):


def test_seller_xfer_double_spend_attempt(looper, sdk_pool_handle, # noqa
nodeSetWithIntegratedTokenPlugin, public_minting, sdk_wallet_client,
seller_address, seller_token_wallet, user1_address, user2_address):
nodeSetWithIntegratedTokenPlugin, public_minting, sdk_wallet_client,
seller_address, seller_token_wallet, user1_address, user2_address):
"""
An address tries to send to send to transactions using the same UTXO,
one of the txn gets rejected even though the amount held by the UTXO is
Expand Down Expand Up @@ -304,8 +304,7 @@ def test_xfer_with_multiple_inputs(helpers, seller_token_wallet):
amount = 50
first_address = helpers.wallet.create_address()
outputs = [{"address": first_address, "amount": amount}]
mint_result = helpers.general.do_mint(outputs)
seq_no = get_seq_no(mint_result)
helpers.general.do_mint(outputs)

# =============
# Transfer tokens to 3 different addresses
Expand All @@ -318,13 +317,12 @@ def test_xfer_with_multiple_inputs(helpers, seller_token_wallet):
inputs = helpers.general.get_utxo_addresses([first_address])[0]
outputs = [{"address": address, "amount": amount // 3} for address in new_addresses]
outputs[-1]["amount"] += amount % 3
xfer_result = helpers.general.do_transfer(inputs, outputs)
helpers.general.do_transfer(inputs, outputs)

# =============
# Assert tokens are in new addresses
# =============

xfer_seq_no = get_seq_no(xfer_result)
new_address_utxos = helpers.general.get_utxo_addresses(new_addresses)

assert new_address_utxos[0][0][PAYMENT_ADDRESS] == new_addresses[0]
Expand All @@ -341,7 +339,7 @@ def test_xfer_with_multiple_inputs(helpers, seller_token_wallet):
inputs = helpers.general.get_utxo_addresses(new_addresses)
inputs = [utxo for utxos in inputs for utxo in utxos]
outputs = [{"address": first_address, "amount": amount}]
xfer_result = helpers.general.do_transfer(inputs, outputs)
helpers.general.do_transfer(inputs, outputs)

[
first_address_utxos,
Expand Down
6 changes: 3 additions & 3 deletions sovtoken/sovtoken/test/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def test_token_wallet_get_total_amount_subset_invalid(test_wallet, address0, add
# TypeError expected here because this method cannot handle a subset
# This refactor has been removed because it breaks other test and is unnecessary
with pytest.raises(TypeError):
total = test_wallet.get_total_address_amount([address0, address1])
test_wallet.get_total_address_amount([address0, address1])


# TODO: Throws assertion error currently because of line 87 in wallet.py
Expand Down Expand Up @@ -281,10 +281,10 @@ def test_token_wallet_get_val_success(test_wallet, address0):

def test_token_wallet_get_val_null(test_wallet, address0):
with pytest.raises(KeyError):
val = test_wallet.get_val(address0, None)
test_wallet.get_val(address0, None)


def test_token_wallet_get_val_invalid_address(test_wallet):
address0_not_in_wallet = Address()
with pytest.raises(KeyError):
val = test_wallet.get_val(address0_not_in_wallet, 1)
test_wallet.get_val(address0_not_in_wallet, 1)
8 changes: 4 additions & 4 deletions sovtoken/sovtoken/test/unittests/test_utxo_amounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_add_amount():
amount.add_amount(32, None)


def test_remove_seq_no():
def test_remove_seq_no_1():
amount = UTXOAmounts(VALID_ADDR_1, "1:100:2:332")
amount.remove_seq_no(2)
assert len(amount.data) == 2
Expand All @@ -103,7 +103,7 @@ def test_remove_seq_no():
amount.remove_seq_no(2)


def test_as_output_list():
def test_as_output_list_1():
amount = UTXOAmounts(VALID_ADDR_1, "1:100:2:332")
output_list = amount.as_output_list()
assert len(output_list) == 2
Expand Down Expand Up @@ -138,7 +138,7 @@ def test_as_str_invalid():
assert val == '10:11:12:5:13:6'


def test_as_output_list():
def test_as_output_list_2():
with pytest.raises(UTXOError):
UTXOAmounts(VALID_ADDR_1, '2:20:3:30:30:40:40:30:20').as_output_list()
with pytest.raises(UTXOError):
Expand All @@ -158,7 +158,7 @@ def test_as_output_list():
]


def test_remove_seq_no():
def test_remove_seq_no_2():
seq_nos_amounts = ":".join(['2', '20', '3', '30', '30', '40', '40', '30', '20', '1'])
amounts = UTXOAmounts(VALID_ADDR_1, seq_nos_amounts)
original_length = len(amounts.data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_revert_batches_with_fees_unset_fees_without_fee(looper, helpers,
r = sdk_sign_and_submit_req_obj(looper, sdk_pool_handle, helpers.request._steward_wallet, request_check_health)
looper.runFor(waits.expectedPrePrepareTime(len(node_set)))
"""
We send only 1 txn with fees, and expects,
We send only 1 txn with fees, and expects,
that we have only 1 uncommitted txn for token_ledger
"""
assert get_uncommitted_txns_count_for_pool([reverted_node], TOKEN_LEDGER_ID) - uncommitted_size_before == 1
Expand All @@ -52,7 +52,7 @@ def test_revert_batches_with_fees_unset_fees_without_fee(looper, helpers,
helpers.node.reset_fees()
sdk_add_new_nym(looper, sdk_pool_handle, sdk_wallet_steward)
"""
We sent a NYM txn without fees and expects,
We sent a NYM txn without fees and expects,
that count of uncommitted txns wasn`t changed
"""
assert get_uncommitted_txns_count_for_pool([reverted_node], TOKEN_LEDGER_ID) - uncommitted_size_before == 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_create_did_without_endorser_payment(looper, nodeSetWithIntegratedTokenP
utxos=utxos
)

rep = helpers.sdk.send_and_check_request_objects([req], wallet=(wh, sender_did))
helpers.sdk.send_and_check_request_objects([req], wallet=(wh, sender_did))

details = get_nym_details(nodeSetWithIntegratedTokenPlugin[0].states[1], sender_did, is_committed=True)
assert details[ROLE] == NEW_ROLE
Expand Down
Loading

0 comments on commit fe91271

Please sign in to comment.