mobilecoinofficial / full-service

A MobileCoin service for wallet implementations.
Other
46 stars 21 forks source link

FS-154 New TransactionId Derivation #1001

Closed lnsiegel closed 2 months ago

lnsiegel commented 2 months ago

Motivation

transaction_log_ids created by full-service are used to lookup records in the transaction_log within the local wallet database.

Many third-party full-service clients expose this id to their users, expecting it to be the equivalent of other blockchain's transaction ids -- a hash that can be used to find evidence of the transaction on the blockchain itself.

Up until now, this has not been the case. While it was a 32 byte hash, represented as a 64 character hex string, the information being hashed included information private to the wallet database and so could not be used to find evidence of the transaction on the blockchain itself.

In this PR

This PR updates the algorithm for creating new transaction_log_ids (historical ids will remain unchanged) to use public blockchain information only. Specifically, we now use the public_key of one of the transaction's payload_txos as the transaction_log.id for newly created transaction_log entries. This will result in improved experiences for when the transaction_log.id is shared with end users and used by them to, for example, search for the transaction in the block-explorer.

Meanwhile clients that use the transaction_log.id to look up transaction_logs can still use it the same as always.

codecov-commenter commented 2 months ago

Codecov Report

Attention: Patch coverage is 47.22222% with 19 lines in your changes missing coverage. Please review.

Project coverage is 55.57%. Comparing base (ab2af32) to head (d7606da). Report is 203 commits behind head on main.

Files Patch % Lines
full-service/src/db/transaction_log.rs 60.71% 4 Missing and 7 partials :warning:
full-service/src/json_rpc/v1/api/wallet.rs 0.00% 2 Missing and 2 partials :warning:
full-service/src/json_rpc/v2/api/wallet.rs 0.00% 3 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1001 +/- ## ========================================== - Coverage 60.12% 55.57% -4.56% ========================================== Files 88 125 +37 Lines 12356 16517 +4161 Branches 2010 2840 +830 ========================================== + Hits 7429 9179 +1750 - Misses 3238 5234 +1996 - Partials 1689 2104 +415 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.