diff --git a/packages/types/src/interfaces/payment/definitions.ts b/packages/types/src/interfaces/payment/definitions.ts index a341c1dcab..6afca90250 100644 --- a/packages/types/src/interfaces/payment/definitions.ts +++ b/packages/types/src/interfaces/payment/definitions.ts @@ -29,6 +29,13 @@ export default { partialFee: 'Balance' }, RuntimeDispatchInfoV1: { + // NOTE: Generally we always point high -> low, however in this case we do have some _potential_ + // discrepancies where some nodes may not return the correct RPC responses. Basically any node that + // is on WeightV2 and does not yet include https://github.com/paritytech/substrate/pull/12633 would + // have unparsable results. So effectively this makes the API not fail in those cases, however it + // will create "some" chaos on the side of the users who does expect the correct response. + // TL:DR Somebody _will_ still break since in cases where the RPCs are "between fixes" + __fallback: 'RuntimeDispatchInfoV2', weight: 'WeightV1', class: 'DispatchClass', partialFee: 'Balance' diff --git a/packages/types/src/interfaces/payment/runtime.ts b/packages/types/src/interfaces/payment/runtime.ts index 3509437a94..c75da9b643 100644 --- a/packages/types/src/interfaces/payment/runtime.ts +++ b/packages/types/src/interfaces/payment/runtime.ts @@ -74,10 +74,11 @@ export const runtime: DefinitionsCall = { type: 'u32' } ], - // NOTE: _Should_ be V1 (as per current Substrate), however the interface was changed mid-flight between - // versions. So we have some of each depending on runtime. (We do detect the weight type, so correct) - // type: 'RuntimeDispatchInfoV1' - type: 'RuntimeDispatchInfo' + // NOTE: For some versions of the runtime which have not been corrected, there _could_ be a + // wrong reponse returned, i.e. RuntimeDispatchInfoV2. (See the comment applying to both + // RPC and state_call in definitions -> RuntimeDispatchInfoV1 for the fallbacks) + // TL;DR This is correct based on Substrate, but _may_ yield fallbacks on certain runtimes + type: 'RuntimeDispatchInfoV1' } }, V1_V2_SHARED_PAY), version: 1 @@ -117,10 +118,9 @@ export const runtime: DefinitionsCall = { type: 'u32' } ], - // NOTE: _Should_ be V1 (as per current Substrate), however the interface was changed mid-flight between - // versions. So we have some of each depending on runtime. (We do detect the weight type, so correct) - // type: 'RuntimeDispatchInfoV1' - type: 'RuntimeDispatchInfo' + // NOTE: As per the above comment, the below is correct according to Substrate, but + // _may_ yield fallback decoding on some versions of the runtime + type: 'RuntimeDispatchInfoV1' } }, V1_V2_SHARED_CALL), version: 1