-
Notifications
You must be signed in to change notification settings - Fork 251
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
[2.0.0] feat: LookupMap and LookupSet #217
Conversation
Are we making this a minor version update? Seems like one could argue it's a major version update due to backwards-incompatible changes |
Good point. But it's also somewhat backward compatible, assuming these are deprecations. Like |
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.
Looks good overall. @chefsale this PR contains breaking changes, how do we pipe them into https://github.com/nearprotocol/near-ops/issues/123 ?
Going to change version to |
{ | ||
fn default() -> Self { | ||
Self::new(next_trie_id()) | ||
Self { id, key, lft: None, rgt: None, ht: 1 } |
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.
Maybe left, right and height would be more readable?
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.
Yep. Bad naming.
1.1.0
Contract changes
status-message-collections
to useLookupMap
fungible-token
implementation to useLookupMap
. It changes storage layout.API changes
LookupMap
andLookupSet
that are faster implementations ofUnorderedMap
andUnorderedSet
, but without support for iterators.Most read/lookup/write are done in 1 storage access instead of 2 or 3 for
Unordered*
implementations.Default
is removed fromnear_sdk::collections
to avoid implicit state conflicts.Collections should be initialized by explicitly specifying prefix using
new
method.TreeMap
implementation was updated to useLookupMap
.Previous
TreeMap
implementation was renamed toLegacyTreeMap
and was deprecated.It should only be used if the contract was already deployed and state has to be compatible with the previous implementation.