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

Limit the number of elements in the vector #2906

Open
steelgeek091 opened this issue Nov 15, 2024 · 2 comments
Open

Limit the number of elements in the vector #2906

steelgeek091 opened this issue Nov 15, 2024 · 2 comments
Labels
area:movevm skill::rust Need the rust language skill to complete the issue
Milestone

Comments

@steelgeek091
Copy link
Collaborator

After a series of discussions, we found that we should implement reasonable limits on the number of elements stored in Move vectors.
There are two potential limitations:

  1. When calling add_field, limit the number of elements stored in vectors, especially when the vector elements are struct types.
  2. When the client calls query_object_states, handle cases where vector elements are struct types and the element count is excessive.
@steelgeek091
Copy link
Collaborator Author

@jolestar jolestar added area:movevm skill::rust Need the rust language skill to complete the issue labels Nov 15, 2024
@jolestar jolestar added this to the Rooch v0.8 milestone Nov 15, 2024
@steelgeek091
Copy link
Collaborator Author

steelgeek091 commented Nov 15, 2024

In the codebase, there are also some use cases where vectors store a large number of elements:

simple_multimap.move

    struct SimpleMultiMap<Key, Value> has copy, drop, store {
        data: vector<Element<Key, Value>>,
    }

    struct Element<Key, Value> has copy, drop, store {
        key: Key,
        value: vector<Value>,
    }

big_vector.move

struct BigVector<T: store> has store {
        buckets: Table<u64, vector<T>>,
        end_index: u64,
        bucket_size: u64
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:movevm skill::rust Need the rust language skill to complete the issue
Projects
Status: No status
Development

No branches or pull requests

2 participants