I'm running:
- Which Parity version?: v1.11.8-stable-c754a028e-20180725/x86_64-windows-msvc/rustc1.27.2
- Which operating system?: Windows
- How installed?: via installer
- Are you fully synchronized?: doesn't matter (running a private chain)
- Which network are you connected to?: private
- Did you try to restart the node?: yes
I have the following contracts:
pragma solidity ^0.4.24;
interface Interface1 {
function get() external pure returns (uint256);
}
contract Contract1 is Interface1 {
function get() external pure returns (uint256) {return 123456;}
}
contract Contract2 {
Interface1 public interface1;
constructor(Interface1 _interface1) public {interface1 = _interface1;}
function get() external view returns (uint256) {return interface1.get();}
}
And the following Web3 (v1) test for them:
let fs = require("fs");
let Web3 = require("web3");
let NODE_ADDR = "http://localhost:8545";
let PUBLIC_KEY = "0x_MY_PUBLIC_KEY";
let PRIVATE_KEY = "0x_MY_PRIVATE_KEY";
let web3 = new Web3(NODE_ADDR);
async function deploy(contractName, contractArgs = []) {
let abi = fs.readFileSync(contractName + ".abi").toString();
let bin = fs.readFileSync(contractName + ".bin").toString();
let contract = new web3.eth.Contract(JSON.parse(abi));
let transaction = contract.deploy({data: "0x" + bin, arguments: contractArgs});
let options = {
to : transaction._parent._address,
data: transaction.encodeABI(),
gas : await transaction.estimateGas({from: PUBLIC_KEY})
};
let signedTransaction = await web3.eth.accounts.signTransaction(options, PRIVATE_KEY);
let receipt = await web3.eth.sendSignedTransaction(signedTransaction.rawTransaction);
console.log(`${contractName} contract deployed at address ${receipt.contractAddress}`);
return new web3.eth.Contract(JSON.parse(abi), receipt.contractAddress);
}
async function execute() {
let contract1 = await deploy("Contract1");
let contract2 = await deploy("Contract2", [contract1._address]);
let addr = await contract2.methods.interface1().call();
console.log(addr);
let val1 = await contract1.methods.get().call();
console.log(val1);
let val2 = await contract2.methods.get().call(); // Parity fails here with VM execution error
console.log(val2);
}
execute();
I am running Parity as a local process listening on port 8545.
When I execute the test, I get:
Error: Returned error: VM execution error
On the line:
await contract2.methods.get().call();
When I try the same with other Ethereum clients (Ganache and Geth), the test completes successfully.
My Parity configuration is:
--chain=chain.json
--engine-signer=0x_MY_PUBLIC_KEY
--password=password.txt
--ntp-servers=127.0.0.1:123
--jsonrpc-port=8545
--jsonrpc-interface=all
--jsonrpc-apis=all
--jsonrpc-hosts=all
--jsonrpc-cors=none
--reseal-on-txs=none
--force-sealing
--tx-gas-limit=0x1000000000
--mode=offline
File chain.json contains:
{
"name": "my_private_network",
"engine": {
"authorityRound": {
"params": {
"gasLimitBoundDivisor": "0x400",
"stepDuration": "1",
"validators" : {
"list": [
"0x_MY_PUBLIC_KEY"
]
}
}
}
},
"genesis": {
"seal": {
"authorityRound": {
"step": "0x0",
"signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x20000",
"gasLimit": "0xffffffff"
},
"params": {
"accountStartNonce": "0x0",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"gasLimitBoundDivisor": "0x400",
"networkID" : "0x8245",
"eip658Transition": 0,
"eip140Transition": 0
},
"accounts": {
"0x_MY_PUBLIC_KEY": { "balance": "1000000000000000000000" }
}
}
I bet it's because of the genesis, could you try adding the following:
"eip150Transition": "0x0",
"eip160Transition": "0x0",
"eip161abcTransition": "0x0",
"eip161dTransition": "0x0",
"eip155Transition": "0x0",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"maxCodeSize": 24576,
"maxCodeSizeTransition": "0x0",
"eip140Transition": "0x0",
"eip211Transition": "0x0",
"eip214Transition": "0x0",
"eip658Transition": "0x0",
like here: https://github.com/paritytech/parity-ethereum/blob/master/ethcore/res/instant_seal.json
You can alternatively try with --chain dev
@Tbaut:
Perfect, that solved it!!!
Thank you very much.
Could you please explain which one of these parameters solved the problem?
P.S.: I already had:
"eip658Transition": 0,
"eip140Transition": 0
So it has to be one of the other parameters, or a combination of several parameters.
Thanks again!!!
I've seen quite often tests to rely on the status field of transactionReceipt. This field was enabled by "eip658Transition": 0,