3

I got through a lot of documentation and official examples, but I still cannot understand how you estimate what precisely the values should be when implementing a given pallet's Config (i.e. pallet_assets::Config) for a Runtime.

Example below:

impl pallet_assets::Config for Runtime {
    type RuntimeEvent = ();
    type Balance = ();
    type RemoveItemsLimit = ();
    type AssetId = ();
    type AssetIdParameter = ();
    type Currency = ();
    type CreateOrigin = ();
    type ForceOrigin = ();
    type AssetDeposit = ();
    type AssetAccountDeposit = ();
    type MetadataDepositBase = ();
    type MetadataDepositPerByte = ();
    type ApprovalDeposit = ();
    type StringLimit = ();
    type Freezer = ();
    type Extra = ();
    type CallbackHandle = ();
    type WeightInfo = ();
}

So far I've been using LLM, Google, and other people's repositories in GitHub to find out what's needed for the concrete types, but that's really not a good approach.

Can you please let me know what's the better way of doing this?

2 Answers 2

2

It is not really about "estimation" about most of these types! I think the general thing that is lacking here is documentation and a fundamental understanding of what Config and all these types are meaning. If you take a look at the docs of Config you will see a lot of these types are being explained. However, I can understand that even these explanations are not understandable for a newcomer. It is being worked on to make it easier for people to get a reasonable and secure default config relative easy.

type AssetDeposit = ();
type AssetAccountDeposit = ();
type MetadataDepositBase = ();
type MetadataDepositPerByte = ();
type ApprovalDeposit = ();
type StringLimit = ();

The first five are deposits that will get reserved in the user account for different kind of operations. The docs tell you when they are reserved.

The StringLimit is the maximum length of a symbol that you can store for an asset.

Stuff like

   type CreateOrigin = ();
   type ForceOrigin = ();

are the origins that are allowed to create an asset or to force create an asset. While force creation is should be something that is only allowed for "special" origins as it gets more configuration possibilities.

Things like RuntimeEvents (and most of the other stuff that is prefixed with "Runtime") requires you to pass the type that is being generated by construct_runtime! in your runtime. In your case here it would be type RuntimeEvents = RuntimeEvents;.

Otherwise you can take a look at the configuration of Statemine or other chains: https://github.com/paritytech/cumulus/blob/9b4e0247137f158d1a35118197d34adfa58858b7/parachains/runtimes/assets/statemine/src/lib.rs#L238-L259

1
  • thank you, I appreciate your time and effort to write this
    – munificent
    May 3, 2023 at 8:31
1

It's arbitrary.

You'd better start from the node-template's parameters.

https://github.com/substrate-developer-hub/substrate-node-template

Or you can take a look at the Polkadot/Kusama's.

https://github.com/paritytech/polkadot/tree/master/runtime

After that, you can try adjusting these parameters yourself to adapt your chain/network.

1
  • hey @AurevoirXavier, can you please elaborate a bit more on your answer, if you have time ofc 😅 seems really arbitrary for me, and I've already gone through the substrate-node-template, what should I be looking for specifically in the polkadot repo and how did you first approach this initially?
    – munificent
    May 3, 2023 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.