-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add set_code_hash
to EnvAccess
#1698
Conversation
🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑
These are the results when building the
Link to the run | Last update: Thu Mar 2 13:59:11 CET 2023 |
Codecov Report
@@ Coverage Diff @@
## master #1698 +/- ##
==========================================
+ Coverage 70.72% 70.82% +0.10%
==========================================
Files 205 205
Lines 6409 6407 -2
==========================================
+ Hits 4533 4538 +5
+ Misses 1876 1869 -7
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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 like having Hash
instead of [u8; 32]
, but changing the env/api
function signature would require a MAJOR
version bump.
It's too early in the life of 4.0 to start keeping release branches around so that master
can contain breaking changes like this.
While it would be fine to add the function with the new signature to EnvAccess
, I'd add it with the old signature ([u8; 32]
) for consistency.
You're right, didn't consider that. I wonder if there is a compromise using |
Adding a Therefore I have gone with adding a |
crates/env/src/api.rs
Outdated
@@ -701,6 +701,106 @@ pub fn set_code_hash(code_hash: &[u8; 32]) -> Result<()> { | |||
<EnvInstance as OnInstance>::on_instance(|instance| instance.set_code_hash(code_hash)) | |||
} | |||
|
|||
/// **New version of this function which will replace [`set_code_hash`] in `v5.0`** |
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.
Can you create a follow-up ticket for removing the comment and renaming the function? Can also add the Hernando wishlist there:
I like having
Hash
instead of[u8; 32]
, but changing theenv/api
function signature would require aMAJOR
version bump.
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.
Clarification of the comment please, besides that LGTM.
Oh, and CHANGELOG.md
:-).
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.
Thanks, much cleaner!
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.
Thanks 👌
set_code_hash2
which accepts theHash
environment type instead of concrete[u8; 32]
to match other methods which handle code hashes.EnvAccess
to allow callingself.env.set_code_hash(&code_hash)
, which callsset_code_hash2
.set_code_hash
impl, which will be replaced by theset_code_hash2
impl in the next MAJOR release