-
Notifications
You must be signed in to change notification settings - Fork 119
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
[x/programs] Support key deletion #737
Conversation
432f624
to
dd4fed7
Compare
wasmlanche_sdk: update state module import - add delete function imports/pstate: add delete function
This function is using the new delete function being available from the state import module
dd4fed7
to
ce0469d
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.
Hey @najeal, thanks for the PR!
We're starting to get a little more strict with reviews here, so I apologize if you followed an existing pattern and I asked you to change something.
The change requests should be simple enough, though!
Feel free to let me know if you have any questions.
x/programs/examples/token_test.go
Outdated
// check balance of alice | ||
result, err = rt.Call(ctx, "get_balance", programIDPtr, alicePtr) | ||
require.NoError(err) | ||
require.Equal(int64(0), result[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.
🤔, this test doesn't guarantee that the behaviour is as intended. We should check the state and ensure the key is no longer there.
delete function returns -1 when removing key from state fails
Access state db to verify key has been deleted after calling burn_from function
require: None, | ||
}, owner_key) | ||
.expect("failed to burn alice tokens"); | ||
assert_eq!(resp.error, None); |
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.
👍
@najeal, looks like you need to run |
@najeal, can you mention me in a comment if I forget about this? Everything looks good, we just need CI to pass |
@richardpringle CI passed 🙂 |
This PR does the following:
It enhances
state
import module and usage addingdelete
function to delete keys from the State.It updates the Token example to use the
delete
function throught a new public program functionburn_from
.Closes #590