-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Proposal: Defensive trait for infallible frame operations #10626
Conversation
I've thought about something similar a few times, really like this idea! 👍 |
This makes sense to me and I think it would improve ergonomics, at least with the style of code I have gotten used to writing the last few months. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me, and I would have a hard time seeing how this is something we would not want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit unsure about the naming (what does defensive
really mean in such a context? conservative
?) but the idea makes sense.
bot merge |
bot merge |
Error: Github API says #10626 is not mergeable |
bot merge |
Error: Github API says #10626 is not mergeable |
Leave it be; @paritytech-processbot is stubborn. |
main reason is that I am on a weak Wifi and a consequence of that seems to be github send my comments multiple times :/ |
* add a blueprint of how defensive traits could look like * add something for arithmetic as well * add some use cases in different pallets * some build fixing * Some new stuff and examples * Fix deadly bug * add more doc. * undo faulty change to assets pallet * Update frame/support/src/traits/misc.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * some review comments * remove draft comment * Fix ident test * Fix proxy tests as well * a few new ideas * Fix build * Fix doc Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
…#10626) * add a blueprint of how defensive traits could look like * add something for arithmetic as well * add some use cases in different pallets * some build fixing * Some new stuff and examples * Fix deadly bug * add more doc. * undo faulty change to assets pallet * Update frame/support/src/traits/misc.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * some review comments * remove draft comment * Fix ident test * Fix proxy tests as well * a few new ideas * Fix build * Fix doc Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
…#10626) * add a blueprint of how defensive traits could look like * add something for arithmetic as well * add some use cases in different pallets * some build fixing * Some new stuff and examples * Fix deadly bug * add more doc. * undo faulty change to assets pallet * Update frame/support/src/traits/misc.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * some review comments * remove draft comment * Fix ident test * Fix proxy tests as well * a few new ideas * Fix build * Fix doc Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
…#10626) * add a blueprint of how defensive traits could look like * add something for arithmetic as well * add some use cases in different pallets * some build fixing * Some new stuff and examples * Fix deadly bug * add more doc. * undo faulty change to assets pallet * Update frame/support/src/traits/misc.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * some review comments * remove draft comment * Fix ident test * Fix proxy tests as well * a few new ideas * Fix build * Fix doc Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
I've had this idea for a while and we've also talked about it internally.
Most ideas pointed to a rather more complicated implementation where you would also flip some storage item that could easily be monitored if any of these operations happened.
This is my quicker and simpler version, to begin with.
I am marking this as draft, as I am not sure if the direction makes all stake holders happy or not: @paritytech/frame-coders. If we want this, then I will scan the runtime and find use cases. I have already counted a few dozens of instances where the defensive-arithmetic could be used.