Skip to content

Commit

Permalink
update gas limit padding to 50% (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
mholtzman authored Apr 15, 2022
1 parent 51637e3 commit d3009b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main/provider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export class Provider extends EventEmitter {
}

const estimatedLimit = parseInt(response.result, 16)
const paddedLimit = Math.ceil(estimatedLimit * 1.15)
const paddedLimit = Math.ceil(estimatedLimit * 1.5)

log.verbose(`gas estimate for tx to ${txParams.to}: ${estimatedLimit}, using ${paddedLimit} as gas limit`)
return resolve(addHexPrefix(paddedLimit.toString(16)))
Expand Down
4 changes: 2 additions & 2 deletions test/main/provider/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ describe('#send', () => {
})
})

it('pads the gas estimate from the network by 15 percent', done => {
it('pads the gas estimate from the network by 50 percent', done => {
connection.send.mockImplementationOnce((payload, cb) => {
expect(payload.method).toBe('eth_estimateGas')
cb({ result: addHexPrefix((150000).toString(16)) })
Expand All @@ -670,7 +670,7 @@ describe('#send', () => {
sendTransaction(() => {
try {
const initialRequest = accountRequests[0]
expect(initialRequest.data.gasLimit).toBe(addHexPrefix((172500).toString(16)))
expect(initialRequest.data.gasLimit).toBe(addHexPrefix((225000).toString(16)))
done()
} catch (e) { done(e) }
})
Expand Down

0 comments on commit d3009b1

Please sign in to comment.