0

I run the following code against two private blockchains, parity-aura and geth-clique. Why does the parity transaction revert and why does it use 6,000,000gas when it should actually only use about 44709gas?

JS Code

contract = new web3.eth.Contract(KVStoreABI);
contract.options.address = contractAddress;
tx = contract.methods.set("hello", "world");
tx.send({ "from": fromAddress })
        .once('transactionHash', function (hash) {
            console.log("TX RECEIVED:", hash)
        })
        .once('receipt', function (receipt) {
            console.log("RECEIPT:\n", receipt)
        })
        .on('error', function (error) {
            console.log("ERROR\n:", error)
        })
        .then(function (receipt) {
            console.log("TX MINED:", receipt.transactionHash)
        });

kvstore.sol

pragma solidity ^0.5.7;

contract KVstore {

  mapping(string=>string) public store;

  function get(string memory key) public view returns(string memory) {
    return store[key];
  }
  function set(string memory key, string memory value) public {
    store[key] = value;
  }
}

Parity-Aura

Contract at: 0xd653D36C16c01dC6c0802B571Bb4B129A2Cb2CD7
Sending  1txs...

TX RECEIVED: 0x0d5e8b19a8706bf2f1e1c46e35081353e140d5a0b608c0b65aae6225cd41a8b3
(node:29273) UnhandledPromiseRejectionWarning: Error: Transaction has been reverted by the EVM:
{
  "blockHash": "0xa1ef20cfdb0790d3fa00420cd892e7cfd59e013c45cd794d0766f8f076e54ff6",
  "blockNumber": 20,
  "contractAddress": null,
  "cumulativeGasUsed": 6000000,
  "from": "0x933e73c3f959759c169effa4019c8faf7d05ce33",
  "gasUsed": 6000000,
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "root": null,
  "status": false,
  "to": "0xd653d36c16c01dc6c0802b571bb4b129a2cb2cd7",
  "transactionHash": "0x0d5e8b19a8706bf2f1e1c46e35081353e140d5a0b608c0b65aae6225cd41a8b3",
  "transactionIndex": 0,
  "events": {}
}
at /home/ubuntu/node_modules/web3-core-method/src/index.js:412:37
at processTicksAndRejections (internal/process/task_queues.js:93:5)

Geth-Clique

Contract at: 0x4032E20ea7bb7F1F9dA448D661B3B27EcbCa9DFd
Sending  1txs...

TX RECEIVED: 0x0d7766a5eab1fa3220c9401dc74444360653932fa467941b3e38e033aca132ad
RECEIPT:
 {
  blockHash: '0x177e9d9c12bdfc8cfa895e7bc545e801baca1310e2637637d9dd3afd8a31e063',
  blockNumber: 326,
  contractAddress: null,
  cumulativeGasUsed: 44709,
  from: '0x933e73c3f959759c169effa4019c8faf7d05ce33',
  gasUsed: 44709,
  logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  status: true,
  to: '0x4032e20ea7bb7f1f9da448d661b3b27ecbca9dfd',
  transactionHash: '0x0d7766a5eab1fa3220c9401dc74444360653932fa467941b3e38e033aca132ad',
  transactionIndex: 0,
  events: {}
}
TX MINED: 0x0d7766a5eab1fa3220c9401dc74444360653932fa467941b3e38e033aca132ad
  • A wild guess: account 0x933e73c3f959759c169effa4019c8faf7d05ce33 is unlocked on your Geth-Clique network but not on your Parity-Aura network... – goodvibration Oct 13 '19 at 19:06
  • @goodvibration good guess but it should be unlocked. Otherwise it doesn't deploy the contract and I don't receive a transaction hash at all. – Senju Oct 14 '19 at 6:53
0

my understanding is that with the advent of Constantinople fork and St Petersburg the EVM code changed and that contracts compiled with versions of solidity 0.5.5 and greater are only compatible with networks running Constantinople/St Petersburg

from Github Parity-Ethereum

I compiled the contract with solidity 0.5.0 and it solved the issue, running for both implementations now!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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