Skip to content

examples/gno.land/p/demo/avl use signed size #4440

@Davphla

Description

@Davphla

Description

Every implementation in demo/avl has signed size, which may cause issues as:

  • GetByIndex with negative index, which is considered as valid index.
  • TraverseByOffset with negative offset and size, which can let us set a negative limit
if limit <= 0 || offset >= node.size {
  • Confuse users when they use avl/list Size as nextID with a big tree, which wont be equal to its key over 2^31 size (idgen == uint64, size == int).

I believe it's not a good practice and it could reveal later some underlying issues due to that implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions