Skip to content

Commit

Permalink
fix(gas-limit): increase gas optimization constant
Browse files Browse the repository at this point in the history
fixes #86
  • Loading branch information
alexanderwende committed Jan 25, 2022
1 parent 3c79832 commit 721c9fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/vendors/ethers/utils/gas-limit.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ethers } from 'ethers';

/**
* This value has been calculated as the difference between estimated gas with caching on a single block
* and actual gas without caching on multiple blocks.
* This value has been determined after testing all `order - fill` pairings and recording the difference
* between `ethers`' `estimateGas` and the tx's `gasUsed`.
*/
const GAS_LIMIT_DELTA = ethers.BigNumber.from('15000');
const GAS_LIMIT_DELTA = ethers.BigNumber.from('26000');

/**
* Calculates a higher gas limit to prevent out-of-gas errors in certain situations.
Expand Down
2 changes: 1 addition & 1 deletion test/vendors/ethers/utils/gas-limit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ describe('vendors/ethers/utils/gas-limit', () => {

assert.strictEqual(limit._isBigNumber, true, 'should create a BigNumber instance');
assert.strictEqual(limit.gt(estimated), true, 'the limit should be greater than the estimate');
assert.strictEqual(limit.toNumber(), estimated.toNumber() + 15000, 'the limit should be 15k greater than the estimate');
assert.strictEqual(limit.toNumber(), estimated.toNumber() + 26000, 'the limit should be 26k greater than the estimate');
});
});

0 comments on commit 721c9fc

Please sign in to comment.