Skip to content

Commit

Permalink
feat(cardano): add conway unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskp committed Nov 10, 2023
1 parent ca4a5fb commit cfa8c24
Showing 1 changed file with 170 additions and 0 deletions.
170 changes: 170 additions & 0 deletions core/tests/test_apps.cardano.certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ def test_validate_certificate(self):
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
deposit=2000000,
),
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
deposit=2000000,
),
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
deposit=2000000,
),
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DELEGATION,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
Expand Down Expand Up @@ -72,6 +91,25 @@ def test_validate_certificate(self):
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
deposit=2000000,
),
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
deposit=2000000,
),
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
deposit=2000000,
),
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_POOL_REGISTRATION,
pool_parameters=CardanoPoolParametersType(
Expand Down Expand Up @@ -124,6 +162,12 @@ def test_validate_certificate(self):
"f61c42cbf7c8c53af3f520508212ad3e72f674f957fe23ff0acb4973"
),
),
# STAKE_REGISTRATION deposit is set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
deposit=2000000,
),
# STAKE_REGISTRATION pool parameters are set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION,
Expand All @@ -144,6 +188,66 @@ def test_validate_certificate(self):
relays_count=1,
),
),
# STAKE_REGISTRATION_CONWAY neither path or script_hash is set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
deposit=2000000,
),
# STAKE_REGISTRATION_CONWAY both path and script_hash are set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
deposit=2000000,
),
# STAKE_REGISTRATION_CONWAY both script_hash and key_hash are set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
deposit=2000000,
),
# STAKE_REGISTRATION_CONWAY pool is set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
pool=unhexlify(
"f61c42cbf7c8c53af3f520508212ad3e72f674f957fe23ff0acb4973"
),
deposit=2000000,
),
# STAKE_REGISTRATION_CONWAY deposit not set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
),
# STAKE_REGISTRATION_CONWAY pool parameters are set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
pool_parameters=CardanoPoolParametersType(
pool_id=unhexlify(
"f61c42cbf7c8c53af3f520508212ad3e72f674f957fe23ff0acb4973"
),
vrf_key_hash=unhexlify(
"198890ad6c92e80fbdab554dda02da9fb49d001bbd96181f3e07f7a6ab0d0640"
),
pledge=500000000,
cost=340000000,
margin_numerator=1,
margin_denominator=2,
reward_account="stake1uya87zwnmax0v6nnn8ptqkl6ydx4522kpsc3l3wmf3yswygwx45el",
owners_count=1,
relays_count=1,
),
deposit=2000000,
),
# STAKE_DELEGATION neither path or script_hash is set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DELEGATION,
Expand Down Expand Up @@ -228,6 +332,12 @@ def test_validate_certificate(self):
"f61c42cbf7c8c53af3f520508212ad3e72f674f957fe23ff0acb4973"
),
),
# STAKE_DEREGISTRATION deposit is set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
deposit=2000000,
),
# STAKE_DEREGISTRATION pool parameters are set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION,
Expand All @@ -248,6 +358,66 @@ def test_validate_certificate(self):
relays_count=1,
),
),
# STAKE_DEREGISTRATION_CONWAY neither path or script_hash is set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
deposit=2000000,
),
# STAKE_DEREGISTRATION_CONWAY both path and script_hash are set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
deposit=2000000,
),
# STAKE_DEREGISTRATION_CONWAY both script_hash and key_hash are set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
deposit=2000000,
),
# STAKE_DEREGISTRATION_CONWAY pool is set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
pool=unhexlify(
"f61c42cbf7c8c53af3f520508212ad3e72f674f957fe23ff0acb4973"
),
deposit=2000000,
),
# STAKE_DEREGISTRATION_CONWAY deposit not set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
),
# STAKE_DEREGISTRATION pool parameters are set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
pool_parameters=CardanoPoolParametersType(
pool_id=unhexlify(
"f61c42cbf7c8c53af3f520508212ad3e72f674f957fe23ff0acb4973"
),
vrf_key_hash=unhexlify(
"198890ad6c92e80fbdab554dda02da9fb49d001bbd96181f3e07f7a6ab0d0640"
),
pledge=500000000,
cost=340000000,
margin_numerator=1,
margin_denominator=2,
reward_account="stake1uya87zwnmax0v6nnn8ptqkl6ydx4522kpsc3l3wmf3yswygwx45el",
owners_count=1,
relays_count=1,
),
deposit=2000000,
),
# STAKE_POOL_REGISTRATION pool parameters are not set
CardanoTxCertificate(
type=CardanoCertificateType.STAKE_POOL_REGISTRATION,
Expand Down

0 comments on commit cfa8c24

Please sign in to comment.