-
Notifications
You must be signed in to change notification settings - Fork 151
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
fix!: integrate @substrate/[email protected] for partial fees #1017
Conversation
Co-authored-by: James Wilson <[email protected]>
…into tarik-fix-partial-fee-calc
As a side-not to this PR when paritytech/substrate#11648 is a thing I guess it would simplify things for us. |
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.
looks alright, I think the QueryFeeDetailsCache
would benefit with some additional docs such that "this is a workaround" because it's not possible to fetch which runtime APIs
are available.
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.
Awesome!
Summary (BREAKING CHANGES)
This PR focuses on adding
calc_partial_fee
from@substrate/calc
v0.3.0 so that fee calculations for both relay and parachains are completely accurate. It uses a combination of bothpayment_queryInfo
andpayment_queryFeeDetails
in order to calculate the fee. Ifpayment_queryFeeDetails
is not present or available to use, it will default topayment_queryInfo
. This PR also adds a field to theinfo
of an extrinsic calledkind
which can either bepreDispatch
, orpostDispatch
. More Info below.Removed
feeByEvent
query param as it is no longer needed as Sidecar now has the accuracy it needs for fees. In the future if the eventTransactionFeePaid
is present it will take the fee from there.Added
kind: 'preDispatch' | 'postDispatch'
field ininfo
for extrinsics.preDispatch
:payment_queryInfo
was used to get thepartialFee
givenpreDispatch
information.postDispatch
:calc_partial_fee
was used to calculate the fee using post dispatch fee information.calc_partial_fee
:/blocks/*
now uses this method to accurately calculatepartialFee
's for extrinsics.Fixed
payment_queryInfo
Notes
payment_queryFeeDetails
is available in the runtime, and polkadot-js will throw an error regardless of catching it. Therefore we log a warning after the error is emitted to let users know the error is not important, than we cache the runtime to not callpayment_queryFeeDetails
again and instead recieve the partialFee fromqueryInfo
.Todo
payment_queryFeeDetails
for a runtime that doesn't support it.