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

(state breaking) make get set in unorderedmap more efficient #212

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

ailisp
Copy link
Member

@ailisp ailisp commented Sep 9, 2022

This is a state breaking change, addresses #107, inspired by @austinabell 's suggestions

I assume developers contract using unorderedmap is still in testnet / no production users and safe to clear the state to use the state breaking change. If this is not the case, then you can use the following strategy to upgrade state:

  1. write a one-method contract with old near-sdk-js, iterate and get all key-value pairs in your unordered map
  2. clear states that are prefixed by the old unordered map prefix
  3. write a one-method temp contract with new near-sdk-js, add a method to add all (key, value) to the new unordered map
  4. remove the temp contract, build your contract with new-sdk-js and deploy!

Copy link
Collaborator

@volovyks volovyks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice simplification!

@volovyks volovyks merged commit 91dec29 into develop Sep 9, 2022
@ailisp ailisp deleted the new-unordered-map branch September 9, 2022 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants