-
Notifications
You must be signed in to change notification settings - Fork 6
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
[backends/eth] Use approve instead of increaseAllowance for ERC20 deposit #4
Comments
So the problem in your example would be that the user briefly approved 30 instead of the 20? I think it is not a problem since both transactions that the The only problem that i see is with parallel funding, this could mess up the current approval. |
The problem is not that user briefly approved 30. That part is acceptable because, perun contracts indeed want to transfer a total amount of 30. But, as you rightly pointed out, it will be with parallel funding.
|
Seems relevant to me. Need to consider that for one of our upcoming releases. |
The most obvious solution would be to disable parallel funding for |
Location
[backend/ethereum/channel]
Problem
Currently, for funding a channel with ERC20 tokens, we use
increaseAllowance
to set the amount that the perun contracts can transfer from the user's account.However, the
increaseAllowance
functions is not a part of the ERC20 standard interface, but an extension provided by open zepplin reference implementation of ERC20 token standard. It is provided as an alternative to approve, in order to avoid some of the issues associated withapprove
function. However, the ERC20 token standard does not include this extension for maintaining backward compatibility and suggests careful usage of theapprove
method as the solution to deal with the issues.Links: attack description, , discussion related to it and suggested mitigation technique.
Proposal
Replace the usage of
increaseAllowance
withapprove
method.However, the implementation would be tricky and not straightforward. Especially when we consider the scenario where, a user wants to fund multiple channels with the same ERC20 token (described below).
Say a user wants to fund
ch1
with 10 PRN tokens andch2
with 20 PRN tokens.The challenge here would be
The text was updated successfully, but these errors were encountered: