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

2
  • can you edit with code that you were using from contract?
    – VoR0220
    Commented Apr 13, 2016 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. Commented Apr 13, 2016 at 14:09

1 Answer 1

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 agree to our terms of service and acknowledge you have read our privacy policy.

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