micromix
semaphore
libsemaphore
surrogeth
feedback on working on Micromix V2
For V2 proper testing and handling, configuration and configuration usage needed to be rewriten that leeded to rewrite lots of code
Without this it will be complicate to spam one webserver and backend for each network and token tested
Micromix V1 has hardcoded 1 network and 1 token
Micromix V1 Contract Test is dupplicated for ETH and token
Micromix V1 Contract deployement deploy hardcoded 1 semaphore/mixer for eth and 1 for token
Micromix V1 Frontend have hardcoded 1 eth and 1 token
Micromix V1 Backend has hardcoded configuration for network and token
Micromix V1 Backend test has hardcoded configuration for network and token
By default, when I start working on a project I try to use the last versions of the dependencies when possible for many good reason.
I fist started to updates dependencies but it lead to unsolvables issues.
So I have done the first milestone with node 11
As I get block by some issues on the test I decided again to update the dependencies to make sure it didn't come from bug already solved.
Node 11 is not suppoted and should not be use in production and etherlime need node 11 https://github.com/appliedzkp/maci/pull/174
etherlime and react-web3 does nt support ethers 5
I try to update but it is not compatible without modification
Update packages in different modules except React that break too many things
Mixer 1 was running with ganache and kovan that are fast (kovan 1 block/4s)
Using Rinkeby and Arbitrum that have 1 block/15s slow down the test and make it quite long to run the suite for all the network and token (1h ?).
The mixer registry address is stored on the git repository in contract/deployedAddresses
to enable sharing of mixer threw the network and avoid duplicated mixer that will reduce the anonimity.
curent deployement:
*
*
*
Some netowrk bug to fix
Fork of surrogeth : https://github.com/jrastit/surrogeth
SURROGETH_PRIVATE_KEY=0x.............................
LOCAL_RPC_URL=...............
KOVAN_RPC_URL=...............
MAINNET_RPC_URL=...............
SURROGETH_MIN_TX_PROFIT=...
SURROGETH_ERC20_MIN_TX_PROFIT='{"0x8CdaF0CD259887258Bc13a92C0a6dA92698644C0": 1000000000000000000}'
SURROGETH_FEE=...
KOVAN_ALLOWED_RECIPIENTS=0x............................. 0x.............................
MAINNET_ALLOWED_RECIPIENTS=0x.............................
#file generated by mixer config with command npm run surrogeth-info
surrogethPort: 8124
surrogethIp: "127.0.0.1"
network:
kovan:
url: "https://kovan.infura.io/v3/5d37c494621a43558d77c90e368d4022"
chainId: 42
privateKeysPath: "kovanPrivateKeys.json"
ForwarderRegistryERC20: "0x0CEFa2EA705192ba1349980025e61D25E9782B16"
token:
eth:
feeAmt: 0.001
tkn:
address: "0x6fB66Fe3a00aFF2fD0a373223592D9Ebe21913eF"
decimals: 18
feeAmt: 2
dai:
address: "0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa"
decimals: 18
feeAmt: 0.02
ganache:
url: "http://localhost:8545"
chainId: 1337
privateKeysPath: "ganachePrivateKeys.json"
ForwarderRegistryERC20: "0xF12b5dd4EAD5F743C6BaA640B0216200e89B60Da"
token:
eth:
feeAmt: 0.001
tkn:
address: "0xAa588d3737B611baFD7bD713445b314BD453a5C8"
decimals: 18
feeAmt: 2
#generate the configuration file from mixer configuration
npm run surrogeth-info
#run the surrogeth daemon with mixer generated config
#It will automaticaly register on the registry at start
#if not registered or if ip/port have changes
npm run surrogeth
The mixer 1 version based the requirement for the user to wait until the next day for withdraw. That is good in the case there are enought deposit the same day. With v2 and the support of multiple network and token it is most likely not to have enought deposit the same day. Calculation the expected time for enought deposit seams quite complicate. To make it simple I indicate the number of deposit to the user and the anonimity level to help him to wait longer if needed.
One side effect is that to get this information the user will ask the RPC server the number of deposit since the block he used to deposit till he trigger the withdraw throw surrogeth and it can lead for a malicious RPC server to geter some information to be able to link the deposit to the withdraw. This can be offuscated in the future if needed chosing a random block for the query
https://github.com/jrastit/libsemaphore/blob/v0.0.16/ts/utils.ts : 70 : //groth16.terminate()
It will be fix when remplecing websnark by wasmsnark in the same file
On Arbitrum and Skale only:
To reproduce the issue:
run the contract test: npm run test-withdraw
run the backend test on Skale: npm run test-eth or npm run test-token
message: 'the proof is invalid according to pre-broadcast checks'
the problem appen when calling the function: preBroadcastCheck on semaphore.sol that return false instead of true due to the subcall of verifyProof from verifier.sol that return false
verifier.sol is a generated file.
the proof is calculated as well by generated files.
The issue does not appen en Kovan, Rinkeby and local Ganache.
It imply mixer/semaphore/libsemaphore/snarkjs
Base on good practice, private key must be stored encrypted and critical data must be backup.
Deploying a smart contract to trick surrogeth will give the possibility to get money from surrogeth. A simple one using random will have a behavior that change between the surrogeth check and the real contract execution.
Need to check with Arbitrum or Optimism if it can work
Will not work as it is on ethereum mainet
Let Barry also check with our BLS project because they would also benifit from this :)
It semas it is quite complex due to the number of resources and library used as well as depending on crypto algorytm optimisation.
Semaphore version used does not seams to install with npm i with node 15