1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 20:38:10 +00:00

feat(cardano): Add Conway certificates

This commit is contained in:
Peter Jaško 2023-11-10 15:18:57 +01:00 committed by matejcik
parent 76e98ecc3d
commit 10e4352aad
21 changed files with 1595 additions and 88 deletions

View File

@ -56,6 +56,16 @@ enum CardanoCertificateType {
STAKE_DEREGISTRATION = 1; STAKE_DEREGISTRATION = 1;
STAKE_DELEGATION = 2; STAKE_DELEGATION = 2;
STAKE_POOL_REGISTRATION = 3; STAKE_POOL_REGISTRATION = 3;
STAKE_REGISTRATION_CONWAY = 7;
STAKE_DEREGISTRATION_CONWAY = 8;
VOTE_DELEGATION = 9;
}
enum CardanoDRepType {
KEY_HASH = 0;
SCRIPT_HASH = 1;
ABSTAIN = 2;
NO_CONFIDENCE = 3;
} }
enum CardanoPoolRelayType { enum CardanoPoolRelayType {
@ -335,6 +345,16 @@ message CardanoPoolParametersType {
required uint32 relays_count = 12; // number of pool relays required uint32 relays_count = 12; // number of pool relays
} }
/**
* DRep delegation parameters
* @embed
*/
message CardanoDRep {
required CardanoDRepType type = 1; // drep type
optional bytes key_hash = 2; // drep key hash
optional bytes script_hash = 3; // drep script hash
}
/** /**
* Request: Transaction certificate data * Request: Transaction certificate data
* @next CardanoTxItemAck * @next CardanoTxItemAck
@ -346,6 +366,8 @@ message CardanoTxCertificate {
optional CardanoPoolParametersType pool_parameters = 4; // used for stake pool registration certificate optional CardanoPoolParametersType pool_parameters = 4; // used for stake pool registration certificate
optional bytes script_hash = 5; // stake credential script hash optional bytes script_hash = 5; // stake credential script hash
optional bytes key_hash = 6; // stake credential key hash optional bytes key_hash = 6; // stake credential key hash
optional uint64 deposit = 7; // used for stake key registration certificate
optional CardanoDRep drep = 8; // used for vote delegation certificate
} }
/** /**

View File

@ -662,6 +662,59 @@
] ]
} }
}, },
{
"description": "transaction with conway stake registration certificate",
"parameters": {
"protocol_magic": 764824073,
"network_id": 1,
"fee": 42,
"ttl": 10,
"validity_interval_start": null,
"certificates": [
{
"type": 7,
"path": "m/1852'/1815'/0'/2/0",
"deposit": 2000000
}
],
"withdrawals": [],
"auxiliary_data": null,
"inputs": [
{
"path": "m/1852'/1815'/0'/0/0",
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
"prev_index": 0
}
],
"outputs": [
{
"address": "addr1q84sh2j72ux0l03fxndjnhctdg7hcppsaejafsa84vh7lwgmcs5wgus8qt4atk45lvt4xfxpjtwfhdmvchdf2m3u3hlsd5tq5r",
"amount": "1"
}
],
"mint": [],
"script_data_hash": null,
"collateral_inputs": [],
"required_signers": [],
"collateral_return": null,
"total_collateral": null,
"reference_inputs": [],
"signing_mode": "ORDINARY_TRANSACTION",
"additional_witness_requests": [],
"include_network_id": false
},
"result": {
"tx_hash": "e200b2c91f3493a1f3b9cfc8b6c141f70181741025e53941e9d57d22b1470c5c",
"witnesses": [
{
"type": 1,
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
"signature": "79a357517a08c7256b0fab1e93a92a477386f4c2d72cea7bc68527c0133c32472305f010350665d72e8017bb6c2080b5742680ce7700bbddda561c917f294a07",
"chain_code": null
}
]
}
},
{ {
"description": "transaction with stake registration certificate (no outputs)", "description": "transaction with stake registration certificate (no outputs)",
"parameters": { "parameters": {
@ -830,6 +883,65 @@
] ]
} }
}, },
{
"description": "transaction with conway stake deregistration certificate",
"parameters": {
"protocol_magic": 764824073,
"network_id": 1,
"fee": 42,
"ttl": 10,
"validity_interval_start": null,
"certificates": [
{
"type": 8,
"path": "m/1852'/1815'/0'/2/0",
"deposit": 2000000
}
],
"withdrawals": [],
"auxiliary_data": null,
"inputs": [
{
"path": "m/1852'/1815'/0'/0/0",
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
"prev_index": 0
}
],
"outputs": [
{
"address": "addr1q84sh2j72ux0l03fxndjnhctdg7hcppsaejafsa84vh7lwgmcs5wgus8qt4atk45lvt4xfxpjtwfhdmvchdf2m3u3hlsd5tq5r",
"amount": "1"
}
],
"mint": [],
"script_data_hash": null,
"collateral_inputs": [],
"required_signers": [],
"collateral_return": null,
"total_collateral": null,
"reference_inputs": [],
"signing_mode": "ORDINARY_TRANSACTION",
"additional_witness_requests": [],
"include_network_id": false
},
"result": {
"tx_hash": "564ad55097101e1ca85629cffe839f43a19bf33aa1940c99a62eb8f14392eebb",
"witnesses": [
{
"type": 1,
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
"signature": "a0fa6630498f57249b305824ad4d32157653820e7d651332a58af70a80364df882ee8b0471e76dd7a335eea84a18c52b12c02508779d46b193bc418c22e8a00f",
"chain_code": null
},
{
"type": 1,
"pub_key": "bc65be1b0b9d7531778a1317c2aa6de936963c3f9ac7d5ee9e9eda25e0c97c5e",
"signature": "5d282fcd2685ee47f3770f84b2badf4046e8e76bfdaa26f74e292ecd16bcf89fb330b99edff13bc9c81e8c6523864f69a3ac7cde29d5a648707724c5cb48730e",
"chain_code": null
}
]
}
},
{ {
"description": "transaction with stake deregistration and withdrawal", "description": "transaction with stake deregistration and withdrawal",
"parameters": { "parameters": {
@ -952,6 +1064,252 @@
] ]
} }
}, },
{
"description": "transaction delegating vote to DRep by key hash",
"parameters": {
"protocol_magic": 764824073,
"network_id": 1,
"fee": 42,
"ttl": 10,
"validity_interval_start": null,
"certificates": [
{
"type": 9,
"path": "m/1852'/1815'/0'/2/0",
"drep": {
"type": 0,
"key_hash": "29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
}
}
],
"withdrawals": [],
"auxiliary_data": null,
"inputs": [
{
"path": "m/1852'/1815'/0'/0/0",
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
"prev_index": 0
}
],
"outputs": [
{
"address": "addr1q84sh2j72ux0l03fxndjnhctdg7hcppsaejafsa84vh7lwgmcs5wgus8qt4atk45lvt4xfxpjtwfhdmvchdf2m3u3hlsd5tq5r",
"amount": "1"
}
],
"mint": [],
"script_data_hash": null,
"collateral_inputs": [],
"required_signers": [],
"collateral_return": null,
"total_collateral": null,
"reference_inputs": [],
"signing_mode": "ORDINARY_TRANSACTION",
"additional_witness_requests": [],
"include_network_id": false
},
"result": {
"tx_hash": "1669062fd6efc4f11ed8ae9511a9c9f4454fa4f64e2043483f99d7c711236664",
"witnesses": [
{
"type": 1,
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
"signature": "b900968efd7cfed3666a63f11267bb4fdc08684788883b91cf690e37834263387b164d52c770d1bb91578ca0029a954c9ef787ab0d3b9f3f396dedf744baa80b",
"chain_code": null
},
{
"type": 1,
"pub_key": "bc65be1b0b9d7531778a1317c2aa6de936963c3f9ac7d5ee9e9eda25e0c97c5e",
"signature": "d4fb5ebae0a061afa784df1ecceda5c06955a59ebc1ca4f7c2457f7ba27eacca756b8be9d84584f1b2ea23ce7b8420c73fc447398cf6caa725cb0d5c9b9f700e",
"chain_code": null
}
]
}
},
{
"description": "transaction delegating vote to DRep by script hash",
"parameters": {
"protocol_magic": 764824073,
"network_id": 1,
"fee": 42,
"ttl": 10,
"validity_interval_start": null,
"certificates": [
{
"type": 9,
"path": "m/1852'/1815'/0'/2/0",
"drep": {
"type": 1,
"script_hash": "29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
}
}
],
"withdrawals": [],
"auxiliary_data": null,
"inputs": [
{
"path": "m/1852'/1815'/0'/0/0",
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
"prev_index": 0
}
],
"outputs": [
{
"address": "addr1q84sh2j72ux0l03fxndjnhctdg7hcppsaejafsa84vh7lwgmcs5wgus8qt4atk45lvt4xfxpjtwfhdmvchdf2m3u3hlsd5tq5r",
"amount": "1"
}
],
"mint": [],
"script_data_hash": null,
"collateral_inputs": [],
"required_signers": [],
"collateral_return": null,
"total_collateral": null,
"reference_inputs": [],
"signing_mode": "ORDINARY_TRANSACTION",
"additional_witness_requests": [],
"include_network_id": false
},
"result": {
"tx_hash": "fccf753e4f96e20c880e5ea933041ed33509ec6c0dc1aee8b25a1fe3d562b7aa",
"witnesses": [
{
"type": 1,
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
"signature": "bde0242fee0de5b862d2f02847d789ebe10e8f82bf15837370f115c89c1b413f1b0fa5a470210127af92059c4d3ebff297d39e93143667d3823476f12f0f6f07",
"chain_code": null
},
{
"type": 1,
"pub_key": "bc65be1b0b9d7531778a1317c2aa6de936963c3f9ac7d5ee9e9eda25e0c97c5e",
"signature": "cd8a2fca634c1aa2c88609042de7e4fce232bf233b1271612b5edc7b806e11ff44e6b6b15feb5b6e76b7e16a8d703e7653d860c00981edf6fe3b1e4cbeaba406",
"chain_code": null
}
]
}
},
{
"description": "transaction delegating vote to predefined DRep 'Abstain'",
"parameters": {
"protocol_magic": 764824073,
"network_id": 1,
"fee": 42,
"ttl": 10,
"validity_interval_start": null,
"certificates": [
{
"type": 9,
"path": "m/1852'/1815'/0'/2/0",
"drep": {
"type": 2
}
}
],
"withdrawals": [],
"auxiliary_data": null,
"inputs": [
{
"path": "m/1852'/1815'/0'/0/0",
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
"prev_index": 0
}
],
"outputs": [
{
"address": "addr1q84sh2j72ux0l03fxndjnhctdg7hcppsaejafsa84vh7lwgmcs5wgus8qt4atk45lvt4xfxpjtwfhdmvchdf2m3u3hlsd5tq5r",
"amount": "1"
}
],
"mint": [],
"script_data_hash": null,
"collateral_inputs": [],
"required_signers": [],
"collateral_return": null,
"total_collateral": null,
"reference_inputs": [],
"signing_mode": "ORDINARY_TRANSACTION",
"additional_witness_requests": [],
"include_network_id": false
},
"result": {
"tx_hash": "01d0f76fadc899087c5352befac56cbfdc2e868ac715fbfe00230bab3f7fa751",
"witnesses": [
{
"type": 1,
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
"signature": "52c57d9c0e06fc9883285db4eec1a1504e27726dc5afce943d6f54df22188f05c3eeee06d052375eceb55df83c314237b3718f07fccef6198bda8c20d794b102",
"chain_code": null
},
{
"type": 1,
"pub_key": "bc65be1b0b9d7531778a1317c2aa6de936963c3f9ac7d5ee9e9eda25e0c97c5e",
"signature": "6de4940ff99738aaf3659ffeb8e4f6f01ff88ddb65c24028d75a847ca684d07af000e32eaa4c915c8031f6d928b2bcbe8c6f57e389299d3eafe213bd0ab1190c",
"chain_code": null
}
]
}
},
{
"description": "transaction delegating vote to predefined DRep 'No Confidence'",
"parameters": {
"protocol_magic": 764824073,
"network_id": 1,
"fee": 42,
"ttl": 10,
"validity_interval_start": null,
"certificates": [
{
"type": 9,
"path": "m/1852'/1815'/0'/2/0",
"drep": {
"type": 3
}
}
],
"withdrawals": [],
"auxiliary_data": null,
"inputs": [
{
"path": "m/1852'/1815'/0'/0/0",
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
"prev_index": 0
}
],
"outputs": [
{
"address": "addr1q84sh2j72ux0l03fxndjnhctdg7hcppsaejafsa84vh7lwgmcs5wgus8qt4atk45lvt4xfxpjtwfhdmvchdf2m3u3hlsd5tq5r",
"amount": "1"
}
],
"mint": [],
"script_data_hash": null,
"collateral_inputs": [],
"required_signers": [],
"collateral_return": null,
"total_collateral": null,
"reference_inputs": [],
"signing_mode": "ORDINARY_TRANSACTION",
"additional_witness_requests": [],
"include_network_id": false
},
"result": {
"tx_hash": "567e9bd00787190f1ab51879dcf834002b76007130c526b2e4d1bf9a996f5ad0",
"witnesses": [
{
"type": 1,
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
"signature": "20e3f9ecc3a1b97cbda08cf610b2e72b45d0e0916af2be2ad472d4c8d2be4b13818497818961c8d27379754f0057b00fa286bce0d59f177f24eeee4e2b24940f",
"chain_code": null
},
{
"type": 1,
"pub_key": "bc65be1b0b9d7531778a1317c2aa6de936963c3f9ac7d5ee9e9eda25e0c97c5e",
"signature": "898fb2cef0c4b954f22c4218fc9a188a5da340ddb5c6d5bba01c67520bbf537f5743814b6d40dd7f299ece7e39d7efb16a1cb597e8d421649a9483f631371703",
"chain_code": null
}
]
}
},
{ {
"description": "transaction with auxiliary data hash", "description": "transaction with auxiliary data hash",
"parameters": { "parameters": {

View File

@ -663,6 +663,8 @@ static void _librust_qstrs(void) {
MP_QSTR_cardano__addr_pointer; MP_QSTR_cardano__addr_pointer;
MP_QSTR_cardano__addr_reward; MP_QSTR_cardano__addr_reward;
MP_QSTR_cardano__address_no_staking; MP_QSTR_cardano__address_no_staking;
MP_QSTR_cardano__always_abstain;
MP_QSTR_cardano__always_no_confidence;
MP_QSTR_cardano__amount_burned_decimals_unknown; MP_QSTR_cardano__amount_burned_decimals_unknown;
MP_QSTR_cardano__amount_minted_decimals_unknown; MP_QSTR_cardano__amount_minted_decimals_unknown;
MP_QSTR_cardano__amount_sent_decimals_unknown; MP_QSTR_cardano__amount_sent_decimals_unknown;
@ -690,6 +692,9 @@ static void _librust_qstrs(void) {
MP_QSTR_cardano__credential_mismatch; MP_QSTR_cardano__credential_mismatch;
MP_QSTR_cardano__datum_hash; MP_QSTR_cardano__datum_hash;
MP_QSTR_cardano__delegating_to; MP_QSTR_cardano__delegating_to;
MP_QSTR_cardano__delegating_to_key_hash;
MP_QSTR_cardano__delegating_to_script;
MP_QSTR_cardano__deposit;
MP_QSTR_cardano__for_account_and_index_template; MP_QSTR_cardano__for_account_and_index_template;
MP_QSTR_cardano__for_account_template; MP_QSTR_cardano__for_account_template;
MP_QSTR_cardano__for_key_hash; MP_QSTR_cardano__for_key_hash;
@ -759,6 +764,7 @@ static void _librust_qstrs(void) {
MP_QSTR_cardano__unusual_path; MP_QSTR_cardano__unusual_path;
MP_QSTR_cardano__valid_since; MP_QSTR_cardano__valid_since;
MP_QSTR_cardano__verify_script; MP_QSTR_cardano__verify_script;
MP_QSTR_cardano__vote_delegation;
MP_QSTR_cardano__vote_key_registration; MP_QSTR_cardano__vote_key_registration;
MP_QSTR_cardano__vote_public_key; MP_QSTR_cardano__vote_public_key;
MP_QSTR_cardano__voting_purpose; MP_QSTR_cardano__voting_purpose;

View File

@ -1239,6 +1239,18 @@ pub enum TranslatedString {
storage_msg__wrong_pin = 844, // "Wrong PIN" storage_msg__wrong_pin = 844, // "Wrong PIN"
reset__create_x_of_y_multi_share_backup_template = 845, // "Do you want to create a {0} of {1} multi-share backup?" reset__create_x_of_y_multi_share_backup_template = 845, // "Do you want to create a {0} of {1} multi-share backup?"
reset__title_shamir_backup = 846, // "Multi-share backup" reset__title_shamir_backup = 846, // "Multi-share backup"
#[cfg(feature = "universal_fw")]
cardano__always_abstain = 847, // "Always Abstain"
#[cfg(feature = "universal_fw")]
cardano__always_no_confidence = 848, // "Always No Confidence"
#[cfg(feature = "universal_fw")]
cardano__delegating_to_key_hash = 849, // "Delegating to key hash:"
#[cfg(feature = "universal_fw")]
cardano__delegating_to_script = 850, // "Delegating to script:"
#[cfg(feature = "universal_fw")]
cardano__deposit = 851, // "Deposit:"
#[cfg(feature = "universal_fw")]
cardano__vote_delegation = 852, // "Vote delegation"
} }
impl TranslatedString { impl TranslatedString {
@ -2473,6 +2485,18 @@ impl TranslatedString {
Self::storage_msg__wrong_pin => "Wrong PIN", Self::storage_msg__wrong_pin => "Wrong PIN",
Self::reset__create_x_of_y_multi_share_backup_template => "Do you want to create a {0} of {1} multi-share backup?", Self::reset__create_x_of_y_multi_share_backup_template => "Do you want to create a {0} of {1} multi-share backup?",
Self::reset__title_shamir_backup => "Multi-share backup", Self::reset__title_shamir_backup => "Multi-share backup",
#[cfg(feature = "universal_fw")]
Self::cardano__always_abstain => "Always Abstain",
#[cfg(feature = "universal_fw")]
Self::cardano__always_no_confidence => "Always No Confidence",
#[cfg(feature = "universal_fw")]
Self::cardano__delegating_to_key_hash => "Delegating to key hash:",
#[cfg(feature = "universal_fw")]
Self::cardano__delegating_to_script => "Delegating to script:",
#[cfg(feature = "universal_fw")]
Self::cardano__deposit => "Deposit:",
#[cfg(feature = "universal_fw")]
Self::cardano__vote_delegation => "Vote delegation",
} }
} }
@ -3708,6 +3732,18 @@ impl TranslatedString {
Qstr::MP_QSTR_storage_msg__wrong_pin => Some(Self::storage_msg__wrong_pin), Qstr::MP_QSTR_storage_msg__wrong_pin => Some(Self::storage_msg__wrong_pin),
Qstr::MP_QSTR_reset__create_x_of_y_multi_share_backup_template => Some(Self::reset__create_x_of_y_multi_share_backup_template), Qstr::MP_QSTR_reset__create_x_of_y_multi_share_backup_template => Some(Self::reset__create_x_of_y_multi_share_backup_template),
Qstr::MP_QSTR_reset__title_shamir_backup => Some(Self::reset__title_shamir_backup), Qstr::MP_QSTR_reset__title_shamir_backup => Some(Self::reset__title_shamir_backup),
#[cfg(feature = "universal_fw")]
Qstr::MP_QSTR_cardano__always_abstain => Some(Self::cardano__always_abstain),
#[cfg(feature = "universal_fw")]
Qstr::MP_QSTR_cardano__always_no_confidence => Some(Self::cardano__always_no_confidence),
#[cfg(feature = "universal_fw")]
Qstr::MP_QSTR_cardano__delegating_to_key_hash => Some(Self::cardano__delegating_to_key_hash),
#[cfg(feature = "universal_fw")]
Qstr::MP_QSTR_cardano__delegating_to_script => Some(Self::cardano__delegating_to_script),
#[cfg(feature = "universal_fw")]
Qstr::MP_QSTR_cardano__deposit => Some(Self::cardano__deposit),
#[cfg(feature = "universal_fw")]
Qstr::MP_QSTR_cardano__vote_delegation => Some(Self::cardano__vote_delegation),
_ => None, _ => None,
} }
} }

View File

@ -111,6 +111,8 @@ class TR:
cardano__addr_pointer: str = "Pointer" cardano__addr_pointer: str = "Pointer"
cardano__addr_reward: str = "Reward" cardano__addr_reward: str = "Reward"
cardano__address_no_staking: str = "address - no staking rewards." cardano__address_no_staking: str = "address - no staking rewards."
cardano__always_abstain: str = "Always Abstain"
cardano__always_no_confidence: str = "Always No Confidence"
cardano__amount_burned_decimals_unknown: str = "Amount burned (decimals unknown):" cardano__amount_burned_decimals_unknown: str = "Amount burned (decimals unknown):"
cardano__amount_minted_decimals_unknown: str = "Amount minted (decimals unknown):" cardano__amount_minted_decimals_unknown: str = "Amount minted (decimals unknown):"
cardano__amount_sent_decimals_unknown: str = "Amount sent (decimals unknown):" cardano__amount_sent_decimals_unknown: str = "Amount sent (decimals unknown):"
@ -138,6 +140,9 @@ class TR:
cardano__credential_mismatch: str = "Credential doesn't match payment credential." cardano__credential_mismatch: str = "Credential doesn't match payment credential."
cardano__datum_hash: str = "Datum hash:" cardano__datum_hash: str = "Datum hash:"
cardano__delegating_to: str = "Delegating to:" cardano__delegating_to: str = "Delegating to:"
cardano__delegating_to_key_hash: str = "Delegating to key hash:"
cardano__delegating_to_script: str = "Delegating to script:"
cardano__deposit: str = "Deposit:"
cardano__for_account_and_index_template: str = "for account {0} and index {1}:" cardano__for_account_and_index_template: str = "for account {0} and index {1}:"
cardano__for_account_template: str = "for account {0}:" cardano__for_account_template: str = "for account {0}:"
cardano__for_key_hash: str = "for key hash:" cardano__for_key_hash: str = "for key hash:"
@ -207,6 +212,7 @@ class TR:
cardano__unusual_path: str = "Path is unusual." cardano__unusual_path: str = "Path is unusual."
cardano__valid_since: str = "Valid since:" cardano__valid_since: str = "Valid since:"
cardano__verify_script: str = "Verify script" cardano__verify_script: str = "Verify script"
cardano__vote_delegation: str = "Vote delegation"
cardano__vote_key_registration: str = "Vote key registration (CIP-36)" cardano__vote_key_registration: str = "Vote key registration (CIP-36)"
cardano__vote_public_key: str = "Vote public key:" cardano__vote_public_key: str = "Vote public key:"
cardano__voting_purpose: str = "Voting purpose:" cardano__voting_purpose: str = "Voting purpose:"

View File

@ -381,6 +381,8 @@ if not utils.BITCOIN_ONLY:
import trezor.enums.CardanoCVoteRegistrationFormat import trezor.enums.CardanoCVoteRegistrationFormat
trezor.enums.CardanoCertificateType trezor.enums.CardanoCertificateType
import trezor.enums.CardanoCertificateType import trezor.enums.CardanoCertificateType
trezor.enums.CardanoDRepType
import trezor.enums.CardanoDRepType
trezor.enums.CardanoDerivationType trezor.enums.CardanoDerivationType
import trezor.enums.CardanoDerivationType import trezor.enums.CardanoDerivationType
trezor.enums.CardanoNativeScriptHashDisplayFormat trezor.enums.CardanoNativeScriptHashDisplayFormat

View File

@ -1,7 +1,7 @@
from micropython import const from micropython import const
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from trezor.enums import CardanoCertificateType, CardanoPoolRelayType from trezor.enums import CardanoCertificateType, CardanoDRepType, CardanoPoolRelayType
from trezor.wire import ProcessError from trezor.wire import ProcessError
from . import addresses from . import addresses
@ -51,6 +51,19 @@ def validate(
ProcessError("Invalid certificate"), ProcessError("Invalid certificate"),
) )
if certificate.type in (
CCT.STAKE_REGISTRATION_CONWAY,
CCT.STAKE_DEREGISTRATION_CONWAY,
):
if certificate.deposit is None:
raise ProcessError("Invalid certificate")
validate_stake_credential(
certificate.path,
certificate.script_hash,
certificate.key_hash,
ProcessError("Invalid certificate"),
)
if certificate.type == CCT.STAKE_DELEGATION: if certificate.type == CCT.STAKE_DELEGATION:
if not certificate.pool or len(certificate.pool) != _POOL_HASH_SIZE: if not certificate.pool or len(certificate.pool) != _POOL_HASH_SIZE:
raise ProcessError("Invalid certificate") raise ProcessError("Invalid certificate")
@ -62,24 +75,45 @@ def validate(
certificate.pool_parameters, protocol_magic, network_id certificate.pool_parameters, protocol_magic, network_id
) )
if certificate.type == CCT.VOTE_DELEGATION:
if certificate.drep is None:
raise ProcessError("Invalid certificate")
validate_drep(
certificate.drep,
ProcessError("Invalid certificate"),
)
validate_stake_credential(
certificate.path,
certificate.script_hash,
certificate.key_hash,
ProcessError("Invalid certificate"),
)
account_path_checker.add_certificate(certificate) account_path_checker.add_certificate(certificate)
def _validate_structure(certificate: messages.CardanoTxCertificate) -> None: def _validate_structure(certificate: messages.CardanoTxCertificate) -> None:
pool = certificate.pool # local_cache_attribute pool = certificate.pool # local_cache_attribute
pool_parameters = certificate.pool_parameters # local_cache_attribute pool_parameters = certificate.pool_parameters # local_cache_attribute
deposit = certificate.deposit
drep = certificate.drep
CCT = CardanoCertificateType # local_cache_global CCT = CardanoCertificateType # local_cache_global
fields_to_be_empty: dict[CardanoCertificateType, tuple[Any, ...]] = { fields_to_be_empty: dict[CardanoCertificateType, tuple[Any, ...]] = {
CCT.STAKE_REGISTRATION: (pool, pool_parameters), CCT.STAKE_REGISTRATION: (pool, pool_parameters, deposit, drep),
CCT.STAKE_DELEGATION: (pool_parameters,), CCT.STAKE_REGISTRATION_CONWAY: (pool, pool_parameters, drep),
CCT.STAKE_DEREGISTRATION: (pool, pool_parameters), CCT.STAKE_DELEGATION: (pool_parameters, deposit, drep),
CCT.STAKE_DEREGISTRATION: (pool, pool_parameters, deposit, drep),
CCT.STAKE_DEREGISTRATION_CONWAY: (pool, pool_parameters, drep),
CCT.STAKE_POOL_REGISTRATION: ( CCT.STAKE_POOL_REGISTRATION: (
certificate.path, certificate.path,
certificate.script_hash, certificate.script_hash,
certificate.key_hash, certificate.key_hash,
pool, pool,
deposit,
drep,
), ),
CCT.VOTE_DELEGATION: (pool, pool_parameters, deposit),
} }
if certificate.type not in fields_to_be_empty or any( if certificate.type not in fields_to_be_empty or any(
@ -106,6 +140,20 @@ def cborize(
certificate.key_hash, certificate.key_hash,
), ),
) )
elif cert_type in (
CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
):
return (
cert_type,
cborize_stake_credential(
keychain,
certificate.path,
certificate.script_hash,
certificate.key_hash,
),
certificate.deposit,
)
elif cert_type == CardanoCertificateType.STAKE_DELEGATION: elif cert_type == CardanoCertificateType.STAKE_DELEGATION:
return ( return (
cert_type, cert_type,
@ -117,6 +165,18 @@ def cborize(
), ),
certificate.pool, certificate.pool,
) )
elif cert_type == CardanoCertificateType.VOTE_DELEGATION:
assert certificate.drep is not None
return (
cert_type,
cborize_stake_credential(
keychain,
certificate.path,
certificate.script_hash,
certificate.key_hash,
),
cborize_drep(certificate.drep),
)
else: else:
raise RuntimeError # should be unreachable raise RuntimeError # should be unreachable
@ -198,6 +258,32 @@ def _validate_pool_parameters(
assert_cond(all((32 <= ord(c) < 127) for c in pool_metadata.url)) assert_cond(all((32 <= ord(c) < 127) for c in pool_metadata.url))
def validate_drep(
drep: messages.CardanoDRep,
error: ProcessError,
) -> None:
from .helpers import ADDRESS_KEY_HASH_SIZE, SCRIPT_HASH_SIZE
drep_type = drep.type
script_hash = drep.script_hash
key_hash = drep.key_hash
if drep_type == CardanoDRepType.KEY_HASH:
if script_hash or not key_hash or len(key_hash) != ADDRESS_KEY_HASH_SIZE:
raise error
elif drep_type == CardanoDRepType.SCRIPT_HASH:
if key_hash or not script_hash or len(script_hash) != SCRIPT_HASH_SIZE:
raise error
elif drep_type in (
CardanoDRepType.ABSTAIN,
CardanoDRepType.NO_CONFIDENCE,
):
if script_hash or key_hash:
raise error
else:
raise RuntimeError # should be unreachable
def validate_pool_owner( def validate_pool_owner(
owner: messages.CardanoPoolOwner, account_path_checker: AccountPathChecker owner: messages.CardanoPoolOwner, account_path_checker: AccountPathChecker
) -> None: ) -> None:
@ -237,6 +323,21 @@ def validate_pool_relay(pool_relay: messages.CardanoPoolRelayParameters) -> None
raise RuntimeError # should be unreachable raise RuntimeError # should be unreachable
def cborize_drep(drep: messages.CardanoDRep) -> tuple[int, bytes] | tuple[int]:
if drep.type == CardanoDRepType.KEY_HASH:
assert drep.key_hash is not None
return 0, drep.key_hash
elif drep.type == CardanoDRepType.SCRIPT_HASH:
assert drep.script_hash is not None
return 1, drep.script_hash
elif drep.type == CardanoDRepType.ABSTAIN:
return (2,)
elif drep.type == CardanoDRepType.NO_CONFIDENCE:
return (3,)
else:
raise RuntimeError # should be unreachable
def cborize_pool_owner( def cborize_pool_owner(
keychain: seed.Keychain, pool_owner: messages.CardanoPoolOwner keychain: seed.Keychain, pool_owner: messages.CardanoPoolOwner
) -> bytes: ) -> bytes:

View File

@ -15,6 +15,8 @@ HRP_STAKE_KEY_HASH = "stake_vkh"
HRP_REQUIRED_SIGNER_KEY_HASH = "req_signer_vkh" HRP_REQUIRED_SIGNER_KEY_HASH = "req_signer_vkh"
HRP_OUTPUT_DATUM_HASH = "datum" HRP_OUTPUT_DATUM_HASH = "datum"
HRP_SCRIPT_DATA_HASH = "script_data" HRP_SCRIPT_DATA_HASH = "script_data"
HRP_DREP_KEY_HASH = "drep"
HRP_DREP_SCRIPT_HASH = "drep_script"
def encode(hrp: str, data: bytes) -> str: def encode(hrp: str, data: bytes) -> str:

View File

@ -5,6 +5,7 @@ from trezor.enums import (
ButtonRequestType, ButtonRequestType,
CardanoAddressType, CardanoAddressType,
CardanoCertificateType, CardanoCertificateType,
CardanoDRepType,
CardanoNativeScriptType, CardanoNativeScriptType,
) )
from trezor.strings import format_amount from trezor.strings import format_amount
@ -58,9 +59,12 @@ SCRIPT_TYPE_NAMES = {
CERTIFICATE_TYPE_NAMES = { CERTIFICATE_TYPE_NAMES = {
CardanoCertificateType.STAKE_REGISTRATION: TR.cardano__stake_registration, CardanoCertificateType.STAKE_REGISTRATION: TR.cardano__stake_registration,
CardanoCertificateType.STAKE_REGISTRATION_CONWAY: TR.cardano__stake_registration,
CardanoCertificateType.STAKE_DEREGISTRATION: TR.cardano__stake_deregistration, CardanoCertificateType.STAKE_DEREGISTRATION: TR.cardano__stake_deregistration,
CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY: TR.cardano__stake_deregistration,
CardanoCertificateType.STAKE_DELEGATION: TR.cardano__stake_delegation, CardanoCertificateType.STAKE_DELEGATION: TR.cardano__stake_delegation,
CardanoCertificateType.STAKE_POOL_REGISTRATION: TR.cardano__stake_pool_registration, CardanoCertificateType.STAKE_POOL_REGISTRATION: TR.cardano__stake_pool_registration,
CardanoCertificateType.VOTE_DELEGATION: TR.cardano__vote_delegation,
} }
BRT_Other = ButtonRequestType.Other # global_import_cache BRT_Other = ButtonRequestType.Other # global_import_cache
@ -552,7 +556,9 @@ async def confirm_tx(
) )
async def confirm_certificate(certificate: messages.CardanoTxCertificate) -> None: async def confirm_certificate(
certificate: messages.CardanoTxCertificate, network_id: int
) -> None:
# stake pool registration requires custom confirmation logic not covered # stake pool registration requires custom confirmation logic not covered
# in this call # in this call
assert certificate.type != CardanoCertificateType.STAKE_POOL_REGISTRATION assert certificate.type != CardanoCertificateType.STAKE_POOL_REGISTRATION
@ -567,6 +573,18 @@ async def confirm_certificate(certificate: messages.CardanoTxCertificate) -> Non
if certificate.type == CardanoCertificateType.STAKE_DELEGATION: if certificate.type == CardanoCertificateType.STAKE_DELEGATION:
assert certificate.pool is not None # validate_certificate assert certificate.pool is not None # validate_certificate
props.append((TR.cardano__to_pool, format_stake_pool_id(certificate.pool))) props.append((TR.cardano__to_pool, format_stake_pool_id(certificate.pool)))
elif certificate.type in (
CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
):
assert certificate.deposit is not None # validate_certificate
props.append(
(TR.cardano__deposit, format_coin_amount(certificate.deposit, network_id))
)
elif certificate.type == CardanoCertificateType.VOTE_DELEGATION:
assert certificate.drep is not None # validate_certificate
props.append(_format_drep(certificate.drep))
await confirm_properties( await confirm_properties(
"confirm_certificate", "confirm_certificate",
@ -768,6 +786,28 @@ def _format_stake_credential(
raise ValueError raise ValueError
def _format_drep(drep: messages.CardanoDRep) -> tuple[str, str]:
if drep.type == CardanoDRepType.KEY_HASH:
assert drep.key_hash is not None # validate_drep
return (
TR.cardano__delegating_to_key_hash,
bech32.encode(bech32.HRP_DREP_KEY_HASH, drep.key_hash),
)
elif drep.type == CardanoDRepType.SCRIPT_HASH:
assert drep.script_hash is not None # validate_drep
return (
TR.cardano__delegating_to_script,
bech32.encode(bech32.HRP_DREP_SCRIPT_HASH, drep.script_hash),
)
elif drep.type == CardanoDRepType.ABSTAIN:
return (TR.cardano__delegating_to, TR.cardano__always_abstain)
elif drep.type == CardanoDRepType.NO_CONFIDENCE:
return (TR.cardano__delegating_to, TR.cardano__always_no_confidence)
else:
# should be unreachable unless there's a bug in validation
raise ValueError
async def confirm_cvote_registration_delegation( async def confirm_cvote_registration_delegation(
public_key: str, public_key: str,
weight: int, weight: int,

View File

@ -728,7 +728,7 @@ class Signer:
certificate.pool_parameters.metadata certificate.pool_parameters.metadata
) )
else: else:
await layout.confirm_certificate(certificate) await layout.confirm_certificate(certificate, self.msg.network_id)
# pool owners # pool owners

View File

@ -6,3 +6,6 @@ STAKE_REGISTRATION = 0
STAKE_DEREGISTRATION = 1 STAKE_DEREGISTRATION = 1
STAKE_DELEGATION = 2 STAKE_DELEGATION = 2
STAKE_POOL_REGISTRATION = 3 STAKE_POOL_REGISTRATION = 3
STAKE_REGISTRATION_CONWAY = 7
STAKE_DEREGISTRATION_CONWAY = 8
VOTE_DELEGATION = 9

View File

@ -0,0 +1,8 @@
# Automatically generated by pb2py
# fmt: off
# isort:skip_file
KEY_HASH = 0
SCRIPT_HASH = 1
ABSTAIN = 2
NO_CONFIDENCE = 3

View File

@ -388,6 +388,15 @@ if TYPE_CHECKING:
STAKE_DEREGISTRATION = 1 STAKE_DEREGISTRATION = 1
STAKE_DELEGATION = 2 STAKE_DELEGATION = 2
STAKE_POOL_REGISTRATION = 3 STAKE_POOL_REGISTRATION = 3
STAKE_REGISTRATION_CONWAY = 7
STAKE_DEREGISTRATION_CONWAY = 8
VOTE_DELEGATION = 9
class CardanoDRepType(IntEnum):
KEY_HASH = 0
SCRIPT_HASH = 1
ABSTAIN = 2
NO_CONFIDENCE = 3
class CardanoPoolRelayType(IntEnum): class CardanoPoolRelayType(IntEnum):
SINGLE_HOST_IP = 0 SINGLE_HOST_IP = 0

View File

@ -27,6 +27,7 @@ if TYPE_CHECKING:
from trezor.enums import CardanoAddressType # noqa: F401 from trezor.enums import CardanoAddressType # noqa: F401
from trezor.enums import CardanoCVoteRegistrationFormat # noqa: F401 from trezor.enums import CardanoCVoteRegistrationFormat # noqa: F401
from trezor.enums import CardanoCertificateType # noqa: F401 from trezor.enums import CardanoCertificateType # noqa: F401
from trezor.enums import CardanoDRepType # noqa: F401
from trezor.enums import CardanoDerivationType # noqa: F401 from trezor.enums import CardanoDerivationType # 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
@ -1617,6 +1618,24 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: Any) -> TypeGuard["CardanoPoolParametersType"]: def is_type_of(cls, msg: Any) -> TypeGuard["CardanoPoolParametersType"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class CardanoDRep(protobuf.MessageType):
type: "CardanoDRepType"
key_hash: "bytes | None"
script_hash: "bytes | None"
def __init__(
self,
*,
type: "CardanoDRepType",
key_hash: "bytes | None" = None,
script_hash: "bytes | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["CardanoDRep"]:
return isinstance(msg, cls)
class CardanoTxCertificate(protobuf.MessageType): class CardanoTxCertificate(protobuf.MessageType):
type: "CardanoCertificateType" type: "CardanoCertificateType"
path: "list[int]" path: "list[int]"
@ -1624,6 +1643,8 @@ if TYPE_CHECKING:
pool_parameters: "CardanoPoolParametersType | None" pool_parameters: "CardanoPoolParametersType | None"
script_hash: "bytes | None" script_hash: "bytes | None"
key_hash: "bytes | None" key_hash: "bytes | None"
deposit: "int | None"
drep: "CardanoDRep | None"
def __init__( def __init__(
self, self,
@ -1634,6 +1655,8 @@ if TYPE_CHECKING:
pool_parameters: "CardanoPoolParametersType | None" = None, pool_parameters: "CardanoPoolParametersType | None" = None,
script_hash: "bytes | None" = None, script_hash: "bytes | None" = None,
key_hash: "bytes | None" = None, key_hash: "bytes | None" = None,
deposit: "int | None" = None,
drep: "CardanoDRep | None" = None,
) -> None: ) -> None:
pass pass

View File

@ -1,8 +1,8 @@
from common import * # isort:skip from common import * # isort:skip
from trezor import wire from trezor import wire
from trezor.enums import CardanoCertificateType from trezor.enums import CardanoCertificateType, CardanoDRepType
from trezor.messages import CardanoPoolParametersType, CardanoTxCertificate from trezor.messages import CardanoDRep, CardanoPoolParametersType, CardanoTxCertificate
from apps.common.paths import HARDENED from apps.common.paths import HARDENED
@ -32,6 +32,25 @@ class TestCardanoCertificate(unittest.TestCase):
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd" "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( CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DELEGATION, type=CardanoCertificateType.STAKE_DELEGATION,
path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0], path=[1852 | HARDENED, 1815 | HARDENED, 0 | HARDENED, 2, 0],
@ -73,6 +92,25 @@ class TestCardanoCertificate(unittest.TestCase):
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd" "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( CardanoTxCertificate(
type=CardanoCertificateType.STAKE_POOL_REGISTRATION, type=CardanoCertificateType.STAKE_POOL_REGISTRATION,
pool_parameters=CardanoPoolParametersType( pool_parameters=CardanoPoolParametersType(
@ -92,6 +130,44 @@ class TestCardanoCertificate(unittest.TestCase):
metadata=None, metadata=None,
), ),
), ),
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.KEY_HASH,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.SCRIPT_HASH,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(type=CardanoDRepType.ABSTAIN),
),
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(type=CardanoDRepType.NO_CONFIDENCE),
),
] ]
invalid_test_vectors = [ invalid_test_vectors = [
@ -125,6 +201,12 @@ class TestCardanoCertificate(unittest.TestCase):
"f61c42cbf7c8c53af3f520508212ad3e72f674f957fe23ff0acb4973" "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 # STAKE_REGISTRATION pool parameters are set
CardanoTxCertificate( CardanoTxCertificate(
type=CardanoCertificateType.STAKE_REGISTRATION, type=CardanoCertificateType.STAKE_REGISTRATION,
@ -145,6 +227,66 @@ class TestCardanoCertificate(unittest.TestCase):
relays_count=1, 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 # STAKE_DELEGATION neither path or script_hash is set
CardanoTxCertificate( CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DELEGATION, type=CardanoCertificateType.STAKE_DELEGATION,
@ -229,6 +371,12 @@ class TestCardanoCertificate(unittest.TestCase):
"f61c42cbf7c8c53af3f520508212ad3e72f674f957fe23ff0acb4973" "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 # STAKE_DEREGISTRATION pool parameters are set
CardanoTxCertificate( CardanoTxCertificate(
type=CardanoCertificateType.STAKE_DEREGISTRATION, type=CardanoCertificateType.STAKE_DEREGISTRATION,
@ -249,6 +397,66 @@ class TestCardanoCertificate(unittest.TestCase):
relays_count=1, 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 # STAKE_POOL_REGISTRATION pool parameters are not set
CardanoTxCertificate( CardanoTxCertificate(
type=CardanoCertificateType.STAKE_POOL_REGISTRATION, type=CardanoCertificateType.STAKE_POOL_REGISTRATION,
@ -342,6 +550,171 @@ class TestCardanoCertificate(unittest.TestCase):
relays_count=1, relays_count=1,
), ),
), ),
# VOTE_REGISTRATION missing drep
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
# VOTE_REGISTRATION missing key hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(type=CardanoDRepType.KEY_HASH),
),
# VOTE_REGISTRATION missing script hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(type=CardanoDRepType.SCRIPT_HASH),
),
# VOTE_REGISTRATION unexpected script hash set instead of key hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.KEY_HASH,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
# VOTE_REGISTRATION unexpected key hash set instead of script hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.SCRIPT_HASH,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
# VOTE_REGISTRATION key hash set but unexpected script hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.KEY_HASH,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
# VOTE_REGISTRATION script hash set but unexpected key hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.SCRIPT_HASH,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
# VOTE_REGISTRATION unexpected key hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.ABSTAIN,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
# VOTE_REGISTRATION unexpected key hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.NO_CONFIDENCE,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
# VOTE_REGISTRATION unexpected script hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.ABSTAIN,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
# VOTE_REGISTRATION unexpected script hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.NO_CONFIDENCE,
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
# VOTE_REGISTRATION unexpected script hash and key hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.ABSTAIN,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
# VOTE_REGISTRATION unexpected script hash and key hash
CardanoTxCertificate(
type=CardanoCertificateType.VOTE_DELEGATION,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
drep=CardanoDRep(
type=CardanoDRepType.NO_CONFIDENCE,
key_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
script_hash=unhexlify(
"29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd"
),
),
),
] ]
for certificate in valid_test_vectors: for certificate in valid_test_vectors:

View File

@ -113,6 +113,8 @@
"cardano__addr_pointer": "Pointer", "cardano__addr_pointer": "Pointer",
"cardano__addr_reward": "Reward", "cardano__addr_reward": "Reward",
"cardano__address_no_staking": "address - no staking rewards.", "cardano__address_no_staking": "address - no staking rewards.",
"cardano__always_abstain": "Always Abstain",
"cardano__always_no_confidence": "Always No Confidence",
"cardano__amount_burned_decimals_unknown": "Amount burned (decimals unknown):", "cardano__amount_burned_decimals_unknown": "Amount burned (decimals unknown):",
"cardano__amount_minted_decimals_unknown": "Amount minted (decimals unknown):", "cardano__amount_minted_decimals_unknown": "Amount minted (decimals unknown):",
"cardano__amount_sent_decimals_unknown": "Amount sent (decimals unknown):", "cardano__amount_sent_decimals_unknown": "Amount sent (decimals unknown):",
@ -140,6 +142,9 @@
"cardano__credential_mismatch": "Credential doesn't match payment credential.", "cardano__credential_mismatch": "Credential doesn't match payment credential.",
"cardano__datum_hash": "Datum hash:", "cardano__datum_hash": "Datum hash:",
"cardano__delegating_to": "Delegating to:", "cardano__delegating_to": "Delegating to:",
"cardano__delegating_to_key_hash": "Delegating to key hash:",
"cardano__delegating_to_script": "Delegating to script:",
"cardano__deposit": "Deposit:",
"cardano__for_account_and_index_template": "for account {0} and index {1}:", "cardano__for_account_and_index_template": "for account {0} and index {1}:",
"cardano__for_account_template": "for account {0}:", "cardano__for_account_template": "for account {0}:",
"cardano__for_key_hash": "for key hash:", "cardano__for_key_hash": "for key hash:",
@ -209,6 +214,7 @@
"cardano__unusual_path": "Path is unusual.", "cardano__unusual_path": "Path is unusual.",
"cardano__valid_since": "Valid since:", "cardano__valid_since": "Valid since:",
"cardano__verify_script": "Verify script", "cardano__verify_script": "Verify script",
"cardano__vote_delegation": "Vote delegation",
"cardano__vote_key_registration": "Vote key registration (CIP-36)", "cardano__vote_key_registration": "Vote key registration (CIP-36)",
"cardano__vote_public_key": "Vote public key:", "cardano__vote_public_key": "Vote public key:",
"cardano__voting_purpose": "Voting purpose:", "cardano__voting_purpose": "Voting purpose:",

View File

@ -845,5 +845,11 @@
"843": "storage_msg__verifying_pin", "843": "storage_msg__verifying_pin",
"844": "storage_msg__wrong_pin", "844": "storage_msg__wrong_pin",
"845": "reset__create_x_of_y_multi_share_backup_template", "845": "reset__create_x_of_y_multi_share_backup_template",
"846": "reset__title_shamir_backup" "846": "reset__title_shamir_backup",
"847": "cardano__always_abstain",
"848": "cardano__always_no_confidence",
"849": "cardano__delegating_to_key_hash",
"850": "cardano__delegating_to_script",
"851": "cardano__deposit",
"852": "cardano__vote_delegation"
} }

View File

@ -1,8 +1,8 @@
{ {
"current": { "current": {
"merkle_root": "84629035a4b41f95a6d058c3a4a67220ff3ed4aea61bb72bd0c266b51708bd09", "merkle_root": "1f974d2401250eb1b9ca75b0b8067d583c2a1520f87697f8f68f5bf2d66b44c2",
"datetime": "2024-05-13T15:44:26.979619", "datetime": "2024-05-16T21:16:11.144158",
"commit": "82e62cf41c1e0134d2d2ed824c3ad74ead01f10e" "commit": "3d74e30fa7f27695813040baffb620461d5e0677"
}, },
"history": [ "history": [
{ {

View File

@ -420,6 +420,27 @@ def parse_certificate(certificate: dict) -> CertificateWithPoolOwnersAndRelays:
), ),
None, None,
) )
elif certificate_type in (
messages.CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
messages.CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
):
if "deposit" not in certificate:
raise CERTIFICATE_MISSING_FIELDS_ERROR
path, script_hash, key_hash = _parse_credential(
certificate, CERTIFICATE_MISSING_FIELDS_ERROR
)
return (
messages.CardanoTxCertificate(
type=certificate_type,
path=path,
script_hash=script_hash,
key_hash=key_hash,
deposit=int(certificate["deposit"]),
),
None,
)
elif certificate_type == messages.CardanoCertificateType.STAKE_POOL_REGISTRATION: elif certificate_type == messages.CardanoCertificateType.STAKE_POOL_REGISTRATION:
pool_parameters = certificate["pool_parameters"] pool_parameters = certificate["pool_parameters"]
@ -465,6 +486,30 @@ def parse_certificate(certificate: dict) -> CertificateWithPoolOwnersAndRelays:
), ),
(owners, relays), (owners, relays),
) )
if certificate_type == messages.CardanoCertificateType.VOTE_DELEGATION:
if "drep" not in certificate:
raise CERTIFICATE_MISSING_FIELDS_ERROR
path, script_hash, key_hash = _parse_credential(
certificate, CERTIFICATE_MISSING_FIELDS_ERROR
)
return (
messages.CardanoTxCertificate(
type=certificate_type,
path=path,
script_hash=script_hash,
key_hash=key_hash,
drep=messages.CardanoDRep(
type=messages.CardanoDRepType(certificate["drep"]["type"]),
key_hash=parse_optional_bytes(certificate["drep"].get("key_hash")),
script_hash=parse_optional_bytes(
certificate["drep"].get("script_hash")
),
),
),
None,
)
else: else:
raise ValueError("Unknown certificate type") raise ValueError("Unknown certificate type")
@ -686,6 +731,9 @@ def _get_witness_requests(
in ( in (
messages.CardanoCertificateType.STAKE_DEREGISTRATION, messages.CardanoCertificateType.STAKE_DEREGISTRATION,
messages.CardanoCertificateType.STAKE_DELEGATION, messages.CardanoCertificateType.STAKE_DELEGATION,
messages.CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
messages.CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
messages.CardanoCertificateType.VOTE_DELEGATION,
) )
and certificate.path and certificate.path
): ):

View File

@ -410,6 +410,16 @@ class CardanoCertificateType(IntEnum):
STAKE_DEREGISTRATION = 1 STAKE_DEREGISTRATION = 1
STAKE_DELEGATION = 2 STAKE_DELEGATION = 2
STAKE_POOL_REGISTRATION = 3 STAKE_POOL_REGISTRATION = 3
STAKE_REGISTRATION_CONWAY = 7
STAKE_DEREGISTRATION_CONWAY = 8
VOTE_DELEGATION = 9
class CardanoDRepType(IntEnum):
KEY_HASH = 0
SCRIPT_HASH = 1
ABSTAIN = 2
NO_CONFIDENCE = 3
class CardanoPoolRelayType(IntEnum): class CardanoPoolRelayType(IntEnum):
@ -2648,6 +2658,26 @@ class CardanoPoolParametersType(protobuf.MessageType):
self.metadata = metadata self.metadata = metadata
class CardanoDRep(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("type", "CardanoDRepType", repeated=False, required=True),
2: protobuf.Field("key_hash", "bytes", repeated=False, required=False, default=None),
3: protobuf.Field("script_hash", "bytes", repeated=False, required=False, default=None),
}
def __init__(
self,
*,
type: "CardanoDRepType",
key_hash: Optional["bytes"] = None,
script_hash: Optional["bytes"] = None,
) -> None:
self.type = type
self.key_hash = key_hash
self.script_hash = script_hash
class CardanoTxCertificate(protobuf.MessageType): class CardanoTxCertificate(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 325 MESSAGE_WIRE_TYPE = 325
FIELDS = { FIELDS = {
@ -2657,6 +2687,8 @@ class CardanoTxCertificate(protobuf.MessageType):
4: protobuf.Field("pool_parameters", "CardanoPoolParametersType", repeated=False, required=False, default=None), 4: protobuf.Field("pool_parameters", "CardanoPoolParametersType", repeated=False, required=False, default=None),
5: protobuf.Field("script_hash", "bytes", repeated=False, required=False, default=None), 5: protobuf.Field("script_hash", "bytes", repeated=False, required=False, default=None),
6: protobuf.Field("key_hash", "bytes", repeated=False, required=False, default=None), 6: protobuf.Field("key_hash", "bytes", repeated=False, required=False, default=None),
7: protobuf.Field("deposit", "uint64", repeated=False, required=False, default=None),
8: protobuf.Field("drep", "CardanoDRep", repeated=False, required=False, default=None),
} }
def __init__( def __init__(
@ -2668,6 +2700,8 @@ class CardanoTxCertificate(protobuf.MessageType):
pool_parameters: Optional["CardanoPoolParametersType"] = None, pool_parameters: Optional["CardanoPoolParametersType"] = None,
script_hash: Optional["bytes"] = None, script_hash: Optional["bytes"] = None,
key_hash: Optional["bytes"] = None, key_hash: Optional["bytes"] = None,
deposit: Optional["int"] = None,
drep: Optional["CardanoDRep"] = None,
) -> None: ) -> None:
self.path: Sequence["int"] = path if path is not None else [] self.path: Sequence["int"] = path if path is not None else []
self.type = type self.type = type
@ -2675,6 +2709,8 @@ class CardanoTxCertificate(protobuf.MessageType):
self.pool_parameters = pool_parameters self.pool_parameters = pool_parameters
self.script_hash = script_hash self.script_hash = script_hash
self.key_hash = key_hash self.key_hash = key_hash
self.deposit = deposit
self.drep = drep
class CardanoTxWithdrawal(protobuf.MessageType): class CardanoTxWithdrawal(protobuf.MessageType):

View File

@ -5895,6 +5895,261 @@ impl ::protobuf::reflect::ProtobufValue for CardanoPoolParametersType {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
} }
// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoDRep)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct CardanoDRep {
// message fields
// @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoDRep.type)
pub type_: ::std::option::Option<::protobuf::EnumOrUnknown<CardanoDRepType>>,
// @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoDRep.key_hash)
pub key_hash: ::std::option::Option<::std::vec::Vec<u8>>,
// @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoDRep.script_hash)
pub script_hash: ::std::option::Option<::std::vec::Vec<u8>>,
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoDRep.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a CardanoDRep {
fn default() -> &'a CardanoDRep {
<CardanoDRep as ::protobuf::Message>::default_instance()
}
}
impl CardanoDRep {
pub fn new() -> CardanoDRep {
::std::default::Default::default()
}
// required .hw.trezor.messages.cardano.CardanoDRepType type = 1;
pub fn type_(&self) -> CardanoDRepType {
match self.type_ {
Some(e) => e.enum_value_or(CardanoDRepType::KEY_HASH),
None => CardanoDRepType::KEY_HASH,
}
}
pub fn clear_type_(&mut self) {
self.type_ = ::std::option::Option::None;
}
pub fn has_type(&self) -> bool {
self.type_.is_some()
}
// Param is passed by value, moved
pub fn set_type(&mut self, v: CardanoDRepType) {
self.type_ = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v));
}
// optional bytes key_hash = 2;
pub fn key_hash(&self) -> &[u8] {
match self.key_hash.as_ref() {
Some(v) => v,
None => &[],
}
}
pub fn clear_key_hash(&mut self) {
self.key_hash = ::std::option::Option::None;
}
pub fn has_key_hash(&self) -> bool {
self.key_hash.is_some()
}
// Param is passed by value, moved
pub fn set_key_hash(&mut self, v: ::std::vec::Vec<u8>) {
self.key_hash = ::std::option::Option::Some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_key_hash(&mut self) -> &mut ::std::vec::Vec<u8> {
if self.key_hash.is_none() {
self.key_hash = ::std::option::Option::Some(::std::vec::Vec::new());
}
self.key_hash.as_mut().unwrap()
}
// Take field
pub fn take_key_hash(&mut self) -> ::std::vec::Vec<u8> {
self.key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new())
}
// optional bytes script_hash = 3;
pub fn script_hash(&self) -> &[u8] {
match self.script_hash.as_ref() {
Some(v) => v,
None => &[],
}
}
pub fn clear_script_hash(&mut self) {
self.script_hash = ::std::option::Option::None;
}
pub fn has_script_hash(&self) -> bool {
self.script_hash.is_some()
}
// Param is passed by value, moved
pub fn set_script_hash(&mut self, v: ::std::vec::Vec<u8>) {
self.script_hash = ::std::option::Option::Some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_script_hash(&mut self) -> &mut ::std::vec::Vec<u8> {
if self.script_hash.is_none() {
self.script_hash = ::std::option::Option::Some(::std::vec::Vec::new());
}
self.script_hash.as_mut().unwrap()
}
// Take field
pub fn take_script_hash(&mut self) -> ::std::vec::Vec<u8> {
self.script_hash.take().unwrap_or_else(|| ::std::vec::Vec::new())
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(3);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"type",
|m: &CardanoDRep| { &m.type_ },
|m: &mut CardanoDRep| { &mut m.type_ },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"key_hash",
|m: &CardanoDRep| { &m.key_hash },
|m: &mut CardanoDRep| { &mut m.key_hash },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"script_hash",
|m: &CardanoDRep| { &m.script_hash },
|m: &mut CardanoDRep| { &mut m.script_hash },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<CardanoDRep>(
"CardanoDRep",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for CardanoDRep {
const NAME: &'static str = "CardanoDRep";
fn is_initialized(&self) -> bool {
if self.type_.is_none() {
return false;
}
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
8 => {
self.type_ = ::std::option::Option::Some(is.read_enum_or_unknown()?);
},
18 => {
self.key_hash = ::std::option::Option::Some(is.read_bytes()?);
},
26 => {
self.script_hash = ::std::option::Option::Some(is.read_bytes()?);
},
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
if let Some(v) = self.type_ {
my_size += ::protobuf::rt::int32_size(1, v.value());
}
if let Some(v) = self.key_hash.as_ref() {
my_size += ::protobuf::rt::bytes_size(2, &v);
}
if let Some(v) = self.script_hash.as_ref() {
my_size += ::protobuf::rt::bytes_size(3, &v);
}
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
if let Some(v) = self.type_ {
os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?;
}
if let Some(v) = self.key_hash.as_ref() {
os.write_bytes(2, v)?;
}
if let Some(v) = self.script_hash.as_ref() {
os.write_bytes(3, v)?;
}
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> CardanoDRep {
CardanoDRep::new()
}
fn clear(&mut self) {
self.type_ = ::std::option::Option::None;
self.key_hash = ::std::option::Option::None;
self.script_hash = ::std::option::Option::None;
self.special_fields.clear();
}
fn default_instance() -> &'static CardanoDRep {
static instance: CardanoDRep = CardanoDRep {
type_: ::std::option::Option::None,
key_hash: ::std::option::Option::None,
script_hash: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for CardanoDRep {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("CardanoDRep").unwrap()).clone()
}
}
impl ::std::fmt::Display for CardanoDRep {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for CardanoDRep {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
// @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxCertificate) // @@protoc_insertion_point(message:hw.trezor.messages.cardano.CardanoTxCertificate)
#[derive(PartialEq,Clone,Default,Debug)] #[derive(PartialEq,Clone,Default,Debug)]
pub struct CardanoTxCertificate { pub struct CardanoTxCertificate {
@ -5911,6 +6166,10 @@ pub struct CardanoTxCertificate {
pub script_hash: ::std::option::Option<::std::vec::Vec<u8>>, pub script_hash: ::std::option::Option<::std::vec::Vec<u8>>,
// @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.key_hash) // @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.key_hash)
pub key_hash: ::std::option::Option<::std::vec::Vec<u8>>, pub key_hash: ::std::option::Option<::std::vec::Vec<u8>>,
// @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.deposit)
pub deposit: ::std::option::Option<u64>,
// @@protoc_insertion_point(field:hw.trezor.messages.cardano.CardanoTxCertificate.drep)
pub drep: ::protobuf::MessageField<CardanoDRep>,
// special fields // special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxCertificate.special_fields) // @@protoc_insertion_point(special_field:hw.trezor.messages.cardano.CardanoTxCertificate.special_fields)
pub special_fields: ::protobuf::SpecialFields, pub special_fields: ::protobuf::SpecialFields,
@ -6057,8 +6316,27 @@ impl CardanoTxCertificate {
self.key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) self.key_hash.take().unwrap_or_else(|| ::std::vec::Vec::new())
} }
// optional uint64 deposit = 7;
pub fn deposit(&self) -> u64 {
self.deposit.unwrap_or(0)
}
pub fn clear_deposit(&mut self) {
self.deposit = ::std::option::Option::None;
}
pub fn has_deposit(&self) -> bool {
self.deposit.is_some()
}
// Param is passed by value, moved
pub fn set_deposit(&mut self, v: u64) {
self.deposit = ::std::option::Option::Some(v);
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(6); let mut fields = ::std::vec::Vec::with_capacity(8);
let mut oneofs = ::std::vec::Vec::with_capacity(0); let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"type", "type",
@ -6090,6 +6368,16 @@ impl CardanoTxCertificate {
|m: &CardanoTxCertificate| { &m.key_hash }, |m: &CardanoTxCertificate| { &m.key_hash },
|m: &mut CardanoTxCertificate| { &mut m.key_hash }, |m: &mut CardanoTxCertificate| { &mut m.key_hash },
)); ));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"deposit",
|m: &CardanoTxCertificate| { &m.deposit },
|m: &mut CardanoTxCertificate| { &mut m.deposit },
));
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, CardanoDRep>(
"drep",
|m: &CardanoTxCertificate| { &m.drep },
|m: &mut CardanoTxCertificate| { &mut m.drep },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<CardanoTxCertificate>( ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<CardanoTxCertificate>(
"CardanoTxCertificate", "CardanoTxCertificate",
fields, fields,
@ -6110,6 +6398,11 @@ impl ::protobuf::Message for CardanoTxCertificate {
return false; return false;
} }
}; };
for v in &self.drep {
if !v.is_initialized() {
return false;
}
};
true true
} }
@ -6137,6 +6430,12 @@ impl ::protobuf::Message for CardanoTxCertificate {
50 => { 50 => {
self.key_hash = ::std::option::Option::Some(is.read_bytes()?); self.key_hash = ::std::option::Option::Some(is.read_bytes()?);
}, },
56 => {
self.deposit = ::std::option::Option::Some(is.read_uint64()?);
},
66 => {
::protobuf::rt::read_singular_message_into_field(is, &mut self.drep)?;
},
tag => { tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
}, },
@ -6168,6 +6467,13 @@ impl ::protobuf::Message for CardanoTxCertificate {
if let Some(v) = self.key_hash.as_ref() { if let Some(v) = self.key_hash.as_ref() {
my_size += ::protobuf::rt::bytes_size(6, &v); my_size += ::protobuf::rt::bytes_size(6, &v);
} }
if let Some(v) = self.deposit {
my_size += ::protobuf::rt::uint64_size(7, v);
}
if let Some(v) = self.drep.as_ref() {
let len = v.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
}
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32); self.special_fields.cached_size().set(my_size as u32);
my_size my_size
@ -6192,6 +6498,12 @@ impl ::protobuf::Message for CardanoTxCertificate {
if let Some(v) = self.key_hash.as_ref() { if let Some(v) = self.key_hash.as_ref() {
os.write_bytes(6, v)?; os.write_bytes(6, v)?;
} }
if let Some(v) = self.deposit {
os.write_uint64(7, v)?;
}
if let Some(v) = self.drep.as_ref() {
::protobuf::rt::write_message_field_with_cached_size(8, v, os)?;
}
os.write_unknown_fields(self.special_fields.unknown_fields())?; os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(()) ::std::result::Result::Ok(())
} }
@ -6215,6 +6527,8 @@ impl ::protobuf::Message for CardanoTxCertificate {
self.pool_parameters.clear(); self.pool_parameters.clear();
self.script_hash = ::std::option::Option::None; self.script_hash = ::std::option::Option::None;
self.key_hash = ::std::option::Option::None; self.key_hash = ::std::option::Option::None;
self.deposit = ::std::option::Option::None;
self.drep.clear();
self.special_fields.clear(); self.special_fields.clear();
} }
@ -6226,6 +6540,8 @@ impl ::protobuf::Message for CardanoTxCertificate {
pool_parameters: ::protobuf::MessageField::none(), pool_parameters: ::protobuf::MessageField::none(),
script_hash: ::std::option::Option::None, script_hash: ::std::option::Option::None,
key_hash: ::std::option::Option::None, key_hash: ::std::option::Option::None,
deposit: ::std::option::Option::None,
drep: ::protobuf::MessageField::none(),
special_fields: ::protobuf::SpecialFields::new(), special_fields: ::protobuf::SpecialFields::new(),
}; };
&instance &instance
@ -9601,6 +9917,12 @@ pub enum CardanoCertificateType {
STAKE_DELEGATION = 2, STAKE_DELEGATION = 2,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_POOL_REGISTRATION) // @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_POOL_REGISTRATION)
STAKE_POOL_REGISTRATION = 3, STAKE_POOL_REGISTRATION = 3,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_REGISTRATION_CONWAY)
STAKE_REGISTRATION_CONWAY = 7,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY)
STAKE_DEREGISTRATION_CONWAY = 8,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoCertificateType.VOTE_DELEGATION)
VOTE_DELEGATION = 9,
} }
impl ::protobuf::Enum for CardanoCertificateType { impl ::protobuf::Enum for CardanoCertificateType {
@ -9616,6 +9938,9 @@ impl ::protobuf::Enum for CardanoCertificateType {
1 => ::std::option::Option::Some(CardanoCertificateType::STAKE_DEREGISTRATION), 1 => ::std::option::Option::Some(CardanoCertificateType::STAKE_DEREGISTRATION),
2 => ::std::option::Option::Some(CardanoCertificateType::STAKE_DELEGATION), 2 => ::std::option::Option::Some(CardanoCertificateType::STAKE_DELEGATION),
3 => ::std::option::Option::Some(CardanoCertificateType::STAKE_POOL_REGISTRATION), 3 => ::std::option::Option::Some(CardanoCertificateType::STAKE_POOL_REGISTRATION),
7 => ::std::option::Option::Some(CardanoCertificateType::STAKE_REGISTRATION_CONWAY),
8 => ::std::option::Option::Some(CardanoCertificateType::STAKE_DEREGISTRATION_CONWAY),
9 => ::std::option::Option::Some(CardanoCertificateType::VOTE_DELEGATION),
_ => ::std::option::Option::None _ => ::std::option::Option::None
} }
} }
@ -9626,6 +9951,9 @@ impl ::protobuf::Enum for CardanoCertificateType {
"STAKE_DEREGISTRATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_DEREGISTRATION), "STAKE_DEREGISTRATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_DEREGISTRATION),
"STAKE_DELEGATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_DELEGATION), "STAKE_DELEGATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_DELEGATION),
"STAKE_POOL_REGISTRATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_POOL_REGISTRATION), "STAKE_POOL_REGISTRATION" => ::std::option::Option::Some(CardanoCertificateType::STAKE_POOL_REGISTRATION),
"STAKE_REGISTRATION_CONWAY" => ::std::option::Option::Some(CardanoCertificateType::STAKE_REGISTRATION_CONWAY),
"STAKE_DEREGISTRATION_CONWAY" => ::std::option::Option::Some(CardanoCertificateType::STAKE_DEREGISTRATION_CONWAY),
"VOTE_DELEGATION" => ::std::option::Option::Some(CardanoCertificateType::VOTE_DELEGATION),
_ => ::std::option::Option::None _ => ::std::option::Option::None
} }
} }
@ -9635,6 +9963,9 @@ impl ::protobuf::Enum for CardanoCertificateType {
CardanoCertificateType::STAKE_DEREGISTRATION, CardanoCertificateType::STAKE_DEREGISTRATION,
CardanoCertificateType::STAKE_DELEGATION, CardanoCertificateType::STAKE_DELEGATION,
CardanoCertificateType::STAKE_POOL_REGISTRATION, CardanoCertificateType::STAKE_POOL_REGISTRATION,
CardanoCertificateType::STAKE_REGISTRATION_CONWAY,
CardanoCertificateType::STAKE_DEREGISTRATION_CONWAY,
CardanoCertificateType::VOTE_DELEGATION,
]; ];
} }
@ -9645,7 +9976,15 @@ impl ::protobuf::EnumFull for CardanoCertificateType {
} }
fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor {
let index = *self as usize; let index = match self {
CardanoCertificateType::STAKE_REGISTRATION => 0,
CardanoCertificateType::STAKE_DEREGISTRATION => 1,
CardanoCertificateType::STAKE_DELEGATION => 2,
CardanoCertificateType::STAKE_POOL_REGISTRATION => 3,
CardanoCertificateType::STAKE_REGISTRATION_CONWAY => 4,
CardanoCertificateType::STAKE_DEREGISTRATION_CONWAY => 5,
CardanoCertificateType::VOTE_DELEGATION => 6,
};
Self::enum_descriptor().value_by_index(index) Self::enum_descriptor().value_by_index(index)
} }
} }
@ -9662,6 +10001,78 @@ impl CardanoCertificateType {
} }
} }
#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoDRepType)
pub enum CardanoDRepType {
// @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoDRepType.KEY_HASH)
KEY_HASH = 0,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoDRepType.SCRIPT_HASH)
SCRIPT_HASH = 1,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoDRepType.ABSTAIN)
ABSTAIN = 2,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.cardano.CardanoDRepType.NO_CONFIDENCE)
NO_CONFIDENCE = 3,
}
impl ::protobuf::Enum for CardanoDRepType {
const NAME: &'static str = "CardanoDRepType";
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<CardanoDRepType> {
match value {
0 => ::std::option::Option::Some(CardanoDRepType::KEY_HASH),
1 => ::std::option::Option::Some(CardanoDRepType::SCRIPT_HASH),
2 => ::std::option::Option::Some(CardanoDRepType::ABSTAIN),
3 => ::std::option::Option::Some(CardanoDRepType::NO_CONFIDENCE),
_ => ::std::option::Option::None
}
}
fn from_str(str: &str) -> ::std::option::Option<CardanoDRepType> {
match str {
"KEY_HASH" => ::std::option::Option::Some(CardanoDRepType::KEY_HASH),
"SCRIPT_HASH" => ::std::option::Option::Some(CardanoDRepType::SCRIPT_HASH),
"ABSTAIN" => ::std::option::Option::Some(CardanoDRepType::ABSTAIN),
"NO_CONFIDENCE" => ::std::option::Option::Some(CardanoDRepType::NO_CONFIDENCE),
_ => ::std::option::Option::None
}
}
const VALUES: &'static [CardanoDRepType] = &[
CardanoDRepType::KEY_HASH,
CardanoDRepType::SCRIPT_HASH,
CardanoDRepType::ABSTAIN,
CardanoDRepType::NO_CONFIDENCE,
];
}
impl ::protobuf::EnumFull for CardanoDRepType {
fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().enum_by_package_relative_name("CardanoDRepType").unwrap()).clone()
}
fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor {
let index = *self as usize;
Self::enum_descriptor().value_by_index(index)
}
}
impl ::std::default::Default for CardanoDRepType {
fn default() -> Self {
CardanoDRepType::KEY_HASH
}
}
impl CardanoDRepType {
fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData {
::protobuf::reflect::GeneratedEnumDescriptorData::new::<CardanoDRepType>("CardanoDRepType")
}
}
#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
// @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoPoolRelayType) // @@protoc_insertion_point(enum:hw.trezor.messages.cardano.CardanoPoolRelayType)
pub enum CardanoPoolRelayType { pub enum CardanoPoolRelayType {
@ -10089,78 +10500,87 @@ static file_descriptor_proto_data: &'static [u8] = b"\
unt\x18\x07\x20\x02(\tR\rrewardAccount\x12O\n\x08metadata\x18\n\x20\x01(\ unt\x18\x07\x20\x02(\tR\rrewardAccount\x12O\n\x08metadata\x18\n\x20\x01(\
\x0b23.hw.trezor.messages.cardano.CardanoPoolMetadataTypeR\x08metadata\ \x0b23.hw.trezor.messages.cardano.CardanoPoolMetadataTypeR\x08metadata\
\x12!\n\x0cowners_count\x18\x0b\x20\x02(\rR\x0bownersCount\x12!\n\x0crel\ \x12!\n\x0cowners_count\x18\x0b\x20\x02(\rR\x0bownersCount\x12!\n\x0crel\
ays_count\x18\x0c\x20\x02(\rR\x0brelaysCount\"\xa2\x02\n\x14CardanoTxCer\ ays_count\x18\x0c\x20\x02(\rR\x0brelaysCount\"\x8a\x01\n\x0bCardanoDRep\
tificate\x12F\n\x04type\x18\x01\x20\x02(\x0e22.hw.trezor.messages.cardan\ \x12?\n\x04type\x18\x01\x20\x02(\x0e2+.hw.trezor.messages.cardano.Cardan\
o.CardanoCertificateTypeR\x04type\x12\x12\n\x04path\x18\x02\x20\x03(\rR\ oDRepTypeR\x04type\x12\x19\n\x08key_hash\x18\x02\x20\x01(\x0cR\x07keyHas\
\x04path\x12\x12\n\x04pool\x18\x03\x20\x01(\x0cR\x04pool\x12^\n\x0fpool_\ h\x12\x1f\n\x0bscript_hash\x18\x03\x20\x01(\x0cR\nscriptHash\"\xf9\x02\n\
parameters\x18\x04\x20\x01(\x0b25.hw.trezor.messages.cardano.CardanoPool\ \x14CardanoTxCertificate\x12F\n\x04type\x18\x01\x20\x02(\x0e22.hw.trezor\
ParametersTypeR\x0epoolParameters\x12\x1f\n\x0bscript_hash\x18\x05\x20\ .messages.cardano.CardanoCertificateTypeR\x04type\x12\x12\n\x04path\x18\
\x01(\x0cR\nscriptHash\x12\x19\n\x08key_hash\x18\x06\x20\x01(\x0cR\x07ke\ \x02\x20\x03(\rR\x04path\x12\x12\n\x04pool\x18\x03\x20\x01(\x0cR\x04pool\
yHash\"}\n\x13CardanoTxWithdrawal\x12\x12\n\x04path\x18\x01\x20\x03(\rR\ \x12^\n\x0fpool_parameters\x18\x04\x20\x01(\x0b25.hw.trezor.messages.car\
\x04path\x12\x16\n\x06amount\x18\x02\x20\x02(\x04R\x06amount\x12\x1f\n\ dano.CardanoPoolParametersTypeR\x0epoolParameters\x12\x1f\n\x0bscript_ha\
\x0bscript_hash\x18\x03\x20\x01(\x0cR\nscriptHash\x12\x19\n\x08key_hash\ sh\x18\x05\x20\x01(\x0cR\nscriptHash\x12\x19\n\x08key_hash\x18\x06\x20\
\x18\x04\x20\x01(\x0cR\x07keyHash\"d\n\"CardanoCVoteRegistrationDelegati\ \x01(\x0cR\x07keyHash\x12\x18\n\x07deposit\x18\x07\x20\x01(\x04R\x07depo\
on\x12&\n\x0fvote_public_key\x18\x01\x20\x02(\x0cR\rvotePublicKey\x12\ sit\x12;\n\x04drep\x18\x08\x20\x01(\x0b2'.hw.trezor.messages.cardano.Car\
\x16\n\x06weight\x18\x02\x20\x02(\rR\x06weight\"\x8e\x04\n&CardanoCVoteR\ danoDRepR\x04drep\"}\n\x13CardanoTxWithdrawal\x12\x12\n\x04path\x18\x01\
egistrationParametersType\x12&\n\x0fvote_public_key\x18\x01\x20\x01(\x0c\ \x20\x03(\rR\x04path\x12\x16\n\x06amount\x18\x02\x20\x02(\x04R\x06amount\
R\rvotePublicKey\x12!\n\x0cstaking_path\x18\x02\x20\x03(\rR\x0bstakingPa\ \x12\x1f\n\x0bscript_hash\x18\x03\x20\x01(\x0cR\nscriptHash\x12\x19\n\
th\x12v\n\x1apayment_address_parameters\x18\x03\x20\x01(\x0b28.hw.trezor\ \x08key_hash\x18\x04\x20\x01(\x0cR\x07keyHash\"d\n\"CardanoCVoteRegistra\
.messages.cardano.CardanoAddressParametersTypeR\x18paymentAddressParamet\ tionDelegation\x12&\n\x0fvote_public_key\x18\x01\x20\x02(\x0cR\rvotePubl\
ers\x12\x14\n\x05nonce\x18\x04\x20\x02(\x04R\x05nonce\x12Y\n\x06format\ icKey\x12\x16\n\x06weight\x18\x02\x20\x02(\rR\x06weight\"\x8e\x04\n&Card\
\x18\x05\x20\x01(\x0e2:.hw.trezor.messages.cardano.CardanoCVoteRegistrat\ anoCVoteRegistrationParametersType\x12&\n\x0fvote_public_key\x18\x01\x20\
ionFormat:\x05CIP15R\x06format\x12`\n\x0bdelegations\x18\x06\x20\x03(\ \x01(\x0cR\rvotePublicKey\x12!\n\x0cstaking_path\x18\x02\x20\x03(\rR\x0b\
\x0b2>.hw.trezor.messages.cardano.CardanoCVoteRegistrationDelegationR\ stakingPath\x12v\n\x1apayment_address_parameters\x18\x03\x20\x01(\x0b28.\
\x0bdelegations\x12%\n\x0evoting_purpose\x18\x07\x20\x01(\x04R\rvotingPu\ hw.trezor.messages.cardano.CardanoAddressParametersTypeR\x18paymentAddre\
rpose\x12'\n\x0fpayment_address\x18\x08\x20\x01(\tR\x0epaymentAddress\"\ ssParameters\x12\x14\n\x05nonce\x18\x04\x20\x02(\x04R\x05nonce\x12Y\n\
\xb5\x01\n\x16CardanoTxAuxiliaryData\x12\x86\x01\n\x1dcvote_registration\ \x06format\x18\x05\x20\x01(\x0e2:.hw.trezor.messages.cardano.CardanoCVot\
_parameters\x18\x01\x20\x01(\x0b2B.hw.trezor.messages.cardano.CardanoCVo\ eRegistrationFormat:\x05CIP15R\x06format\x12`\n\x0bdelegations\x18\x06\
teRegistrationParametersTypeR\x1bcvoteRegistrationParameters\x12\x12\n\ \x20\x03(\x0b2>.hw.trezor.messages.cardano.CardanoCVoteRegistrationDeleg\
\x04hash\x18\x02\x20\x01(\x0cR\x04hash\"=\n\rCardanoTxMint\x12,\n\x12ass\ ationR\x0bdelegations\x12%\n\x0evoting_purpose\x18\x07\x20\x01(\x04R\rvo\
et_groups_count\x18\x01\x20\x02(\rR\x10assetGroupsCount\"V\n\x18CardanoT\ tingPurpose\x12'\n\x0fpayment_address\x18\x08\x20\x01(\tR\x0epaymentAddr\
xCollateralInput\x12\x1b\n\tprev_hash\x18\x01\x20\x02(\x0cR\x08prevHash\ ess\"\xb5\x01\n\x16CardanoTxAuxiliaryData\x12\x86\x01\n\x1dcvote_registr\
\x12\x1d\n\nprev_index\x18\x02\x20\x02(\rR\tprevIndex\"O\n\x17CardanoTxR\ ation_parameters\x18\x01\x20\x01(\x0b2B.hw.trezor.messages.cardano.Carda\
equiredSigner\x12\x19\n\x08key_hash\x18\x01\x20\x01(\x0cR\x07keyHash\x12\ noCVoteRegistrationParametersTypeR\x1bcvoteRegistrationParameters\x12\
\x19\n\x08key_path\x18\x02\x20\x03(\rR\x07keyPath\"U\n\x17CardanoTxRefer\ \x12\n\x04hash\x18\x02\x20\x01(\x0cR\x04hash\"=\n\rCardanoTxMint\x12,\n\
enceInput\x12\x1b\n\tprev_hash\x18\x01\x20\x02(\x0cR\x08prevHash\x12\x1d\ \x12asset_groups_count\x18\x01\x20\x02(\rR\x10assetGroupsCount\"V\n\x18C\
\n\nprev_index\x18\x02\x20\x02(\rR\tprevIndex\"\x12\n\x10CardanoTxItemAc\ ardanoTxCollateralInput\x12\x1b\n\tprev_hash\x18\x01\x20\x02(\x0cR\x08pr\
k\"\xea\x01\n\x20CardanoTxAuxiliaryDataSupplement\x12T\n\x04type\x18\x01\ evHash\x12\x1d\n\nprev_index\x18\x02\x20\x02(\rR\tprevIndex\"O\n\x17Card\
\x20\x02(\x0e2@.hw.trezor.messages.cardano.CardanoTxAuxiliaryDataSupplem\ anoTxRequiredSigner\x12\x19\n\x08key_hash\x18\x01\x20\x01(\x0cR\x07keyHa\
entTypeR\x04type\x12.\n\x13auxiliary_data_hash\x18\x02\x20\x01(\x0cR\x11\ sh\x12\x19\n\x08key_path\x18\x02\x20\x03(\rR\x07keyPath\"U\n\x17CardanoT\
auxiliaryDataHash\x12@\n\x1ccvote_registration_signature\x18\x03\x20\x01\ xReferenceInput\x12\x1b\n\tprev_hash\x18\x01\x20\x02(\x0cR\x08prevHash\
(\x0cR\x1acvoteRegistrationSignature\"-\n\x17CardanoTxWitnessRequest\x12\ \x12\x1d\n\nprev_index\x18\x02\x20\x02(\rR\tprevIndex\"\x12\n\x10Cardano\
\x12\n\x04path\x18\x01\x20\x03(\rR\x04path\"\xb6\x01\n\x18CardanoTxWitne\ TxItemAck\"\xea\x01\n\x20CardanoTxAuxiliaryDataSupplement\x12T\n\x04type\
ssResponse\x12D\n\x04type\x18\x01\x20\x02(\x0e20.hw.trezor.messages.card\ \x18\x01\x20\x02(\x0e2@.hw.trezor.messages.cardano.CardanoTxAuxiliaryDat\
ano.CardanoTxWitnessTypeR\x04type\x12\x17\n\x07pub_key\x18\x02\x20\x02(\ aSupplementTypeR\x04type\x12.\n\x13auxiliary_data_hash\x18\x02\x20\x01(\
\x0cR\x06pubKey\x12\x1c\n\tsignature\x18\x03\x20\x02(\x0cR\tsignature\ \x0cR\x11auxiliaryDataHash\x12@\n\x1ccvote_registration_signature\x18\
\x12\x1d\n\nchain_code\x18\x04\x20\x01(\x0cR\tchainCode\"\x12\n\x10Carda\ \x03\x20\x01(\x0cR\x1acvoteRegistrationSignature\"-\n\x17CardanoTxWitnes\
noTxHostAck\",\n\x11CardanoTxBodyHash\x12\x17\n\x07tx_hash\x18\x01\x20\ sRequest\x12\x12\n\x04path\x18\x01\x20\x03(\rR\x04path\"\xb6\x01\n\x18Ca\
\x02(\x0cR\x06txHash\"\x17\n\x15CardanoSignTxFinished*B\n\x15CardanoDeri\ rdanoTxWitnessResponse\x12D\n\x04type\x18\x01\x20\x02(\x0e20.hw.trezor.m\
vationType\x12\n\n\x06LEDGER\x10\0\x12\n\n\x06ICARUS\x10\x01\x12\x11\n\r\ essages.cardano.CardanoTxWitnessTypeR\x04type\x12\x17\n\x07pub_key\x18\
ICARUS_TREZOR\x10\x02*\xd2\x01\n\x12CardanoAddressType\x12\x08\n\x04BASE\ \x02\x20\x02(\x0cR\x06pubKey\x12\x1c\n\tsignature\x18\x03\x20\x02(\x0cR\
\x10\0\x12\x13\n\x0fBASE_SCRIPT_KEY\x10\x01\x12\x13\n\x0fBASE_KEY_SCRIPT\ \tsignature\x12\x1d\n\nchain_code\x18\x04\x20\x01(\x0cR\tchainCode\"\x12\
\x10\x02\x12\x16\n\x12BASE_SCRIPT_SCRIPT\x10\x03\x12\x0b\n\x07POINTER\ \n\x10CardanoTxHostAck\",\n\x11CardanoTxBodyHash\x12\x17\n\x07tx_hash\
\x10\x04\x12\x12\n\x0ePOINTER_SCRIPT\x10\x05\x12\x0e\n\nENTERPRISE\x10\ \x18\x01\x20\x02(\x0cR\x06txHash\"\x17\n\x15CardanoSignTxFinished*B\n\
\x06\x12\x15\n\x11ENTERPRISE_SCRIPT\x10\x07\x12\t\n\x05BYRON\x10\x08\x12\ \x15CardanoDerivationType\x12\n\n\x06LEDGER\x10\0\x12\n\n\x06ICARUS\x10\
\n\n\x06REWARD\x10\x0e\x12\x11\n\rREWARD_SCRIPT\x10\x0f*o\n\x17CardanoNa\ \x01\x12\x11\n\rICARUS_TREZOR\x10\x02*\xd2\x01\n\x12CardanoAddressType\
tiveScriptType\x12\x0b\n\x07PUB_KEY\x10\0\x12\x07\n\x03ALL\x10\x01\x12\ \x12\x08\n\x04BASE\x10\0\x12\x13\n\x0fBASE_SCRIPT_KEY\x10\x01\x12\x13\n\
\x07\n\x03ANY\x10\x02\x12\n\n\x06N_OF_K\x10\x03\x12\x12\n\x0eINVALID_BEF\ \x0fBASE_KEY_SCRIPT\x10\x02\x12\x16\n\x12BASE_SCRIPT_SCRIPT\x10\x03\x12\
ORE\x10\x04\x12\x15\n\x11INVALID_HEREAFTER\x10\x05*K\n$CardanoNativeScri\ \x0b\n\x07POINTER\x10\x04\x12\x12\n\x0ePOINTER_SCRIPT\x10\x05\x12\x0e\n\
ptHashDisplayFormat\x12\x08\n\x04HIDE\x10\0\x12\n\n\x06BECH32\x10\x01\ \nENTERPRISE\x10\x06\x12\x15\n\x11ENTERPRISE_SCRIPT\x10\x07\x12\t\n\x05B\
\x12\r\n\tPOLICY_ID\x10\x02*G\n\"CardanoTxOutputSerializationFormat\x12\ YRON\x10\x08\x12\n\n\x06REWARD\x10\x0e\x12\x11\n\rREWARD_SCRIPT\x10\x0f*\
\x10\n\x0cARRAY_LEGACY\x10\0\x12\x0f\n\x0bMAP_BABBAGE\x10\x01*}\n\x16Car\ o\n\x17CardanoNativeScriptType\x12\x0b\n\x07PUB_KEY\x10\0\x12\x07\n\x03A\
danoCertificateType\x12\x16\n\x12STAKE_REGISTRATION\x10\0\x12\x18\n\x14S\ LL\x10\x01\x12\x07\n\x03ANY\x10\x02\x12\n\n\x06N_OF_K\x10\x03\x12\x12\n\
TAKE_DEREGISTRATION\x10\x01\x12\x14\n\x10STAKE_DELEGATION\x10\x02\x12\ \x0eINVALID_BEFORE\x10\x04\x12\x15\n\x11INVALID_HEREAFTER\x10\x05*K\n$Ca\
\x1b\n\x17STAKE_POOL_REGISTRATION\x10\x03*X\n\x14CardanoPoolRelayType\ rdanoNativeScriptHashDisplayFormat\x12\x08\n\x04HIDE\x10\0\x12\n\n\x06BE\
\x12\x12\n\x0eSINGLE_HOST_IP\x10\0\x12\x14\n\x10SINGLE_HOST_NAME\x10\x01\ CH32\x10\x01\x12\r\n\tPOLICY_ID\x10\x02*G\n\"CardanoTxOutputSerializatio\
\x12\x16\n\x12MULTIPLE_HOST_NAME\x10\x02*R\n$CardanoTxAuxiliaryDataSuppl\ nFormat\x12\x10\n\x0cARRAY_LEGACY\x10\0\x12\x0f\n\x0bMAP_BABBAGE\x10\x01\
ementType\x12\x08\n\x04NONE\x10\0\x12\x20\n\x1cCVOTE_REGISTRATION_SIGNAT\ *\xd2\x01\n\x16CardanoCertificateType\x12\x16\n\x12STAKE_REGISTRATION\
URE\x10\x01*6\n\x1eCardanoCVoteRegistrationFormat\x12\t\n\x05CIP15\x10\0\ \x10\0\x12\x18\n\x14STAKE_DEREGISTRATION\x10\x01\x12\x14\n\x10STAKE_DELE\
\x12\t\n\x05CIP36\x10\x01*\x82\x01\n\x14CardanoTxSigningMode\x12\x18\n\ GATION\x10\x02\x12\x1b\n\x17STAKE_POOL_REGISTRATION\x10\x03\x12\x1d\n\
\x14ORDINARY_TRANSACTION\x10\0\x12\x1e\n\x1aPOOL_REGISTRATION_AS_OWNER\ \x19STAKE_REGISTRATION_CONWAY\x10\x07\x12\x1f\n\x1bSTAKE_DEREGISTRATION_\
\x10\x01\x12\x18\n\x14MULTISIG_TRANSACTION\x10\x02\x12\x16\n\x12PLUTUS_T\ CONWAY\x10\x08\x12\x13\n\x0fVOTE_DELEGATION\x10\t*P\n\x0fCardanoDRepType\
RANSACTION\x10\x03*>\n\x14CardanoTxWitnessType\x12\x11\n\rBYRON_WITNESS\ \x12\x0c\n\x08KEY_HASH\x10\0\x12\x0f\n\x0bSCRIPT_HASH\x10\x01\x12\x0b\n\
\x10\0\x12\x13\n\x0fSHELLEY_WITNESS\x10\x01B;\n#com.satoshilabs.trezor.l\ \x07ABSTAIN\x10\x02\x12\x11\n\rNO_CONFIDENCE\x10\x03*X\n\x14CardanoPoolR\
ib.protobufB\x14TrezorMessageCardano\ elayType\x12\x12\n\x0eSINGLE_HOST_IP\x10\0\x12\x14\n\x10SINGLE_HOST_NAME\
\x10\x01\x12\x16\n\x12MULTIPLE_HOST_NAME\x10\x02*R\n$CardanoTxAuxiliaryD\
ataSupplementType\x12\x08\n\x04NONE\x10\0\x12\x20\n\x1cCVOTE_REGISTRATIO\
N_SIGNATURE\x10\x01*6\n\x1eCardanoCVoteRegistrationFormat\x12\t\n\x05CIP\
15\x10\0\x12\t\n\x05CIP36\x10\x01*\x82\x01\n\x14CardanoTxSigningMode\x12\
\x18\n\x14ORDINARY_TRANSACTION\x10\0\x12\x1e\n\x1aPOOL_REGISTRATION_AS_O\
WNER\x10\x01\x12\x18\n\x14MULTISIG_TRANSACTION\x10\x02\x12\x16\n\x12PLUT\
US_TRANSACTION\x10\x03*>\n\x14CardanoTxWitnessType\x12\x11\n\rBYRON_WITN\
ESS\x10\0\x12\x13\n\x0fSHELLEY_WITNESS\x10\x01B;\n#com.satoshilabs.trezo\
r.lib.protobufB\x14TrezorMessageCardano\
"; ";
/// `FileDescriptorProto` object which was a source for this generated file /// `FileDescriptorProto` object which was a source for this generated file
@ -10179,7 +10599,7 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| {
let mut deps = ::std::vec::Vec::with_capacity(1); let mut deps = ::std::vec::Vec::with_capacity(1);
deps.push(super::messages_common::file_descriptor().clone()); deps.push(super::messages_common::file_descriptor().clone());
let mut messages = ::std::vec::Vec::with_capacity(36); let mut messages = ::std::vec::Vec::with_capacity(37);
messages.push(CardanoBlockchainPointerType::generated_message_descriptor_data()); messages.push(CardanoBlockchainPointerType::generated_message_descriptor_data());
messages.push(CardanoNativeScript::generated_message_descriptor_data()); messages.push(CardanoNativeScript::generated_message_descriptor_data());
messages.push(CardanoGetNativeScriptHash::generated_message_descriptor_data()); messages.push(CardanoGetNativeScriptHash::generated_message_descriptor_data());
@ -10200,6 +10620,7 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
messages.push(CardanoPoolRelayParameters::generated_message_descriptor_data()); messages.push(CardanoPoolRelayParameters::generated_message_descriptor_data());
messages.push(CardanoPoolMetadataType::generated_message_descriptor_data()); messages.push(CardanoPoolMetadataType::generated_message_descriptor_data());
messages.push(CardanoPoolParametersType::generated_message_descriptor_data()); messages.push(CardanoPoolParametersType::generated_message_descriptor_data());
messages.push(CardanoDRep::generated_message_descriptor_data());
messages.push(CardanoTxCertificate::generated_message_descriptor_data()); messages.push(CardanoTxCertificate::generated_message_descriptor_data());
messages.push(CardanoTxWithdrawal::generated_message_descriptor_data()); messages.push(CardanoTxWithdrawal::generated_message_descriptor_data());
messages.push(CardanoCVoteRegistrationDelegation::generated_message_descriptor_data()); messages.push(CardanoCVoteRegistrationDelegation::generated_message_descriptor_data());
@ -10216,13 +10637,14 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
messages.push(CardanoTxHostAck::generated_message_descriptor_data()); messages.push(CardanoTxHostAck::generated_message_descriptor_data());
messages.push(CardanoTxBodyHash::generated_message_descriptor_data()); messages.push(CardanoTxBodyHash::generated_message_descriptor_data());
messages.push(CardanoSignTxFinished::generated_message_descriptor_data()); messages.push(CardanoSignTxFinished::generated_message_descriptor_data());
let mut enums = ::std::vec::Vec::with_capacity(11); let mut enums = ::std::vec::Vec::with_capacity(12);
enums.push(CardanoDerivationType::generated_enum_descriptor_data()); enums.push(CardanoDerivationType::generated_enum_descriptor_data());
enums.push(CardanoAddressType::generated_enum_descriptor_data()); enums.push(CardanoAddressType::generated_enum_descriptor_data());
enums.push(CardanoNativeScriptType::generated_enum_descriptor_data()); enums.push(CardanoNativeScriptType::generated_enum_descriptor_data());
enums.push(CardanoNativeScriptHashDisplayFormat::generated_enum_descriptor_data()); enums.push(CardanoNativeScriptHashDisplayFormat::generated_enum_descriptor_data());
enums.push(CardanoTxOutputSerializationFormat::generated_enum_descriptor_data()); enums.push(CardanoTxOutputSerializationFormat::generated_enum_descriptor_data());
enums.push(CardanoCertificateType::generated_enum_descriptor_data()); enums.push(CardanoCertificateType::generated_enum_descriptor_data());
enums.push(CardanoDRepType::generated_enum_descriptor_data());
enums.push(CardanoPoolRelayType::generated_enum_descriptor_data()); enums.push(CardanoPoolRelayType::generated_enum_descriptor_data());
enums.push(CardanoTxAuxiliaryDataSupplementType::generated_enum_descriptor_data()); enums.push(CardanoTxAuxiliaryDataSupplementType::generated_enum_descriptor_data());
enums.push(CardanoCVoteRegistrationFormat::generated_enum_descriptor_data()); enums.push(CardanoCVoteRegistrationFormat::generated_enum_descriptor_data());