Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 38 additions & 12 deletions common/protob/messages-cardano.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ enum CardanoCertificateType {
STAKE_DEREGISTRATION = 1;
STAKE_DELEGATION = 2;
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 {
Expand All @@ -66,10 +76,10 @@ enum CardanoPoolRelayType {

enum CardanoTxAuxiliaryDataSupplementType {
NONE = 0;
GOVERNANCE_REGISTRATION_SIGNATURE = 1;
CVOTE_REGISTRATION_SIGNATURE = 1;
}

enum CardanoGovernanceRegistrationFormat {
enum CardanoCVoteRegistrationFormat {
CIP15 = 0;
CIP36 = 1;
}
Expand Down Expand Up @@ -164,6 +174,7 @@ message CardanoGetAddress {
required uint32 network_id = 4; // network id - mainnet or testnet
required CardanoAddressParametersType address_parameters = 5; // parameters used to derive the address
required CardanoDerivationType derivation_type = 6;
optional bool chunkify = 7; // display the address in chunks of 4 characters
}

/**
Expand Down Expand Up @@ -223,6 +234,8 @@ message CardanoSignTxInit {
optional bool has_collateral_return = 19 [default=false];
optional uint64 total_collateral = 20;
optional uint32 reference_inputs_count = 21 [default=0];
optional bool chunkify = 22; // display the address in chunks of 4 characters
optional bool tag_cbor_sets = 23 [default=false]; // use tag 258 for sets in cbor
}

/**
Expand Down Expand Up @@ -333,6 +346,16 @@ message CardanoPoolParametersType {
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
* @next CardanoTxItemAck
Expand All @@ -344,6 +367,8 @@ message CardanoTxCertificate {
optional CardanoPoolParametersType pool_parameters = 4; // used for stake pool registration certificate
optional bytes script_hash = 5; // stake credential script 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
}

/**
Expand All @@ -360,22 +385,23 @@ message CardanoTxWithdrawal {
/**
* @embed
*/
message CardanoGovernanceRegistrationDelegation {
required bytes voting_public_key = 1;
message CardanoCVoteRegistrationDelegation {
required bytes vote_public_key = 1;
required uint32 weight = 2;
}

/**
* @embed
*/
message CardanoGovernanceRegistrationParametersType {
optional bytes voting_public_key = 1;
message CardanoCVoteRegistrationParametersType {
optional bytes vote_public_key = 1; // mutually exclusive with delegations
repeated uint32 staking_path = 2;
required CardanoAddressParametersType reward_address_parameters = 3;
optional CardanoAddressParametersType payment_address_parameters = 3; // mutually exclusive with payment_address
required uint64 nonce = 4;
optional CardanoGovernanceRegistrationFormat format = 5 [default=CIP15];
repeated CardanoGovernanceRegistrationDelegation delegations = 6; // mutually exclusive with voting_public_key; max 32 delegations
optional CardanoCVoteRegistrationFormat format = 5 [default=CIP15];
repeated CardanoCVoteRegistrationDelegation delegations = 6; // mutually exclusive with vote_public_key; max 32 delegations
optional uint64 voting_purpose = 7;
optional string payment_address = 8; // mutually exclusive with payment_address_parameters
}

/**
Expand All @@ -384,7 +410,7 @@ message CardanoGovernanceRegistrationParametersType {
* @next CardanoTxAuxiliaryDataSupplement
*/
message CardanoTxAuxiliaryData {
optional CardanoGovernanceRegistrationParametersType governance_registration_parameters = 1;
optional CardanoCVoteRegistrationParametersType cvote_registration_parameters = 1;
optional bytes hash = 2;
}

Expand Down Expand Up @@ -452,7 +478,7 @@ message CardanoTxItemAck {
message CardanoTxAuxiliaryDataSupplement {
required CardanoTxAuxiliaryDataSupplementType type = 1;
optional bytes auxiliary_data_hash = 2;
optional bytes governance_signature = 3;
optional bytes cvote_registration_signature = 3;
}

/**
Expand Down Expand Up @@ -504,7 +530,7 @@ message CardanoSignTxFinished {
* @next CardanoMessageSignature
* @next Failure
*/
message CardanoSignMessage {
message CardanoSignMessage {
repeated uint32 address_n = 1;
required bytes message = 2;
required CardanoDerivationType derivation_type = 3;
Expand Down
6 changes: 4 additions & 2 deletions core/src/all_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,12 +1023,14 @@
import trezor.enums.BinanceTimeInForce
trezor.enums.CardanoAddressType
import trezor.enums.CardanoAddressType
trezor.enums.CardanoCVoteRegistrationFormat
import trezor.enums.CardanoCVoteRegistrationFormat
trezor.enums.CardanoCertificateType
import trezor.enums.CardanoCertificateType
trezor.enums.CardanoDRepType
import trezor.enums.CardanoDRepType
trezor.enums.CardanoDerivationType
import trezor.enums.CardanoDerivationType
trezor.enums.CardanoGovernanceRegistrationFormat
import trezor.enums.CardanoGovernanceRegistrationFormat
trezor.enums.CardanoNativeScriptHashDisplayFormat
import trezor.enums.CardanoNativeScriptHashDisplayFormat
trezor.enums.CardanoNativeScriptType
Expand Down
6 changes: 3 additions & 3 deletions core/src/apps/cardano/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Since Alonzo era, network id may be included as an item in the transaction body.

## Key types

In Shelley two types of keys are used. Payment key and staking key. Payment keys are derived from _m/1852'/1815'/x/[0,1]/y_ paths and are used for holding/transferring funds. Staking keys are derived from _m/1852'/1815'/x/2/0_ paths, thus there is only one staking key per account. They are used for staking operations - certificates, withdrawals. Shelley addresses are built from the combination of hashes of these keys.
In Shelley two types of keys are used. Payment key and staking key. Payment keys are derived from _m/1852'/1815'/x/[0,1]/y_ paths and are used for holding/transferring funds. Staking keys are derived from _m/1852'/1815'/x/2/y_ paths (in the past, the only allowed value of `y` was `0`). They are used for staking operations - certificates, withdrawals. Shelley addresses are built from the combination of hashes of these keys.

[Multi-sig paths (1854')](https://cips.cardano.org/cips/cip1854/) are used to generate keys which should be used in native scripts and also to sign multi-sig transactions. [Minting paths (1855')](https://cips.cardano.org/cips/cip1855/) are used for creating minting policies and for witnessing minting transactions.

Expand Down Expand Up @@ -291,9 +291,9 @@ Each transaction may contain auxiliary data. Auxiliary data format can be found

Auxiliary data can be sent to Trezor as a hash or as an object with parameters. The hash will be included in the transaction body as is and will be shown to the user.

The only object currently supported is governance voting key registration (currently, this is used only by Catalyst, but there may be other governance use cases in the future). To be in compliance with the CDDL and other Cardano tools, governance voting key registration object is being wrapped in a tuple and an empty tuple follows it. The empty tuple represents `auxiliary_scripts` which are not yet supported on Trezor and are thus always empty. Byron addresses are not supported as governance reward addresses. The governance registration signature is returned in the form of `CardanoTxAuxiliaryDataSupplement` which also contains the auxiliary data hash calculated by Trezor.
The only object currently supported is CIP-15/CIP-36 vote key registration (currently, this is used only by Catalyst, but there may be other voting use cases in the future). To be in compliance with the CDDL and other Cardano tools, vote key registration object is being wrapped in a tuple and an empty tuple follows it. The empty tuple represents `auxiliary_scripts` which are not yet supported on Trezor and are thus always empty. Byron addresses are not supported as the addresses to receive rewards. The registration signature is returned in the form of `CardanoTxAuxiliaryDataSupplement` which also contains the auxiliary data hash calculated by Trezor.

[Governance Registration Transaction Metadata Format](https://cips.cardano.org/cips/cip36/)
[CIP-36 Vote Registration Transaction Metadata Format](https://cips.cardano.org/cips/cip36/)

### Native scripts

Expand Down
Loading
Loading