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

bug(rln): problems syncing the rln tree, different roots #2002

Closed
alrevuelta opened this issue Sep 7, 2023 · 2 comments · Fixed by #2015
Closed

bug(rln): problems syncing the rln tree, different roots #2002

alrevuelta opened this issue Sep 7, 2023 · 2 comments · Fixed by #2015
Labels
bug Something isn't working critical This issue needs critical attention E:3.2: Basic DoS protection in production See https://github.com/waku-org/pm/issues/70 for details

Comments

@alrevuelta
Copy link
Contributor

Problem

Using 0x0A988fd9CA5BAebDf098b8A73621b2AaDa6492E8
Commit 5638bd06bbab5f52aeb399b2cf162c8b834ce011

When continuosly injecting new memberships into the rln contract (at a rate of one per block or so) different nodes calculate different merkle roots when syncing. This creates a "fork" in the network, where some nodes reject valid messages and others accept them. This issue seems to happen (or at least more often) when continuosly injecting new memberships into the contract.

After stopping injecting memberships and inspecting the database of different nodes, they seem to split into:

  • Nodes that have synced 5673 memberships
  • Nodes with 5672 memberships

This off-by-one membership seems to be the rootcause of the issue. If one of the first memberships was lost, then the nodes will calculate completely different trees and won't be able to validate the same messages.

Notes:

  • Cleaning the db and resyncing again seems to fix the issue.
  • This happens to 1 every 10 nodes or so.
@alrevuelta alrevuelta added the bug Something isn't working label Sep 7, 2023
@alrevuelta alrevuelta added critical This issue needs critical attention E:2023-rln labels Sep 7, 2023
@alrevuelta
Copy link
Contributor Author

@rymnc and @alrevuelta are investigating this right now

@alrevuelta
Copy link
Contributor Author

After a long debugging session with @rymnc, we have concluded that some nodes were missing memberships to be inserted in the tree (1 in most of the cases). Even if just one membership was missing, this led to a completely different tree, with a different merkle root.

Memberships were missing because the node was missing events from the chain. And the node was missing events from the chain because there was a delay between the "initial sync in chunks" and the "real time streaming of blocks". Meaning that in some cases, we were skipping 1 or 2 blocks in the sync process. This is why this issue appeared when constantly injecting new memberships into the contract.

Fix on its way.
#2013

@github-project-automation github-project-automation bot moved this to Done in Waku Sep 8, 2023
@fryorcraken fryorcraken added the E:3.2: Basic DoS protection in production See https://github.com/waku-org/pm/issues/70 for details label Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working critical This issue needs critical attention E:3.2: Basic DoS protection in production See https://github.com/waku-org/pm/issues/70 for details
Projects
Archived in project
2 participants