Skip to content
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

Swingset Keeper SetStorage can orphan child keys #5381

Closed
gibson042 opened this issue May 17, 2022 · 0 comments · Fixed by #5394
Closed

Swingset Keeper SetStorage can orphan child keys #5381

gibson042 opened this issue May 17, 2022 · 0 comments · Fixed by #5394
Assignees
Labels
bug Something isn't working cosmic-swingset package: cosmic-swingset

Comments

@gibson042
Copy link
Member

Describe the bug

Setting the value of an IAVL key to the empty string deletes it, resulting in subsequent absence from "keys" results even if the key itself has children.

To Reproduce

It is not yet possible to manipulate arbitrary IAVL data, but this is the sequence of steps to expose the bug:

  1. Set data for key "foo.bar.baz" to a nonempty value, e.g. "qux".
  2. Observe that the results of RPC call Keys for key "foo" include "bar", and that the results of RPC call Keys for key "foo.bar" include "baz".
  3. Observe that the results of RPC call Storage for key "foo.bar.baz" are value "qux".
  4. Set the data for key "foo.bar" to empty.
  5. Observe that the results of RPC call Keys for key "foo" include "bar".
  6. Observe that the results of RPC call Storage for key "foo.bar.baz" are still value "qux" (i.e., that key "foo.bar.baz" still exists and has data even though it is not reported by RPC call Keys for key "foo.bar").

Expected behavior

Given the unusual behavior that setting a key's data to empty is treated as deletion, attempting such an operation on a key that has children should either a) fail or b) leave the key present under its parent. I'm inclined towards option b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cosmic-swingset package: cosmic-swingset
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants