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

fix nested lazy vec iter #1218

Merged
merged 5 commits into from
May 12, 2023
Merged

fix nested lazy vec iter #1218

merged 5 commits into from
May 12, 2023

Conversation

tzemanovic
Copy link
Member

fixes #1213

based on #1212

This PR:

  • Adds a test that replicates the issue for LazyVec nested inside another collection (only LazyMap currently allows nesting)
  • Adds a new storage_api function iter_prefix_with_filter. This is preferable over the regular iter_prefix combined with the iterator's filter function as it avoids trying to decode values that don't pass the filter. For iter_prefix_bytes, filter works fine
  • Adds a new method is_data_sub_key to trait LazyCollection
  • Fixes the fn iter for a LazyMap with nested collection using the iter_prefix_with_filter with is_data_sub_key as a predicate

@tzemanovic
Copy link
Member Author

pls update wasm

tzemanovic added a commit that referenced this pull request Mar 14, 2023
@tzemanovic tzemanovic requested a review from brentstone March 14, 2023 07:36
brentstone
brentstone previously approved these changes Mar 15, 2023
Copy link
Collaborator

@brentstone brentstone left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks

brentstone added a commit that referenced this pull request Mar 20, 2023
* tomas/nested-lazy-vec-iter:
  changelog: add #1218
  [ci] wasm checksums update
  core/storage_api/lazy_map: fix `iter` for map with nested collections
  core/storage_api/collections: add `is_data_sub_key` helper method
  core/storage_api: add predicate filtering version of prefix_iter
  test/lazy_vec: add test case to reproduce nested collection iter issue
  changelog: add #1212
  [ci] wasm checksums update
  core/lazy_vec: test and fix for address values
  core/lazy_set: test and fix for address sub-key
  core/lazy_map: test and fix for address sub-key
brentstone pushed a commit that referenced this pull request Mar 22, 2023
tzemanovic added a commit that referenced this pull request Mar 29, 2023
@tzemanovic tzemanovic force-pushed the tomas/nested-lazy-vec-iter branch from cc3e2a9 to 8bcdf52 Compare March 29, 2023 08:48
@tzemanovic
Copy link
Member Author

I've rebased onto the updated #1212 and fixed the newly added test here was also affected by the change in address ordering

@tzemanovic
Copy link
Member Author

pls update wasm

brentstone pushed a commit that referenced this pull request Mar 29, 2023
@brentstone brentstone force-pushed the tomas/nested-lazy-vec-iter branch from 36e556d to 78d1356 Compare March 29, 2023 16:56
brentstone
brentstone previously approved these changes Mar 29, 2023
Copy link
Collaborator

@brentstone brentstone left a comment

Choose a reason for hiding this comment

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

LGTM!

brentstone pushed a commit that referenced this pull request Apr 20, 2023
@brentstone brentstone force-pushed the tomas/nested-lazy-vec-iter branch from 78d1356 to 0306c78 Compare April 20, 2023 19:46
brentstone added a commit that referenced this pull request Apr 20, 2023
* tomas/nested-lazy-vec-iter:
  changelog: add #1218
  core/storage_api/lazy_map: fix `iter` for map with nested collections
  core/storage_api/collections: add `is_data_sub_key` helper method
  core/storage_api: add predicate filtering version of prefix_iter
  test/lazy_vec: add test case to reproduce nested collection iter issue
brentstone added a commit that referenced this pull request Apr 21, 2023
…ase-0151-AA

* tomas/nested-lazy-vec-iter:
  changelog: add #1218
  core/storage_api/lazy_map: fix `iter` for map with nested collections
  core/storage_api/collections: add `is_data_sub_key` helper method
  core/storage_api: add predicate filtering version of prefix_iter
  test/lazy_vec: add test case to reproduce nested collection iter issue
tzemanovic added a commit that referenced this pull request Apr 26, 2023
* tomas/nested-lazy-vec-iter:
  changelog: add #1218
  core/storage_api/lazy_map: fix `iter` for map with nested collections
  core/storage_api/collections: add `is_data_sub_key` helper method
  core/storage_api: add predicate filtering version of prefix_iter
  test/lazy_vec: add test case to reproduce nested collection iter issue
@tzemanovic tzemanovic mentioned this pull request Apr 26, 2023
brentstone added a commit that referenced this pull request Apr 28, 2023
* tomas/nested-lazy-vec-iter:
  changelog: add #1218
  core/storage_api/lazy_map: fix `iter` for map with nested collections
  core/storage_api/collections: add `is_data_sub_key` helper method
  core/storage_api: add predicate filtering version of prefix_iter
  test/lazy_vec: add test case to reproduce nested collection iter issue
tzemanovic added a commit that referenced this pull request May 9, 2023
* tomas/nested-lazy-vec-iter:
  changelog: add #1218
  core/storage_api/lazy_map: fix `iter` for map with nested collections
  core/storage_api/collections: add `is_data_sub_key` helper method
  core/storage_api: add predicate filtering version of prefix_iter
  test/lazy_vec: add test case to reproduce nested collection iter issue
@tzemanovic tzemanovic force-pushed the tomas/nested-lazy-vec-iter branch from 0306c78 to 1626479 Compare May 10, 2023 04:35
juped added a commit that referenced this pull request May 10, 2023
…) into main

* namada/tomas/nested-lazy-vec-iter:
  changelog: add #1218
  core/storage_api/lazy_map: fix `iter` for map with nested collections
  core/storage_api/collections: add `is_data_sub_key` helper method
  core/storage_api: add predicate filtering version of prefix_iter
  test/lazy_vec: add test case to reproduce nested collection iter issue
juped added a commit that referenced this pull request May 12, 2023
* tag 'v0.15.2':
  Namada 0.15.2
  changelog: add #1218
  fix description
  add changelog
  changelog: #1325
  [ci] wasm checksums update
  pos/epoched: fix update_data methods
  pos/epoched: add a test for epoched data trimming
  fix table options
  fix rollback
  fix dump_db
  column families
  added changelog
  small fixes
  fix `test_init_genesis` failure due to validator ordering
  test/pos: add a seed for failing `test_init_genesis` test case
  test/pos/bonds: fix failing cases
  test: set verbose = 1 for state machine tests
  test: update to new proptest state machine testing branch
  enable rocksdb wal and batch once
  fix: review comments
  added changelog
  [ci] wasm checksums update
  core/storage_api/lazy_map: fix `iter` for map with nested collections
  core/storage_api/collections: add `is_data_sub_key` helper method
  core/storage_api: add predicate filtering version of prefix_iter
  test/lazy_vec: add test case to reproduce nested collection iter issue
  changelog: #1295
  cargo: enable overflow-checks in release build
  update tonic
  [ci] wasm checksums update
  for CI
  update ibc-rs to v0.36.0+
  revert epoch_per_year in test genesis
  use ibc-rs validate_self_tendermint_client
  fix the receive key and add unit tests
  add match_value() and fix a unit test for timeout
  for CI
  [ci] wasm checksums update
  update ibc-rs to 0.32.0
  update tower-abci
  fix wasm_for_tests deps
  fix E2E test
  WIP: for clippy
  WIP: restore denom
  WIP: fix tests
  WIP: fix unit tests for IBC VP
  WIP: fix tests
  WIP: add context file
  WIP: emit multiple IBC events
  WIP: store denom in IBC execution
  WIP: IbcAction and TransferModule have Rc<RefCell<C>>
  WIP: upgrade ibc-rs to v0.31.0
  WIP: fix denom validation
  WIP: add IbcCommonContext
  WIP: fix tests/src/vm_host_env/ibc.rs
  WIP: fix vp_get_block_header
  WIP: fix IBC VP
  WIP: fix IBC VP for denom store
  WIP: fix IBC token VP
  WIP: get_block_header
  WIP: implementing IBC VP and tx
  WIP: implement TokenTransferContext
  WIP: implementing TokenTransferContext
  WIP: implement Module
  WIP: upgrade ibc-rs to 0.29.0
  WIP: implement ExecutionContext
  WIP: restore read_counter and read_sequence
  WIP: add context dir
  WIP: impl ValidationContext
  WIP: resolve dependences for new ibc-rs
  fix: review comments
  format
  ledger: added utils to convert pk to tendermint address
  fix: doc strings
  fix: use data_dir
  ledger: default folder in home directory
juped added a commit that referenced this pull request May 12, 2023
…) into main

* namada/tomas/nested-lazy-vec-iter:
  changelog: add #1218
  core/storage_api/lazy_map: fix `iter` for map with nested collections
  core/storage_api/collections: add `is_data_sub_key` helper method
  core/storage_api: add predicate filtering version of prefix_iter
  test/lazy_vec: add test case to reproduce nested collection iter issue
@juped juped merged commit 00c178b into main May 12, 2023
@juped juped deleted the tomas/nested-lazy-vec-iter branch May 12, 2023 00:57
juped added a commit that referenced this pull request May 12, 2023
… ray/sdk-wip

* namada/tomas/nested-lazy-vec-iter:
  changelog: add #1218
  core/storage_api/lazy_map: fix `iter` for map with nested collections
  core/storage_api/collections: add `is_data_sub_key` helper method
  core/storage_api: add predicate filtering version of prefix_iter
  test/lazy_vec: add test case to reproduce nested collection iter issue
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.

prefix iter with a predicate
3 participants