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

Add worker test setup #98

Merged
merged 9 commits into from
Dec 20, 2022
Merged

Add worker test setup #98

merged 9 commits into from
Dec 20, 2022

Conversation

lok52
Copy link
Collaborator

@lok52 lok52 commented Nov 10, 2022

Closes #83

Updates:

  • Add test-flow-generator tool. It allows you to generate any transaction flow with pre-calculated proofs and signatures using a json file. Flows can also be made of independent transactions meaning that each transaction uses the same merkle root for SNARK proofs.
  • Add several worker tests (in file zp-relayer/test/worker-tests) covering functionality added in recent releases. Each test runs in an independent environment with clear node's state (with deployed pool contracts only) and clear local state. Tests use zp-relayer/test/flows/flow_independent_deposits_5.json file with pre-generated flow using test-flow-generator. You can generate your own flow to test different scenarios if needed. Also, you can change test env variables in test.env file if needed.
  • Priority for sentTxQueue jobs is now calculated as tx_nonce+1 because 0 priority is undefined in bullmq.

NOTES:

  • ZK transactions and SNARK proofs in test-flow-generator are calculated in local browser environment (launched automatically using puppeteer) using libzkbob-rs-wasm-web package.
  • Contracts are deployed using lok52/zkbob-contracts docker image with tweaked Env.s.sol file where relayer and token minter addresses are changed (bobMinter = 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1, zkBobRelayer = 0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b).
  • Also, there some useful utility functions prepared in zp-relayer/test/utils.ts, e.g. you can enable/disable mining on a node, mine blocks manually, drop transactions from mempool, etc.
  • To run tests you should have a locally installed docker-compose

@lok52 lok52 force-pushed the feature/worker-tests branch from 38cbd75 to 2657325 Compare November 10, 2022 19:58
lok52 and others added 5 commits November 12, 2022 14:11
* added test if proof incorrect

* update test

* fix bugs

Co-authored-by: Vadim Nikonov <vadim.n@peppersec.com>
* add new test: new gas price higher than previous one

* updated test

* Refactor

Co-authored-by: Vadim Nikonov <vadim.n@peppersec.com>
@lok52 lok52 mentioned this pull request Nov 22, 2022
@akolotov akolotov merged commit cf6334a into devel Dec 20, 2022
@akolotov akolotov deleted the feature/worker-tests branch December 20, 2022 09:03
akolotov added a commit that referenced this pull request Jan 2, 2023
This merge contains the following set of changes:
  - Add relayer test setup (#98)
  - Actualize README (#111)
  - Support of several RPC URLs to send transactions (#112)
  - Add /siblings endpoint (#113)
  - Remove fallback job fetching from /job endpoint (#114)
  - Forbid withdrawals to zero account (#118)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create tests for workers
4 participants