diff --git a/integration-test/docker-compose-chang.yml b/integration-test/docker-compose-chang.yml index 0978c444..d2266442 100644 --- a/integration-test/docker-compose-chang.yml +++ b/integration-test/docker-compose-chang.yml @@ -9,7 +9,7 @@ networks: services: cardano-node: - image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-9.1.0} + image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-10.1.3} platform: linux/amd64 entrypoint: bash environment: @@ -35,7 +35,7 @@ services: max-file: "10" cardano-pool: - image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-9.1.0} + image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-10.1.3} platform: linux/amd64 entrypoint: bash environment: @@ -56,14 +56,14 @@ services: max-file: "10" ogmios: - image: cardanosolutions/ogmios:v6.8.0 + image: cardanosolutions/ogmios:v6.9.0 platform: linux/amd64 environment: NETWORK: "${NETWORK:-local-alonzo}" command: [ "--host", "0.0.0.0", - "--node-socket", "/ipc/node.socket", + "--node-socket", "/ipc/pool.socket", "--node-config", "/code/configs/${NETWORK:-local-alonzo}/config.json", "--log-level-websocket", "Debug" ] @@ -85,7 +85,7 @@ services: NETWORK: "${NETWORK:-local}" command: [ - "--node-socket", "/ipc/node.socket", + "--node-socket", "/ipc/pool.socket", "--node-config", "/code/configs/${NETWORK:-local-alonzo}/config.json", "--host", "0.0.0.0", "--since", "origin", diff --git a/integration-test/keys/pool/pool_registration_tx.signed b/integration-test/keys/pool/pool_registration_tx.signed new file mode 100644 index 00000000..c0759dd6 --- /dev/null +++ b/integration-test/keys/pool/pool_registration_tx.signed @@ -0,0 +1,5 @@ +{ + "type": "Witnessed Tx AlonzoEra", + "description": "Ledger Cddl Format", + "cborHex": "84a50081825820732bfd67e66be8e8288349fcaaa2294973ef6271cc189a239bb431275401b8e500018282583900cc30497f4ff962f4c1dca54cceefe39f86f1d7179668009f8eb71e594828a2dadba97ca9fd0cdc99975899470c219bdc0d828cfa6ddf6d691b00000068c617140082581d60d413c1745d306023e49589e658a7b7a4b4dda165ff5c97d8c8b979bf1b00000068c5f572f7021a00031c89031b00005af3107a4000048382008200581c4828a2dadba97ca9fd0cdc99975899470c219bdc0d828cfa6ddf6d698a03581cc2105401f5b4e8dfcc3b04f7a2722f72a8f6c4b1c00f9b5b8f46dd5e5820d5daee7ab045f90495107b9997b677cf3b469d0f42fcf8528a80510a7d1c270b00190154d81e820001581de04828a2dadba97ca9fd0cdc99975899470c219bdc0d828cfa6ddf6d6981581c4828a2dadba97ca9fd0cdc99975899470c219bdc0d828cfa6ddf6d69818400190bb84400000000f682782768747470733a2f2f746573747374616b65706f6f6c2e636f6d2f6d657461646174612e6a736f6e5820c5c38833176e2d575bd8693e206e3af2e1088e556def86cae9f6c2fc45579f3683028200581c4828a2dadba97ca9fd0cdc99975899470c219bdc0d828cfa6ddf6d69581cc2105401f5b4e8dfcc3b04f7a2722f72a8f6c4b1c00f9b5b8f46dd5ea100838258205edaa384c658c2bd8945ae389edac0a5bd452d0cfd5d1245e3ecd540030d1e3c5840109f3ca65a4173c986e0841f454e49805cda9f091a90e57203307fffadb0f9ed6237c81411cdf25a1122d4ffb16579cf70be41de49305529a03c62e1929e9a028258202f896875fd81ee621cd8ef450c46a4e3c62a7b68ae0cc7b4372c2b02774cf7595840fca096a9180245137d6194e7294c20c31800d397fa1ea5d731224dcf19280c0ea9c1fbab4942b11d00ac1d969fcf64ca417c270a5ae033d19f241c772cf6830e8258208be8339e9f3addfa6810d59e2f072f85e64d4c024c087e0d24f8317c6544f62f58406f9b7ea9bef5613d4dd7bc553daec40a0a2865a29885475d16558a554c565a6f2f8518bc65f6ddb1501aa9f35273956a6749c68bacee7082b6ae18bbf95d8305f5f6" +} \ No newline at end of file diff --git a/integration-test/run_pool.sh b/integration-test/run_pool.sh index d27bfc83..a1caa84d 100644 --- a/integration-test/run_pool.sh +++ b/integration-test/run_pool.sh @@ -4,41 +4,18 @@ echo "$NETWORK" if [ "$NETWORK" = "local-alonzo" ] || [ "$NETWORK" = "local-vasil" ] || [ "$NETWORK" = "local-chang" ] then -# Waiting for BFT node to be ready -while [ ! -S /ipc/node.socket ] -do - sleep 0.1 -done + # Waiting for BFT node to be ready + while [ ! -S /ipc/node.socket ] + do + sleep 0.1 + done - export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket - - cardano-cli transaction build \ - --tx-in 732bfd67e66be8e8288349fcaaa2294973ef6271cc189a239bb431275401b8e5#0 \ - --tx-out "$(cat /code/keys/pool/full.addr)"+450000000000 \ - --change-address "$(cat /code/tmp_configs/"$NETWORK"/shelley/utxo-keys/payment.addr)" \ - --out-file tx.raw \ - --testnet-magic 42 \ - --certificate-file /code/keys/pool/stake.cert \ - --certificate-file /code/keys/pool/pool-registration.cert \ - --certificate-file /code/keys/pool/delegation.cert \ - --witness-override 3 \ - --invalid-hereafter 100000000000000 \ - --alonzo-era - - cat tx.raw + sleep 5 - cardano-cli transaction sign \ - --tx-body-file tx.raw \ - --signing-key-file /code/tmp_configs/"$NETWORK"/shelley/utxo-keys/utxo1.skey \ - --signing-key-file /code/keys/pool/stake.skey \ - --signing-key-file /code/keys/pool/cold.skey \ - --testnet-magic 42 \ - --out-file tx.signed - - cat tx.signed + export CARDANO_NODE_SOCKET_PATH=/ipc/node.socket - cardano-cli transaction submit \ - --tx-file tx.signed \ + cardano-cli alonzo transaction submit \ + --tx-file /code/keys/pool/pool_registration_tx.signed \ --testnet-magic 42 mkdir -p /data/db @@ -50,7 +27,7 @@ done --config /code/tmp_configs/"$NETWORK"/config.json \ --topology /code/keys/pool/topology.json \ --database-path /data/db \ - --socket-path /data/db/node.socket \ + --socket-path /ipc/pool.socket \ --shelley-kes-key /code/keys/pool/kes.skey \ --shelley-vrf-key /code/keys/pool/vrf.skey \ --shelley-operational-certificate /code/keys/pool/node.cert \ diff --git a/integration-test/run_tests.sh b/integration-test/run_tests.sh index 906eb979..a4193631 100755 --- a/integration-test/run_tests.sh +++ b/integration-test/run_tests.sh @@ -74,8 +74,20 @@ export PAYMENT_KEY="$ROOT"/configs/local-chang/shelley/utxo-keys/utxo1.skey export EXTENDED_PAYMENT_KEY="$ROOT"/keys/extended.skey export POOL_ID=$(cat "$ROOT"/keys/pool/pool.id) -# Wait for stake pool to start producing blocks -sleep 30 +sleep 10 + +while true; do + response=$(curl -s -H 'Accept: application/json' http://localhost:1337/health) + current_era=$(echo "$response" | jq -r '.currentEra') + + if [ "$current_era" == "conway" ]; then + echo "Ogmios is ready! Current era: $current_era" + break + fi + + echo -n "." + sleep 2 +done poetry run pytest -m "not (CardanoCLI)" -s -vv -n 4 "$ROOT"/test --cov=pycardano --cov-config=../.coveragerc --cov-report=xml:../coverage.xml diff --git a/integration-test/test/base.py b/integration-test/test/base.py index 2c0e8f67..8e2dff3b 100644 --- a/integration-test/test/base.py +++ b/integration-test/test/base.py @@ -1,6 +1,7 @@ """An example that demonstrates low-level construction of a transaction.""" import os +import time import ogmios as python_ogmios from retry import retry diff --git a/integration-test/test/test_cardano_cli.py b/integration-test/test/test_cardano_cli.py index 1b484a8d..be9e4a0b 100644 --- a/integration-test/test/test_cardano_cli.py +++ b/integration-test/test/test_cardano_cli.py @@ -36,7 +36,7 @@ class TestCardanoCli: network_magic_number=int(network_magic), ) - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) def test_protocol_param(self): protocol_param = self.chain_context.protocol_param diff --git a/integration-test/test/test_certificate.py b/integration-test/test/test_certificate.py index a16d4985..3497932f 100644 --- a/integration-test/test/test_certificate.py +++ b/integration-test/test/test_certificate.py @@ -9,7 +9,7 @@ class TestDelegation(TestBase): - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) def test_stake_delegation(self): address = Address( self.payment_key_pair.verification_key.hash(), diff --git a/integration-test/test/test_certificate_script.py b/integration-test/test/test_certificate_script.py index b4ea1c73..b76016e4 100644 --- a/integration-test/test/test_certificate_script.py +++ b/integration-test/test/test_certificate_script.py @@ -10,7 +10,7 @@ class TestDelegation(TestBase): - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) def test_stake_delegation(self): with open("./plutus_scripts/pass_certifying_and_rewarding.plutus", "r") as f: script_hex = f.read() diff --git a/integration-test/test/test_min_utxo.py b/integration-test/test/test_min_utxo.py index 0c86af49..fd6c0207 100644 --- a/integration-test/test/test_min_utxo.py +++ b/integration-test/test/test_min_utxo.py @@ -12,7 +12,7 @@ class TestMint(TestBase): - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) @pytest.mark.post_alonzo def test_min_utxo(self): address = Address(self.payment_vkey.hash(), network=self.NETWORK) diff --git a/integration-test/test/test_mint.py b/integration-test/test/test_mint.py index 87ad1aac..35ced77b 100644 --- a/integration-test/test/test_mint.py +++ b/integration-test/test/test_mint.py @@ -12,7 +12,7 @@ class TestMint(TestBase): - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) def test_mint(self): address = Address(self.payment_vkey.hash(), network=self.NETWORK) @@ -166,7 +166,7 @@ def load_or_create_key_pair(base_dir, base_name): self.assert_output(address, nft_to_send) - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) def test_mint_nft_with_script(self): address = Address(self.payment_vkey.hash(), network=self.NETWORK) @@ -255,7 +255,7 @@ def test_mint_nft_with_script(self): self.assert_output(address, nft_output) - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) @pytest.mark.post_alonzo def test_mint_nft_with_script_plutus_v1(self): address = Address(self.payment_vkey.hash(), network=self.NETWORK) diff --git a/integration-test/test/test_ogmios.py b/integration-test/test/test_ogmios.py index 603f3cc4..330485f3 100644 --- a/integration-test/test/test_ogmios.py +++ b/integration-test/test/test_ogmios.py @@ -4,7 +4,7 @@ class TestProtocolParam(TestBase): - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) def test_protocol_param_cost_models(self): protocol_param = self.chain_context.protocol_param diff --git a/integration-test/test/test_plutus.py b/integration-test/test/test_plutus.py index 965bc0f9..d2f95389 100644 --- a/integration-test/test/test_plutus.py +++ b/integration-test/test/test_plutus.py @@ -27,7 +27,7 @@ class HelloWorldRedeemer(PlutusData): class TestPlutus(TestBase): - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) def test_plutus_v1(self): # ----------- Giver give --------------- @@ -110,7 +110,7 @@ def test_plutus_v1(self): self.assert_output(taker_address, take_output) - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) @pytest.mark.post_alonzo def test_plutus_v2_datum_hash(self): # ----------- Giver give --------------- @@ -185,7 +185,7 @@ def test_plutus_v2_datum_hash(self): self.assert_output(taker_address, take_output) - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) @pytest.mark.post_alonzo def test_plutus_v2_inline_script_inline_datum(self): # ----------- Giver give --------------- @@ -248,7 +248,7 @@ def test_plutus_v2_inline_script_inline_datum(self): self.assert_output(taker_address, take_output) - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) @pytest.mark.post_alonzo def test_plutus_v2_ref_script(self): # ----------- Create a reference script --------------- @@ -329,7 +329,7 @@ def test_plutus_v2_ref_script(self): self.assert_output(taker_address, take_output) - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) @pytest.mark.post_alonzo def test_transaction_chaining(self): giver_address = Address(self.payment_vkey.hash(), network=self.NETWORK) @@ -350,7 +350,7 @@ def test_transaction_chaining(self): self.chain_context.submit_tx(tx1) self.chain_context.submit_tx(tx2) - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) @pytest.mark.post_alonzo def test_get_plutus_script(self): # ----------- Giver give --------------- @@ -383,7 +383,7 @@ def test_get_plutus_script(self): assert utxos[0].output.script == forty_two_script - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) @pytest.mark.post_chang def test_plutus_v3(self): # ----------- Giver give --------------- diff --git a/integration-test/test/test_zero_empty_asset.py b/integration-test/test/test_zero_empty_asset.py index 71ca83c0..e6d5fe48 100644 --- a/integration-test/test/test_zero_empty_asset.py +++ b/integration-test/test/test_zero_empty_asset.py @@ -10,7 +10,7 @@ class TestZeroEmptyAsset(TestBase): - @retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4)) + @retry(tries=TEST_RETRIES, backoff=1.3, delay=2, jitter=(0, 10)) @pytest.mark.post_chang def test_submit_zero_and_empty(self): address = Address(self.payment_vkey.hash(), network=self.NETWORK)