Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Invalid Jump Destination" #1091

Closed
haydenadams opened this issue Nov 21, 2018 · 4 comments
Closed

"Invalid Jump Destination" #1091

haydenadams opened this issue Nov 21, 2018 · 4 comments
Labels
bug Bug that shouldn't change language semantics when fixed.

Comments

@haydenadams
Copy link

I've noticed that ever since switching to a vyper version using #901 the only error I get (on transactions that should fail) is eth.exceptions.InvalidJumpDestination: Invalid Jump Destination

Here is my testing setup:
https://github.com/Uniswap/contracts-vyper/blob/master/tests/conftest.py

Version Information

asn1crypto==0.24.0
atomicwrites==1.2.1
attrdict==2.0.0
attrs==18.2.0
certifi==2018.10.15
cffi==1.11.5
chardet==3.0.4
cryptography==2.3.1
cytoolz==0.9.0.1
eth-abi==1.2.2
eth-account==0.2.3
eth-bloom==1.0.1
eth-hash==0.2.0
eth-keyfile==0.5.1
eth-keys==0.2.0b3
eth-rlp==0.1.2
eth-tester==0.1.0b33
eth-typing==1.3.0
eth-utils==1.2.2
hexbytes==0.1.0
idna==2.7
lru-dict==1.1.6
more-itertools==4.3.0
parsimonious==0.8.1
pluggy==0.8.0
py==1.7.0
py-ecc==1.4.3
py-evm==0.2.0a33
pycparser==2.19
pycryptodome==3.6.6
pyethash==0.1.27
pytest==3.9.2
requests==2.20.0
rlp==1.0.3
semantic-version==2.6.0
six==1.11.0
toolz==0.9.0
trie==1.3.8
urllib3==1.24
vyper==0.1.0b3
web3==4.4.1
websockets==5.0.1

Error Output:

test_eth_to_token.py:18:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../env/lib/python3.6/site-packages/web3/eth.py:263: in sendTransaction
    get_buffered_gas_estimate(self.web3, transaction),
../../env/lib/python3.6/site-packages/web3/utils/transactions.py:84: in get_buffered_gas_estimate
    gas_estimate = web3.eth.estimateGas(gas_estimate_transaction)
../../env/lib/python3.6/site-packages/web3/eth.py:304: in estimateGas
    [transaction],
../../env/lib/python3.6/site-packages/web3/manager.py:107: in request_blocking
    response = self._make_request(method, params)
../../env/lib/python3.6/site-packages/web3/manager.py:90: in _make_request
    return request_func(method, params)
../../env/lib/python3.6/site-packages/web3/middleware/gas_price_strategy.py:18: in middleware
    return make_request(method, params)
cytoolz/functoolz.pyx:232: in cytoolz.functoolz.curry.__call__
    ???
../../env/lib/python3.6/site-packages/web3/middleware/formatting.py:48: in apply_formatters
    response = make_request(method, formatted_params)
../../env/lib/python3.6/site-packages/web3/middleware/attrdict.py:18: in middleware
    response = make_request(method, params)
cytoolz/functoolz.pyx:232: in cytoolz.functoolz.curry.__call__
    ???
../../env/lib/python3.6/site-packages/web3/middleware/formatting.py:48: in apply_formatters
    response = make_request(method, formatted_params)
../../env/lib/python3.6/site-packages/web3/middleware/normalize_errors.py:9: in middleware
    result = make_request(method, params)
cytoolz/functoolz.pyx:232: in cytoolz.functoolz.curry.__call__
    ???
../../env/lib/python3.6/site-packages/web3/middleware/formatting.py:48: in apply_formatters
    response = make_request(method, formatted_params)
cytoolz/functoolz.pyx:232: in cytoolz.functoolz.curry.__call__
    ???
../../env/lib/python3.6/site-packages/web3/middleware/formatting.py:48: in apply_formatters
    response = make_request(method, formatted_params)
../../env/lib/python3.6/site-packages/web3/providers/eth_tester/middleware.py:320: in middleware
    return make_request(method, [filled_transaction] + params[1:])
../../env/lib/python3.6/site-packages/web3/middleware/fixture.py:12: in middleware
    return make_request(method, params)
cytoolz/functoolz.pyx:232: in cytoolz.functoolz.curry.__call__
    ???
../../env/lib/python3.6/site-packages/web3/middleware/formatting.py:48: in apply_formatters
    response = make_request(method, formatted_params)
../../env/lib/python3.6/site-packages/web3/providers/eth_tester/main.py:46: in make_request
    response = delegator(self.ethereum_tester, params)
cytoolz/functoolz.pyx:232: in cytoolz.functoolz.curry.__call__
    ???
../../env/lib/python3.6/site-packages/web3/providers/eth_tester/defaults.py:36: in call_eth_tester
    return getattr(eth_tester, fn_name)(*fn_args, **fn_kwargs)
../../env/lib/python3.6/site-packages/eth_tester/main.py:445: in estimate_gas
    raw_gas_estimate = self.backend.estimate_gas(raw_transaction)
../../env/lib/python3.6/site-packages/eth_tester/utils/formatting.py:85: in wrapper
    return to_wrap(*args, **kwargs)
../../env/lib/python3.6/site-packages/eth_tester/backends/pyevm/main.py:511: in estimate_gas
    return self.chain.estimate_gas(spoofed_transaction)
../../env/lib/python3.6/site-packages/eth/chains/base.py:615: in estimate_gas
    return self.gas_estimator(state, transaction)
cytoolz/functoolz.pyx:232: in cytoolz.functoolz.curry.__call__
    ???
../../env/lib/python3.6/site-packages/eth/estimators/gas.py:65: in binary_gas_search
    raise error
../../env/lib/python3.6/site-packages/eth/vm/computation.py:560: in apply_computation
    opcode_fn(computation=computation)
../../env/lib/python3.6/site-packages/eth/vm/opcode.py:49: in wrapped_logic_fn
    return logic_fn(computation)

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

computation = <eth.vm.forks.byzantium.computation.ByzantiumComputation object at 0x10fcc6400>

    def jumpi(computation):
        jump_dest, check_value = computation.stack_pop(num_items=2, type_hint=constants.UINT256)

        if check_value:
            computation.code.pc = jump_dest

            next_opcode = computation.code.peek()

            if next_opcode != JUMPDEST:
>               raise InvalidJumpDestination("Invalid Jump Destination")
E               eth.exceptions.InvalidJumpDestination: Invalid Jump Destination

../../env/lib/python3.6/site-packages/eth/vm/logic/flow.py:39: InvalidJumpDestination
@jacqueswww
Copy link
Contributor

@haydenadams does this occur on assert statements? I think this is probably related to our get_revert function if so: https://github.com/ethereum/vyper/blob/master/vyper/compile_lll.py#L30

@haydenadams
Copy link
Author

@jacqueswww It occurs on failing web3 function calls that are not constant.

@haydenadams
Copy link
Author

@jacqueswww wait sorry I misunderstood. You mean Vyper asserts not pytest asserts.

Yeah I think thats the case.

@jacqueswww
Copy link
Contributor

After a lot of digging, I have figured out what is causing this. Doing an invalid jump, was the old method of throwing in a contract, before REVERT came to be. create_with_code_of still uses this type of exception after the delegatcall returns a failure. So here are the steps to fix this issue:

  • Fix kode variable in functions.py to be more readable, hex blobs should be avoided.
  • Make the create_with_code_of use REVERT instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that shouldn't change language semantics when fixed.
Projects
None yet
Development

No branches or pull requests

2 participants