dtr-org / unit-e

A digital currency for a new era of decentralized trust
https://unit-e.io
MIT License
45 stars 15 forks source link

Fix near-zero decode rate in graphene #986

Closed AM5800 closed 5 years ago

AM5800 commented 5 years ago

Currently we have near-zero decode rate in graphene. Here is what happening: When deserializing graphene block: 1) Bloom filter is default constructed. And it sets isFull = true. This is correct. Empty bloom filter - is full 2) Bloom filter is deserialized, it is not empty anymore, but isFull flag is still true 3) Bloom filter with this flag returns true for all contains requests => graphene is ruined

This was not caught by tests because In functional tests we had nodes with very similar mempools. Somewhat different mempools were tested only in unit tests. And this serialization issue occurs only in functional tests

This PR fixes one more thing: In the original PR I accidentally commented out some parts of functional tests. I am restoring them

Signed-off-by: Aleksandr Mikhailov aleksandr@thirdhash.com

AM5800 commented 5 years ago

At the moment of writing I had 38/40 successful graphene decodes on my local node. Before this fix I had zero

frolosofsky commented 5 years ago

This was not caught by tests because In functional tests we had nodes with very similar mempools. Somewhat different mempools were tested only in unit tests. And this serialization issue occurs only in functional tests

Would be nice to adjust functional tests.

AM5800 commented 5 years ago

@frolosofsky I actually updated test. Forgot to mention this in the description