Skip to content

Commit

Permalink
Merge branch 'master' into fix_codesize
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Apr 2, 2022
2 parents 3c21a7a + 6fdeb84 commit 591ba5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
4 changes: 3 additions & 1 deletion tests/base_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def _none_addr(datatype, data):

@pytest.fixture(scope="module")
def tester():
custom_genesis = PyEVMBackend._generate_genesis_params(overrides={"gas_limit": 4500000})
# set absurdly high gas limit so that london basefee never adjusts
# (note: 2**63 - 1 is max that evm allows)
custom_genesis = PyEVMBackend._generate_genesis_params(overrides={"gas_limit": 10 ** 10})
custom_genesis["base_fee_per_gas"] = 0
backend = PyEVMBackend(genesis_parameters=custom_genesis)
return EthereumTester(backend=backend)
Expand Down
19 changes: 3 additions & 16 deletions vyper/codegen/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,28 +260,15 @@ def getpos(node):
)


# TODO since this is always(?) used as add_ofst(ptr, n*ptr.location.word_scale)
# maybe the API should be `add_words_to_ofst(ptr, n)` and handle the
# word_scale multiplication inside
# add an offset to a pointer, keeping location and encoding info
def add_ofst(ptr, ofst):
ofst = IRnode.from_list(ofst)
if isinstance(ptr.value, int) and isinstance(ofst.value, int):
# NOTE: duplicate with optimizer rule (but removing this makes a
# test on --no-optimize mode use too much gas)
ret = ptr.value + ofst.value
else:
ret = ["add", ptr, ofst]
ret = ["add", ptr, ofst]
return IRnode.from_list(ret, location=ptr.location, encoding=ptr.encoding)


# shorthand util
def _mul(x, y):
x, y = IRnode.from_list(x), IRnode.from_list(y)
# NOTE: similar deal: duplicate with optimizer rule
if isinstance(x.value, int) and isinstance(y.value, int):
ret = x.value * y.value
else:
ret = ["mul", x, y]
ret = ["mul", x, y]
return IRnode.from_list(ret)


Expand Down

0 comments on commit 591ba5c

Please sign in to comment.