6

I have a contract with a method add() where I read the value msg.value and change the contract informations.

before upgrading, I was calling this method in my test with return contract.add({from: accounts[1], value: 1});.

after upgrading, all the calls create an exception : Uncaught Error: VM Exception while processing transaction: invalid JUMP. To make it work again, I have to remove , value: 1 and just keep return contract.add({from: accounts[1]});. and I still get the message even if i remove the whole code inside the add method : function add() {}

Is there a new way to send ethers with the transactions ? I read all the documentation and tutorial but it seems everyone is doing like me.

note that it seems that things come from testrpc. Here are the logs i get :

Transaction: 0x7d739e8416775a70a47616347471024feb8fb7da2dc938d3c7a25acf5031d0b8
  Gas usage: 0x47e7c4
  Block Number: 0x13
  Block Time: Sun Oct 16 2016 17:43:33 GMT+0200 (CEST)
  Runtime Error: invalid JUMP

 <   [
 <     {
 <       "id": 61,
 <       "jsonrpc": "2.0",
 <       "result": [
 <         "0x23abbf0929b16b5d905a6cc2735c5d718f598811b5bf4668e64ae91953839571",
 <         "0xd6f5b175fe05dc3b3df1d96d9793468feb9d098290c4b7ab51e034f276376f17"
 <       ]
 <     },
 <     {
 <       "id": 62,
 <       "jsonrpc": "2.0",
 <       "result": [
 <         "0x9f9e54e2c65ef2f0bc73dab9622c33cd726d4e81507a55b37b2d62b01b8bf9b1",
 <         "0xd6f5b175fe05dc3b3df1d96d9793468feb9d098290c4b7ab51e034f276376f17"
 <       ]
 <     },
 <     {
 <       "id": 63,
 <       "jsonrpc": "2.0",
 <       "result": [
 <         "0x0e1a087bec7de89c464714f7e49b9eb46edcf1c540e32111d2d9506bea02a062",
 <         "0xd6f5b175fe05dc3b3df1d96d9793468feb9d098290c4b7ab51e034f276376f17"
 <       ]
 <     }
 <   ]
eth
  • 85,679
  • 53
  • 285
  • 406
  • The error you're reporting is an error in the EVM. We'd have to see the specific code of your contract (or just the add() function) to answer this. – Matthew Schmidt Oct 16 '16 at 16:11
  • Even if i remove the whole code and just leave function ajoutAssureur() { } i get the same error :(. But the constructor works fine and the contract is created. – Stéphane Traumat Oct 16 '16 at 16:13

1 Answers1

10

You need to put the payable modifier in your function.

In the latest version of solidity, if a function does not have that modifier, it will throw (i.e. perform an invalid jump) if it receives ether.

Matthew Schmidt
  • 7,290
  • 1
  • 24
  • 35
  • Thanks a lot Mathhew, this keyword did not appear in any of the tutorial i read ! and the error message I was getting was not already seen on Google. Thanks a lot for ur help – Stéphane Traumat Oct 16 '16 at 16:35
  • this a new feature in solidity so you will not find it in the non-nupdated documentation – Badr Bellaj Oct 16 '16 at 17:14