Skip to content

Commit

Permalink
fix: gas estimation with new lll shape
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdefinitelyahuman committed Feb 15, 2021
1 parent 0350f20 commit fa7c8ba
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions vyper/compiler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ def build_gas_estimates(lll_nodes: LLLnode) -> dict:
if len(lll_nodes.args) > 0 and lll_nodes.args[-1].value == "return":
lll_nodes = lll_nodes.args[-1].args[1].args[0]

assert lll_nodes.value == "seq"
for arg in lll_nodes.args:
if arg.func_name is not None:
gas_estimates[arg.func_name] = arg.total_gas
external_sub = next((i for i in lll_nodes.args if i.value == "with"), None)
if external_sub:
for func_lll in external_sub.args[-1].args:
if func_lll.func_name is not None:
gas_estimates[func_lll.func_name] = func_lll.total_gas

return gas_estimates

Expand Down

0 comments on commit fa7c8ba

Please sign in to comment.