Skip to content

Update node version for integration tests #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions integration-test/configs/local-alonzo/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"ByronGenesisFile": "byron-genesis.json",
"ShelleyGenesisFile": "shelley-genesis.json",
"AlonzoGenesisFile": "alonzo-genesis.json",
"ConwayGenesisFile": "conway-genesis.json",
"SocketPath": "db/node.socket",
"MaxConcurrencyBulkSync": 1,
"MaxConcurrencyDeadline": 2,
Expand Down Expand Up @@ -99,6 +100,6 @@
"TestAllegraHardForkAtEpoch": 0,
"TestMaryHardForkAtEpoch": 0,
"TestAlonzoHardForkAtEpoch": 0,
"TestEnableDevelopmentHardForkEras": true,
"TestEnableDevelopmentNetworkProtocols": true
"EnableDevelopmentHardForkEras": true,
"ExperimentalProtocolsEnabled": true
}
39 changes: 39 additions & 0 deletions integration-test/configs/local-alonzo/conway-genesis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"poolVotingThresholds": {
"committeeNormal": 0.51,
"committeeNoConfidence": 0.51,
"hardForkInitiation": 0.51,
"motionNoConfidence": 0.51,
"ppSecurityGroup": 0.51
},
"dRepVotingThresholds": {
"motionNoConfidence": 0.51,
"committeeNormal": 0.51,
"committeeNoConfidence": 0.51,
"updateToConstitution": 0.51,
"hardForkInitiation": 0.51,
"ppNetworkGroup": 0.51,
"ppEconomicGroup": 0.51,
"ppTechnicalGroup": 0.51,
"ppGovGroup": 0.51,
"treasuryWithdrawal": 0.51
},
"committeeMinSize": 0,
"committeeMaxTermLength": 200,
"govActionLifetime": 10,
"govActionDeposit": 1000000000,
"dRepDeposit": 2000000,
"dRepActivity": 20,
"constitution": {
"anchor": {
"url": "",
"dataHash": "0000000000000000000000000000000000000000000000000000000000000000"
}
},
"committee": {
"members": {

},
"quorum": 0
}
}
5 changes: 3 additions & 2 deletions integration-test/configs/local-vasil/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"ByronGenesisFile": "byron-genesis.json",
"ShelleyGenesisFile": "shelley-genesis.json",
"AlonzoGenesisFile": "alonzo-genesis.json",
"ConwayGenesisFile": "conway-genesis.json",
"SocketPath": "db/node.socket",
"MaxConcurrencyBulkSync": 1,
"MaxConcurrencyDeadline": 2,
Expand Down Expand Up @@ -100,6 +101,6 @@
"TestMaryHardForkAtEpoch": 0,
"TestAlonzoHardForkAtEpoch": 0,
"TestBabbageHardForkAtEpoch": 10,
"TestEnableDevelopmentHardForkEras": true,
"TestEnableDevelopmentNetworkProtocols": true
"EnableDevelopmentHardForkEras": true,
"ExperimentalProtocolsEnabled": true
}
39 changes: 39 additions & 0 deletions integration-test/configs/local-vasil/conway-genesis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"poolVotingThresholds": {
"committeeNormal": 0.51,
"committeeNoConfidence": 0.51,
"hardForkInitiation": 0.51,
"motionNoConfidence": 0.51,
"ppSecurityGroup": 0.51
},
"dRepVotingThresholds": {
"motionNoConfidence": 0.51,
"committeeNormal": 0.51,
"committeeNoConfidence": 0.51,
"updateToConstitution": 0.51,
"hardForkInitiation": 0.51,
"ppNetworkGroup": 0.51,
"ppEconomicGroup": 0.51,
"ppTechnicalGroup": 0.51,
"ppGovGroup": 0.51,
"treasuryWithdrawal": 0.51
},
"committeeMinSize": 0,
"committeeMaxTermLength": 200,
"govActionLifetime": 10,
"govActionDeposit": 1000000000,
"dRepDeposit": 2000000,
"dRepActivity": 20,
"constitution": {
"anchor": {
"url": "",
"dataHash": "0000000000000000000000000000000000000000000000000000000000000000"
}
},
"committee": {
"members": {

},
"quorum": 0
}
}
6 changes: 3 additions & 3 deletions integration-test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ networks:
services:

cardano-node:
image: inputoutput/cardano-node:${CARDANO_NODE_VERSION:-1.35.7}
image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-8.9.2}
entrypoint: bash
environment:
NETWORK: "${NETWORK:-local-alonzo}"
Expand All @@ -34,7 +34,7 @@ services:
max-file: "10"

cardano-pool:
image: inputoutput/cardano-node:${CARDANO_NODE_VERSION:-1.35.7}
image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-8.9.2}
entrypoint: bash
environment:
NETWORK: "${NETWORK:-local-alonzo}"
Expand All @@ -54,7 +54,7 @@ services:
max-file: "10"

ogmios:
image: cardanosolutions/ogmios:v5.6.0-mainnet
image: cardanosolutions/ogmios:v6.2.0
environment:
NETWORK: "${NETWORK:-local-alonzo}"

Expand Down
1 change: 1 addition & 0 deletions integration-test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -o pipefail
ROOT=$(pwd)

poetry install
poetry run pip install ogmios

##########
# Alonzo #
Expand Down
9 changes: 5 additions & 4 deletions integration-test/test/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""An example that demonstrates low-level construction of a transaction."""

import os
import time

import ogmios as python_ogmios
from retry import retry

from pycardano import *
Expand All @@ -19,11 +19,12 @@ class TestBase:
# Define chain context
NETWORK = Network.TESTNET

OGMIOS_WS = "ws://localhost:1337"

# TODO: Bring back kupo test
KUPO_URL = "http://localhost:1442"

chain_context = OgmiosChainContext(OGMIOS_WS, Network.TESTNET, kupo_url=KUPO_URL)
chain_context = python_ogmios.OgmiosChainContext(
host="localhost", port=1337, network=Network.TESTNET
)

check_chain_context(chain_context)

Expand Down
10 changes: 7 additions & 3 deletions integration-test/test/test_cardano_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
from pathlib import Path

from retry import retry

from pycardano import (
CardanoCliChainContext,
CardanoCliNetwork,
Expand All @@ -10,6 +12,8 @@
)
from pycardano.backend.cardano_cli import DockerConfig

from .base import TEST_RETRIES


class TestCardanoCli:
network_env = os.getenv("NETWORK", "local-alonzo")
Expand All @@ -30,16 +34,16 @@ class TestCardanoCli:
network_magic_number=int(network_magic),
)

@retry(tries=TEST_RETRIES, backoff=1.5, delay=6, jitter=(0, 4))
def test_protocol_param(self):
protocol_param = self.chain_context.protocol_param

assert protocol_param is not None
assert isinstance(protocol_param, ProtocolParameters)

cost_models = protocol_param.cost_models
for _, cost_model in cost_models.items():
assert "addInteger-cpu-arguments-intercept" in cost_model
assert "addInteger-cpu-arguments-slope" in cost_model
for cost_model in cost_models.items():
assert len(cost_model) > 0

def test_genesis_param(self):
genesis_param = self.chain_context.genesis_param
Expand Down
3 changes: 1 addition & 2 deletions integration-test/test/test_ogmios.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ def test_protocol_param_cost_models(self):

cost_models = protocol_param.cost_models
for _, cost_model in cost_models.items():
assert "addInteger-cpu-arguments-intercept" in cost_model
assert "addInteger-cpu-arguments-slope" in cost_model
assert len(cost_model) > 0
8 changes: 4 additions & 4 deletions integration-test/test/test_plutus.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ def test_get_plutus_script(self):
assert utxos[0].output.script == forty_two_script


class TestPlutusOgmiosOnly(TestPlutus):
@classmethod
def setup_class(cls):
cls.chain_context._kupo_url = None
# class TestPlutusOgmiosOnly(TestPlutus):
# @classmethod
# def setup_class(cls):
# cls.chain_context._kupo_url = None


def evaluate_tx(tx: Transaction) -> Dict[str, ExecutionUnits]:
Expand Down
5 changes: 5 additions & 0 deletions pycardano/backend/cardano_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ def _parse_cost_models(cli_result: JsonDict) -> Dict[str, Dict[str, int]]:
elif "PlutusV2" in cli_cost_models:
cost_models["PlutusV2"] = cli_cost_models["PlutusV2"].copy()

# After 8.x.x, cardano-cli returns cost models as a list
for m in cost_models:
if isinstance(cost_models[m], list):
cost_models[m] = {i: v for i, v in enumerate(cost_models[m])}

return cost_models

def _is_chain_tip_updated(self):
Expand Down
10 changes: 9 additions & 1 deletion test/pycardano/backend/test_cardano_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,15 @@ def test_protocol_param(self, chain_context):
coins_per_utxo_byte=QUERY_PROTOCOL_PARAMETERS_RESULT.get(
"coinsPerUtxoByte", 0
),
cost_models=QUERY_PROTOCOL_PARAMETERS_RESULT["costModels"],
cost_models={
l: {
i: v
for i, v in enumerate(
QUERY_PROTOCOL_PARAMETERS_RESULT["costModels"][l]
)
}
for l in QUERY_PROTOCOL_PARAMETERS_RESULT["costModels"]
},
)
== chain_context.protocol_param
)
Expand Down
Loading