-
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
Closes #92: validates transactions relying on the Ledger.Validator
api
#93
Conversation
since conversion doesn't preserve signatures
This PR is in a good shape. It just needs to provide |
Ledger.Validator
api
which are somewhat dual to quick currencies
the transaction changes and the computed fees are wrong.
@sjoerdvisscher , if you have some time to look at this it would be greatly appreciated; the only important place to look would be the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mechanisms to deal with signatures and fees seem crazy, but apparently we have no choice.
@GuillaumeGen The requiredSigners situation will improve in the future when we complete the switch from our own Tx data type to the cardano-ledger one. The fee calculation is what it is, it was design with security and network stability in mind, not ease of use... |
@sjoerdvisscher It is great to learn that the handling of signature will be simplified in the future. |
@GuillaumeGen The fee depends on the amount of inputs and outputs, so it depends on balancing, and since you do your own balancing you can just call a function to calculate the fees. Obviously balancing also depends on the fees in turn, hence the need for a fixed point. And then customers reported that the fixed point was not always reached, a bigger fee can cause a bigger input to be chosen during balancing, leading to fewer inputs, leading to lower fees, cycling ad infinitum. So it's annoyingly complicated. |
the library and use minAda instead of magic numbers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of side improvements besides the main matters of the hope-for-a-fixpoint fee calculation/balancing daunting matter and support for collaterals and signatures the right way. Still not sure I understand why we start with high fees and switch to little fees if that's not possible. Is it just an empirical optimization hack that tries to avoid many iterations if possible or is there more to it in terms of correctness?
I have no use case in mind for the True
minting policy but I conceptually like a lot how the new Currency module distinguishes between quick and permanent (old quicks) values. Some old code for pretty printing old quick values is no longer relevant. I left a more detailed comment.
@@ -5,7 +5,9 @@ | |||
|
|||
module Cooked.MockChain.Wallet where | |||
|
|||
import qualified Cardano.Api as C |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the qualified names in the module are becoming confusing. Maybe we could refactor:
- avoiding 1-2 letters names apart from
Pl
, includingM
which could be imported asMap
along with a non qualified import for the typeMap
- making it clear what comes from Plutus and what comes from Cardano.
There are twoCrypto
modules here, one from Plutus, one from Cardano. - being consistent whether we name the submodule (e.g.
Validation
/Crypto
/CW
), give them the lib name (Pl
/Cardano
), or both (e.g.PlCrypto
/CardanoCrypto
).
This is a PR closes #92. The most important change is that we now rely on the validation exactly as performed by the cardano node, not just on the simplified
Ledger.Index
validation. Consequently, we needed a proper fee computation, which was mostly taken fromplutus-apps
.Moreover, since empty currency symbols are not permitted anymore, we had to make a simple
QuickCurrency
minting policy for quick values.There's still work to be done with respect to collateral, which I'll tackle before marking the PR as ready.