Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIP-0021 | Restrictions on transactions signed by hardware wallets #107

Merged
merged 5 commits into from
Sep 15, 2021

Conversation

gabrielKerekes
Copy link
Contributor

No description provided.

@crptmppt
Copy link
Contributor

crptmppt commented Aug 3, 2021

For the future, please do not allocate a tentative CIP number in the title - hard to juggle the titles, informal references, and which are currently ongoing under that number

Copy link
Contributor

@SebastienGllmt SebastienGllmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content makes sense. Is the plan to merge this CIP for now and then update it again after for Alonzo HW support for smart contracts?

@gabrielKerekes
Copy link
Contributor Author

gabrielKerekes commented Aug 4, 2021

Is the plan to merge this CIP for now and then update it again after for Alonzo HW support for smart contracts?

Yes - at least from our side. It might also need to be updated when multisig/native script support is added to HW wallets, which will happen before Alonzo.

@@ -0,0 +1,115 @@
---
CIP: 0021
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

21 (tentative)

@crptmppt
Copy link
Contributor

PR107 is set as a REVIEW item for next week, 8/17 Editor meeting 28: if the issue is of relevance to you, consider attending the meeting or adding to the conversation here.

@@ -0,0 +1,115 @@
---
CIP: 0021
Title: Restrictions on transactions signed by hardware wallets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the title is a bit misleading. Rather this CIP wants to establish some best practices for HW wallets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the intention is unclear and should be made clearer in the CIP. It does not comment on best practices, but lists limitations arising from hardware limitations of Trezor and especially Ledger.

The intended CIP audience are people integrating with HW wallets (developers of software wallets and similar tools), not HW wallet developers. In other words the CIP should define how you should build your transactions in order for them to be compatible (signable) with HW wallets - specifically Ledger and Trezor (not sure if there are other significant ones currently). In general, the rules should be a superset of restrictions for each HW wallet, so if you follow this CIP, you would be compatible with all HW wallets, and if you don't, you risk that some parties use HW wallets and will not be able to sign your transaction. This is especially important in context of transactions signed by multiple parties.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest using the term "interoperability" in the title, e.g. "Transaction guidelines for interoperability with hardware wallets".

@gabrielKerekes
Copy link
Contributor Author

We added “Optional empty lists and maps”, “Outputs” and “Auxiliary data” sections due to an issue reported to the Cardano LedgerJS project - vacuumlabs/ledgerjs-cardano-shelley#125 - outputs with no multi-assets contained the empty multiasset map which caused a tx hash mismatch on Ledger which doesn’t include it. 81d2394

CIP-0021/CIP-0021.md Outdated Show resolved Hide resolved
CIP-0021/CIP-0021.md Show resolved Hide resolved
CIP-0021/CIP-0021.md Show resolved Hide resolved

**Integers**

While the Cardano CDDL specification usually does not limit the size of integers, HW wallets only support `int64` for signed integers and `uint64` for unsigned integers. Any integer value must fit in the appropriate type.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alas... I am still not sure whether unbounded integers on the blockchain was a good idea in the first place 😶

Copy link
Contributor

@dcoutts dcoutts Aug 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do limit the size in the CDDL, usually to signed or unsigned int 64. There are only a few places where we allow "big ints". See the big_int type definition in the Alonzo CDDL.

And note that those big ints are themselves bounded to 64 bytes. This is for Plutus integer data.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And note that those big ints are themselves bounded to 64 bytes.

That's good to know actually.

CIP-0021/CIP-0021.md Outdated Show resolved Hide resolved
[ transaction_metadata: { * transaction_metadatum_label => transaction_metadatum }, auxiliary_scripts: [ * native_script ]]
```

The `auxiliary_scripts` must be an array of length 0.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that something which is in the making, or there's no plan to support auxiliary_scripts ever? That may be quite limiting for Plutus.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If auxiliary_scripts support is needed on HW wallets it should be added. Currently it's not supported and so it is a restriction on the transactions.

There are two limits on the number of witnesses:

- an absolute limit of `UINT16_MAX`, i.e. 65535;
- a relative limit dependent on the transaction body (essentially one witness per each input, each withdrawal and each certificate in a typical transaction).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This second condition may be overly restrictive in Alonzo where it'll be allowed to request additional signatures which do not correspond to any input. This would be however specified by a dedicated field on transactions required_signers (key 14 in transaction body).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will change with the introduction of multi-sig to HW wallets which is currently being finalised. It will be possible to send additional_witness_requests to the HW wallets which will sign the transaction with a key derived from the path given in the request.

@KtorZ KtorZ changed the title CIP-0021: Restrictions on transactions signed by hardware wallets CIP-0021 | Restrictions on transactions signed by hardware wallets Aug 17, 2021
@gabrielKerekes
Copy link
Contributor Author

I've updated the CIP name and I've removed the sections regarding witnesses since this isn't true anymore. 74bb782

@crptmppt
Copy link
Contributor

This PR was Reviewed last Editor meeting (28) - see notes.
the PR is now setup as a 'Last Check' item: it is on track to be merged pending any final reservations.
If this PR is of interest and/or you would like to discuss further, consider joining the upcoming CIP Editor meeting (29) coming up on crowdcast on 8/31.

Copy link
Contributor

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I'd again suggest correcting the section on integers. The CDDL does say where big ints vs fixed size ints are allowed. So the the Cardano CDDL does always limit the size of integers: either big ints are not included or where they are there is a size bound on them. If you see any place where that's not the case it's a bug that we should fix.

@gabrielKerekes
Copy link
Contributor Author

I've updated the section on integers in f3d1b04.

@crptmppt crptmppt merged commit 9a2e45d into cardano-foundation:master Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants