Skip to content

Conversation

@cbeck88
Copy link
Contributor

@cbeck88 cbeck88 commented Oct 8, 2022

The motivation here is that, hardware wallets like Ledger have an expectation that the device can verify what is the balance change that will result from signing a given transaction and who the outbound money will be paid to.

However, currently we have scoped things so that hardware wallets just are responsible for signing the Ring MLSAG, and they don't see large parts of the Tx, including the TxPrefix.

The only way that the set of outputs is connected to the RingMLSAG is that the TxPrefix is hashed into the "message", which is hashed with more things to produce the "extended_message_digest", which is the 32 byte digest that the RingMLSAG actually signs.

For the hardware wallet to really know what it is signing then, it would have to reproduce the entire extended message digest. The problem with this is that the TxPrefix can be > 100kb, which is much larger than the few kb that the hardware device currently has to handle, and is much too big to fit in the device's memory.

Instead, we introduce a TxSummary object and add an extra step where it is hashed in just at the very end. The computer can then prove that the hash the MLSAG is signing is connected to a given TxSummary, and provide enough information from there to understand the balance delta and where the money is going. This manages to avoid sending all the merkle proofs for all the mixins and so it can be done sending only a few kb.

The hope is to do this for v3, otherwise this issue may become the long pole for shipping hardware wallet support.

For other clients and servers, this doesn't meaningfully affect the time to sign or verify a Tx.

@cbeck88 cbeck88 self-assigned this Oct 8, 2022
@cbeck88 cbeck88 added enhancement New feature or request consensus Related only to the consensus protocol or service old-v4.0.0 Blocker for v4 and removed consensus Related only to the consensus protocol or service labels Oct 8, 2022
@cbeck88 cbeck88 mentioned this pull request Oct 10, 2022
4 tasks
@cbeck88
Copy link
Contributor Author

cbeck88 commented Oct 10, 2022

There is now an MCIP for this, we should bring this code into alignment with the MCIP spec: mobilecoinfoundation/mcips#52

@cbeck88 cbeck88 added the transaction-core Area: Rules defining a valid transaction and its structure label Oct 10, 2022
cbeck88 and others added 9 commits October 14, 2022 21:05
The motivation here is that, hardware wallets like Ledger have
an expectation that the device can verify what is the balance
change that will result from signing a given transaction and who
the outbound money will be paid to.

However, currently we have scoped things so that hardware wallets
just are responsible for signing the Ring MLSAG, and they don't
see large parts of the Tx, including the TxPrefix.

The only way that the set of outputs is connected to the RingMLSAG
is that the TxPrefix is hashed into the "message", which is hashed
with more things to produce the "extended_message_digest", which
is the 32 byte digest that the RingMLSAG actually signs.

For the hardware wallet to really know what it is signing then,
it would have to reproduce the entire extended message digest.
The problem with this is that the TxPrefix can be > 100kb, which is
much larger than the few kb that the hardware device currently has
to handle, and is much too big to fit in the device's memory.

Instead, we introduce a `TxSummary` object and add an extra step
where it is hashed in just at the very end. The computer can then
prove that the hash the MLSAG is signing is connected to a given
TxSummary, and provide enough information from there to understand
the balance delta and where the money is going. This manages to
avoid sending all the merkle proofs for all the mixins and so
it can be done sending only a few kb.

The hope is to do this for v3, otherwise this issue may become
the long poll for shipping hardware wallet support.
Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>
Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>
Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>
Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>
Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>
Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>
@cbeck88 cbeck88 force-pushed the feature/tx-summary-digest branch from dea1851 to c622dbb Compare October 15, 2022 03:12
@cbeck88
Copy link
Contributor Author

cbeck88 commented Oct 15, 2022

Still to do:

  • Update spec for the InputRules stuff per discussion
  • Implement the unblinding data
  • Implement the streaming support for TxSummary + TxSummaryUnblindingData verification
  • Tests of this

I am thinking to do the unblinding data in a separate PR staged on this one to ease review

@cbeck88 cbeck88 requested review from a team and remoun October 31, 2022 15:39
Copy link
Contributor

@isis-mc isis-mc left a comment

Choose a reason for hiding this comment

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

LGTM, small nits detailed above.

@cbeck88 cbeck88 merged commit f8b8a58 into master Nov 1, 2022
@cbeck88 cbeck88 deleted the feature/tx-summary-digest branch November 1, 2022 21:38
dolanbernard pushed a commit to dolanbernard/mobilecoin that referenced this pull request Nov 2, 2022
…bilecoinfoundation#2683)

* Add TxSummary object and incorporate it into MLSAG signing digest

The motivation here is that, hardware wallets like Ledger have
an expectation that the device can verify what is the balance
change that will result from signing a given transaction and who
the outbound money will be paid to.

However, currently we have scoped things so that hardware wallets
just are responsible for signing the Ring MLSAG, and they don't
see large parts of the Tx, including the TxPrefix.

The only way that the set of outputs is connected to the RingMLSAG
is that the TxPrefix is hashed into the "message", which is hashed
with more things to produce the "extended_message_digest", which
is the 32 byte digest that the RingMLSAG actually signs.

For the hardware wallet to really know what it is signing then,
it would have to reproduce the entire extended message digest.
The problem with this is that the TxPrefix can be > 100kb, which is
much larger than the few kb that the hardware device currently has
to handle, and is much too big to fit in the device's memory.

Instead, we introduce a `TxSummary` object and add an extra step
where it is hashed in just at the very end. The computer can then
prove that the hash the MLSAG is signing is connected to a given
TxSummary, and provide enough information from there to understand
the balance delta and where the money is going. This manages to
avoid sending all the merkle proofs for all the mixins and so
it can be done sending only a few kb.

The hope is to do this for v3, otherwise this issue may become
the long poll for shipping hardware wallet support.

* store input_rules with TxSummary, bring TxSummary in line with spec

* fixup

* Update transaction/core/src/tx_summary.rs

Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>

* Update transaction/types/src/block_version.rs

Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>

* Update transaction/core/src/tx_summary.rs

Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>

* Update transaction/core/src/tx_summary.rs

Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>

* Update transaction/core/src/tx_summary.rs

Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>

* Update transaction/core/src/tx_summary.rs

Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>

* fixups to idea for SCI support in TxSummary

* Update transaction/core/src/tx_summary.rs

Co-authored-by: Nick Santana <nick@mobilecoin.com>

* lint and clippy

* fixup TxOutSummary tags

* review comments, add types for digests, move digests to new module

* fixups to "associated_to_input_rules" test for TxOutSummary

* improved code comments and cargo fmt

Co-authored-by: Remoun Metyas <remoun@mobilecoin.com>
Co-authored-by: Nick Santana <nick@mobilecoin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request old-v4.0.0 Blocker for v4 transaction-core Area: Rules defining a valid transaction and its structure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants