Commit 8487adb9 authored by Maurelian's avatar Maurelian Committed by Kelvin Fichter

refactor(contracts): Remove printGasSavings function

The function was mostly useful for tracking how much gas had been
saved during the dev process, but is no longer needed in the
test suite
parent f96e0ba9
......@@ -145,18 +145,8 @@ describe('[GAS BENCHMARK] Depositing via the standard bridge', () => {
const receipt = await res.wait()
const gasUsed = receipt.gasUsed.toNumber()
const regenesis040Cost = 196_128
console.log(' - Gas used:', gasUsed)
console.log(
' - Absolute savings vs regenesis/0.4.0:',
regenesis040Cost - gasUsed
)
console.log(
' - Relative savings vs regenesis/0.4.0:',
(((regenesis040Cost - gasUsed) / regenesis040Cost) * 100).toFixed(2) +
'%'
)
expectApprox(gasUsed, 154_247, {
expectApprox(gasUsed, 116_003, {
absoluteUpperDeviation: 500,
// Assert a lower bound of 1% reduction on gas cost. If your tests are breaking because your
// contracts are too efficient, consider updating the target value!
......@@ -182,23 +172,14 @@ describe('[GAS BENCHMARK] Depositing via the standard bridge', () => {
const receipt = await res.wait()
const gasUsed = receipt.gasUsed.toNumber()
const regenesis040Cost = 244_358
console.log(' - Gas used:', gasUsed)
console.log(
' - Absolute savings vs regenesis/0.4.0:',
regenesis040Cost - gasUsed
)
console.log(
' - Relative savings vs regenesis/0.4.0:',
(((regenesis040Cost - gasUsed) / regenesis040Cost) * 100).toFixed(2) +
'%'
)
expectApprox(gasUsed, 202_088, {
expectApprox(gasUsed, 163_844, {
absoluteUpperDeviation: 500,
// Assert a lower bound of 1% reduction on gas cost. If your tests are breaking because your
// contracts are too efficient, consider updating the target value!
percentLowerDeviation: 1,
})
// Sanity check that the message was enqueued.
expect(await CanonicalTransactionChain.getQueueLength()).to.equal(3)
})
......
......@@ -41,18 +41,6 @@ const appendSequencerBatch = async (
})
}
const printGasSavings = (gasUsed: number, regenesis040Cost: number): void => {
console.log(' - Gas used:', gasUsed)
console.log(
' - Absolute savings vs regenesis/0.4.0:',
regenesis040Cost - gasUsed
)
console.log(
' - Relative savings vs regenesis/0.4.0:',
(((regenesis040Cost - gasUsed) / regenesis040Cost) * 100).toFixed(2) + '%'
)
}
describe('[GAS BENCHMARK] CanonicalTransactionChain', () => {
let sequencer: Signer
before(async () => {
......@@ -163,7 +151,6 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => {
const gasUsed = receipt.gasUsed.toNumber()
console.log('Benchmark complete.')
printGasSavings(gasUsed, 1_616_390)
console.log('Fixed calldata cost:', fixedCalldataCost)
console.log(
......@@ -211,7 +198,6 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => {
const gasUsed = receipt.gasUsed.toNumber()
console.log('Benchmark complete.')
printGasSavings(gasUsed, 1_632_687)
console.log('Fixed calldata cost:', fixedCalldataCost)
console.log(
......@@ -269,7 +255,6 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => {
const gasUsed = receipt.gasUsed.toNumber()
console.log('Benchmark complete.')
printGasSavings(gasUsed, 2_099_387)
console.log('Fixed calldata cost:', fixedCalldataCost)
console.log(
......@@ -307,7 +292,6 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => {
const gasUsed = receipt.gasUsed.toNumber()
console.log('Benchmark complete.')
printGasSavings(gasUsed, 237_065)
expectApprox(gasUsed, 187_081, {
absoluteUpperDeviation: 500,
......@@ -329,7 +313,6 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => {
const gasUsed = receipt.gasUsed.toNumber()
console.log('Benchmark complete.')
printGasSavings(gasUsed, 196_457)
expectApprox(gasUsed, 126_700, {
absoluteUpperDeviation: 500,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment