Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

What will happen in case of REVERT inside DELEGATE_CALL? #39

Open
k06a opened this issue Sep 19, 2019 · 4 comments
Open

What will happen in case of REVERT inside DELEGATE_CALL? #39

k06a opened this issue Sep 19, 2019 · 4 comments

Comments

@k06a
Copy link

k06a commented Sep 19, 2019

I see a lot of BAD JUMP DESTINATION transactions here: https://etherscan.io/address/0x3958b4ec427f8fa24eb60f42821760e88d485f7f

SNX token calls tokenFallback on Uniswap contract in the middle of exchange and it seems Uniswap proxy handles this problem in a wrong way.

Proxy code is:

CALLDATASIZE
PUSH1 0x00
PUSH1 0x00
CALLDATACOPY
PUSH2 0x1000
PUSH1 0x00
CALLDATASIZE
PUSH1 0x00
PUSH20 0x2157a7894439191e520825fe9399ab8655e0f708
GAS
DELEGATE_CALL
ISZERO
PC
JUMPI
PUSH2 0x1000
PUSH1 0x00
RETURN

What does the latest part after DELEGATE_CALL means can anyone describe what should happen after DELEGATE_CALL reverts internally?

It seems Uniswap exchange called by another smart contract will eat all of its gas.

@haydenadams
Copy link
Contributor

Yeah that comes from a vyper bug that wasn't discovered until after Uniswap launch

vyperlang/vyper#1091

@k06a
Copy link
Author

k06a commented Sep 19, 2019

So now we have an issue with Uniswap contract eating all the gas our smart contract provided.

@haydenadams
Copy link
Contributor

@k06a on transaction fail, yes

@k06a
Copy link
Author

k06a commented Sep 19, 2019

@haydenadams found a reason and solution to 900K gas estimation to be dramatically decreased for SNX. Think could be delivered with upcoming token upgrade.

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

No branches or pull requests

2 participants