-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add root storage #76
Add root storage #76
Conversation
3e5fb03
to
17af262
Compare
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.
Could you add a test for both good and bad cases?
This change seems to be rather difficult to test manually on staging environment, so it's better to have some test coverage
It is rather hard to implement such e2e test where multiple transactions will be in optimistic state and then make the first one fail. We need to run a local node in no-mining mode and manually send requests to mine blocks at specific points in time. I will try to make it, but it does not look straightforward for now. |
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.
looks good, although further testing is required
@LyzeOfKiel please fix the merge conflict |
Will fix conflicts after #78 will be merged in this branch |
This merge contains the following set of changes: - Remove /proof_tx endpoint (#59) - Add merkle root index validation (#60) - Add endpoints for parameters hash (#65) - Improvements in user tx validation (#69) - Update ZkBobPool ABI (#71) - Configuration ability fo DB files dir (#79) - Bunch of improvements to robust transaction sending (#78) - Maintenance of merkle root for more robust transaction verification (#76) - Add fallback in root lookup method (#86)
Closes #62
Add separate root storage to relayer similar to
roots
mapping inZkBobPool
contract.It allows more strict validation of users' transactions on relayer side reducing the possibility to drain relayer sending reverting transactions.
Logic flow is similar to
nullifierSet
, but root storage is built usingHSET
redis command, maintaining a mapping from a pool index to a corresponding root.Applications states:
zeropool-relayer/zp-relayer/pool.ts
Lines 207 to 212 in 3e5fb03
zeropool-relayer/zp-relayer/validateTx.ts
Line 213 in 3e5fb03
3.1. Mined: remove root from optimistic storage and include it into confirmed storage.
zeropool-relayer/zp-relayer/workers/sentTxWorker.ts
Lines 88 to 93 in 3e5fb03
3.2: Reverted: delete whole optimistic root storage
zeropool-relayer/zp-relayer/workers/sentTxWorker.ts
Lines 120 to 121 in 3e5fb03