Skip to content

Commit

Permalink
fix raw_call
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Sep 19, 2023
1 parent 823675a commit 257d5e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
20 changes: 13 additions & 7 deletions vyper/builtins/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,14 +1155,20 @@ def build_IR(self, expr, args, kwargs, context):
outsize,
]

if delegate_call:
call_op = ["delegatecall", gas, to, *common_call_args]
elif static_call:
call_op = ["staticcall", gas, to, *common_call_args]
else:
call_op = ["call", gas, to, value, *common_call_args]
gas, value = IRnode.from_list(gas), IRnode.from_list(value)
with value.cache_when_complex("_value") as (b1, value), gas.cache_when_complex("_gas") as (
b2,
gas,
), to.cache_when_complex("_to") as (b3, to):
if delegate_call:
call_op = ["delegatecall", gas, to, *common_call_args]
elif static_call:
call_op = ["staticcall", gas, to, *common_call_args]
else:
call_op = ["call", gas, to, value, *common_call_args]

call_ir += [call_op]
call_ir += [call_op]
call_ir = b1.resolve(b2.resolve(b3.resolve(call_ir)))

# build sequence IR
if outsize:
Expand Down
3 changes: 2 additions & 1 deletion vyper/codegen/ir_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ def gas(self):
def is_complex_ir(self):
# list of items not to cache. note can add other env variables
# which do not change, e.g. calldatasize, coinbase, etc.
do_not_cache = {"~empty", "calldatasize"}
do_not_cache = {"~empty", "calldatasize", "callvalue"}

return (
isinstance(self.value, str)
and (self.value.lower() in VALID_IR_MACROS or self.value.upper() in get_ir_opcodes())
Expand Down

0 comments on commit 257d5e4

Please sign in to comment.