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

asset-conversion pallet: persist a pool account id #14784

Closed
2 tasks done
muharem opened this issue Aug 17, 2023 · 4 comments
Closed
2 tasks done

asset-conversion pallet: persist a pool account id #14784

muharem opened this issue Aug 17, 2023 · 4 comments
Labels
J0-enhancement An additional feature request.

Comments

@muharem
Copy link
Contributor

muharem commented Aug 17, 2023

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Motivation

A pool account id is computed every time we need it. The computation involves a decoding which in theory might change over time (with some major updates for example).
I can not reason from the code base why should the account id should be compute every time we need it.

Solution

Compute a pool account id on a pool creation and store it in the Pools storage as PoolInfo.

@muharem muharem added the J0-enhancement An additional feature request. label Aug 17, 2023
@muharem
Copy link
Contributor Author

muharem commented Aug 17, 2023

@jsidorenko @gilescope

@gilescope
Copy link
Contributor

I like this idea as it also makes the data more easily discoverable for people/apps walking the state.

@bkchr
Copy link
Member

bkchr commented Aug 21, 2023

The computation involves a decoding which in theory might change over time (with some major updates for example).

This argument could also be used for every type that may changes and thus the decoding could fail in the future.

I can not reason from the code base why should the account id should be compute every time we need it.

We are doing this everywhere were we use an account id. The question here would be on what is faster, a storage read or doing the computation.

@muharem
Copy link
Contributor Author

muharem commented Aug 22, 2023

@bkchr agree. and accessing the storage wont be faster. my benchmarks showed pool id generation is matter of nano seconds.
but may be worth having this additional docs
#14811

@muharem muharem closed this as completed Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request.
Projects
None yet
Development

No branches or pull requests

3 participants