Skip to content

Commit

Permalink
Merge #3211
Browse files Browse the repository at this point in the history
3211: Speed up `TransactionSpec.signTransaction`. r=jonathanknowles a=jonathanknowles

## Issue Number

ADP-1485

## Summary

This PR:

- adjusts `checkSubsetOf` to use set-based lookups instead of repeated list traversals.
- adjusts `signTransaction` properties to only test 10 examples per property, rather than 100.

This results in a substantial reduction in total time required to run the `signTransaction` tests:

```
Before:  530 ± 10 seconds (over 4 runs)
After:    48 ±  2 seconds (over 4 runs)
```

## Additional Improvements

This PR also:

- introduces function `spec_forAllEras` to eliminate some repetition in the `signTransaction` spec .
- makes the output of `signTransaction` property tests more readable, so that the name of each property is written once as a section header, rather than being repeated for every single era. (The individual eras are still as subsections.)

```hs
Cardano.Wallet.Shelley.Transaction                                                         
  Sign transaction                                                                                                                                                                        signTransaction adds reward account witness when necessary    
      ByronEra                                                                             
        +++ OK, passed 10 tests (100% feature not supported in ByronEra).
      ShelleyEra (2144ms)
        +++ OK, passed 10 tests.
      AllegraEra (2143ms)
        +++ OK, passed 10 tests.
      MaryEra (2142ms)
        +++ OK, passed 10 tests.
      AlonzoEra (2142ms)
        +++ OK, passed 10 tests.
    signTransaction adds extra key witnesses when necessary
      ByronEra
        +++ OK, passed 10 tests (100% feature not supported in ByronEra).
      ShelleyEra
        +++ OK, passed 10 tests (100% feature not supported in ShelleyEra).
      AllegraEra
        +++ OK, passed 10 tests (100% feature not supported in AllegraEra).
      MaryEra
        +++ OK, passed 10 tests (100% feature not supported in MaryEra).
      AlonzoEra (686ms)
        +++ OK, passed 10 tests.
```

Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
  • Loading branch information
iohk-bors[bot] and jonathanknowles authored Mar 31, 2022
2 parents aa85d19 + c28f435 commit 8fa3628
Showing 1 changed file with 374 additions and 202 deletions.
Loading

0 comments on commit 8fa3628

Please sign in to comment.