Skip to content
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

The use of metadataRpc and possible reduction of size #111

Closed
will-yjn opened this issue Jul 5, 2021 · 14 comments · Fixed by #224
Closed

The use of metadataRpc and possible reduction of size #111

will-yjn opened this issue Jul 5, 2021 · 14 comments · Fixed by #224

Comments

@will-yjn
Copy link

will-yjn commented Jul 5, 2021

Hello there,

Our signing device is isolated and stateless. So currently we pass metadataRpc to it every time we sign a transaction. The metadataRpc is approximately 300k in size and it is inconvenient. Can you point out where in your library you utilize metadataRpc for signing transactions?

We would like to reduce the size of metadataRpc passed into the signing device, possibly eliminate it.

@emostov
Copy link
Contributor

emostov commented Jul 5, 2021

@TarikGul we should explore just using the call metadata. We can have a function the pulls out the call metadata and just returns a hex string which can then be passed to the offline device

@TarikGul
Copy link
Member

TarikGul commented Jul 5, 2021

@emostov Sounds good. What do you mean by call metadata?

@emostov
Copy link
Contributor

emostov commented Jul 5, 2021

Just the calls for each pallet; no errors, events, or storage items.

@will-yjn
Copy link
Author

will-yjn commented Jul 7, 2021

With txwrapper-core, I signed a transaction using metadataRpc at blockhash "0x11eb8502ff2369538b4bf3ef9a6fe2732db93ff8a83ba7134553f185824596f2" where specVersion is '11' and transactionVersion '0'. I have successfully broadcasted it. Does this mean that the calls or the parts relevant to transaction signature in the "Balances" module have not changed?

@TarikGul
Copy link
Member

@will-yijinin Yup exactly!

@anhcao142
Copy link

I have problems with big metadataRpc too, hope we can have a solution

@TarikGul
Copy link
Member

@anhcao142 Hey! Yea currently looking into ways to improve the metadata calls.

@codemaster101
Copy link

Hi @TarikGul is there any update on this. With the metadata, the file supplied to our offline device exceeds 0.5 MB, which is extremely large. The amount of data we store on the QR code, with respect to the QR codes size generates over 200 QR codes!
Unsure how much the size is reduced, (we estimate around 25%) after adding asCallsOnly, as we feel that the data being sent might not be that relevant to creating the transaction as is?

Would be great if any other solution can be found or suggested in this regard?

-rw-rw-r--  1 515118 Apr 20 15:52 polk2.json

reduced to

-rw-rw-r--  1 437415 May  5 13:56 11488_hex_string_dot.json

@TarikGul
Copy link
Member

TarikGul commented May 5, 2022

Yea this has been something on my mind for a bit, but not necessarily a priority (More than happy to make it one for txwrapper-core and get the ball rolling on this for a more optimal solution though). You are absolutely correct most of the data included in the metadata is not absolutely necessary to construct the transaction. More or less its just the implementation that we currently use for whats available.

I will put some emphasis on moving forward with this though. My idea was to potential contribute to polkadot-js and add a asSingleCall getter attached to the Metadata type.

@TarikGul
Copy link
Member

@codemaster101 The following PR above, drastically reduces the size of the metadata. Once it goes in I will give you a ping.

@codemaster101
Copy link

Thanks a lot @TarikGul

@TarikGul
Copy link
Member

@codemaster101 PR is in, checkout this example, on how to generate the stripped metadata, and registry. The release should be out sometime today - tomorrow.

@codemaster101
Copy link

Thanks @TarikGul btw we must use both balances and system as the params for metadata generator right?

@TarikGul
Copy link
Member

TarikGul commented Jun 2, 2022

Yea, you can technically get away without using system but it's recommended to use it as some calls will not decode without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants