1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 23:38:09 +00:00

chore(cardano): rename Catalyst to governance

This commit is contained in:
David Misiak 2022-09-22 15:03:24 +02:00 committed by matejcik
parent ab02f7a400
commit c36870defa
18 changed files with 164 additions and 161 deletions

View File

@ -66,10 +66,10 @@ enum CardanoPoolRelayType {
enum CardanoTxAuxiliaryDataSupplementType { enum CardanoTxAuxiliaryDataSupplementType {
NONE = 0; NONE = 0;
CATALYST_REGISTRATION_SIGNATURE = 1; GOVERNANCE_REGISTRATION_SIGNATURE = 1;
} }
enum CardanoCatalystRegistrationFormat { enum CardanoGovernanceRegistrationFormat {
CIP15 = 0; CIP15 = 0;
CIP36 = 1; CIP36 = 1;
} }
@ -360,7 +360,7 @@ message CardanoTxWithdrawal {
/** /**
* @embed * @embed
*/ */
message CardanoCatalystRegistrationDelegation { message CardanoGovernanceRegistrationDelegation {
required bytes voting_public_key = 1; required bytes voting_public_key = 1;
required uint32 weight = 2; required uint32 weight = 2;
} }
@ -368,13 +368,13 @@ message CardanoCatalystRegistrationDelegation {
/** /**
* @embed * @embed
*/ */
message CardanoCatalystRegistrationParametersType { message CardanoGovernanceRegistrationParametersType {
optional bytes voting_public_key = 1; optional bytes voting_public_key = 1;
repeated uint32 staking_path = 2; repeated uint32 staking_path = 2;
required CardanoAddressParametersType reward_address_parameters = 3; required CardanoAddressParametersType reward_address_parameters = 3;
required uint64 nonce = 4; required uint64 nonce = 4;
optional CardanoCatalystRegistrationFormat format = 5 [default=CIP15]; optional CardanoGovernanceRegistrationFormat format = 5 [default=CIP15];
repeated CardanoCatalystRegistrationDelegation delegations = 6; // mutually exclusive with voting_public_key; max 32 delegations repeated CardanoGovernanceRegistrationDelegation delegations = 6; // mutually exclusive with voting_public_key; max 32 delegations
optional uint64 voting_purpose = 7; optional uint64 voting_purpose = 7;
} }
@ -384,7 +384,7 @@ message CardanoCatalystRegistrationParametersType {
* @next CardanoTxAuxiliaryDataSupplement * @next CardanoTxAuxiliaryDataSupplement
*/ */
message CardanoTxAuxiliaryData { message CardanoTxAuxiliaryData {
optional CardanoCatalystRegistrationParametersType catalyst_registration_parameters = 1; optional CardanoGovernanceRegistrationParametersType governance_registration_parameters = 1;
optional bytes hash = 2; optional bytes hash = 2;
} }
@ -452,7 +452,7 @@ message CardanoTxItemAck {
message CardanoTxAuxiliaryDataSupplement { message CardanoTxAuxiliaryDataSupplement {
required CardanoTxAuxiliaryDataSupplementType type = 1; required CardanoTxAuxiliaryDataSupplementType type = 1;
optional bytes auxiliary_data_hash = 2; optional bytes auxiliary_data_hash = 2;
optional bytes catalyst_signature = 3; optional bytes governance_signature = 3;
} }
/** /**

View File

@ -1299,7 +1299,7 @@
} }
}, },
{ {
"description": "transaction with catalyst registration containing byron reward address", "description": "transaction with governance registration containing byron reward address",
"parameters": { "parameters": {
"protocol_magic": 764824073, "protocol_magic": 764824073,
"network_id": 1, "network_id": 1,
@ -1309,7 +1309,7 @@
"certificates": [], "certificates": [],
"withdrawals": [], "withdrawals": [],
"auxiliary_data": { "auxiliary_data": {
"catalyst_registration_parameters": { "governance_registration_parameters": {
"voting_public_key": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7", "voting_public_key": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
"staking_path": "m/1852'/1815'/0'/2/0", "staking_path": "m/1852'/1815'/0'/2/0",
"nonce": 22634813, "nonce": 22634813,
@ -1348,7 +1348,7 @@
} }
}, },
{ {
"description": "transaction with both auxiliary data blob and catalyst registration", "description": "transaction with both auxiliary data blob and governance registration",
"parameters": { "parameters": {
"protocol_magic": 764824073, "protocol_magic": 764824073,
"network_id": 1, "network_id": 1,
@ -1359,7 +1359,7 @@
"withdrawals": [], "withdrawals": [],
"auxiliary_data": { "auxiliary_data": {
"hash": "ea4c91860dd5ec5449f8f985d227946ff39086b17f10b5afb93d12ee87050b6a", "hash": "ea4c91860dd5ec5449f8f985d227946ff39086b17f10b5afb93d12ee87050b6a",
"catalyst_registration_parameters": { "governance_registration_parameters": {
"voting_public_key": "38DA0B509D45BF6C87BD55594B92F97081D3923B8C1334B9B8D0BF13FC1C12D0", "voting_public_key": "38DA0B509D45BF6C87BD55594B92F97081D3923B8C1334B9B8D0BF13FC1C12D0",
"staking_path": "m/1852'/1815'/0'/2/0", "staking_path": "m/1852'/1815'/0'/2/0",
"reward_address_parameters": { "reward_address_parameters": {
@ -1399,7 +1399,7 @@
} }
}, },
{ {
"description": "transaction with both voting public key and delegations in catalyst registration", "description": "transaction with both voting public key and delegations in governance registration",
"parameters": { "parameters": {
"protocol_magic": 764824073, "protocol_magic": 764824073,
"network_id": 1, "network_id": 1,
@ -1409,7 +1409,7 @@
"certificates": [], "certificates": [],
"withdrawals": [], "withdrawals": [],
"auxiliary_data": { "auxiliary_data": {
"catalyst_registration_parameters": { "governance_registration_parameters": {
"voting_public_key": "38DA0B509D45BF6C87BD55594B92F97081D3923B8C1334B9B8D0BF13FC1C12D0", "voting_public_key": "38DA0B509D45BF6C87BD55594B92F97081D3923B8C1334B9B8D0BF13FC1C12D0",
"staking_path": "m/1852'/1815'/0'/2/0", "staking_path": "m/1852'/1815'/0'/2/0",
"reward_address_parameters": { "reward_address_parameters": {

View File

@ -1002,7 +1002,7 @@
} }
}, },
{ {
"description": "transaction with CIP15 catalyst registration", "description": "transaction with CIP15 governance registration",
"parameters": { "parameters": {
"protocol_magic": 764824073, "protocol_magic": 764824073,
"network_id": 1, "network_id": 1,
@ -1012,7 +1012,7 @@
"certificates": [], "certificates": [],
"withdrawals": [], "withdrawals": [],
"auxiliary_data": { "auxiliary_data": {
"catalyst_registration_parameters": { "governance_registration_parameters": {
"voting_public_key": "1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc", "voting_public_key": "1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc",
"staking_path": "m/1852'/1815'/0'/2/0", "staking_path": "m/1852'/1815'/0'/2/0",
"reward_address_parameters": { "reward_address_parameters": {
@ -1060,12 +1060,12 @@
"auxiliary_data_supplement": { "auxiliary_data_supplement": {
"type": 1, "type": 1,
"auxiliary_data_hash": "a943e9166f1bb6d767b175384d3bd7d23645170df36fc1861fbf344135d8e120", "auxiliary_data_hash": "a943e9166f1bb6d767b175384d3bd7d23645170df36fc1861fbf344135d8e120",
"catalyst_signature": "74f27d877bbb4a5fc4f7c56869905c11f70bad0af3de24b23afaa1d024e750930f434ecc4b73e5d1723c2cb8548e8bf6098ac876487b3a6ed0891cb76994d409" "governance_signature": "74f27d877bbb4a5fc4f7c56869905c11f70bad0af3de24b23afaa1d024e750930f434ecc4b73e5d1723c2cb8548e8bf6098ac876487b3a6ed0891cb76994d409"
} }
} }
}, },
{ {
"description": "transaction with CIP36 catalyst registration and voting purpose not specified", "description": "transaction with CIP36 governance registration and voting purpose not specified",
"parameters": { "parameters": {
"protocol_magic": 764824073, "protocol_magic": 764824073,
"network_id": 1, "network_id": 1,
@ -1075,7 +1075,7 @@
"certificates": [], "certificates": [],
"withdrawals": [], "withdrawals": [],
"auxiliary_data": { "auxiliary_data": {
"catalyst_registration_parameters": { "governance_registration_parameters": {
"staking_path": "m/1852'/1815'/0'/2/0", "staking_path": "m/1852'/1815'/0'/2/0",
"reward_address_parameters": { "reward_address_parameters": {
"addressType": 0, "addressType": 0,
@ -1133,12 +1133,12 @@
"auxiliary_data_supplement": { "auxiliary_data_supplement": {
"type": 1, "type": 1,
"auxiliary_data_hash": "9d4c00f5b5b67760931fd7ed9850ff8e14dcdf957685191ab4bc755c52f0ed56", "auxiliary_data_hash": "9d4c00f5b5b67760931fd7ed9850ff8e14dcdf957685191ab4bc755c52f0ed56",
"catalyst_signature": "2671b8e668ffce235647ac89deda6cc222e7b31a3d44606c2723fcf711b29f9af1e30b0c6b4f87ba37ddf9f6adf0226c39c09e655255890644a3dc4e64c3a001" "governance_signature": "2671b8e668ffce235647ac89deda6cc222e7b31a3d44606c2723fcf711b29f9af1e30b0c6b4f87ba37ddf9f6adf0226c39c09e655255890644a3dc4e64c3a001"
} }
} }
}, },
{ {
"description": "transaction with CIP36 catalyst registration and OTHER voting purpose", "description": "transaction with CIP36 governance registration and OTHER voting purpose",
"parameters": { "parameters": {
"protocol_magic": 764824073, "protocol_magic": 764824073,
"network_id": 1, "network_id": 1,
@ -1148,7 +1148,7 @@
"certificates": [], "certificates": [],
"withdrawals": [], "withdrawals": [],
"auxiliary_data": { "auxiliary_data": {
"catalyst_registration_parameters": { "governance_registration_parameters": {
"staking_path": "m/1852'/1815'/0'/2/0", "staking_path": "m/1852'/1815'/0'/2/0",
"reward_address_parameters": { "reward_address_parameters": {
"addressType": 0, "addressType": 0,
@ -1203,7 +1203,7 @@
"auxiliary_data_supplement": { "auxiliary_data_supplement": {
"type": 1, "type": 1,
"auxiliary_data_hash": "28b7ffa6800833bdfe5421739eaa21d4a49cde1d84e762b147001169f7c0a385", "auxiliary_data_hash": "28b7ffa6800833bdfe5421739eaa21d4a49cde1d84e762b147001169f7c0a385",
"catalyst_signature": "ebc00c615f988c6fc2e132d4419a719f04bbec56fe2569a00746a9e9b0d6e5bdd0809515cb2522c773c991c5ae39834403654d36b37e70b14897c0e98c8c0a0c" "governance_signature": "ebc00c615f988c6fc2e132d4419a719f04bbec56fe2569a00746a9e9b0d6e5bdd0809515cb2522c773c991c5ae39834403654d36b37e70b14897c0e98c8c0a0c"
} }
} }
}, },
@ -1734,7 +1734,7 @@
} }
], ],
"auxiliary_data": { "auxiliary_data": {
"catalyst_registration_parameters": { "governance_registration_parameters": {
"staking_path": "m/1852'/1815'/0'/2/0", "staking_path": "m/1852'/1815'/0'/2/0",
"reward_address_parameters": { "reward_address_parameters": {
"addressType": 0, "addressType": 0,
@ -1794,7 +1794,7 @@
"auxiliary_data_supplement": { "auxiliary_data_supplement": {
"type": 1, "type": 1,
"auxiliary_data_hash": "544c9ae849c82e31224865ff936decc6160047409eee4a6b4178b729fe3d286c", "auxiliary_data_hash": "544c9ae849c82e31224865ff936decc6160047409eee4a6b4178b729fe3d286c",
"catalyst_signature": "3064949c9f186138f95e228075d0119dd5cb50e1b7e75d24d569fa547e018a597615da7c79a39ca8e394ee1ba8acb83e70be80f37e69aef3b86e7c4a6bd44903" "governance_signature": "3064949c9f186138f95e228075d0119dd5cb50e1b7e75d24d569fa547e018a597615da7c79a39ca8e394ee1ba8acb83e70be80f37e69aef3b86e7c4a6bd44903"
} }
} }
}, },

View File

@ -457,7 +457,7 @@
} }
}, },
{ {
"description": "transaction with CIP36 catalyst registration and voting purpose not specified", "description": "transaction with CIP36 governance registration and voting purpose not specified",
"parameters": { "parameters": {
"protocol_magic": 764824073, "protocol_magic": 764824073,
"network_id": 1, "network_id": 1,
@ -467,7 +467,7 @@
"certificates": [], "certificates": [],
"withdrawals": [], "withdrawals": [],
"auxiliary_data": { "auxiliary_data": {
"catalyst_registration_parameters": { "governance_registration_parameters": {
"staking_path": "m/1852'/1815'/0'/2/0", "staking_path": "m/1852'/1815'/0'/2/0",
"reward_address_parameters": { "reward_address_parameters": {
"addressType": 0, "addressType": 0,
@ -525,7 +525,7 @@
"auxiliary_data_supplement": { "auxiliary_data_supplement": {
"type": 1, "type": 1,
"auxiliary_data_hash": "9d4c00f5b5b67760931fd7ed9850ff8e14dcdf957685191ab4bc755c52f0ed56", "auxiliary_data_hash": "9d4c00f5b5b67760931fd7ed9850ff8e14dcdf957685191ab4bc755c52f0ed56",
"catalyst_signature": "2671b8e668ffce235647ac89deda6cc222e7b31a3d44606c2723fcf711b29f9af1e30b0c6b4f87ba37ddf9f6adf0226c39c09e655255890644a3dc4e64c3a001" "governance_signature": "2671b8e668ffce235647ac89deda6cc222e7b31a3d44606c2723fcf711b29f9af1e30b0c6b4f87ba37ddf9f6adf0226c39c09e655255890644a3dc4e64c3a001"
} }
} }
} }

View File

@ -419,12 +419,12 @@ if not utils.BITCOIN_ONLY:
import trezor.enums.BinanceTimeInForce import trezor.enums.BinanceTimeInForce
trezor.enums.CardanoAddressType trezor.enums.CardanoAddressType
import trezor.enums.CardanoAddressType import trezor.enums.CardanoAddressType
trezor.enums.CardanoCatalystRegistrationFormat
import trezor.enums.CardanoCatalystRegistrationFormat
trezor.enums.CardanoCertificateType trezor.enums.CardanoCertificateType
import trezor.enums.CardanoCertificateType import trezor.enums.CardanoCertificateType
trezor.enums.CardanoDerivationType trezor.enums.CardanoDerivationType
import trezor.enums.CardanoDerivationType import trezor.enums.CardanoDerivationType
trezor.enums.CardanoGovernanceRegistrationFormat
import trezor.enums.CardanoGovernanceRegistrationFormat
trezor.enums.CardanoNativeScriptHashDisplayFormat trezor.enums.CardanoNativeScriptHashDisplayFormat
import trezor.enums.CardanoNativeScriptHashDisplayFormat import trezor.enums.CardanoNativeScriptHashDisplayFormat
trezor.enums.CardanoNativeScriptType trezor.enums.CardanoNativeScriptType

View File

@ -291,9 +291,9 @@ Each transaction may contain auxiliary data. Auxiliary data format can be found
Auxiliary data can be sent to Trezor as a hash or as an object with parameters. The hash will be included in the transaction body as is and will be shown to the user. Auxiliary data can be sent to Trezor as a hash or as an object with parameters. The hash will be included in the transaction body as is and will be shown to the user.
The only object currently supported is Catalyst voting key registration. To be in compliance with the CDDL and other Cardano tools, Catalyst voting key registration object is being wrapped in a tuple and an empty tuple follows it. The empty tuple represents `auxiliary_scripts` which are not yet supported on Trezor and are thus always empty. Byron addresses are not supported as Catalyst reward addresses. The Catalyst registration signature is returned in the form of `CardanoTxAuxiliaryDataSupplement` which also contains the auxiliary data hash calculated by Trezor. The only object currently supported is governance voting key registration (currently, this is used only by Catalyst, but there may be other governance use cases in the future). To be in compliance with the CDDL and other Cardano tools, governance voting key registration object is being wrapped in a tuple and an empty tuple follows it. The empty tuple represents `auxiliary_scripts` which are not yet supported on Trezor and are thus always empty. Byron addresses are not supported as governance reward addresses. The governance registration signature is returned in the form of `CardanoTxAuxiliaryDataSupplement` which also contains the auxiliary data hash calculated by Trezor.
[Catalyst Registration Transaction Metadata Format](https://github.com/cardano-foundation/CIPs/blob/749f22eccd78e05fcdc4552c49639bb3bbd0a458/CIP-0015/CIP-0015.md) [Governance Registration Transaction Metadata Format](https://cips.cardano.org/cips/cip36/)
### Native scripts ### Native scripts

View File

@ -5,7 +5,7 @@ from trezor.crypto import hashlib
from trezor.crypto.curve import ed25519 from trezor.crypto.curve import ed25519
from trezor.enums import ( from trezor.enums import (
CardanoAddressType, CardanoAddressType,
CardanoCatalystRegistrationFormat, CardanoGovernanceRegistrationFormat,
CardanoTxAuxiliaryDataSupplementType, CardanoTxAuxiliaryDataSupplementType,
) )
@ -18,21 +18,21 @@ from .helpers.utils import derive_public_key
if TYPE_CHECKING: if TYPE_CHECKING:
Delegations = list[tuple[bytes, int]] Delegations = list[tuple[bytes, int]]
CatalystRegistrationPayload = dict[int, Delegations | bytes | int] GovernanceRegistrationPayload = dict[int, Delegations | bytes | int]
SignedCatalystRegistrationPayload = tuple[CatalystRegistrationPayload, bytes] SignedGovernanceRegistrationPayload = tuple[GovernanceRegistrationPayload, bytes]
CatalystRegistrationSignature = dict[int, bytes] GovernanceRegistrationSignature = dict[int, bytes]
CatalystRegistration = dict[ GovernanceRegistration = dict[
int, CatalystRegistrationPayload | CatalystRegistrationSignature int, GovernanceRegistrationPayload | GovernanceRegistrationSignature
] ]
from . import seed from . import seed
AUXILIARY_DATA_HASH_SIZE = 32 AUXILIARY_DATA_HASH_SIZE = 32
CATALYST_VOTING_PUBLIC_KEY_LENGTH = 32 GOVERNANCE_VOTING_PUBLIC_KEY_LENGTH = 32
CATALYST_REGISTRATION_HASH_SIZE = 32 GOVERNANCE_REGISTRATION_HASH_SIZE = 32
METADATA_KEY_CATALYST_REGISTRATION = 61284 METADATA_KEY_GOVERNANCE_REGISTRATION = 61284
METADATA_KEY_CATALYST_REGISTRATION_SIGNATURE = 61285 METADATA_KEY_GOVERNANCE_REGISTRATION_SIGNATURE = 61285
MAX_DELEGATION_COUNT = 32 MAX_DELEGATION_COUNT = 32
DEFAULT_VOTING_PURPOSE = 0 DEFAULT_VOTING_PURPOSE = 0
@ -48,10 +48,10 @@ def validate(auxiliary_data: messages.CardanoTxAuxiliaryData) -> None:
if auxiliary_data.hash: if auxiliary_data.hash:
fields_provided += 1 fields_provided += 1
_validate_hash(auxiliary_data.hash) _validate_hash(auxiliary_data.hash)
if auxiliary_data.catalyst_registration_parameters: if auxiliary_data.governance_registration_parameters:
fields_provided += 1 fields_provided += 1
_validate_catalyst_registration_parameters( _validate_governance_registration_parameters(
auxiliary_data.catalyst_registration_parameters auxiliary_data.governance_registration_parameters
) )
assert_cond(fields_provided == 1) assert_cond(fields_provided == 1)
@ -60,8 +60,8 @@ def _validate_hash(auxiliary_data_hash: bytes) -> None:
assert_cond(len(auxiliary_data_hash) == AUXILIARY_DATA_HASH_SIZE) assert_cond(len(auxiliary_data_hash) == AUXILIARY_DATA_HASH_SIZE)
def _validate_catalyst_registration_parameters( def _validate_governance_registration_parameters(
parameters: messages.CardanoCatalystRegistrationParametersType, parameters: messages.CardanoGovernanceRegistrationParametersType,
) -> None: ) -> None:
voting_key_fields_provided = 0 voting_key_fields_provided = 0
if parameters.voting_public_key is not None: if parameters.voting_public_key is not None:
@ -69,7 +69,7 @@ def _validate_catalyst_registration_parameters(
_validate_voting_public_key(parameters.voting_public_key) _validate_voting_public_key(parameters.voting_public_key)
if parameters.delegations: if parameters.delegations:
voting_key_fields_provided += 1 voting_key_fields_provided += 1
assert_cond(parameters.format == CardanoCatalystRegistrationFormat.CIP36) assert_cond(parameters.format == CardanoGovernanceRegistrationFormat.CIP36)
_validate_delegations(parameters.delegations) _validate_delegations(parameters.delegations)
assert_cond(voting_key_fields_provided == 1) assert_cond(voting_key_fields_provided == 1)
@ -80,15 +80,15 @@ def _validate_catalyst_registration_parameters(
addresses.validate_address_parameters(address_parameters) addresses.validate_address_parameters(address_parameters)
if parameters.voting_purpose is not None: if parameters.voting_purpose is not None:
assert_cond(parameters.format == CardanoCatalystRegistrationFormat.CIP36) assert_cond(parameters.format == CardanoGovernanceRegistrationFormat.CIP36)
def _validate_voting_public_key(key: bytes) -> None: def _validate_voting_public_key(key: bytes) -> None:
assert_cond(len(key) == CATALYST_VOTING_PUBLIC_KEY_LENGTH) assert_cond(len(key) == GOVERNANCE_VOTING_PUBLIC_KEY_LENGTH)
def _validate_delegations( def _validate_delegations(
delegations: list[messages.CardanoCatalystDelegation], delegations: list[messages.CardanoGovernanceDelegation],
) -> None: ) -> None:
assert_cond(len(delegations) <= MAX_DELEGATION_COUNT) assert_cond(len(delegations) <= MAX_DELEGATION_COUNT)
for delegation in delegations: for delegation in delegations:
@ -96,9 +96,9 @@ def _validate_delegations(
def _get_voting_purpose_to_serialize( def _get_voting_purpose_to_serialize(
parameters: messages.CardanoCatalystRegistrationParametersType, parameters: messages.CardanoGovernanceRegistrationParametersType,
) -> int | None: ) -> int | None:
if parameters.format == CardanoCatalystRegistrationFormat.CIP15: if parameters.format == CardanoGovernanceRegistrationFormat.CIP15:
return None return None
if parameters.voting_purpose is None: if parameters.voting_purpose is None:
return DEFAULT_VOTING_PURPOSE return DEFAULT_VOTING_PURPOSE
@ -109,13 +109,13 @@ async def show(
ctx: wire.Context, ctx: wire.Context,
keychain: seed.Keychain, keychain: seed.Keychain,
auxiliary_data_hash: bytes, auxiliary_data_hash: bytes,
parameters: messages.CardanoCatalystRegistrationParametersType | None, parameters: messages.CardanoGovernanceRegistrationParametersType | None,
protocol_magic: int, protocol_magic: int,
network_id: int, network_id: int,
should_show_details: bool, should_show_details: bool,
) -> None: ) -> None:
if parameters: if parameters:
await _show_catalyst_registration( await _show_governance_registration(
ctx, ctx,
keychain, keychain,
parameters, parameters,
@ -128,10 +128,10 @@ async def show(
await layout.show_auxiliary_data_hash(ctx, auxiliary_data_hash) await layout.show_auxiliary_data_hash(ctx, auxiliary_data_hash)
async def _show_catalyst_registration( async def _show_governance_registration(
ctx: wire.Context, ctx: wire.Context,
keychain: seed.Keychain, keychain: seed.Keychain,
parameters: messages.CardanoCatalystRegistrationParametersType, parameters: messages.CardanoGovernanceRegistrationParametersType,
protocol_magic: int, protocol_magic: int,
network_id: int, network_id: int,
should_show_details: bool, should_show_details: bool,
@ -140,7 +140,7 @@ async def _show_catalyst_registration(
encoded_public_key = bech32.encode( encoded_public_key = bech32.encode(
bech32.HRP_JORMUN_PUBLIC_KEY, delegation.voting_public_key bech32.HRP_JORMUN_PUBLIC_KEY, delegation.voting_public_key
) )
await layout.confirm_catalyst_registration_delegation( await layout.confirm_governance_registration_delegation(
ctx, encoded_public_key, delegation.weight ctx, encoded_public_key, delegation.weight
) )
@ -161,7 +161,7 @@ async def _show_catalyst_registration(
_get_voting_purpose_to_serialize(parameters) if should_show_details else None _get_voting_purpose_to_serialize(parameters) if should_show_details else None
) )
await layout.confirm_catalyst_registration( await layout.confirm_governance_registration(
ctx, ctx,
encoded_public_key, encoded_public_key,
parameters.staking_path, parameters.staking_path,
@ -177,20 +177,20 @@ def get_hash_and_supplement(
protocol_magic: int, protocol_magic: int,
network_id: int, network_id: int,
) -> tuple[bytes, messages.CardanoTxAuxiliaryDataSupplement]: ) -> tuple[bytes, messages.CardanoTxAuxiliaryDataSupplement]:
if parameters := auxiliary_data.catalyst_registration_parameters: if parameters := auxiliary_data.governance_registration_parameters:
( (
catalyst_registration_payload, governance_registration_payload,
catalyst_signature, governance_signature,
) = _get_signed_catalyst_registration_payload( ) = _get_signed_governance_registration_payload(
keychain, parameters, protocol_magic, network_id keychain, parameters, protocol_magic, network_id
) )
auxiliary_data_hash = _get_catalyst_registration_hash( auxiliary_data_hash = _get_governance_registration_hash(
catalyst_registration_payload, catalyst_signature governance_registration_payload, governance_signature
) )
auxiliary_data_supplement = messages.CardanoTxAuxiliaryDataSupplement( auxiliary_data_supplement = messages.CardanoTxAuxiliaryDataSupplement(
type=CardanoTxAuxiliaryDataSupplementType.CATALYST_REGISTRATION_SIGNATURE, type=CardanoTxAuxiliaryDataSupplementType.GOVERNANCE_REGISTRATION_SIGNATURE,
auxiliary_data_hash=auxiliary_data_hash, auxiliary_data_hash=auxiliary_data_hash,
catalyst_signature=catalyst_signature, governance_signature=governance_signature,
) )
return auxiliary_data_hash, auxiliary_data_supplement return auxiliary_data_hash, auxiliary_data_supplement
else: else:
@ -200,35 +200,35 @@ def get_hash_and_supplement(
) )
def _get_catalyst_registration_hash( def _get_governance_registration_hash(
catalyst_registration_payload: CatalystRegistrationPayload, governance_registration_payload: GovernanceRegistrationPayload,
catalyst_registration_payload_signature: bytes, governance_registration_payload_signature: bytes,
) -> bytes: ) -> bytes:
cborized_catalyst_registration = _cborize_catalyst_registration( cborized_governance_registration = _cborize_governance_registration(
catalyst_registration_payload, governance_registration_payload,
catalyst_registration_payload_signature, governance_registration_payload_signature,
) )
return _get_hash(cbor.encode(_wrap_metadata(cborized_catalyst_registration))) return _get_hash(cbor.encode(_wrap_metadata(cborized_governance_registration)))
def _cborize_catalyst_registration( def _cborize_governance_registration(
catalyst_registration_payload: CatalystRegistrationPayload, governance_registration_payload: GovernanceRegistrationPayload,
catalyst_registration_payload_signature: bytes, governance_registration_payload_signature: bytes,
) -> CatalystRegistration: ) -> GovernanceRegistration:
catalyst_registration_signature = {1: catalyst_registration_payload_signature} governance_registration_signature = {1: governance_registration_payload_signature}
return { return {
METADATA_KEY_CATALYST_REGISTRATION: catalyst_registration_payload, METADATA_KEY_GOVERNANCE_REGISTRATION: governance_registration_payload,
METADATA_KEY_CATALYST_REGISTRATION_SIGNATURE: catalyst_registration_signature, METADATA_KEY_GOVERNANCE_REGISTRATION_SIGNATURE: governance_registration_signature,
} }
def _get_signed_catalyst_registration_payload( def _get_signed_governance_registration_payload(
keychain: seed.Keychain, keychain: seed.Keychain,
parameters: messages.CardanoCatalystRegistrationParametersType, parameters: messages.CardanoGovernanceRegistrationParametersType,
protocol_magic: int, protocol_magic: int,
network_id: int, network_id: int,
) -> SignedCatalystRegistrationPayload: ) -> SignedGovernanceRegistrationPayload:
delegations_or_key: Delegations | bytes delegations_or_key: Delegations | bytes
if len(parameters.delegations) > 0: if len(parameters.delegations) > 0:
delegations_or_key = [ delegations_or_key = [
@ -251,7 +251,7 @@ def _get_signed_catalyst_registration_payload(
voting_purpose = _get_voting_purpose_to_serialize(parameters) voting_purpose = _get_voting_purpose_to_serialize(parameters)
payload: CatalystRegistrationPayload = { payload: GovernanceRegistrationPayload = {
1: delegations_or_key, 1: delegations_or_key,
2: staking_key, 2: staking_key,
3: reward_address, 3: reward_address,
@ -260,7 +260,7 @@ def _get_signed_catalyst_registration_payload(
if voting_purpose is not None: if voting_purpose is not None:
payload[5] = voting_purpose payload[5] = voting_purpose
signature = _create_catalyst_registration_payload_signature( signature = _create_governance_registration_payload_signature(
keychain, keychain,
payload, payload,
parameters.staking_path, parameters.staking_path,
@ -269,24 +269,24 @@ def _get_signed_catalyst_registration_payload(
return payload, signature return payload, signature
def _create_catalyst_registration_payload_signature( def _create_governance_registration_payload_signature(
keychain: seed.Keychain, keychain: seed.Keychain,
catalyst_registration_payload: CatalystRegistrationPayload, governance_registration_payload: GovernanceRegistrationPayload,
path: list[int], path: list[int],
) -> bytes: ) -> bytes:
node = keychain.derive(path) node = keychain.derive(path)
encoded_catalyst_registration = cbor.encode( encoded_governance_registration = cbor.encode(
{METADATA_KEY_CATALYST_REGISTRATION: catalyst_registration_payload} {METADATA_KEY_GOVERNANCE_REGISTRATION: governance_registration_payload}
) )
catalyst_registration_hash = hashlib.blake2b( governance_registration_hash = hashlib.blake2b(
data=encoded_catalyst_registration, data=encoded_governance_registration,
outlen=CATALYST_REGISTRATION_HASH_SIZE, outlen=GOVERNANCE_REGISTRATION_HASH_SIZE,
).digest() ).digest()
return ed25519.sign_ext( return ed25519.sign_ext(
node.private_key(), node.private_key_ext(), catalyst_registration_hash node.private_key(), node.private_key_ext(), governance_registration_hash
) )

View File

@ -750,13 +750,13 @@ def _format_stake_credential(
raise ValueError raise ValueError
async def confirm_catalyst_registration_delegation( async def confirm_governance_registration_delegation(
ctx: wire.Context, ctx: wire.Context,
public_key: str, public_key: str,
weight: int, weight: int,
) -> None: ) -> None:
props: list[PropertyType] = [ props: list[PropertyType] = [
("Catalyst voting key registration", None), ("Governance voting key registration", None),
("Delegating to:", public_key), ("Delegating to:", public_key),
] ]
if weight is not None: if weight is not None:
@ -764,14 +764,14 @@ async def confirm_catalyst_registration_delegation(
await confirm_properties( await confirm_properties(
ctx, ctx,
"confirm_catalyst_registration_delegation", "confirm_governance_registration_delegation",
title="Confirm transaction", title="Confirm transaction",
props=props, props=props,
br_code=ButtonRequestType.Other, br_code=ButtonRequestType.Other,
) )
async def confirm_catalyst_registration( async def confirm_governance_registration(
ctx: wire.Context, ctx: wire.Context,
public_key: str | None, public_key: str | None,
staking_path: list[int], staking_path: list[int],
@ -779,7 +779,7 @@ async def confirm_catalyst_registration(
nonce: int, nonce: int,
voting_purpose: int | None, voting_purpose: int | None,
) -> None: ) -> None:
props: list[PropertyType] = [("Catalyst voting key registration", None)] props: list[PropertyType] = [("Governance voting key registration", None)]
if public_key is not None: if public_key is not None:
props.append(("Voting public key:", public_key)) props.append(("Voting public key:", public_key))
props.extend( props.extend(
@ -802,7 +802,7 @@ async def confirm_catalyst_registration(
await confirm_properties( await confirm_properties(
ctx, ctx,
"confirm_catalyst_registration", "confirm_governance_registration",
title="Confirm transaction", title="Confirm transaction",
props=props, props=props,
br_code=ButtonRequestType.Other, br_code=ButtonRequestType.Other,

View File

@ -839,7 +839,7 @@ class Signer:
self.ctx, self.ctx,
self.keychain, self.keychain,
auxiliary_data_hash, auxiliary_data_hash,
data.catalyst_registration_parameters, data.governance_registration_parameters,
self.msg.protocol_magic, self.msg.protocol_magic,
self.msg.network_id, self.msg.network_id,
self.should_show_details, self.should_show_details,

View File

@ -3,4 +3,4 @@
# isort:skip_file # isort:skip_file
NONE = 0 NONE = 0
CATALYST_REGISTRATION_SIGNATURE = 1 GOVERNANCE_REGISTRATION_SIGNATURE = 1

View File

@ -381,9 +381,9 @@ if TYPE_CHECKING:
class CardanoTxAuxiliaryDataSupplementType(IntEnum): class CardanoTxAuxiliaryDataSupplementType(IntEnum):
NONE = 0 NONE = 0
CATALYST_REGISTRATION_SIGNATURE = 1 GOVERNANCE_REGISTRATION_SIGNATURE = 1
class CardanoCatalystRegistrationFormat(IntEnum): class CardanoGovernanceRegistrationFormat(IntEnum):
CIP15 = 0 CIP15 = 0
CIP36 = 1 CIP36 = 1

View File

@ -24,9 +24,9 @@ if TYPE_CHECKING:
from trezor.enums import ButtonRequestType # noqa: F401 from trezor.enums import ButtonRequestType # noqa: F401
from trezor.enums import Capability # noqa: F401 from trezor.enums import Capability # noqa: F401
from trezor.enums import CardanoAddressType # noqa: F401 from trezor.enums import CardanoAddressType # noqa: F401
from trezor.enums import CardanoCatalystRegistrationFormat # noqa: F401
from trezor.enums import CardanoCertificateType # noqa: F401 from trezor.enums import CardanoCertificateType # noqa: F401
from trezor.enums import CardanoDerivationType # noqa: F401 from trezor.enums import CardanoDerivationType # noqa: F401
from trezor.enums import CardanoGovernanceRegistrationFormat # noqa: F401
from trezor.enums import CardanoNativeScriptHashDisplayFormat # noqa: F401 from trezor.enums import CardanoNativeScriptHashDisplayFormat # noqa: F401
from trezor.enums import CardanoNativeScriptType # noqa: F401 from trezor.enums import CardanoNativeScriptType # noqa: F401
from trezor.enums import CardanoPoolRelayType # noqa: F401 from trezor.enums import CardanoPoolRelayType # noqa: F401
@ -1637,7 +1637,7 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: Any) -> TypeGuard["CardanoTxWithdrawal"]: def is_type_of(cls, msg: Any) -> TypeGuard["CardanoTxWithdrawal"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class CardanoCatalystRegistrationDelegation(protobuf.MessageType): class CardanoGovernanceRegistrationDelegation(protobuf.MessageType):
voting_public_key: "bytes" voting_public_key: "bytes"
weight: "int" weight: "int"
@ -1650,16 +1650,16 @@ if TYPE_CHECKING:
pass pass
@classmethod @classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["CardanoCatalystRegistrationDelegation"]: def is_type_of(cls, msg: Any) -> TypeGuard["CardanoGovernanceRegistrationDelegation"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class CardanoCatalystRegistrationParametersType(protobuf.MessageType): class CardanoGovernanceRegistrationParametersType(protobuf.MessageType):
voting_public_key: "bytes | None" voting_public_key: "bytes | None"
staking_path: "list[int]" staking_path: "list[int]"
reward_address_parameters: "CardanoAddressParametersType" reward_address_parameters: "CardanoAddressParametersType"
nonce: "int" nonce: "int"
format: "CardanoCatalystRegistrationFormat" format: "CardanoGovernanceRegistrationFormat"
delegations: "list[CardanoCatalystRegistrationDelegation]" delegations: "list[CardanoGovernanceRegistrationDelegation]"
voting_purpose: "int | None" voting_purpose: "int | None"
def __init__( def __init__(
@ -1668,25 +1668,25 @@ if TYPE_CHECKING:
reward_address_parameters: "CardanoAddressParametersType", reward_address_parameters: "CardanoAddressParametersType",
nonce: "int", nonce: "int",
staking_path: "list[int] | None" = None, staking_path: "list[int] | None" = None,
delegations: "list[CardanoCatalystRegistrationDelegation] | None" = None, delegations: "list[CardanoGovernanceRegistrationDelegation] | None" = None,
voting_public_key: "bytes | None" = None, voting_public_key: "bytes | None" = None,
format: "CardanoCatalystRegistrationFormat | None" = None, format: "CardanoGovernanceRegistrationFormat | None" = None,
voting_purpose: "int | None" = None, voting_purpose: "int | None" = None,
) -> None: ) -> None:
pass pass
@classmethod @classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["CardanoCatalystRegistrationParametersType"]: def is_type_of(cls, msg: Any) -> TypeGuard["CardanoGovernanceRegistrationParametersType"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class CardanoTxAuxiliaryData(protobuf.MessageType): class CardanoTxAuxiliaryData(protobuf.MessageType):
catalyst_registration_parameters: "CardanoCatalystRegistrationParametersType | None" governance_registration_parameters: "CardanoGovernanceRegistrationParametersType | None"
hash: "bytes | None" hash: "bytes | None"
def __init__( def __init__(
self, self,
*, *,
catalyst_registration_parameters: "CardanoCatalystRegistrationParametersType | None" = None, governance_registration_parameters: "CardanoGovernanceRegistrationParametersType | None" = None,
hash: "bytes | None" = None, hash: "bytes | None" = None,
) -> None: ) -> None:
pass pass
@ -1766,14 +1766,14 @@ if TYPE_CHECKING:
class CardanoTxAuxiliaryDataSupplement(protobuf.MessageType): class CardanoTxAuxiliaryDataSupplement(protobuf.MessageType):
type: "CardanoTxAuxiliaryDataSupplementType" type: "CardanoTxAuxiliaryDataSupplementType"
auxiliary_data_hash: "bytes | None" auxiliary_data_hash: "bytes | None"
catalyst_signature: "bytes | None" governance_signature: "bytes | None"
def __init__( def __init__(
self, self,
*, *,
type: "CardanoTxAuxiliaryDataSupplementType", type: "CardanoTxAuxiliaryDataSupplementType",
auxiliary_data_hash: "bytes | None" = None, auxiliary_data_hash: "bytes | None" = None,
catalyst_signature: "bytes | None" = None, governance_signature: "bytes | None" = None,
) -> None: ) -> None:
pass pass

View File

@ -56,12 +56,12 @@ REQUIRED_FIELDS_POOL_PARAMETERS = (
"owners", "owners",
) )
REQUIRED_FIELDS_TOKEN_GROUP = ("policy_id", "tokens") REQUIRED_FIELDS_TOKEN_GROUP = ("policy_id", "tokens")
REQUIRED_FIELDS_CATALYST_REGISTRATION = ( REQUIRED_FIELDS_GOVERNANCE_REGISTRATION = (
"staking_path", "staking_path",
"nonce", "nonce",
"reward_address_parameters", "reward_address_parameters",
) )
REQUIRED_FIELDS_CATALYST_DELEGATION = ("voting_public_key", "weight") REQUIRED_FIELDS_GOVERNANCE_DELEGATION = ("voting_public_key", "weight")
INCOMPLETE_OUTPUT_ERROR_MESSAGE = "The output is missing some fields" INCOMPLETE_OUTPUT_ERROR_MESSAGE = "The output is missing some fields"
@ -558,40 +558,41 @@ def parse_auxiliary_data(
# include all provided fields so we can test validation in FW # include all provided fields so we can test validation in FW
hash = parse_optional_bytes(auxiliary_data.get("hash")) hash = parse_optional_bytes(auxiliary_data.get("hash"))
catalyst_registration_parameters = None governance_registration_parameters = None
if "catalyst_registration_parameters" in auxiliary_data: if "governance_registration_parameters" in auxiliary_data:
catalyst_registration = auxiliary_data["catalyst_registration_parameters"] governance_registration = auxiliary_data["governance_registration_parameters"]
if not all( if not all(
k in catalyst_registration for k in REQUIRED_FIELDS_CATALYST_REGISTRATION k in governance_registration
for k in REQUIRED_FIELDS_GOVERNANCE_REGISTRATION
): ):
raise AUXILIARY_DATA_MISSING_FIELDS_ERROR raise AUXILIARY_DATA_MISSING_FIELDS_ERROR
serialization_format = catalyst_registration.get("format") serialization_format = governance_registration.get("format")
delegations = [] delegations = []
for delegation in catalyst_registration.get("delegations", []): for delegation in governance_registration.get("delegations", []):
if not all(k in delegation for k in REQUIRED_FIELDS_CATALYST_DELEGATION): if not all(k in delegation for k in REQUIRED_FIELDS_GOVERNANCE_DELEGATION):
raise AUXILIARY_DATA_MISSING_FIELDS_ERROR raise AUXILIARY_DATA_MISSING_FIELDS_ERROR
delegations.append( delegations.append(
messages.CardanoCatalystRegistrationDelegation( messages.CardanoGovernanceRegistrationDelegation(
voting_public_key=bytes.fromhex(delegation["voting_public_key"]), voting_public_key=bytes.fromhex(delegation["voting_public_key"]),
weight=int(delegation["weight"]), weight=int(delegation["weight"]),
) )
) )
voting_purpose = None voting_purpose = None
if serialization_format == messages.CardanoCatalystRegistrationFormat.CIP36: if serialization_format == messages.CardanoGovernanceRegistrationFormat.CIP36:
voting_purpose = catalyst_registration.get("voting_purpose") voting_purpose = governance_registration.get("voting_purpose")
catalyst_registration_parameters = ( governance_registration_parameters = (
messages.CardanoCatalystRegistrationParametersType( messages.CardanoGovernanceRegistrationParametersType(
voting_public_key=parse_optional_bytes( voting_public_key=parse_optional_bytes(
catalyst_registration.get("voting_public_key") governance_registration.get("voting_public_key")
), ),
staking_path=tools.parse_path(catalyst_registration["staking_path"]), staking_path=tools.parse_path(governance_registration["staking_path"]),
nonce=catalyst_registration["nonce"], nonce=governance_registration["nonce"],
reward_address_parameters=_parse_address_parameters( reward_address_parameters=_parse_address_parameters(
catalyst_registration["reward_address_parameters"], governance_registration["reward_address_parameters"],
str(AUXILIARY_DATA_MISSING_FIELDS_ERROR), str(AUXILIARY_DATA_MISSING_FIELDS_ERROR),
), ),
format=serialization_format, format=serialization_format,
@ -600,12 +601,12 @@ def parse_auxiliary_data(
) )
) )
if hash is None and catalyst_registration_parameters is None: if hash is None and governance_registration_parameters is None:
raise AUXILIARY_DATA_MISSING_FIELDS_ERROR raise AUXILIARY_DATA_MISSING_FIELDS_ERROR
return messages.CardanoTxAuxiliaryData( return messages.CardanoTxAuxiliaryData(
hash=hash, hash=hash,
catalyst_registration_parameters=catalyst_registration_parameters, governance_registration_parameters=governance_registration_parameters,
) )

View File

@ -156,9 +156,11 @@ def sign_tx(
auxiliary_data_supplement["auxiliary_data_hash"] = auxiliary_data_supplement[ auxiliary_data_supplement["auxiliary_data_hash"] = auxiliary_data_supplement[
"auxiliary_data_hash" "auxiliary_data_hash"
].hex() ].hex()
catalyst_signature = auxiliary_data_supplement.get("catalyst_signature") governance_signature = auxiliary_data_supplement.get("governance_signature")
if catalyst_signature: if governance_signature:
auxiliary_data_supplement["catalyst_signature"] = catalyst_signature.hex() auxiliary_data_supplement[
"governance_signature"
] = governance_signature.hex()
sign_tx_response["auxiliary_data_supplement"] = auxiliary_data_supplement sign_tx_response["auxiliary_data_supplement"] = auxiliary_data_supplement
return sign_tx_response return sign_tx_response

View File

@ -405,10 +405,10 @@ class CardanoPoolRelayType(IntEnum):
class CardanoTxAuxiliaryDataSupplementType(IntEnum): class CardanoTxAuxiliaryDataSupplementType(IntEnum):
NONE = 0 NONE = 0
CATALYST_REGISTRATION_SIGNATURE = 1 GOVERNANCE_REGISTRATION_SIGNATURE = 1
class CardanoCatalystRegistrationFormat(IntEnum): class CardanoGovernanceRegistrationFormat(IntEnum):
CIP15 = 0 CIP15 = 0
CIP36 = 1 CIP36 = 1
@ -2631,7 +2631,7 @@ class CardanoTxWithdrawal(protobuf.MessageType):
self.key_hash = key_hash self.key_hash = key_hash
class CardanoCatalystRegistrationDelegation(protobuf.MessageType): class CardanoGovernanceRegistrationDelegation(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("voting_public_key", "bytes", repeated=False, required=True), 1: protobuf.Field("voting_public_key", "bytes", repeated=False, required=True),
@ -2648,15 +2648,15 @@ class CardanoCatalystRegistrationDelegation(protobuf.MessageType):
self.weight = weight self.weight = weight
class CardanoCatalystRegistrationParametersType(protobuf.MessageType): class CardanoGovernanceRegistrationParametersType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("voting_public_key", "bytes", repeated=False, required=False), 1: protobuf.Field("voting_public_key", "bytes", repeated=False, required=False),
2: protobuf.Field("staking_path", "uint32", repeated=True, required=False), 2: protobuf.Field("staking_path", "uint32", repeated=True, required=False),
3: protobuf.Field("reward_address_parameters", "CardanoAddressParametersType", repeated=False, required=True), 3: protobuf.Field("reward_address_parameters", "CardanoAddressParametersType", repeated=False, required=True),
4: protobuf.Field("nonce", "uint64", repeated=False, required=True), 4: protobuf.Field("nonce", "uint64", repeated=False, required=True),
5: protobuf.Field("format", "CardanoCatalystRegistrationFormat", repeated=False, required=False), 5: protobuf.Field("format", "CardanoGovernanceRegistrationFormat", repeated=False, required=False),
6: protobuf.Field("delegations", "CardanoCatalystRegistrationDelegation", repeated=True, required=False), 6: protobuf.Field("delegations", "CardanoGovernanceRegistrationDelegation", repeated=True, required=False),
7: protobuf.Field("voting_purpose", "uint64", repeated=False, required=False), 7: protobuf.Field("voting_purpose", "uint64", repeated=False, required=False),
} }
@ -2666,13 +2666,13 @@ class CardanoCatalystRegistrationParametersType(protobuf.MessageType):
reward_address_parameters: "CardanoAddressParametersType", reward_address_parameters: "CardanoAddressParametersType",
nonce: "int", nonce: "int",
staking_path: Optional[Sequence["int"]] = None, staking_path: Optional[Sequence["int"]] = None,
delegations: Optional[Sequence["CardanoCatalystRegistrationDelegation"]] = None, delegations: Optional[Sequence["CardanoGovernanceRegistrationDelegation"]] = None,
voting_public_key: Optional["bytes"] = None, voting_public_key: Optional["bytes"] = None,
format: Optional["CardanoCatalystRegistrationFormat"] = CardanoCatalystRegistrationFormat.CIP15, format: Optional["CardanoGovernanceRegistrationFormat"] = CardanoGovernanceRegistrationFormat.CIP15,
voting_purpose: Optional["int"] = None, voting_purpose: Optional["int"] = None,
) -> None: ) -> None:
self.staking_path: Sequence["int"] = staking_path if staking_path is not None else [] self.staking_path: Sequence["int"] = staking_path if staking_path is not None else []
self.delegations: Sequence["CardanoCatalystRegistrationDelegation"] = delegations if delegations is not None else [] self.delegations: Sequence["CardanoGovernanceRegistrationDelegation"] = delegations if delegations is not None else []
self.reward_address_parameters = reward_address_parameters self.reward_address_parameters = reward_address_parameters
self.nonce = nonce self.nonce = nonce
self.voting_public_key = voting_public_key self.voting_public_key = voting_public_key
@ -2683,17 +2683,17 @@ class CardanoCatalystRegistrationParametersType(protobuf.MessageType):
class CardanoTxAuxiliaryData(protobuf.MessageType): class CardanoTxAuxiliaryData(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 327 MESSAGE_WIRE_TYPE = 327
FIELDS = { FIELDS = {
1: protobuf.Field("catalyst_registration_parameters", "CardanoCatalystRegistrationParametersType", repeated=False, required=False), 1: protobuf.Field("governance_registration_parameters", "CardanoGovernanceRegistrationParametersType", repeated=False, required=False),
2: protobuf.Field("hash", "bytes", repeated=False, required=False), 2: protobuf.Field("hash", "bytes", repeated=False, required=False),
} }
def __init__( def __init__(
self, self,
*, *,
catalyst_registration_parameters: Optional["CardanoCatalystRegistrationParametersType"] = None, governance_registration_parameters: Optional["CardanoGovernanceRegistrationParametersType"] = None,
hash: Optional["bytes"] = None, hash: Optional["bytes"] = None,
) -> None: ) -> None:
self.catalyst_registration_parameters = catalyst_registration_parameters self.governance_registration_parameters = governance_registration_parameters
self.hash = hash self.hash = hash
@ -2771,7 +2771,7 @@ class CardanoTxAuxiliaryDataSupplement(protobuf.MessageType):
FIELDS = { FIELDS = {
1: protobuf.Field("type", "CardanoTxAuxiliaryDataSupplementType", repeated=False, required=True), 1: protobuf.Field("type", "CardanoTxAuxiliaryDataSupplementType", repeated=False, required=True),
2: protobuf.Field("auxiliary_data_hash", "bytes", repeated=False, required=False), 2: protobuf.Field("auxiliary_data_hash", "bytes", repeated=False, required=False),
3: protobuf.Field("catalyst_signature", "bytes", repeated=False, required=False), 3: protobuf.Field("governance_signature", "bytes", repeated=False, required=False),
} }
def __init__( def __init__(
@ -2779,11 +2779,11 @@ class CardanoTxAuxiliaryDataSupplement(protobuf.MessageType):
*, *,
type: "CardanoTxAuxiliaryDataSupplementType", type: "CardanoTxAuxiliaryDataSupplementType",
auxiliary_data_hash: Optional["bytes"] = None, auxiliary_data_hash: Optional["bytes"] = None,
catalyst_signature: Optional["bytes"] = None, governance_signature: Optional["bytes"] = None,
) -> None: ) -> None:
self.type = type self.type = type
self.auxiliary_data_hash = auxiliary_data_hash self.auxiliary_data_hash = auxiliary_data_hash
self.catalyst_signature = catalyst_signature self.governance_signature = governance_signature
class CardanoTxWitnessRequest(protobuf.MessageType): class CardanoTxWitnessRequest(protobuf.MessageType):

View File

@ -159,8 +159,8 @@ def _transform_expected_result(result):
"type": supplement["type"], "type": supplement["type"],
"auxiliary_data_hash": bytes.fromhex(supplement["auxiliary_data_hash"]), "auxiliary_data_hash": bytes.fromhex(supplement["auxiliary_data_hash"]),
} }
if catalyst_signature := supplement.get("catalyst_signature"): if governance_signature := supplement.get("governance_signature"):
transformed_result["auxiliary_data_supplement"][ transformed_result["auxiliary_data_supplement"][
"catalyst_signature" "governance_signature"
] = bytes.fromhex(catalyst_signature) ] = bytes.fromhex(governance_signature)
return transformed_result return transformed_result

View File

@ -1171,7 +1171,7 @@
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_auxiliary_data_hash]": "53b24d40fc3ed95b8f102e8c5f2b885836eb5c56dd8aa0fdf3116bfb7187813c", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_auxiliary_data_hash]": "53b24d40fc3ed95b8f102e8c5f2b885836eb5c56dd8aa0fdf3116bfb7187813c",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_base_address_change_output_p-3c7243e1": "54266c3f100fae1303bb579bb3b731a24908eee78c634b1ba92af0dfbcf19d82", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_base_address_change_output_p-3c7243e1": "54266c3f100fae1303bb579bb3b731a24908eee78c634b1ba92af0dfbcf19d82",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_base_address_change_output_s-20438873": "b616c4005ee1a2728953ceb3a154e578d8ce53a908b6f11e8598290a3842f08a", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_base_address_change_output_s-20438873": "b616c4005ee1a2728953ceb3a154e578d8ce53a908b6f11e8598290a3842f08a",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_catalyst_registration]": "3abfe7b0f3de4adacf9d07653eb0d3c80eb4c8876dc456f8c88b2e68ba14850c", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_governance_registration]": "3abfe7b0f3de4adacf9d07653eb0d3c80eb4c8876dc456f8c88b2e68ba14850c",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_everything_set_except_pool_r-1e1ef130": "9130bf5c2da6543833a3c841b18e649768f5c27108695a6227b0cb747a34be3d", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_everything_set_except_pool_r-1e1ef130": "9130bf5c2da6543833a3c841b18e649768f5c27108695a6227b0cb747a34be3d",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_stake_deregistration]": "fea08104b2228ba952c9f0ccb64a88fee1c1fc91aa1fca951e812d1a50f7c771", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_stake_deregistration]": "fea08104b2228ba952c9f0ccb64a88fee1c1fc91aa1fca951e812d1a50f7c771",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_stake_deregistration_and_withdrawal]": "fea08104b2228ba952c9f0ccb64a88fee1c1fc91aa1fca951e812d1a50f7c771", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx[transaction_with_stake_deregistration_and_withdrawal]": "fea08104b2228ba952c9f0ccb64a88fee1c1fc91aa1fca951e812d1a50f7c771",
@ -1284,7 +1284,7 @@
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[testnet_transaction_with_mainnet_output]": "5a608b731c43231bcae0a856e74497612ccfeff809e5022dfb27798863e1bfb1", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[testnet_transaction_with_mainnet_output]": "5a608b731c43231bcae0a856e74497612ccfeff809e5022dfb27798863e1bfb1",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[total_collateral_is_present]": "9e1f554bb74f847e8f09201dda808fd1e0cdb68737515f34d6ad435957671c77", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[total_collateral_is_present]": "9e1f554bb74f847e8f09201dda808fd1e0cdb68737515f34d6ad435957671c77",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[transaction_with_both_auxiliary_data_b-64274ac4": "2b85ec100a491345e0084c4efc226f60645fb47c56fb84ff133b2cb850cdd1f2", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[transaction_with_both_auxiliary_data_b-64274ac4": "2b85ec100a491345e0084c4efc226f60645fb47c56fb84ff133b2cb850cdd1f2",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[transaction_with_catalyst_registration-11533421": "2b85ec100a491345e0084c4efc226f60645fb47c56fb84ff133b2cb850cdd1f2", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[transaction_with_governance_registration-11533421": "2b85ec100a491345e0084c4efc226f60645fb47c56fb84ff133b2cb850cdd1f2",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[two_owners_with_path]": "7b2acc6b455cc40edcacdd0806c04040241f3c21205cfd25a3420c5ef65f33c4", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[two_owners_with_path]": "7b2acc6b455cc40edcacdd0806c04040241f3c21205cfd25a3420c5ef65f33c4",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[unsupported_address_type]": "5a608b731c43231bcae0a856e74497612ccfeff809e5022dfb27798863e1bfb1", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[unsupported_address_type]": "5a608b731c43231bcae0a856e74497612ccfeff809e5022dfb27798863e1bfb1",
"TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[with_multisig_transaction_signing_mode]": "d2ee9af7349df63db617a497532ed03a9fa4c26dac455348cc9e65ca7bc04de7", "TT_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[with_multisig_transaction_signing_mode]": "d2ee9af7349df63db617a497532ed03a9fa4c26dac455348cc9e65ca7bc04de7",
@ -2345,7 +2345,7 @@
"TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[testnet_transaction_with_mainnet_output]": "cbfd7d957541a2ab43c47ccdcf2fa61893d817f888c2ce65af0af14b61c11425", "TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[testnet_transaction_with_mainnet_output]": "cbfd7d957541a2ab43c47ccdcf2fa61893d817f888c2ce65af0af14b61c11425",
"TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[total_collateral_is_present]": "6f59841dc5e3597d0940a7b4be0813b25555652180043634c9018272c5a22a3a", "TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[total_collateral_is_present]": "6f59841dc5e3597d0940a7b4be0813b25555652180043634c9018272c5a22a3a",
"TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[transaction_with_both_auxiliary_data_b-64274ac4": "f71fe6d2af5c42cd6c75af8249deb3f14494ffa33e523469037b49cb13311991", "TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[transaction_with_both_auxiliary_data_b-64274ac4": "f71fe6d2af5c42cd6c75af8249deb3f14494ffa33e523469037b49cb13311991",
"TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[transaction_with_catalyst_registration-11533421": "f71fe6d2af5c42cd6c75af8249deb3f14494ffa33e523469037b49cb13311991", "TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[transaction_with_governance_registration-11533421": "f71fe6d2af5c42cd6c75af8249deb3f14494ffa33e523469037b49cb13311991",
"TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[two_owners_with_path]": "4ce6a2c9ffd6e26da53fa0a303b5a60c5d1bc4b0ec390fe70f08250fd0635ec2", "TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[two_owners_with_path]": "4ce6a2c9ffd6e26da53fa0a303b5a60c5d1bc4b0ec390fe70f08250fd0635ec2",
"TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[unsupported_address_type]": "cbfd7d957541a2ab43c47ccdcf2fa61893d817f888c2ce65af0af14b61c11425", "TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[unsupported_address_type]": "cbfd7d957541a2ab43c47ccdcf2fa61893d817f888c2ce65af0af14b61c11425",
"TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[with_multisig_transaction_signing_mode]": "1046e4587492a3ca32656c7f772db75462abd816d36f60e33022a783a8f155ea", "TTui2_cardano-test_sign_tx.py::test_cardano_sign_tx_failed[with_multisig_transaction_signing_mode]": "1046e4587492a3ca32656c7f772db75462abd816d36f60e33022a783a8f155ea",