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

Equal PersistentOrderedSets are not equal #204

Open
FerrumBrain opened this issue Dec 16, 2024 · 2 comments
Open

Equal PersistentOrderedSets are not equal #204

FerrumBrain opened this issue Dec 16, 2024 · 2 comments

Comments

@FerrumBrain
Copy link

In the following example we have two indentical sets that aren’t equal from assertEquals perspective:

val set1 = persistentSetOf(-486539264, 16777216, 0, 67108864)
val builder = set1.builder()

assertEquals(set1, builder)
assertEquals(set1, builder.build())
assertEquals(set1, builder.build().toSet())


val set2 = set1.remove(0)
builder.remove(0)

assertEquals(set2, builder.build().toSet())
assertEquals(set2, builder.build()) // fails, expected to pass

Bug is found by fuzzing team @ PLAN Lab.

@I-Iege
Copy link

I-Iege commented Dec 20, 2024

maybe this is also related to
#198

@fzhinkin
Copy link
Contributor

It seems to be the same issue as #198, which is indeed reproducible starting from 0.3.5 where optimized equals implementations where introduced: ec42c96#diff-73b47fb05e3a34a7f620efdf8c6dcbde78f72cdfc8f6ed532da314c6bc93a0e1

The problem here, apparently, is that value removal might result in a different trie structure (at least, after #73) and optimized equals compares nodes for exact equality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants