Expected behavior
The StakeDelegation object is serialized and deserialized back into a StakeDelegation object and not into a StakeRegistration object (CODE=2 instead of CODE=0).
Environment and software version (please complete the following information):
OS: Ubuntu 22.04.5 LTS
PyCardano Version: 0.12.0
Additional context
I believe the StakeRegistration.from_primitivemethod lacks the expected code/type check that other Certificate classes have. This implementation fixes the test:
Sounds about correct. I looked into this a while ago and noticed that a lot of classes are missing... because no on got bothered enough by their absence to add them :)
Describe the bug Serializing a list of
Certificate
into CBOR and deserializing them back gives incorrect result.To Reproduce The following
pytest
test demonstrates the issue:Logs The error:
Expected behavior The
StakeDelegation
object is serialized and deserialized back into aStakeDelegation
object and not into aStakeRegistration
object (CODE=2
instead ofCODE=0
).Environment and software version (please complete the following information):
Additional context I believe the
StakeRegistration.from_primitive
method lacks the expected code/type check that otherCertificate
classes have. This implementation fixes the test: