-
Notifications
You must be signed in to change notification settings - Fork 217
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
Expose min fee from node #2920
Expose min fee from node #2920
Conversation
78bb514
to
7a79ee7
Compare
73b30ca
to
cfc1133
Compare
return (pp, sp) | ||
|
||
ppNode <- onAnyEra | ||
(error "not sure at this moment how to handle that") |
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.
Can we not make this Nothing
?
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.
we can. good idea
cfc1133
to
585c331
Compare
ab20b86
to
69d3f98
Compare
69d3f98
to
ec8e1f0
Compare
fromCardanoLovelace minFee | ||
where | ||
minFee = case getSealedTxBody tx of | ||
InAnyCardanoEra ShelleyEra txbody -> |
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'm looking into this, but I don't think we need to expose the ledger txbodies here... The Cardano.Tx body wits
pattern should be enough...
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.
Or is it intentional for some reason?
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 required IsShelleyBasedEra era
, I think we should be able to conjure up somehow...
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.
unfortunately,in the case of tx certs I cannot extract from cardano-node due to how it sneaks BuildTx there. And it turn out that doing this through ledger tx is a way...
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.
feel free to try without ledger bypass if you have a while
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.
For the record, what I had missed until our quick call was:
- We need to predict how many witnesses there will be, as the transaction is not signed.
- We cannot use estimateTransactionKeyWitnessCount
-- Current protocol parameters | ||
-> tx | ||
-- The sealed transaction | ||
-> Coin |
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.
Perhaps we should return Maybe
instead of erroring in case of byron, but I think leaving it as-is is fine while still trying to fit the pieces together.
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 ended up adding a Maybe
here.
@@ -716,6 +722,166 @@ txParametersFromPParams maxBundleSize pp = W.TxParameters | |||
naturalToDouble :: Natural -> Double | |||
naturalToDouble = fromIntegral | |||
|
|||
-------------------------------------------------------------------------------- | |||
-- Copied from cardano-api | |||
-- To be removed when once again exposed. |
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 added this note for future readers
in Cardano.evaluateTransactionFee @Cardano.MaryEra pp txbody (witsNum txbody certNum) 0 | ||
InAnyCardanoEra AlonzoEra txbody -> | ||
let (Cardano.ShelleyTxBody _ ledgertxbody _ _ _ _) = txbody | ||
certNum = length $ Alonzo.txcerts ledgertxbody |
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 these certNum
could be a slight overestimate, as not all certs require witnesses (KeyReg being the exception). This should affect the result of _evaluateMinimumFee
when Daedalus users delegate for the first time.
Another, more theoretical case would also be where all the certs require just a single key witness.
Not a big deal, but could add a comment about it.
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.
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.
LGTM, will be useful to have currentNodeProtocolParameters
1. Make evaluateMinimumFee return `Maybe Coin` rather than being a partial function. 2. Add some comments clarifying aspects.
6faea90
to
9876e47
Compare
bors r+ |
Build succeeded: |
adp-1143
evaluateTransactionFee
from cardano-api uses cardano-api's ProtocolParamters. Hence,Limitations:
Comments
Issue Number