-
Notifications
You must be signed in to change notification settings - Fork 355
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
CW20: Remove IncreaseAllowance / DecreaseAllowance #846
Comments
That's a bit of an absolute. Please note we don't have anything like I don't think we want to break this API at this stage. |
I don't think there is any kind of race condition which would be possible with just a simple one Thus, the current spec seems to be cargo culting ERC-20 and adding extra complexity when extra complexity is not warranted. If there is a specific reason for The downside of adding extra messages and complexity for the token spec is that
|
There are really two messages: GetAllowance and SetAllowance. If I want to increase your allowance by N tokens, the race condition exists between checking your current allowance and setting the new allowance.
You could automate this by watching mempool for my message 4 and trying to frontrun your spend. If you win, you get free money. If you lose, you simply spend some of the new allowance. With increase/decrease allowance:
Whether or not you try to frontrun me, the total amount I give you is never more than 3,000. |
(Not sure if this is the right place to leave feedback on the CW20 token standard, but none of my friends in the Cosmos ecosystem could know better.)
CW20 tokens have IncreaseAllowance and DecreaseAllowance logic copied from ERC-20. Originally not part of the ERC-20 spec, these functions were added afterwards. They do not serve a meaningful purpose and are mostly security theatre.
The origin of these functions is in the questionable discussion of security researchers claiming for a security vulnerability exists where such does not really exist. Such snake-oily behaviour was common during the early Ethereum smart contract years 2017/2018, because security researchers could get reputation and extra audit work by making blog headlines with posts like "all ERC-20 tokens have a vulnerability." Namely, the "race condition" explanation behind these calls does not make any sense as was created there just someone to make name for themselves as security researchers. Because the people pushing these calls were noisy and annoying, the rest of the ecosystem ended up adopting them, instead of tolerating the constant yelling.
Anyone who thinks logically will see through this security issue fallacy
Scenario A)
Scenario B)
Scenario B is not a real threat scenario, because if you give someone an allowance and they want to steal your tokens, they will do it the right way. They are not going to wait for you to reissue
approve()
call.Because CosmWasm is a new high-quality ecosystem, I would recommend CosmWasm not to copy increase/decrease allowance baggage from the past, as its only purpose has been serving as a security theatre.
send()
andtransfer()
confuse end user leading them being scammedThe text was updated successfully, but these errors were encountered: