mobilecoinofficial / full-service

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

Unit tests for FS-154 New TransactionId Derivation #1002

Closed lnsiegel closed 4 months ago

lnsiegel commented 4 months ago

Motivation

Added rust unit tests to confirm the new method of transaction_log_id generation for vectors of OutputTxos passed to the TryFrom<Vec<OutputTxo>> implementation for TransactionId.

In this PR

There are two new unit tests added:

  1. test_try_from_vec_output_txo_for_transaction_id
  2. test_try_from_empty_vec_output_txo_for_transaction_id

The first test creates different sized vectors of OutputTxo structures. The vectors are of size 1 through 10. The embedded TxOut structs are initialized from entropy, so the public keys are unique on each run. Each vector is first scanned for its minimum public key. The vector is then passed to TransactionId::try_from() and the resulting transaction_log_id is asserted to be equal to the vector's minimum public key.

The second test checks that the expected error message is returned when an empty vector is passed to TransactionId::try_from()

codecov-commenter commented 4 months ago

Codecov Report

Attention: Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 55.64%. Comparing base (ab2af32) to head (8588da8). Report is 204 commits behind head on main.

Files Patch % Lines
full-service/src/db/transaction_log.rs 93.75% 0 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1002 +/- ## ========================================== - Coverage 60.12% 55.64% -4.48% ========================================== Files 88 125 +37 Lines 12356 16547 +4191 Branches 2010 2844 +834 ========================================== + Hits 7429 9208 +1779 - Misses 3238 5233 +1995 - Partials 1689 2106 +417 ```

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