aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--app/scripts/lib/idStore.js3
-rw-r--r--test/unit/idStore-test.js9
3 files changed, 7 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 47a6e9b3b..bc8cc5fa3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,7 @@
## Current Master
- Fix bug where gas estimate would sometimes be very high.
-- Increased our gas estimate safety buffer to avoid Out of Gas errors.
+- Increased our gas estimate from 100k gas to 20% of estimate.
- Fix github link on info page to point at current repository.
## 2.13.6 2016-10-26
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js
index 8c811a614..0ce91f471 100644
--- a/app/scripts/lib/idStore.js
+++ b/app/scripts/lib/idStore.js
@@ -287,9 +287,10 @@ IdentityStore.prototype.checkForDelegateCall = function (codeHex) {
}
}
-const gasBuffer = new BN('200000', 10)
IdentityStore.prototype.addGasBuffer = function (gas) {
const bnGas = new BN(ethUtil.stripHexPrefix(gas), 16)
+ const five = new BN('5', 10)
+ const gasBuffer = bnGas.div(five)
const correct = bnGas.add(gasBuffer)
return ethUtil.addHexPrefix(correct.toString(16))
}
diff --git a/test/unit/idStore-test.js b/test/unit/idStore-test.js
index b0940d2fa..064483ba0 100644
--- a/test/unit/idStore-test.js
+++ b/test/unit/idStore-test.js
@@ -159,7 +159,7 @@ describe('IdentityStore', function() {
assert.equal(result.indexOf('0x'), 0, 'include hex prefix')
})
- it('buffers reasonably', function() {
+ it('buffers 20%', function() {
const idStore = new IdentityStore({
configManager: configManagerGen(),
ethStore: {
@@ -169,18 +169,17 @@ describe('IdentityStore', function() {
const gas = '0x04ee59' // Actual estimated gas example
const bnGas = new BN(ethUtil.stripHexPrefix(gas), 16)
- const correctBuffer = new BN('200000', 10)
+ const five = new BN('5', 10)
+ const correctBuffer = bnGas.div(five)
const correct = bnGas.add(correctBuffer)
- const tooBig = new BN(tooBigOutput, 16)
const result = idStore.addGasBuffer(gas)
const bnResult = new BN(ethUtil.stripHexPrefix(result), 16)
assert.equal(result.indexOf('0x'), 0, 'included hex prefix')
assert(bnResult.gt(bnGas), 'Estimate increased in value.')
- assert.equal(bnResult.sub(bnGas).toString(10), '100000', 'added 100k gas')
+ assert.equal(bnResult.sub(bnGas).toString(10), correctBuffer.toString(10), 'added 20% gas')
assert.equal(result, '0x' + correct.toString(16), 'Added the right amount')
- assert.notEqual(result, tooBigOutput, 'not that bad estimate')
})
})