Fee probing
gabrielhdt opened this issue · 1 comments
Symptoms
The fee available in the context of validation is not always the fee applied on the transaction.
Reproduce
To see this bug, you need a validator whose behaviour depends on the fee.
For an example, see the tests at
where the validatorcheckFeeBetween
succeeds if the fee is in some given range.
- the test case "3 Ada is the upper bound" shows that if the upper bound is lower than 3A, the validator fails. So the fee is greater or equal to 3A
- the test case "350 000 Lovelaces is the lower bound" shows that if the lower bound is greater than 350 000 Lovelaces, the validator fails. Therefore the fee is lower or equal to 350k Lovelaces.
Are there several fees? Some explanations later on.
Expected behaviour
One should be able to reduce that range to a single value, the value of the fee itself, which is supposed to be deterministic and unique per transaction.
Some explanations
Because the value of the fee depends on the complexity of the validator, the latter has to be run to compute the former. This leads to a fixpoint algorithm:
- set the fee to some arbitrary value
$f_0$ - run the validator using that value and evaluate the cost of running the validator(s)
- fix the fee to
$f_1$ and re-iterate until the fee has stabilised.
Therefore, the validator is run in several contexts which differ at least by their fee value. In particular, validators are always run at least once with
From our tests, we can deduce that
Environment
Cooked v2
I am closing this because:
- this is outdated
- we now know much more about fees
- fees are properly handled in cooked-validators
- this issue does not clearly described what needs fixing