mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
payment_queryInfo: Make it work with WeightV2 (#12633)
* `payment_queryInfo`: Make it work with `WeighV2` The runtime api for querying the payment info depends on the `Weight` type and broke for old runtimes that still use the `WeighV1`. This pull requests fixes this by: 1. Bumping the version of the runtime api. 2. Making the node side code use the correct runtime api function depending on the version of the runtime api. 3. Make the RPC always return `WeighV1`. Users of the api should switch to `state_call` and decide based on the version of the runtime api which `Weight` type is being returned. * Fix tests * Review comment
This commit is contained in:
@@ -17,6 +17,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
|
||||
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, path = "../../../transaction-payment" }
|
||||
sp-api = { version = "4.0.0-dev", default-features = false, path = "../../../../primitives/api" }
|
||||
sp-runtime = { version = "6.0.0", default-features = false, path = "../../../../primitives/runtime" }
|
||||
sp-weights = { version = "4.0.0", default-features = false, path = "../../../../primitives/weights" }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -25,4 +26,5 @@ std = [
|
||||
"pallet-transaction-payment/std",
|
||||
"sp-api/std",
|
||||
"sp-runtime/std",
|
||||
"sp-weights/std",
|
||||
]
|
||||
|
||||
@@ -25,13 +25,17 @@ use sp_runtime::traits::MaybeDisplay;
|
||||
pub use pallet_transaction_payment::{FeeDetails, InclusionFee, RuntimeDispatchInfo};
|
||||
|
||||
sp_api::decl_runtime_apis! {
|
||||
#[api_version(2)]
|
||||
pub trait TransactionPaymentApi<Balance> where
|
||||
Balance: Codec + MaybeDisplay,
|
||||
{
|
||||
#[changed_in(2)]
|
||||
fn query_info(uxt: Block::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance, sp_weights::OldWeight>;
|
||||
fn query_info(uxt: Block::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance>;
|
||||
fn query_fee_details(uxt: Block::Extrinsic, len: u32) -> FeeDetails<Balance>;
|
||||
}
|
||||
|
||||
#[api_version(2)]
|
||||
pub trait TransactionPaymentCallApi<Balance, Call>
|
||||
where
|
||||
Balance: Codec + MaybeDisplay,
|
||||
|
||||
Reference in New Issue
Block a user