-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fee probing #341
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
cooked-validators/tests/Cooked/Behaviour/Elementary.hs
Line 353 in cb24ef3
checkFeeBetween
succeeds if the fee is in some given range.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:
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$f_0$ so one cannot write a validator that succeeds if and only if the transaction it is run in has fees strictly smaller than $f_0$ .
From our tests, we can deduce that$f_0$ is either close to 3Ada and the final fee is close to 350,000 Lovelaces (so the fee decreases through iterations of the algorithm); or $f_0$ is close to 350,000 Lovelaces and the final fee is close to 3 Ada, which is less probable since the transaction is a light one.
Environment
Cooked v2
The text was updated successfully, but these errors were encountered: