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

Add dedicated FeePolynomial struct #13612

Merged
merged 8 commits into from
Mar 15, 2023
Merged

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Mar 15, 2023

Zero logic refactor as preparation for paritytech/cumulus#2326.
Changes:

  • add Weight::{without_ref_time, without_proof_size}.
  • Add a FeePolynomial to properly type the weight polynomial coefficients in a OOP manner to reusability downstream.

Eventually the WeightToFeePolynomial should be two dimensional, but i want to keep this MR minimal for now.

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez ggwpez added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Mar 15, 2023
}

/// Return self but discard any proof size.
pub const fn without_proof_size(&self) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these 2 functions needed?

Copy link
Member Author

@ggwpez ggwpez Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are just convenience in cases where we want to selectively exclude specific dimensions. Currently there are only two, so it is a bit boring.
I am using them in a test as short-cut for set_proof_size(0) (arguably useful).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is ever useful, but actually very dangerous.

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez ggwpez requested a review from KiChjang March 15, 2023 19:19
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez
Copy link
Member Author

ggwpez commented Mar 15, 2023

bot merge

@paritytech-processbot
Copy link

Waiting for commit status.

@paritytech-processbot paritytech-processbot bot merged commit 8b5306e into master Mar 15, 2023
@paritytech-processbot paritytech-processbot bot deleted the oty-charge-proof-size branch March 15, 2023 20:43
breathx pushed a commit to gear-tech/substrate that referenced this pull request Apr 22, 2023
* Add FeePolynomial struct

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Add Weight::without_{ref_time, proof_size}

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Docs

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Cleanup code

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Add docs

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* doc

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Fix docs

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* docs

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
nathanwhit pushed a commit to nathanwhit/substrate that referenced this pull request Jul 19, 2023
* Add FeePolynomial struct

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Add Weight::without_{ref_time, proof_size}

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Docs

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Cleanup code

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Add docs

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* doc

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* Fix docs

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

* docs

Signed-off-by: Oliver Tale-Yazdi <[email protected]>

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants