Skip to content

Commit

Permalink
Bump up node version and simplify scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
cffls committed Dec 13, 2024
1 parent 7a3c782 commit 2f6ade3
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 56 deletions.
10 changes: 5 additions & 5 deletions integration-test/docker-compose-chang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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"
]
Expand All @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions integration-test/keys/pool/pool_registration_tx.signed
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "Witnessed Tx AlonzoEra",
"description": "Ledger Cddl Format",
"cborHex": "84a50081825820732bfd67e66be8e8288349fcaaa2294973ef6271cc189a239bb431275401b8e500018282583900cc30497f4ff962f4c1dca54cceefe39f86f1d7179668009f8eb71e594828a2dadba97ca9fd0cdc99975899470c219bdc0d828cfa6ddf6d691b00000068c617140082581d60d413c1745d306023e49589e658a7b7a4b4dda165ff5c97d8c8b979bf1b00000068c5f572f7021a00031c89031b00005af3107a4000048382008200581c4828a2dadba97ca9fd0cdc99975899470c219bdc0d828cfa6ddf6d698a03581cc2105401f5b4e8dfcc3b04f7a2722f72a8f6c4b1c00f9b5b8f46dd5e5820d5daee7ab045f90495107b9997b677cf3b469d0f42fcf8528a80510a7d1c270b00190154d81e820001581de04828a2dadba97ca9fd0cdc99975899470c219bdc0d828cfa6ddf6d6981581c4828a2dadba97ca9fd0cdc99975899470c219bdc0d828cfa6ddf6d69818400190bb84400000000f682782768747470733a2f2f746573747374616b65706f6f6c2e636f6d2f6d657461646174612e6a736f6e5820c5c38833176e2d575bd8693e206e3af2e1088e556def86cae9f6c2fc45579f3683028200581c4828a2dadba97ca9fd0cdc99975899470c219bdc0d828cfa6ddf6d69581cc2105401f5b4e8dfcc3b04f7a2722f72a8f6c4b1c00f9b5b8f46dd5ea100838258205edaa384c658c2bd8945ae389edac0a5bd452d0cfd5d1245e3ecd540030d1e3c5840109f3ca65a4173c986e0841f454e49805cda9f091a90e57203307fffadb0f9ed6237c81411cdf25a1122d4ffb16579cf70be41de49305529a03c62e1929e9a028258202f896875fd81ee621cd8ef450c46a4e3c62a7b68ae0cc7b4372c2b02774cf7595840fca096a9180245137d6194e7294c20c31800d397fa1ea5d731224dcf19280c0ea9c1fbab4942b11d00ac1d969fcf64ca417c270a5ae033d19f241c772cf6830e8258208be8339e9f3addfa6810d59e2f072f85e64d4c024c087e0d24f8317c6544f62f58406f9b7ea9bef5613d4dd7bc553daec40a0a2865a29885475d16558a554c565a6f2f8518bc65f6ddb1501aa9f35273956a6749c68bacee7082b6ae18bbf95d8305f5f6"
}
43 changes: 10 additions & 33 deletions integration-test/run_pool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down
16 changes: 14 additions & 2 deletions integration-test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions integration-test/test/base.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,6 +13,8 @@

@retry(tries=10, delay=4)
def check_chain_context(chain_context):
# while chain_context.last_block_slot < 100:
# time.sleep(2)
print(f"Current chain tip: {chain_context.last_block_slot}")


Expand Down
2 changes: 1 addition & 1 deletion integration-test/test/test_cardano_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion integration-test/test/test_certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion integration-test/test/test_certificate_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion integration-test/test/test_min_utxo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions integration-test/test/test_mint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion integration-test/test/test_ogmios.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 7 additions & 7 deletions integration-test/test/test_plutus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------

Expand Down Expand Up @@ -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 ---------------
Expand Down Expand Up @@ -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 ---------------
Expand Down Expand Up @@ -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 ---------------
Expand Down Expand Up @@ -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)
Expand All @@ -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 ---------------
Expand Down Expand Up @@ -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 ---------------
Expand Down
2 changes: 1 addition & 1 deletion integration-test/test/test_zero_empty_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2f6ade3

Please sign in to comment.