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

v0.7 Upgrade with Storage and Readme Updates (for Cosmwasm v1.0) #66

Merged
merged 37 commits into from Dec 6, 2022
Merged

v0.7 Upgrade with Storage and Readme Updates (for Cosmwasm v1.0) #66

merged 37 commits into from Dec 6, 2022

Conversation

srdtrk
Copy link
Contributor

@srdtrk srdtrk commented Oct 27, 2022

Reopening the PR after it was automatically closed when the old branch was deleted. It seems like this needs manual intervention to merge now (probably due to versioning changes)

The following changes were made to the storage as mentioned in release notes, these changes were approved by @reuvenpo conceptually:

  • Added the Keyset storage object (A hashset like storage object).
  • Allowed further customisation of Keymap and Keyset with new constructor structs called KeymapBuilder and KeysetBuilder which allow the user to disable the iterator feature (saving gas) or adjust the internal indexes' page size so that the user may determine how many objects are to be stored/loaded together in the iterator.
  • ::new_with_page_size(namespace, page_size) method was added to AppendStore and DequeStore so that the user may adjust the internal indexes' page size which determine how many objects are to be stored/loaded together in the iterator.
  • Minor performance upgrades to Keymap, AppendStore, and DequeStore.

Moreover, I also fixed all the clippy warnings and updated some readme files to reflect cosmwasm 1.0 changes. Cosmwasm v1.0 branch should probably be made default

packages/storage/src/append_store.rs Outdated Show resolved Hide resolved
packages/storage/src/append_store.rs Outdated Show resolved Hide resolved
packages/storage/src/append_store.rs Show resolved Hide resolved
packages/storage/src/append_store.rs Outdated Show resolved Hide resolved
packages/storage/src/append_store.rs Outdated Show resolved Hide resolved
packages/storage/src/append_store.rs Outdated Show resolved Hide resolved
packages/storage/src/deque_store.rs Outdated Show resolved Hide resolved
packages/storage/src/deque_store.rs Outdated Show resolved Hide resolved
let indexes = self._get_indexes(storage, indexes_page)?;
let item_data = indexes
.get(&index_pos)
.ok_or_else(|| StdError::generic_err("Item not found at this index."))?;
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't the error be "DequeStore out of bounds"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, I think we should only return out of bounds right after checking pos > len

if let Some(item_data) = indexes.get(&index_pos) {
item = Ser::deserialize(item_data);
} else {
item = Err(StdError::generic_err("Item not found at this index."));
Copy link
Member

Choose a reason for hiding this comment

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

Also here, I think "out of bounds" is a more appropriate message

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, I only want to return out of bounds error right after checking pos >= len

@srdtrk srdtrk changed the title Storage v0.6.1 Upgrade with Minor Clippy Fixes and Readme Updates (for Cosmwasm v1.0) v0.7 Upgrade with Storage and Readme Updates (for Cosmwasm v1.0) Dec 6, 2022
@toml01 toml01 merged commit f0fa15b into scrtlabs:master Dec 6, 2022
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.

None yet

2 participants