Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
test: adds test that gas estimation is deterministic (ethereum-optimi…
Browse files Browse the repository at this point in the history
…sm#962)

* test: adds test that gas estimation is deterministic

* chore: yarn lint
  • Loading branch information
gakonst authored May 26, 2021
1 parent a25acbb commit c84d345
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions integration-tests/test/rpc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,22 @@ describe('Basic RPC tests', () => {
})

describe('eth_estimateGas (returns the fee)', () => {
it('gas estimation is deterministic', async () => {
let lastEstimate: BigNumber
for (let i = 0; i < 10; i++) {
const estimate = await l2Provider.estimateGas({
to: DEFAULT_TRANSACTION.to,
value: 0,
})

if (i > 0) {
expect(lastEstimate).to.be.eq(estimate)
}

lastEstimate = estimate
}
})

it('should return a gas estimate for txs with empty data', async () => {
const estimate = await l2Provider.estimateGas({
to: DEFAULT_TRANSACTION.to,
Expand Down

0 comments on commit c84d345

Please sign in to comment.