Skip to content
This repository has been archived by the owner on Mar 1, 2019. It is now read-only.

Fee sanity check is triggered more than it should #191

Closed
3 tasks done
KtorZ opened this issue Jan 3, 2019 · 1 comment
Closed
3 tasks done

Fee sanity check is triggered more than it should #191

KtorZ opened this issue Jan 3, 2019 · 1 comment
Assignees
Labels
BUG Something isn't working

Comments

@KtorZ
Copy link
Contributor

KtorZ commented Jan 3, 2019

Release Operating System Cause
1.4 Windows & OSX & Linux) Code

Context

When solving CSL-2526, we introduced an extra sanity check to make the API fails if it was to generate a transaction with too many fees (to prevent us from creating illed transactions because of a programming error in the coin selection / fee calculation).
Yet, it turns out this check is a bit too strict / wrong for it compare transaction fees to an absolute value. Therefore, some transactions with many inputs and, actually expensive fees, fail to be created despite being totally valid.

Steps to Reproduce

  1. Submit a (valid) transaction with many inputs to the API

Expected behavior

The transaction is successfully created with corresponding fees.

Actual behavior

The API fails (500 error) with "fees out of bound".


Resolution Plan

  • Extend current test suite with a valid case of valid transaction with out-of-bound fees.
  • Make the fee sanity check relative to the transaction's size itself instead of being absolute
  • Backport this change to cardano-sl

PR

Number Base
#199 develop
#207 develop
cardano-sl #3993 release/2.0.1

QA

In order to make the current test scenarios fail (and shed a light on the issue), we had to do a few things:

With this, our test suite was able to identify the issue and trigger the wrong sanity check. By then changing the sanity check to a relative one, I haven't been able to make them fail again even with 50K+ more tests.

Note that the sanity check is rather arbitrary but is now comparing the actual computed fee amount with the estimated one. Cf the corresponding note in the code:

https://github.com/input-output-hk/cardano-wallet/blob/develop/src/Cardano/Wallet/Kernel/CoinSelection/Generic/Fees.hs#L102-L114

Retrospective

Turns ou that our testing scenarios for CoinSelection weren't catching any of this but still, were making us believe they did (the fee sanity checkers were defined and required in the tests themselves but were never needed to run the tests).
This is a pretty big issue in terms of QA which may be also happening in other parts of the testing suite. We will need to invest time ASAP in reviewing our current unit tests and see exactly what are they testing and how exactly do they do it.

@KtorZ KtorZ added the BUG Something isn't working label Jan 3, 2019
@KtorZ KtorZ self-assigned this Jan 3, 2019
@piotr-iohk
Copy link
Contributor

OK. Closing!

@piotr-iohk piotr-iohk added the RESTROSPECTIVE ADR needs restrospective session label Jan 8, 2019
@KtorZ KtorZ removed the RESTROSPECTIVE ADR needs restrospective session label Jan 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
BUG Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants