Skip to content

Commit 3b4a2cc

Browse files
committed
Fix qa
1 parent 4243faa commit 3b4a2cc

File tree

8 files changed

+111
-92
lines changed

8 files changed

+111
-92
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ clean-test: ## remove test and coverage artifacts
5757
test: ## runs tests
5858
poetry run pytest -vv -n 4
5959

60+
test-integration: ## runs integration tests
61+
cd integration-test && ./run_tests.sh
62+
6063
test-single: ## runs tests with "single" markers
6164
poetry run pytest -s -vv -m single
6265

integration-test/configs/local-chang/shelley-genesis.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"keyDeposit": 1000000,
2222
"protocolVersion": {
2323
"minor": 0,
24-
"major": 9
24+
"major": 10
2525
},
2626
"poolDeposit": 1000000,
2727
"a0": 0.0,

integration-test/docker-compose-chang.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ networks:
99
services:
1010

1111
cardano-node:
12-
image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-10.1.3}
12+
image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-10.1.4}
1313
platform: linux/amd64
1414
entrypoint: bash
1515
environment:
@@ -35,7 +35,7 @@ services:
3535
max-file: "10"
3636

3737
cardano-pool:
38-
image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-10.1.3}
38+
image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-10.1.4}
3939
platform: linux/amd64
4040
entrypoint: bash
4141
environment:
@@ -56,7 +56,7 @@ services:
5656
max-file: "10"
5757

5858
ogmios:
59-
image: cardanosolutions/ogmios:v6.9.0
59+
image: cardanosolutions/ogmios:v6.11.0
6060
platform: linux/amd64
6161
environment:
6262
NETWORK: "${NETWORK:-local-alonzo}"

integration-test/run_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -o pipefail
55

66
ROOT=$(pwd)
77

8-
poetry install
8+
poetry install -C ..
99
#poetry run pip install ogmios
1010

1111
##########

poetry.lock

Lines changed: 83 additions & 79 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pycardano/metadata.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ def to_primitive(self) -> Primitive:
123123
return self.data.to_primitive()
124124

125125
@classmethod
126-
def from_primitive(cls: Type[AuxiliaryData], value: Primitive) -> AuxiliaryData:
126+
def from_primitive(
127+
cls: Type[AuxiliaryData], value: Primitive, type_args: Optional[tuple] = None
128+
) -> AuxiliaryData:
127129
for t in [AlonzoMetadata, ShelleyMarryMetadata, Metadata]:
128130
# The schema of metadata in different eras are mutually exclusive, so we can try deserializing
129131
# them one by one without worrying about mismatch.

pycardano/serialization.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ def to_shallow_primitive(self) -> Union[CBORTag, List[T]]:
10091009

10101010
@classmethod
10111011
def from_primitive(
1012-
cls: OrderedSet[T], value: Any, type_args: Optional[tuple] = None
1012+
cls: Type[OrderedSet[T]], value: Primitive, type_args: Optional[tuple] = None
10131013
) -> OrderedSet[T]:
10141014
assert (
10151015
type_args is None or len(type_args) == 1
@@ -1027,7 +1027,7 @@ def from_primitive(
10271027
value = [type_arg.from_primitive(v) for v in value]
10281028
return cls(list(value), use_tag=False)
10291029

1030-
raise ValueError(f"Cannot deserialize {value} to {cls.__name__}")
1030+
raise ValueError(f"Cannot deserialize {value} to {cls}")
10311031

10321032

10331033
class NonEmptyOrderedSet(OrderedSet[T]):
@@ -1040,7 +1040,9 @@ def validate(self):
10401040

10411041
@classmethod
10421042
def from_primitive(
1043-
cls: NonEmptyOrderedSet[T], value: Any, type_args: Optional[tuple] = None
1043+
cls: Type[NonEmptyOrderedSet[T]],
1044+
value: Primitive,
1045+
type_args: Optional[tuple] = None,
10441046
) -> NonEmptyOrderedSet[T]:
10451047
result = cast(NonEmptyOrderedSet[T], super().from_primitive(value, type_args))
10461048
if not result:

pycardano/transaction.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ def __post_init__(self):
316316
self._TYPE = self.script.version
317317

318318
@classmethod
319-
def from_primitive(cls: Type[_Script], values: List[Primitive]) -> _Script:
319+
def from_primitive(
320+
cls: Type[_Script], values: List[Primitive], type_args: Optional[tuple] = None
321+
) -> _Script:
320322
if values[0] == 0:
321323
return cls(NativeScript.from_primitive(values[1]))
322324
assert isinstance(values[1], bytes)
@@ -346,7 +348,9 @@ def to_shallow_primitive(self) -> Primitive:
346348

347349
@classmethod
348350
def from_primitive(
349-
cls: Type[_DatumOption], values: List[Primitive]
351+
cls: Type[_DatumOption],
352+
values: List[Primitive],
353+
type_args: Optional[tuple] = None,
350354
) -> _DatumOption:
351355
if values[0] == 0:
352356
assert isinstance(values[1], bytes)
@@ -368,7 +372,9 @@ def to_primitive(self) -> Primitive:
368372
return CBORTag(24, cbor2.dumps(self.script, default=default_encoder))
369373

370374
@classmethod
371-
def from_primitive(cls: Type[_ScriptRef], value: Primitive) -> _ScriptRef:
375+
def from_primitive(
376+
cls: Type[_ScriptRef], value: List[Primitive], type_args: Optional[tuple] = None
377+
) -> _ScriptRef:
372378
assert isinstance(value, CBORTag)
373379
return cls(_Script.from_primitive(cbor2.loads(value.value)))
374380

@@ -461,7 +467,9 @@ def to_primitive(self) -> Primitive:
461467

462468
@classmethod
463469
def from_primitive(
464-
cls: Type[TransactionOutput], value: Primitive
470+
cls: Type[TransactionOutput],
471+
value: List[Primitive],
472+
type_args: Optional[tuple] = None,
465473
) -> TransactionOutput:
466474
if isinstance(value, list):
467475
output = _TransactionOutputLegacy.from_primitive(value)

0 commit comments

Comments
 (0)