openzeppelin-contracts
openzeppelin-contracts copied to clipboard
Consider removing MinimalForwarder
Even though the documentation states that this contract is not suitable for production use, that message isn't getting across and I believe we should just remove the contract entirely.
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/3d7a93876a2e5e1d7fe29b5a0e96e222afdc4cfa/contracts/metatx/MinimalForwarder.sol#L12-L15
This might be a silly idea, but why not rename the contract & file name to something more obvious (it would be a breaking change, yes, but I don't think this matters in that case)? Maybe something like MinimalForwarderTestContract or similar... or moving the contract to the Mocks folder would be another solution. I just feel like that OZ should preserve such contracts that might be useful for some people at one point.
I just feel like that OZ should preserve such contracts that might be useful for some people at one point.
It could be documentation though, like "here's what a proto forwarder contract might look like".
It could be documentation though, like "here's what a proto forwarder contract might look like".
Speaking of myself, I prefer reading the code directly at first. So if I would want to get started with meta-transactions, I would search for code, issues, and PRs about that topic in the OZ repo. In any case - I agree that you should reflect it in the documentation.
If minimalforwarder is not suitable for production, what should I use as a replacement?
@grp06 maybe look at the Forwarder from GSN https://github.com/opengsn/gsn/blob/master/packages/contracts/src/forwarder/Forwarder.sol. They got 2 audits on their contracts, but I think this version was not included back then FYI.
@pcaversaccio my understanding from Fran's message was that the contract itself can be documentation, not that is a documentation issue.
The idea of having it in mocks makes sense since it's its only purpose.
might be useful for some people at one point.
Agree, but we don't keep things just because they might be useful, I believe there has to be a community-driven reason.
If minimalforwarder is not suitable for production, what should I use as a replacement?
I'd better ask what you want to achieve. Using meta-transactions with EIP-712 signatures as with ERC20's permit could be enough for most of the use cases I'd say.
not that is a documentation issue
Well, this somehow contradicts @frangio's message here, no?
Agree, but we don't keep things just because they might be useful, I believe there has to be a community-driven reason.
Fully agreed, that's why I share my opinion here :) - my preferred solution for this issue is to move it into mocks.
Well, this somehow contradicts @frangio's message here, no?
Somehow, yes. But let me phrase this clearly.
We do think that there's a problem with multiple users asking about this (as @grp06) and it's a legitimate question. In order to make clear that is not suitable for production purposes, there are a few options:
- Improve the documentation by adding a big warning (this doesn't imply it's a documentation issue, people might still ignore it)
- Move it to
mocks - Completely remove it
- Keep it in the docs somewhere else written in the docs as an example
My intuition makes me feel that number 1 won't solve the issue long-term. So I'd advocate for not keeping it in the /contracts folder, which may be 2, 3 or 4
Fully agreed, that's why I share my opinion here :) - my preferred solution for this issue is to move it into
mocks.
Sure, we always appreciate your contributions! Do you know any relevant system based on EIP-2771? Although some people in the community might want to keep it in mocks (maybe including me, not sure yet), it wouldn't make any sense if there's no ecosystem support for it.
Aside from GSN, do we know other players relying on a forwarder implementation? 👈 That's a question for everyone.
Do you know any relevant system based on EIP-2771? Aside from GSN, do we know other players relying on a forwarder implementation?
Ad-hoc, I know that Reddit relied on meta-transactions for their community tokens called "Moon". Here is the old Relay Hub contract (I think it's from GSN) on Rinkeby they used for gasless transactions: https://rinkeby.etherscan.io/address/0xd216153c06e857cd7f72665e0af1d7d82172f494. I don't know about the current setup tho.
In case I encounter a further ecosystem besides GSN, I would let you know here.
There is a 5th option which is to make MinimalForwarder suitable for production so we can recommend it to people. I think the only thing that it's missing is an expiration parameter. Is there anything else?
For production, MinimalForwarder should become more easily to customize (eg let the function become virtual so we can override them)
There is a 5th option which is to make MinimalForwarder suitable for production so we can recommend it to people. I think the only thing that it's missing is an expiration parameter. Is there anything else?
In the current state, money can also be lost due to the lack of refund; ref: #3664
Although I don't believe that should be a detractor to finalize a prod-ready implementation of MinimalForwarder as a trusted foundation for forwarders is not readily available in another trusted place that I am aware of.
We're proposing to make the MinimalForwarder production ready, also adding a deadline parameter in ForwardRequest.
MinimalForwarder should become more easily to customize
What do people think should fall into this category from the MinimalForwarder? One could argue both verify and execute should be virtual but a few questions arise to me:
- Is it a use case for overriding
verify? First sight, EIP-712_TYPE_HASHcould bepublic virtualalthough properties in ForwardRequest might be missing (if you know one aside fromdeadline, please share) - How good is it to make
executevirtual? For reference, some use cases may include not checkingsuccess, take Safe as a reference. This affects gas estimations and assumptions that can be made (like gas estimations).
money can also be lost due to the lack of refund; ref: https://github.com/OpenZeppelin/openzeppelin-contracts/issues/3664
Yes, we're definitely taking care of that if no major issues pop up during implementation 👍🏻
I'll send a PR to continue the discussion there.