Re-add isPedantic check on storage decoding (#3471)

* Re-add isPedantic check on storage decoding

* Additional length log

* Check for existing system

* Adjust output length
This commit is contained in:
Jaco
2021-05-03 13:45:37 +02:00
committed by GitHub
parent 0283d4727b
commit b8d7c2e3e3
3 changed files with 25 additions and 33 deletions
+4 -3
View File
@@ -11,7 +11,7 @@ import { combineLatest, Observable, of } from '@polkadot/x-rxjs';
import { map, take } from '@polkadot/x-rxjs/operators';
// the order and types needs to map with the all array setup below
type ExtractedQ = [bool | null, bool | null, bool | null, Releases | null];
type ExtractedQ = [u32 | null, bool | null, bool | null, bool | null, Releases | null];
type ExtractedR = [Raw | null];
@@ -42,7 +42,7 @@ interface Constants {
const NumberMap = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'];
function mapCapabilities ({ accountIdLength }: Constants, [leasePeriodsPerSlot, slotRangeCount]: ExtractedC, [systemRefcount32, systemRefcountDual, systemRefcountTriple, stakingVersion]: ExtractedQ, [keys]: ExtractedR): Partial<DetectedTypes> {
function mapCapabilities ({ accountIdLength }: Constants, [leasePeriodsPerSlot, slotRangeCount]: ExtractedC, [systemBlockNumber, systemRefcount32, systemRefcountDual, systemRefcountTriple, stakingVersion]: ExtractedQ, [keys]: ExtractedR): Partial<DetectedTypes> {
const types: Partial<DetectedTypes> = {};
// AccountInfo
@@ -50,7 +50,7 @@ function mapCapabilities ({ accountIdLength }: Constants, [leasePeriodsPerSlot,
types.AccountInfo = 'AccountInfoWithTripleRefCount';
} else if (systemRefcountDual && systemRefcountDual.isTrue) {
types.AccountInfo = 'AccountInfoWithDualRefCount';
} else {
} else if (systemBlockNumber && !systemBlockNumber.isEmpty) {
types.AccountInfo = 'AccountInfoWithRefCount';
if (!systemRefcount32 || systemRefcount32.isFalse) {
@@ -139,6 +139,7 @@ export function detectedCapabilities (api: ApiInterfaceRx, blockHash?: Uint8Arra
api.consts.auctions?.slotRangeCount
]);
const queries = filterEntries([
api.query.system?.number,
api.query.system?.upgradedToU32RefCount,
api.query.system?.upgradedToDualRefCount,
api.query.system?.upgradedToTripleRefCount,