1

I am trying to understand how to make modifications to the WeightToFee implementation after updating our decimal places by looking at how Polkadot and Rococo differ.

Rococos decimal places are set to 10e12 here and Polkadots decimal places are set to 10e10 here.

Given that they have different decimal places, I expected their WeightToFeePolynomial implementation to differ slightly. However, they are both the same. Why?

Questions:

  1. Can you please provide clarity on the following comment left here?

// in Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:

For example, what does the "smallest non-zero weight" mean? And how is it that both Rococo and Polkadot are mapped to 1/10 CENT when their decimal places are different?

  1. how is it that in Polkadot the "extrinsic base weight is mapped 1/10 of a cent"? They appear equivalent.

Below the extrinsic base weight does not look like it maps to 1/10 of a cent. Maybe I am misunderstanding the comment?

CENTS = 100_000_000
extrinsic_base_weight = 1_000 * 85_212 = 85_212_000 ~ 100_000_000
  1. Why is Rococo and Polkadot's implementation of WeightToFeePolynomial the same when they both have different decimal places?
1
  • 1
    It feels like this question and this question should be merged in some way. If you have received two answers here which gave you different information, then you can leave these open and mark the answers as correct, otherwise, I would suggest you make the question more different and specific in what you are trying to specifically overcome.
    – Shawn Tabrizi
    Oct 8, 2022 at 5:00

1 Answer 1

0

1/10 Cent is just an abstraction. It does not make any implications about the number of decimals. Have a look at how their are defined in the test-runtime as compared to Polkadot:

// test-runtime
pub const DOTS: Balance = 1_000_000_000_000;
pub const DOLLARS: Balance = DOTS;
pub const CENTS: Balance = DOLLARS / 100;
pub const MILLICENTS: Balance = CENTS / 1_000;

// Polkadot
pub const UNITS: Balance = 10_000_000_000;
pub const DOLLARS: Balance = UNITS; // 10_000_000_000
pub const CENTS: Balance = DOLLARS / 100; // 100_000_000
pub const MILLICENTS: Balance = CENTS / 1_000; // 100_000

You can see that the concrete value of a CENTS is different. I both cases a CENTS is assumed to be DOLLARS/100. The definitions of CENTS and DOLLARS are meant to help humans understand them.
You can define own constants in your chain if you think that is confusing.

The smallest weight is normally ExtrinsicBaseWeight.

3
  • How is it that the extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT? Are the following calculation correct: Polkadots ExtrinsicBaseWeight can be found here CENTS = 100_000_000 extrinsic_base_weight = 1_000 * 85_212 = 85_212_000 ~ 100_000_000
    – Yatusabes
    Oct 7, 2022 at 14:55
  • I updated the question because it is so hard to read the code that I left here.
    – Yatusabes
    Oct 7, 2022 at 15:41
  • Hey, I think I accidentally downvoted your answer. Can you please make an edit so I can regain the ability to upvote?
    – Yatusabes
    Oct 10, 2022 at 16:11

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.