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-relay): RLN DB should be aware of chain and contract address #1921

Closed
3 tasks
Tracked by #1906
richard-ramos opened this issue Aug 21, 2023 · 3 comments · Fixed by #1932
Closed
3 tasks
Tracked by #1906

bug(rln-relay): RLN DB should be aware of chain and contract address #1921

richard-ramos opened this issue Aug 21, 2023 · 3 comments · Fixed by #1932
Assignees
Labels
bug Something isn't working E:3.2: Basic DoS protection in production See https://github.com/waku-org/pm/issues/70 for details

Comments

@richard-ramos
Copy link
Member

richard-ramos commented Aug 21, 2023

Problem

Currently the RLN metadata only saves the last processed block. If we change the RPC endpoint to point to a different chainID, or change the contract address, the information stored in RLN SledDB then the information stored in the database is not useful anymore, as the event logs that populate the database are associated to an specific chainID and contract address. However, rln-relay in its current version does not verify the chainID, so it will reuse the same database information even tho it is incorrect.

Impact

Merkle tree with incorrect data is generated. RLN validation will be done incorrectly.

Expected behavior

  • SetMetadata should store the last processed block, the chainID, and contract address
  • When mounting rln-relay, it should compare the value from --rln-relay-eth-contract-address flag against the contract address stored in the metadata, AND the result from calling eth_chainId RPC method with the chainID stored in the metadata. If there is no match, drop the information of the DB
  • Consider having different databases per chainID and contract address (?) (perhaps it's possible by specifying a different tree path, and instead of dropping the database information, to log a FATAL error indicating a wrong database path is being used?)
@rymnc
Copy link
Contributor

rymnc commented Aug 22, 2023

I think instead of dropping the database, we should just raise an exception from the mounting of rln-relay

@richard-ramos
Copy link
Member Author

What would be the handling of the exception in this case for cases when the user wants to use a different contract and already has a db?

@rymnc
Copy link
Contributor

rymnc commented Aug 22, 2023

We should error out during mount, similar to how geth handles it - we should not even start the wakunode if there's a db mismatch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working E:3.2: Basic DoS protection in production See https://github.com/waku-org/pm/issues/70 for details
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants