Skip to content

Commit

Permalink
Update node version for integration tests
Browse files Browse the repository at this point in the history
This commit made a few changes:
1. Upgrade cardano-node version to v8.x.x from v1.x.x. This will help with testing when entering Chang hardfork.
2. Upgrade ogmios to 6.x.x because of change 1.
3. Replace built-in ogmios chain context with https://gitlab.com/viperscience/ogmios-python because of change 2.
4. Temporarily disable Kupo in integration test because ogmios-python doesn't support kupo yet.
  • Loading branch information
cffls committed May 5, 2024
1 parent 486d97f commit 4b96d69
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 19 deletions.
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
7 changes: 4 additions & 3 deletions integration-test/test/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from pycardano import *

from ogmios import OgmiosChainContext

TEST_RETRIES = 6


Expand All @@ -19,11 +21,10 @@ 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 = OgmiosChainContext(host="localhost", port=1337, network=Network.TESTNET)

check_chain_context(chain_context)

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

from pycardano import (
CardanoCliChainContext,
Expand All @@ -10,6 +11,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 +33,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

0 comments on commit 4b96d69

Please sign in to comment.