Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
What's your issue about?
Transfer to an ERC20 token returns stack underflow if it is in an if clause that never gets executed, but works without the if clause.
The test succeeds if I remove the if clause:
That seems to be correct. I've run the following example
with this Example.vy:
And as expected, calls to
Note on this - if the external call only transfers ETH, i.e.:
I get no error. But, if using erc20:
and the else clause fires, I get stack underflow
@charles-cooper Why do you think the issue relates to
I think the issue has to do with valency. The external call has a valency of 1 because it pushes the memory location of the output to the stack.
if False: # here we leave something on the stack else: # implicit # here we don't
This line means we treat the entire
I don't have much experience with the Vyper compiler, so it's hard for me to suggest or implement a fix. Intuitively, I think
I left out some of the debugging, sorry.
This appears to be where the extra
It's there because the valency of the sequence is 1 because the valency of the
I was testing this Vyper:
@public @payable def doit(): if False: raw_call(msg.sender, b"", outsize=0, value=0, gas=msg.gas)
which compiles to this IR:
@smarx I think your approach is good. If you wanted, I think (not at a keyboard so this is off the top of my head) you could change the valency of LLL