Skip to content

Add bloom filter to hashset #3878

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Add bloom filter to hashset #3878

wants to merge 4 commits into from

Conversation

shargon
Copy link
Member

@shargon shargon commented Apr 4, 2025

Description

This pr add a bloom filter in order to speed up the hash searching

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Test A
  • Test B

Test Configuration:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Wi1l-B0t
Copy link
Contributor

Wi1l-B0t commented Apr 5, 2025

It should add some benchmarks.
Maybe not faster.

@@ -81,8 +81,8 @@ public RemoteNode(NeoSystem system, LocalNode localNode, object connection, IPEn
{
this.system = system;
this.localNode = localNode;
knownHashes = new HashSetCache<UInt256>(system.MemPool.Capacity * 2 / 5);
sentHashes = new HashSetCache<UInt256>(system.MemPool.Capacity * 2 / 5);
_knownHashes = new HashSetUInt256Cache(system.MemPool.Capacity * 2 / 5);
Copy link
Member

Choose a reason for hiding this comment

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

This will be a good change, when you say it is ready we will test.

Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

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

@shargon,

recently, in our investigations, we also considered a bloom filter hashset that is SENT together with the commit!

So, nodes can have a quite good idea of which transactions are in the mempool of other validators.

With such knowledge we were able to reach 150k TPS - 200k TPS theoretically.
However, this is currently not the need of our chain, but can be a great marketing and advance in the consensus.

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.

4 participants