fix gas var; set high enough value

pull/7/head
Iuri Matias 7 years ago
parent 65c1fac71c
commit 79764e2dc0
  1. 64
      sol/tests.sol
  2. 3
      src/deployer.js
  3. 2
      src/provider.js
  4. 11
      src/txProcess.js

@ -62,38 +62,38 @@ library Assert {
AssertionEvent(result, message);
}
// function notEqual(int a, int b, string message) public returns (bool result) {
// result = (a != b);
// AssertionEvent(result, message);
// }
// function notEqual(bool a, bool b, string message) public returns (bool result) {
// result = (a != b);
// AssertionEvent(result, message);
// }
//
// // TODO: only for certain versions of solc
// //function notEqual(fixed a, fixed b, string message) public returns (bool result) {
// // result = (a != b);
// // AssertionEvent(result, message);
// //}
//
// // TODO: only for certain versions of solc
// //function notEqual(ufixed a, ufixed b, string message) public returns (bool result) {
// // result = (a != b);
// // AssertionEvent(result, message);
// //}
//
// function notEqual(address a, address b, string message) public returns (bool result) {
// result = (a != b);
// AssertionEvent(result, message);
// }
//
// function notEqual(bytes32 a, bytes32 b, string message) public returns (bool result) {
// result = (a != b);
// AssertionEvent(result, message);
// }
//
function notEqual(int a, int b, string message) public returns (bool result) {
result = (a != b);
AssertionEvent(result, message);
}
function notEqual(bool a, bool b, string message) public returns (bool result) {
result = (a != b);
AssertionEvent(result, message);
}
// TODO: only for certain versions of solc
//function notEqual(fixed a, fixed b, string message) public returns (bool result) {
// result = (a != b);
// AssertionEvent(result, message);
//}
// TODO: only for certain versions of solc
//function notEqual(ufixed a, ufixed b, string message) public returns (bool result) {
// result = (a != b);
// AssertionEvent(result, message);
//}
function notEqual(address a, address b, string message) public returns (bool result) {
result = (a != b);
AssertionEvent(result, message);
}
function notEqual(bytes32 a, bytes32 b, string message) public returns (bool result) {
result = (a != b);
AssertionEvent(result, message);
}
// // TODO: needs to be convert to bytes first to be comparable
// //function notEqual(string a, string b, string message) public returns (bool result) {
// // result = (a != b);

@ -83,7 +83,8 @@ function deployAll (compileResult, web3, callback) {
console.dir(accounts);
deployObject.send({
from: accounts[0],
gas: Math.ceil(gasValue * 1.1)
//gas: Math.ceil(gasValue * 1.2)
gas: 1200000
}).on('receipt', function (receipt) {
console.dir("==== got the receipt");

@ -30,7 +30,7 @@ Provider.prototype.sendAsync = function(payload, callback) {
return callback(null, jsonRPCResponse(payload.id, this.accounts.map((x) => x.address)))
}
if (payload.method === 'eth_estimateGas') {
callback(null, jsonRPCResponse(payload.id, 800000))
callback(null, jsonRPCResponse(payload.id, 1200000))
}
if (payload.method === 'eth_gasPrice') {
callback(null, jsonRPCResponse(payload.id, 1))

@ -33,6 +33,9 @@ function createContract(payload, from, data, value, gasLimit, txRunner, callback
console.log('-- createContract');
console.dir(arguments);
let finalCallback = function(err, result) {
if (err) {
return callback(err);
}
let contractAddress = ('0x' + result.result.createdAddress.toString('hex'))
callback(null, jsonRPCResponse(payload.id, result.transactionHash))
}
@ -71,8 +74,8 @@ function processTx(accounts, payload, isCall, callback) {
executionContext.init(api.config);
let txRunner = new TxRunner(accounts, api);
let { from: from, to: to, data: data, value: value, gasLimit: gasLimit } = payload.params[0];
gasLimit = gasLimit || 800000;
let { from: from, to: to, data: data, value: value, gas: gas } = payload.params[0];
gas = gas || 1200000;
let callbacks = {
confirmationCb: (network, tx, gasEstimation, continueTxExecution, cancelCb) => {
@ -87,9 +90,9 @@ function processTx(accounts, payload, isCall, callback) {
}
if (to) {
runTx(payload, from, to, data, value, gasLimit, txRunner, callbacks, isCall, callback);
runTx(payload, from, to, data, value, gas, txRunner, callbacks, isCall, callback);
} else {
createContract(payload, from, data, value, gasLimit, txRunner, callbacks, callback);
createContract(payload, from, data, value, gas, txRunner, callbacks, callback);
}
}

Loading…
Cancel
Save