Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: add custom queryFilter #57
feat: add custom queryFilter #57
Changes from all commits
b4a5990
ea74b44
113de6e
b819f4d
b882595
a50cf9c
45faae6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the issue we are encountering are going to be dependent on the Wallet and RPC Provider.
MetaMask using infura is the one with an issue. But If a user used MetaMask with another provider, fetch chunk may need to be lower or higher.
Hence, a few things:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re 3, we made the gas efficient choice to store all idCommitments in a mapping. While this makes the contract more gas efficient, it definitely increases complexity client side. If clients would prefer the tree being stored onchain, we can create a variant of the RLN contracts that do that. Let me know 🫡
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for reference, all eth2 implementations chunk and fetch event logs - https://github.com/status-im/nimbus-eth2/blob/55ae7d3b00fcb7029ced737eef8868690cbaa756/beacon_chain/eth1/eth1_monitor.nim#L642
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in go-waku, fetching logs in chunks was done like this: https://github.com/waku-org/go-waku/blob/master/waku/v2/protocol/rln/group_manager/dynamic/web3.go#L172-L236
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since
idCommitments
are present on a contract that means there is no reason to query events, no?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exposed configuration to outside
I did some research and I see when someone needs to query many blocks then there are two solutions - query in chunks (or have a gateway that allows huge query to run) or store data somewhere on a contract
are there any other solutions, @rymnc , @richard-ramos ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either that or use thegraph to query the events.
The problem with storing the data in the smart contract is that it will probably increase the cost of registering a new membership. Retrieving the query in chunks seem to be the usual workaround (here's an implementation i found in TS that we could use to retrieve the logs: https://github.com/MarkusSprunck/ethereum-event-scan/blob/master/src/app/services/reader.service.ts#L279-L358). I'm also thinking that to speedup loading the events next time the example is accessed, perhaps we should store them in localstorage or indexeddb, but that is something that could be implemented in future PRs