Hey, I am trying to run ethereum benchmarks on my existing blockchain so far I have come across multiple error including
-
Gas Issue (Apparently the contract compiled by my truffle does not have a gas specified which I have to manually specify while executing the benchmarks)
-
After specifying gas price in the contract build I don't still don't get it in the init.js so I have to specify again.
contx.contracts.ProofC.gas = 67219750
contx.contracts.ProofC.estimateGas = 60000000
-
The above two issues I have overcome but not I am getting nonce issues. In run inside init.js I am repeatedly getting same nonce back which causes the first transaction to run and all others to fail.
Please note that I was able to run the existing sample benchmark flawlessly but for actual benchmark of my existing contract I have to use oraclize and as its running fine using web3 and metamask I just want to get performance indicators of my existing setup also right now i am not concerned with the gas estimate or cost i just want to have a benchmark on performance not the gas price used.
I have been stuck in this issue from a month please guide me and let me know anything you need.
Thanks in advance. Any help will be much appreciated.
Truffle using to compile the contracts:
module.exports = {
// See http://truffleframework.com/docs/advanced/configuration
// for more about customizing your Truffle configuration!
networks: {
development: {
host: "127.0.0.1",
port: 8545,
network_id: "*" // Match any network id
}
},
compilers: {
solc: {
version: "0.4.24",
settings: {
optimizer: {
enabled: true,
runs: 2000
},
},
optimizer: {
enabled: true,
runs: 2000
},
}
}
};
============================ OUTPUT ================
2020.06.09-03:50:23.505 info [caliper] [message-handler] Handling "test" message
----------Nonces----------
{ '0x8c1F7A07D5592Fb6c7E1530738368447045B3366': 43 }
2020.06.09-03:50:23.507 info [caliper] [caliper-local-client.js] Info: client 1 start test runFixedNumber():Creating Proof chain.
----------Nonces----------
2020.06.09-03:50:23.508 info [caliper] [message-handler] Handling "test" message
2020.06.09-03:50:23.508 info [caliper] [caliper-local-client.js] txUpdateTime: 5000
{ '0x8c1F7A07D5592Fb6c7E1530738368447045B3366': 43 }
2020.06.09-03:50:23.510 info [caliper] [caliper-local-client.js] txUpdateTime: 5000
2020.06.09-03:50:23.510 info [caliper] [caliper-local-client.js] Info: client 2 start test runFixedNumber():Creating Proof chain.
2020.06.09-03:50:23.511 info [caliper] [message-handler] Handling "test" message
----------Nonces----------
2020.06.09-03:50:23.512 info [caliper] [caliper-local-client.js] Info: client 3 start test runFixedNumber():Creating Proof chain.
----------Nonces----------
{ '0x8c1F7A07D5592Fb6c7E1530738368447045B3366': 43 }
2020.06.09-03:50:23.513 info [caliper] [caliper-local-client.js] txUpdateTime: 5000
{ '0x8c1F7A07D5592Fb6c7E1530738368447045B3366': 43 }
2020.06.09-03:50:23.515 info [caliper] [caliper-local-client.js] Info: client 4 start test runFixedNumber():Creating Proof chain.
----------Nonces----------
{ '0x8c1F7A07D5592Fb6c7E1530738368447045B3366': 43 }
2020.06.09-03:50:23.675 error [caliper] [ethereum.js] Failed tx on ProofC calling method isVerified nonce 0x2b
2020.06.09-03:50:23.676 error [caliper] [ethereum.js] Error: Returned error: the tx doesn't have the correct nonce. account has nonce of: 44 tx has nonce of: 43
2020.06.09-03:50:23.682 error [caliper] [ethereum.js] Failed tx on ProofC calling method isVerified nonce 0x2b
2020.06.09-03:50:23.682 error [caliper] [ethereum.js] Error: Returned error: the tx doesn't have the correct nonce. account has nonce of: 44 tx has nonce of: 43
2020.06.09-03:50:23.739 error [caliper] [ethereum.js] Failed tx on ProofC calling method isVerified nonce 0x2b
2020.06.09-03:50:23.740 error [caliper] [ethereum.js] Error: Returned error: the tx doesn't have the correct nonce. account has nonce of: 44 tx has nonce of: 43
2020.06.09-03:50:23.746 error [caliper] [ethereum.js] Failed tx on ProofC calling method isVerified nonce 0x2b
2020.06.09-03:50:23.746 error [caliper] [ethereum.js] Error: Returned error: the tx doesn't have the correct nonce. account has nonce of: 44 tx has nonce of: 43
2020.06.09-03:50:23.908 info [caliper] [message-handler] Handled "test" message for worker 0
2020.06.09-03:50:23.915 info [caliper] [message-handler] Handled "test" message for worker 3
2020.06.09-03:50:23.942 info [caliper] [message-handler] Handled "test" message for worker 1
2020.06.09-03:50:23.948 info [caliper] [message-handler] Handled "test" message for worker 4
2020.06.09-03:50:23.953 info [caliper] [message-handler] Handled "test" message for worker 2
2020.06.09-03:50:23.958 info [caliper] [report-builder] ### Test result ###
2020.06.09-03:50:23.964 info [caliper] [report-builder]
+------+------+------+-----------------+-----------------+-----------------+-----------------+------------------+
| Name | Succ | Fail | Send Rate (TPS) | Max Latency (s) | Min Latency (s) | Avg Latency (s) | Throughput (TPS) |
|------|------|------|-----------------|-----------------|-----------------|-----------------|------------------|
| init | 1 | 4 | 454.5 | 0.24 | 0.24 | 0.24 | 4.1 |
+------+------+------+-----------------+-----------------+-----------------+-----------------+------------------+
2020.06.09-03:50:23.967 info [caliper] [round-orchestrator] Finished round 1 (init) in 0.19 seconds
========================= init.js ======================================
'use strict';
const web3 = require('web3')
module.exports.info = 'Creating Proof chain.';
let bc, contx;
let runTimes = 0
module.exports.init = function (blockchain, context, args) {
bc = blockchain;
contx = context;
return Promise.resolve();
};
module.exports.run = async function () {
let args;
var fromAddress = '0x8c1F7A07D5592Fb6c7E1530738368447045B3366';
console.log("----------Nonces----------")
console.log(contx.nonces)
contx.contracts.ProofC.gas = 67219750
contx.contracts.ProofC.estimateGas = 60000000
let invokeData = [];
// if (bc.getType() === 'ethereum') {
invokeData = [{
verb: 'isVerified',
args: [web3.utils.asciiToHex('resourceinn.com')]
}];
// }
return bc.invokeSmartContract(contx, 'ProofC', '', invokeData, 60);
};
module.exports.end = function () {
return Promise.resolve();
};
================== Run Command ==============
npx caliper launch master --caliper-bind-sut ethereum:latest --caliper-benchconfig benchmarks/samples/ethereum/config.yaml --caliper-networkconfig networks/ethereum/1node/ethereum.json --caliper-workspace ./