Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

feat: storageRune.size method + sizeTree pattern #657

Merged
merged 3 commits into from
Feb 27, 2023

Conversation

harrysolovay
Copy link
Contributor

A pattern for resolving a pallet-indexed lookup of storage-entry-size lookups.

import { sizeTree } from "capi/patterns/sizeTree.ts"
import { chain } from "polkadot_dev/mod.ts"

const result = await sizeTree(chain).run()

In this example result evaluates to something along the following lines:

{
  System: {
    Account: 1040,
    ExtrinsicCount: undefined,
    BlockWeight: 11,
    AllExtrinsicsLen: undefined,
    BlockHash: 32,
    ExtrinsicData: undefined,
    Number: undefined,
    ParentHash: 32,
    Digest: undefined,
    Events: undefined,
    EventCount: undefined,
    EventTopics: undefined,
    LastRuntimeUpgrade: 11,
    UpgradedToU32RefCount: 1,
    UpgradedToTripleRefCount: 1,
    ExecutionPhase: undefined
  },
  // other pallets...
}

Will hold off on merging until #655, so that we can ensure this pattern is accessible to NodeJS consumers.

@kianenigma, is this what you had in mind? As I understand it, we could take this a step further by iterating over the keys in storage maps... but that feels marginally wrong (in the same vein as Shawn's comment here).

@harrysolovay harrysolovay changed the title feat: size tree feat: storageRune.size method + sizeTree pattern Feb 25, 2023
@harrysolovay harrysolovay marked this pull request as ready for review February 27, 2023 15:49
@harrysolovay harrysolovay requested a review from tjjfvi as a code owner February 27, 2023 15:49
@harrysolovay harrysolovay merged commit c846f1e into main Feb 27, 2023
@harrysolovay harrysolovay deleted the size-tree-pattern branch February 27, 2023 15:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants