-
Notifications
You must be signed in to change notification settings - Fork 2.6k
contracts: Refactor trait Ext::*_storage_transparent
functions
#13600
Conversation
trait Ext::*_storage_transparent
functions
/ptal @athei |
Went for something a bit easier, to keep the trait object safe. Generics only fails because the test is using Ext as an object as you mentioned, I can look into doing what you suggested as well, if you think this is a better solution |
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.
I agree. Refactoring the tests is probably not worth it.
7ed9c97
to
2141598
Compare
@athei replied to your comments, and applied some of the suggestions. |
pushed another commit to make these methods take the substrate/frame/contracts/src/exec.rs Lines 186 to 192 in a449aa6
|
Is this enough reason to make it pass by value? Usually, when both is viable I go for reference: Passing by value makes the compiler copy the value. I know that logically it is moved but the optimizer is not smart enough to demote this to a pass by reference. Since we are passing an array the whole thing will be copied. For I am just saying: It is not really consumed. It just happens to be not being used after being passed into those functions. I think if you can pass something by reference without having to call
|
Did not know the perf implication, will try to remember that. |
Exactly |
4d2faa6
to
14372fd
Compare
@athei should be good to go, rolled back the commit that used value instead of references and remove the type aliases(kept VarSizedKey but made it private) |
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.
Looking good. Just some nits.
00615ce
to
e8de276
Compare
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.
Nice refactoring! LGTM
mmm
looks unrelated to this PR to me 🤔 |
rewrote commits, stashed the typo changes to remove some diff noise fixed my unverified email commit
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>
72cfe6f
to
90b5ca5
Compare
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.
Nice
…itytech#13600) * Refactor _transparent methods rewrote commits, stashed the typo changes to remove some diff noise fixed my unverified email commit * remove type alias * Get rid of From<Fix/VarSizedKey> impl blocks * Get rid of KeyType impl block * remove unnecessary Key export * Update frame/contracts/src/exec.rs Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * PR review comment --------- Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>
…itytech#13600) * Refactor _transparent methods rewrote commits, stashed the typo changes to remove some diff noise fixed my unverified email commit * remove type alias * Get rid of From<Fix/VarSizedKey> impl blocks * Get rid of KeyType impl block * remove unnecessary Key export * Update frame/contracts/src/exec.rs Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * PR review comment --------- Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>
fix #13594