-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Background
In the current RLN implementation, each nwaku node that needs to generate or verify a zero-knowledge proof polls the on-chain Merkle tree contract every 5 seconds to fetch the latest root. This is necessary because the root changes each time another membership is registered or erased, potentially with every new block (e.g., Linea has a 2–3s block time).
This results in a continuous stream of eth_call requests to a Web3 RPC endpoint.
This issue is defined in the roadmap and related discussions here.
Problem
The frequent polling results in a high number of RPC requests, which can negatively impact users—especially those using limited or free-tier Web3 RPC providers, or those running multiple nodes that share the same endpoint.
A bug was identified related to membership insertion time - it is currently possible for a node to receive a message with a root "from the future" which is then invalid. This may be solved with the improved WebRTC call strategy that this issue aims to achieve.
Possible Solutions
- Add a sliding window of latest roots to the contract - added gas cost to write to the contract
- A node is triggered for the latest root when it receives a message
- Polling strategy - run simulations to determine what polling time is optimal and what are the factors that impact it.