-
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
[spec] Bouncer/SignatureChecker + Contract Signatures #1272
Comments
Can you explain further how threshold signatures fit into this? Would there be a component in OpenZeppelin to specifically support them? |
threshold signatures probably isn't the best term, since that's already a real thing. But I'm referencing "be able to validate an array of signatures rather than a single signature" and then make it easy to apply some threshold logic to them. Specifically in the case of multisig schemes where a transaction might require 3 signatures from owners or something. |
Right. That's the kind of thing I was expecting to delegate to contract signatures. So we can just say "we support isValidSignature" and Gnosis Safe can implement that function with their own threshold logic. Do you see OpenZeppelin having its own multisig validator component? I personally think it's best if we delegate that to actual multisig wallet contracts. |
@frangio I think we have the same opinion here! I'll clarify the text. |
? |
Is there a crowdsale example using this yet? It seems kinda necessary for KYC... And the code above looks great |
@projectoblio there are no crowdsales using signatures, but we do have |
I saw that, and I also read through someone else's argument in a closed issue that said that signature based crowdsales somehow cost the EVM a lot more money that WhitelistCrowdsales. I just want to say that (I think) this has to be false, in a WhitelistCrowdsale you have a transaction (signature) from the owner to add an address (string), and another transaction from the end-user (signature). In a Bouncer crowdsale you have only a transaction (signature) from the end-user which contains a signature from the owner (signature). So the WhitelistCrowdsale requires: Transaction + address + Transaction Not only that, the UX experience is probably about equal. In the WhitelistCrowdsale, users have to wait for an owner transaction to be communicated to the blockchain before donated. In the BouncerCrowdsale, users can communicate their signature immediately. This is my first time working with OZ so I haven't examined the gas costs of using each of the contracts. But as far as data storage goes I think the BouncerCrowdsale has to be a lot less. Why u write all that, just submit a PR -- I actually would do this but my solution isn't backwards compatible with the rest of the OZ contracts. It basically requires adding an input parameter to buyTokens .I don't know enough about Solidity to know how to prevent re-entrancy ( although it doesn't seem like my crowdsale can be negatively impacted by it ). So that's what makes the above code so hot and attractive, is because it looks like it can be implemented in OZ really easily. |
This could be implemented by inheriting the original I agree with your statements regarding usefulness of a |
Thanks yea I might've tried that but there was also this big warning that said "DO NOT OVERRIDE" above buyTokens so I wasn't sure i was even doing it right. Rewriting the function inside Crowdsale.sol was easier on my late-night's psyche even though now i realize that's basically the exact same thing. And what am i even saying, is overriding the function the same as inherting it and disabling it? fuck man |
Ah you're right, the strategy I suggested wouldn't work on the |
This comment has been minimized.
This comment has been minimized.
The different components in this issue have had varying levels of progress over the years. We have SignatureChecker and EIP712 implementations. Meta transactions have been supported in the form of GSN v1 in the past, and currently "GSN v2" via ERC2771Context (essentially an implementation of the Bouncer concept). We are not sure the latter is getting much use so we consider deprecating it now, since EIP-4337 is an alternative that seems to have more activity and stronger support, and has the benefit that it is compatible with any contract out of the box. |
🎉 Description
We want to unify the methods by which we check signatures within the OZ contracts. The use-cases are:
isValidSignature
using the same interface as checking EOA signaturesI've done a half-job of building all of this out in a local branch, but I don't have the bandwidth to finish it up before the branch gets stale, so I'm going to document the architecture and get back to this later.
Pending Concerns
We should replace the
eth_personalSign
witheth_signedTypedData
like GnosisSafe has done, which means we need to add the same sort of domainSeparator logic they have to the signature checker instead of assuming everything is anEthereum Signed Message:
.Contracts
ISignatureValidator
ethereum/EIPs#1271
SignatureChecker
SignatureChecker is a contract designed to be inherited. It offers pluggable authentication and authorization logic, designed to allow contracts to easily validate a set of signatures that a user submits.
It is inspired by logic from https://github.com/gnosis/safe-contracts/blob/development/contracts/GnosisSafe.sol
Bouncer
A Bouncer, then, is just some convenience functions for accepting signatures and assumes that the data being signed is the hash of
msg.data
.We call the signatures "tickets" to imply that they're valid for the current transaction.
BouncerWithTrustedSigners
A Bouncer with trusted signers via Roles.sol. This implements the SignatureChecker functions.
BouncerWithNonceTracking
BouncerWithNonceTracking (name tbd) helps keep track of nonces per-address.
Airdrop
And airdrop, then, would look like
GnosisSafe
GnosisSafe could use this pattern as well: they would replace
checkSignatures
withvalidSignatures
. They could implement threshold approvals in two ways:numSignatures
is gte approval threshold, for off-chain signature aggregationSignatureChecker#isAuthorized(...)
for on-chain approvalsThe text was updated successfully, but these errors were encountered: