Skip to content
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 deposit from non-token owner #102

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bogdan
Copy link

@bogdan bogdan commented Dec 7, 2021

Fixes #101

CC @itzmeanjan

@itzmeanjan
Copy link
Contributor

Thanks @bogdan , we'll review it.

Copy link

@zorancuc zorancuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depositor is not checked how it's related with token to deposit but used just for event. I think we need to check how depositor is related with msg.sender or tokenId

@bogdan
Copy link
Author

bogdan commented Dec 8, 2021

depositor is not checked how it's related with token to deposit but used just for event. I think we need to check how
depositor is related with msg.sender or tokenId

Do you think it makes sense to do? Once a predicate is approved for token, anyone can call depositFor and pay the gas. What problems do you see with that?

Copy link
Member

@nitinmittal23 nitinmittal23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bogdan @zorancuc According to this PR, once the approval to mintableERC20Predicate is given then anyone can come and deposit on behalf of user. This is good for your use case but not in general terms.

Let say i just gave approval to mintableERC20Predicate but afterwards i decided not to bridge it. but now anyone can come and deposit on my behalf. You see, i have ERC721 today.. but tomorrow someone deposited it for me on polygon. Although it will be in my account, but i will have to spend ETH to bring it back on ethereum (root) chain

@bogdan
Copy link
Author

bogdan commented Dec 27, 2021

@nitinmittal23 I think this scenario is quite surreal for the following reasons:

  • If you approved someone to do the operation, it is already a privilege that you can withdraw the approval which is not available with a lot of custody contracts that are used as approvals
  • Approve operation already cost you something so thinking in advance if you want to finish the deposit after an approval is quite bad idea
  • There is very little reasoning to finish someones deposit to make damage because you get zero value yourself
  • The amount of damage caused is quite low: you can't make someone lose his token this way.
  • From the end user UI perspective, I think there should be no way to stop the deposit once a predicate is approved: it's all just unnecessary details. In the ideal world, deposit should happen with one transaction, but not two and have a regular way to cancel using a front running with higher gas price from the same account with the same nonce.

@alexletu
Copy link

alexletu commented Feb 1, 2022

Wanted to follow up and see if there are any plans on merging this functionality into production. We're in a scenario where we would like for a user to be able to deposit to polygon by interacting with our contract first (to send some metadata via state sync). However, it looks as though that would require the user to approve our contract, our contract then can transfer tokens to itself, from which it can then approve the predicate then call the deposit function - resulting in excess gas use compared to the scenario where we can specify to the bridge a different source for tokens other than msg.sender.

I see the argument that can be made that this opens up the possibility of griefing by a malicious third party; however, I think it's reasonable to assume that it is a highly problematic scenario since the attacker would need to pay the entire fee (which is comparable to the amount the user would need to pay to bring the tokens back to the root chain - i.e. the attacker would be paying fees on the same order of magnitude as to the victim).

Additionally, if a user has already approved the predicate transfer, wouldn't the best practice be to operate under the assumption that those tokens are no longer under your ownership anyways, since 1. we could not guarantee that the the permitted address is not invoked in some other manner, and 2. it seems unnatural to provide functionality for the case in which a user 'changes their mind' after an approval and before transferFrom can take place. It feels more like an accommodation for buyer's remorse.

@bogdan
Copy link
Author

bogdan commented May 4, 2022

100% agree with @alexletu. We are having the same scenario and concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow deposit by someone who is not a token owner
7 participants