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

[2.0.0] feat: LookupMap and LookupSet #217

Merged
merged 8 commits into from
Aug 24, 2020
Merged

[2.0.0] feat: LookupMap and LookupSet #217

merged 8 commits into from
Aug 24, 2020

Conversation

evgenykuzyakov
Copy link
Contributor

@evgenykuzyakov evgenykuzyakov commented Aug 20, 2020

1.1.0

Contract changes

  • Updated status-message-collections to use LookupMap
  • BREAKING Updated fungible-token implementation to use LookupMap. It changes storage layout.

API changes

  • Introduce LookupMap and LookupSet that are faster implementations of UnorderedMap and UnorderedSet, but without support for iterators.
    Most read/lookup/write are done in 1 storage access instead of 2 or 3 for Unordered* implementations.
  • BREAKING Default is removed from near_sdk::collections to avoid implicit state conflicts.
    Collections should be initialized by explicitly specifying prefix using new method.
  • BREAKING TreeMap implementation was updated to use LookupMap.
    Previous TreeMap implementation was renamed to LegacyTreeMap and was deprecated.
    It should only be used if the contract was already deployed and state has to be compatible with the previous implementation.

@evgenykuzyakov evgenykuzyakov changed the title feat: LookupMap and LookupSet [1.1.0] feat: LookupMap and LookupSet Aug 20, 2020
@mikedotexe
Copy link
Contributor

Are we making this a minor version update? Seems like one could argue it's a major version update due to backwards-incompatible changes

@evgenykuzyakov
Copy link
Contributor Author

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 Default was bogus if you had a collection of collections (e.g. Flux). TreeMap is still supported but in a deprecated version of LegacyTreeMap

Copy link
Contributor

@MaksymZavershynskyi MaksymZavershynskyi left a 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 ?

near-sdk/src/collections/lookup_set.rs Show resolved Hide resolved
@evgenykuzyakov
Copy link
Contributor Author

Going to change version to 2.0.0

{
fn default() -> Self {
Self::new(next_trie_id())
Self { id, key, lft: None, rgt: None, ht: 1 }
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Bad naming.

@evgenykuzyakov evgenykuzyakov changed the title [1.1.0] feat: LookupMap and LookupSet [2.0.0] feat: LookupMap and LookupSet Aug 24, 2020
@evgenykuzyakov evgenykuzyakov merged commit c4c8a7f into master Aug 24, 2020
@evgenykuzyakov evgenykuzyakov deleted the lookup-map branch August 24, 2020 21:13
@evgenykuzyakov evgenykuzyakov restored the lookup-map branch August 24, 2020 21:14
@evgenykuzyakov evgenykuzyakov deleted the lookup-map branch August 24, 2020 21:14
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.

4 participants