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

enum Pays for PaysFee #5733

Merged
merged 4 commits into from
Apr 22, 2020
Merged

enum Pays for PaysFee #5733

merged 4 commits into from
Apr 22, 2020

Conversation

kianenigma
Copy link
Contributor

@kianenigma kianenigma commented Apr 22, 2020

small follow up for #5686

  • enum Pays to be more clear with payment.
  • expose maximum block weight and length as const so that UI can show them.

@@ -1630,7 +1630,7 @@ fn cannot_self_destruct_in_constructor() {
#[test]
fn check_block_gas_limit_works() {
ExtBuilder::default().block_gas_limit(50).build().execute_with(|| {
let info = DispatchInfo { weight: 100, class: DispatchClass::Normal, pays_fee: true };
let info = DispatchInfo { weight: 100, class: DispatchClass::Normal, pays_fee: Pays::Yes };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So except for the high level bin/node/executor tests, I will keep this assertions explicit intentionally, instead of doing Default::default() which is unclear and flaky.

@shawntabrizi
Copy link
Member

Is it actually more clear though? I don't yet see the advantage, unless we expect there to be another option besides yes and no :)

@kianenigma
Copy link
Contributor Author

honestly I can't think of a third option now. I was recommended to do this by @bkchr and to me it just made sense as an assurance and being more explicit.

@bkchr
Copy link
Member

bkchr commented Apr 22, 2020

Is it actually more clear though? I don't yet see the advantage, unless we expect there to be another option besides yes and no :)

The point is, if you read the code you will directly understand what this parameter means, without opening the docs and find the place where this is documented.

@bkchr bkchr merged commit 8bcc42c into master Apr 22, 2020
@bkchr bkchr deleted the kiz-revamp-weight-infra-more branch April 22, 2020 13:50
@maciejhirsz
Copy link
Contributor

FYI, this is a backwards incompatible change in the way this is encoded in SCALE for non-Rust clients. Where previously true encoded as 1 and false encoded as 0, the enum discriminant values default to integer values in order, which makes Yes encode as 0 and No encode as 1.

@jacogr
Copy link
Contributor

jacogr commented May 12, 2020

@maciejhirsz Thanks for picking this up. Yeap, the API decoding broken with this, so will have to do an update.

@shawntabrizi
Copy link
Member

@maciejhirsz @jacogr does it make sense to just flip the order of the enum here?

@kianenigma

@bkchr
Copy link
Member

bkchr commented May 12, 2020

This is already deployed on Kusama, so no.

@AurevoirXavier
Copy link
Contributor

@maciejhirsz @jacogr does it make sense to just flip the order of the enum here?

@kianenigma

OMG, I debug this for a whole afternoon.

sorpaas pushed a commit that referenced this pull request Nov 20, 2020
* enum Pays for PaysFee

* Fix doc test

* Update bin/node/executor/tests/basic.rs

* Update bin/node/executor/tests/basic.rs
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants