-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: add manual initial storage slots #441
Conversation
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.
Use already existing functions for storage slots, and make the storage slot vec non mandatory for vanilla deployment
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 think you removed too many things
EDIT: thought I had received a review request, mb sry
#[tokio::test] | ||
// ANCHOR: deploy_with_salt | ||
async fn deploy_with_salt() -> Result<(), Error> { | ||
// ANCHOR: deploy_with_parameters |
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 think you removed a commit by mistake
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.
After some changes the test in examples
turned out to be the same as the one in harness
. I moved the ANCHOR tags to harness
and removed the example.
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.
LGTM, nice work on the API!
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.
Closes #86
This PR enables manual initialization of storage slots via the SDK.
deploy
anddeploy_with_salt()
now accept aVec<StorageSlot>
which is used to calculate the contract_id on the SDK side and forwarded via the contract deployment transaction.I have discussed multiple options for the UI with @digorithm. The conclusion is that the above approach creates the least amount of cognitive load for the user, i.e. they don't have to remember another workflow.
Since
StorageSlot
requires the user to convert key/value toBytes32
I thought it would be convenient to provide a helper to create a slot from a generic key-value pair.create_storage_slot
uses unsafe Rust and panics if key/value is larger than 32 byte since this is their limit as stated in the specs.