-
Notifications
You must be signed in to change notification settings - Fork 254
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
CLI Tool: Strip metadata to only include certain pallets #629
Comments
Ah, I hit a snag having a go at stripping metadata to only include certain pallets. Well, two things:
My options:
I'm tempted to just leave it be with 4 for now, since 1 is easy but has marginal gains and the others are rather fiddly and is all work that will need duplicating when V15 comes along. Perhaps this is something that should exist in Substrate, anyway? |
For One way to do it that comes to mind would be to rebuild a new
I think that is feasible to do, and even involves a fun programming problem. But obviously extra effort compared to "doing nothing" in
Possibly, e.g. supply a list of pallets to |
I like the Substrate approach personally. Another benefit of implementing stripping there, aside from the bandwidth savings, is that it only needs to be implemented once, rather than reimplemented on the periphery in various tools (like sidecar and subxt) that want to strip it. This matters too when we update to V15 and V16 etc; feels nicer to keep the work done in one place if possible. |
paritytech/substrate#12370 Was a suggestion/PR to add this to Substrate, so that can be tracked there. Failing that, The options I think are:
|
I created a POC in subxt to gather some data regarding a single pallet metadata (here). To achieve this, the code recursively examines all type IDs required to represent a pallet. Pallet Type IDs OnlyThe first number indicates the number of type IDs necessary to describe the pallet, relative to the total number of type IDs in the PortableRegistry. Stripped 0 vs full 756 for pallet [Historical]
Stripped 3 vs full 756 for pallet [Authorship]
Stripped 3 vs full 756 for pallet [RootTesting]
Stripped 4 vs full 756 for pallet [Mmr]
Stripped 4 vs full 756 for pallet [Timestamp]
Stripped 5 vs full 756 for pallet [RandomnessCollectiveFlip]
Stripped 6 vs full 756 for pallet [AuthorityDiscovery]
Stripped 7 vs full 756 for pallet [AssetTxPayment]
Stripped 7 vs full 756 for pallet [TransactionPayment]
Stripped 8 vs full 756 for pallet [Remark]
Stripped 9 vs full 756 for pallet [Glutton]
Stripped 9 vs full 756 for pallet [Pov]
Stripped 13 vs full 756 for pallet [TechnicalMembership]
Stripped 14 vs full 756 for pallet [Indices]
Stripped 15 vs full 756 for pallet [TransactionStorage]
Stripped 16 vs full 756 for pallet [Preimage]
Stripped 16 vs full 756 for pallet [StateTrieMigration]
Stripped 16 vs full 756 for pallet [Vesting]
Stripped 17 vs full 756 for pallet [ChildBounties]
Stripped 17 vs full 756 for pallet [Offences]
Stripped 17 vs full 756 for pallet [VoterList]
Stripped 20 vs full 756 for pallet [Bounties]
Stripped 20 vs full 756 for pallet [MessageQueue]
Stripped 20 vs full 756 for pallet [RankedCollective]
Stripped 20 vs full 756 for pallet [Tips]
Stripped 20 vs full 756 for pallet [Treasury]
Stripped 22 vs full 756 for pallet [Elections]
Stripped 22 vs full 756 for pallet [FastUnstake]
Stripped 23 vs full 756 for pallet [Session]
Stripped 24 vs full 756 for pallet [Assets]
Stripped 24 vs full 756 for pallet [Balances]
Stripped 27 vs full 756 for pallet [Society]
Stripped 29 vs full 756 for pallet [ConvictionVoting]
Stripped 29 vs full 756 for pallet [Nis]
Stripped 31 vs full 756 for pallet [Grandpa]
Stripped 33 vs full 756 for pallet [Uniques]
Stripped 36 vs full 756 for pallet [Contracts]
Stripped 36 vs full 756 for pallet [ImOnline]
Stripped 41 vs full 756 for pallet [Babe]
Stripped 41 vs full 756 for pallet [NominationPools]
Stripped 56 vs full 756 for pallet [Staking]
Stripped 68 vs full 756 for pallet [Identity]
Stripped 78 vs full 756 for pallet [Nfts]
Stripped 91 vs full 756 for pallet [ElectionProviderMultiPhase]
Stripped 314 vs full 756 for pallet [Recovery]
Stripped 316 vs full 756 for pallet [Lottery]
Stripped 317 vs full 756 for pallet [Alliance]
Stripped 317 vs full 756 for pallet [Sudo]
Stripped 317 vs full 756 for pallet [Utility]
Stripped 320 vs full 756 for pallet [AllianceMotion]
Stripped 320 vs full 756 for pallet [Council]
Stripped 320 vs full 756 for pallet [Multisig]
Stripped 320 vs full 756 for pallet [TechnicalCommittee]
Stripped 321 vs full 756 for pallet [Whitelist]
Stripped 322 vs full 756 for pallet [Scheduler]
Stripped 325 vs full 756 for pallet [Proxy]
Stripped 327 vs full 756 for pallet [Democracy]
Stripped 328 vs full 756 for pallet [RankedPolls]
Stripped 329 vs full 756 for pallet [Referenda]
Stripped 417 vs full 756 for pallet [System] Full Metadata for a Pallet Including Extrinsic and Runtime Type IDsThis complete metadata contains all the necessary type IDs for working with a single pallet and can be utilized in Subxt, among other things. Stripped 321 vs full 756 for pallet [Authorship]
Stripped 321 vs full 756 for pallet [Historical]
Stripped 321 vs full 756 for pallet [Mmr]
Stripped 321 vs full 756 for pallet [RootTesting]
Stripped 321 vs full 756 for pallet [Timestamp]
Stripped 322 vs full 756 for pallet [AssetTxPayment]
Stripped 323 vs full 756 for pallet [AuthorityDiscovery]
Stripped 323 vs full 756 for pallet [RandomnessCollectiveFlip]
Stripped 323 vs full 756 for pallet [Remark]
Stripped 324 vs full 756 for pallet [Glutton]
Stripped 324 vs full 756 for pallet [Indices]
Stripped 324 vs full 756 for pallet [Pov]
Stripped 324 vs full 756 for pallet [StateTrieMigration]
Stripped 324 vs full 756 for pallet [TechnicalMembership]
Stripped 324 vs full 756 for pallet [Tips]
Stripped 324 vs full 756 for pallet [TransactionPayment]
Stripped 326 vs full 756 for pallet [ChildBounties]
Stripped 326 vs full 756 for pallet [Elections]
Stripped 326 vs full 756 for pallet [TransactionStorage]
Stripped 326 vs full 756 for pallet [Vesting]
Stripped 327 vs full 756 for pallet [Preimage]
Stripped 327 vs full 756 for pallet [Recovery]
Stripped 327 vs full 756 for pallet [Session]
Stripped 327 vs full 756 for pallet [Treasury]
Stripped 327 vs full 756 for pallet [VoterList]
Stripped 328 vs full 756 for pallet [Bounties]
Stripped 328 vs full 756 for pallet [Grandpa]
Stripped 329 vs full 756 for pallet [Lottery]
Stripped 329 vs full 756 for pallet [Offences]
Stripped 329 vs full 756 for pallet [Sudo]
Stripped 329 vs full 756 for pallet [Utility]
Stripped 330 vs full 756 for pallet [Alliance]
Stripped 330 vs full 756 for pallet [MessageQueue]
Stripped 330 vs full 756 for pallet [RankedCollective]
Stripped 331 vs full 756 for pallet [Assets]
Stripped 332 vs full 756 for pallet [AllianceMotion]
Stripped 332 vs full 756 for pallet [Balances]
Stripped 332 vs full 756 for pallet [Council]
Stripped 332 vs full 756 for pallet [FastUnstake]
Stripped 332 vs full 756 for pallet [Multisig]
Stripped 332 vs full 756 for pallet [TechnicalCommittee]
Stripped 332 vs full 756 for pallet [Uniques]
Stripped 333 vs full 756 for pallet [Identity]
Stripped 333 vs full 756 for pallet [Society]
Stripped 333 vs full 756 for pallet [Whitelist]
Stripped 334 vs full 756 for pallet [Nis]
Stripped 334 vs full 756 for pallet [Scheduler]
Stripped 335 vs full 756 for pallet [ConvictionVoting]
Stripped 336 vs full 756 for pallet [Contracts]
Stripped 336 vs full 756 for pallet [ElectionProviderMultiPhase]
Stripped 336 vs full 756 for pallet [ImOnline]
Stripped 337 vs full 756 for pallet [Babe]
Stripped 337 vs full 756 for pallet [Proxy]
Stripped 340 vs full 756 for pallet [Democracy]
Stripped 341 vs full 756 for pallet [NominationPools]
Stripped 341 vs full 756 for pallet [RankedPolls]
Stripped 342 vs full 756 for pallet [Referenda]
Stripped 347 vs full 756 for pallet [Nfts]
Stripped 349 vs full 756 for pallet [Staking]
Stripped 429 vs full 756 for pallet [System] ConclusionBy removing unnecessary information from the metadata, we can create a smaller metadata binary that other teams can use specifically for working with one pallet. Based on the previous calculations, this approach may result in a metadata binary that is roughly half the size of the original. As such, it may be worthwhile to explore this option further. |
A common use case of Subxt is to generate client logic to talk to specific pallets.
Currently the CLI tool downloads the entirety of the metadata from a node.
It'd be nice if we could instruct the client to strip metadata (either direct from a node or provided) to include only the information necessary for specific pallets to be called. This would allow for more compact codegen and smaller metadata files to be kept around among other things.
The text was updated successfully, but these errors were encountered: