tangle-network / relayer

🕸️ The Webb Relayer Network
https://webb-tools.github.io/relayer/
Apache License 2.0
22 stars 13 forks source link

[TASK] Generalize EVM Event Watchers over `MerkleSystem`s instead of VAnchors #564

Closed shekohex closed 1 year ago

shekohex commented 1 year ago

Task Overview

Looks like #500 did not actually fix the root issue with the Syncing leaves and verifying that the new leaves/commitments are valid always works, I discovered that this bug is still there as I was recently testing Webb Alpha dApp with the current Relayers that they use v0.5.0-rc23-alpha which has that bug fix for a while now. But as you may know that some of these nodes just returns the default root since it does not keep the full history, even tho we query the root at specific block number at the time that event of NewCommitment occurred. However some RPCs does only keep the last 250 blocks of state, maybe Infura keeps more than that, but anyway looks like querying the merkle root separately from the event does not work very well.

During the discussion while working on #500, we mentioned emitting the current merkle root along with the commitment itself in one event, this way we can verify and validate the merkle tree without another query to the RPC. During the PR https://github.com/webb-tools/protocol-solidity/pull/328/ We noticed a change that Insertion Now Includes newMerkleRoot field which we can utilize to build the merkle tree instead.

Task Checklist