Loopring / protocols

A zkRollup DEX & Payment Protocol
https://loopring.org
331 stars 122 forks source link

[hebao v2] encode initial wallet config into counterfactual wallet address #2564

Closed dong77 closed 3 years ago

dong77 commented 3 years ago

Currently, we only use the initial owner and salt as the input together with the wallet contract code to generate the wallet's address. I think we should improve it by hashing the entire wallet configuration into the address, especially initial guardians.

First of all, it's not hard to do at all. Secondly, this can prevent malicious operators, Loopring included, from colluding with a hacker who gained access to the initial owner's private keys. With this change, they cannot change the initial guardians.

Brechtpd commented 3 years ago

Some assumptions:

If we take the above assumptions as true then the only real purpose of the counterfactual wallets is recovery. Using the minimal config allows the wallet owner to update the guardians while still in counterfactual mode. This allows the user to move away from centralized guardians and towards actual social recovery with whatever guardians he decides as he uses the wallet. If he loses his wallet he can now user his own guardians to recover the wallet. I would say that this can potentially greatly improves the security and user friendliness of the recovery process.

I think the extended wallet config can only be seen as superior when the private key was stolen. This goes against assumption B but let's say it is indeed stolen. With the extended config approach:

So assuming assumption A that user assets will be on layer 2, I don't see any real benefits. There could certainly be some benefits for assets on L1 though when the daily quota is enabled and set to a good value. If the theft doesn't happen immediately the best course of action could actually be the same I think with both approaches: deploying the wallet and either locking it as soon as possible and then recovering or just immediately recover if that can be done as fast as locking. The L2 EdDSA key should also be changed as soon as possible either before the recovery using a new secret or after using the new wallet owner.

I think that "best" approach really depends on how we think the counterfactual wallet will be used and for what purpose.