3

Getting an error in executing a token contract:

An error occurred during contract execution: invalid jump destination (PUSH1) 2

http://testnet.etherscan.io/vmtrace?txhash=0xfd2f51d19e32d7b4be5fe63cb46f9207c8f58120b4156d77c20408c1a7ab4dfa

Using this transaction code:

myContractInstance.transferFrom(fromAddress, toAddress, transferValue, {from: web3.eth.accounts[0], gas: 3000000});

Is there an obvious reason I'm overlooking? Thanks

http://testnet.etherscan.io/vmtrace?txhash=0xfd2f51d19e32d7b4be5fe63cb46f9207c8f58120b4156d77c20408c1a7ab4dfa

  • can you edit with code that you were using from contract? – VoR0220 Apr 13 '16 at 6:00
  • This is often from an array out-of-bounds error, but I can't be sure unless you post the source code. – Tjaden Hess Apr 13 '16 at 14:09
2

Replicating ERROR: invalid jump destination (PUSH1) 2

I don't know what source code you were executing, but I can replicate the invalid jump destination (PUSH1) 2 error by running the following function:

contract TestInvalidJumpLoc {

    function testInvalidJumpLocation() public constant returns (uint[5]) {
      uint[5] memory data;
      uint j = 1;
      j = j - 2;
      data[j] = 1235;
      return data;
    }

And executing the function to get the following results:

 testInvalidJumpLocContract.testInvalidJumpLocation()
 ...
 PC 00000304: JUMP GAS: 49978004 COST: 8 ERROR: invalid jump destination (PUSH1) 2
...

This error could have been caused by some other parts of your code, but an invalid array index definitely generates this message.

The above snippet was taken from my answer to the question Bad Jump Array solidity and Data location .

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.