mirror of https://github.com/embarklabs/embark.git
fix: gas estimates in test (#1650)
This commit is contained in:
parent
6d844d72e5
commit
312c631f86
|
@ -316,7 +316,14 @@ class ContractDeployer {
|
|||
next();
|
||||
},
|
||||
function estimateCorrectGas(next) {
|
||||
if (contract.gas === 'auto' || !contract.gas) {
|
||||
if (contract._skipGasEstimations) {
|
||||
// This is Ganache's gas limit. We subtract 1 so we don't reach the limit.
|
||||
//
|
||||
// We do this because Ganache's gas estimates are wrong (contract creation
|
||||
// has a base cost of 53k, not 21k, so it sometimes results in out of gas
|
||||
// errors.)
|
||||
contract.gas = 6721975 - 1;
|
||||
} else if (contract.gas === 'auto' || !contract.gas) {
|
||||
return self.blockchain.estimateDeployContractGas(deployObject, (err, gasValue) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
|
|
|
@ -36,6 +36,7 @@ class DeployManager {
|
|||
this.events.setCommandHandler('deploy:contracts:test', (cb) => {
|
||||
self.fatalErrors = true;
|
||||
self.deployOnlyOnConfig = true;
|
||||
self.skipGasEstimations = true;
|
||||
self.deployContracts(cb);
|
||||
});
|
||||
}
|
||||
|
@ -70,6 +71,7 @@ class DeployManager {
|
|||
callback = result;
|
||||
}
|
||||
contract._gasLimit = self.gasLimit;
|
||||
contract._skipGasEstimations = self.skipGasEstimations;
|
||||
self.events.request('deploy:contract', contract, (err) => {
|
||||
if (err) {
|
||||
contract.error = err.message || err;
|
||||
|
|
Loading…
Reference in New Issue