-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Allow contracts to be delegates of a Bouncer #1005
Comments
Regarding the snippet from #973 (comment), particularly this part: const signer = signerOf(_sig)
if (signer.isContract()) {
// ERC165 detect and call on isValidSignature
return signer.isValidSignature(hash, _sig) How is the |
Hm, I suppose |
@frangio oh yeah, the signer would be the account as normal. and I the if (msg.sender.isContract()) {
// ERC165 detect and call on isValidSignature
return msg.sender.isValidSignature(hash, _sig);
} else {
return hasRole(signerOf(_sig), ROLE_BOUNCER);
} |
@frangio One example would be to have a "smart account" be an owner. A smart account is a contract that would hold all the assets of a user to facilitate a bunch of stuff and where different private key can perform different action. Some PV key could transfer assets and set permissions while others could simply play games or interact on social media on the behalf of this smart account. Smart accounts increase security and can add a bunch of critical functionalities to regular accounts in order to improve UX. Now, if this smart account, which would actually be my main account, is owner of a contract, or has a given role is some bouncer protected contract, it will need to have this kind of method. I have a strong feeling that most users will not use their regular account in the future, which offers very low security and poor UX and will most likely use a smart contract (that is, until account abstraction). For more info about the future of accounts and the concept of smart accounts, check out Alex van de Sande's 15 mins presentation and then mine at the EDCON Ux unconference. |
yeah, very much like ethereum/EIPs#725 |
A quick thought. Isn't "delegating authorization to other arbitrary logic" already covered by being able to assign a role to any contract? |
@frangio I suppose so, yeah; you can easily just compose signature bouncers together if you want to delegate logic like that. But I think the intention here is to remove the coupling between the signer and the "is this signer allowed to sign for this sender", to allow for identity contracts that are proxies with their own access control (like EIP725). The only way for a bouncer contract to know if the signer is one of the approved addresses is to call back to this identity contract an ask. Perhaps it's possible to use the |
Yes, but with the SignatureBouncer.sol, a bouncer need to use an ECDSA signature, however allowing for contract could support arbitrary signature schemes and more.
I don't think this will be only useful for identities per say. It could be a contract that has multiple owners for example, a contract that has a lottery signer, where a new signer is randomly picked every X blocks without on-chain transactions, a validators subset in a proof of stake scheme or a PoW requirement provided with a signature. I'm giving random examples, but the general idea is a contract can have custom control mechanics that are not restricted to ECDSA signatures. |
Let's try to think this through a bit better. I think we can converge at a better design if we first try to define the problem clearly. (Apologies if I repeat stuff expressed elsewhere or if I'm too verbose. 😅 It was quite hard for me to get the necessary context so I hope that this can make it easier for others interested in the discussion.)
The feature request in this issue touches on two mostly orthogonal dimensions where There is another concept lingering around here which is that of smart accounts or identity contracts. In fact 0x's Wallet seems to be an implementation of the same concept. The basic idea is that a user can interact with blockchain applications through a smart contract instead of an account backed by a key, and this allows interesting new possibilities such as having the fees paid by someone else (a service provider of sorts). I actually had not understood the full implications of this idea until i watched @PhABC's talk linked earlier in this thread. Very interesting stuff! Whereas classical accounts are driven by ECDSA signed transactions, smart accounts are driven by the arbitrary logic of a smart contract. This is where it relates to the generalization of @shrugs @PhABC Hopefully by this point we're all in the same page! Now for some of my own thoughts on what to do with all this. After thinking about it for a while, I'm completely sold on the idea of smart accounts and I want OpenZeppelin to have facilities for this type of authentication. However, I'm not sure if tl;dr: IMO, what needs to be generalized for smart accounts is I think the reason this was conflated is that |
Ah! The point about abstracting ECRecovery to support this is really smart! An update on the language I'm using for the Bouncer:
So it seems like the code changes that need to take place are
does that sound right? thanks for your in-depth comment, @frangio ! |
Great summary @frangio! Not too verbose at all :). One point I would like to both of your thoughts on is regarding
Personally, I don't think we can assume the signers are under the control of the If in 5 years everyone is using smart accounts as their main account, then this will be even more frequent. The smart account allows you to manage all your private keys as well, one for your phone, one for your laptop, one for your ledger, etc. Actually, a smart account would also have something like I personally believe the change is fairly simple and does not deviate from the initial goal of the Bouncer contract logic, it's simply allowing signers to be contracts. |
delegates may or may not be related to the owner of the bouncer contract, yeah; I don't think that's the case in the current design either. for example, we could make a digital club where members are able to invite 5 other people via these signatures, so anyone with a signature from an existing member can join the club. verification goes like "owner says identity contract is a delegate, so let's ask the identity contract if the signature is from one of the managed EOA accounts with the correct permissions and if so let them in." lmk if I interpreted that correctly? |
Sounds about right! Doesn't need to be identity, could be a multisig or whatever contract that has some access control method. |
@frangio ah, no, "invitees" have been replaced by "delegate" |
I'll close this issue for the benefit of organization, but will most likely use these same commits in a PR for #1104 (or one that is rebased off of it) |
wait scratch that, this is an issue that we should keep up :D |
closing in favor of tracking via #1272 |
🎉 Description
continuing the discussion from #973
I want to explore the idea proposed by @PhABC where a contract can be the authority, but delegate authorizations to other arbitrary logic. This is a pattern that 0x v2 is also adopting for allowing the main exchange contract to delegate order acceptance logic to a contract.
The text was updated successfully, but these errors were encountered: