Commit b42a8e90 authored by Kevin Chen's avatar Kevin Chen

Replace event with output for better readability.

parent d6ffb8c0
...@@ -48,9 +48,8 @@ export const findFirstUnfinalizedStateBatchIndex = async ( ...@@ -48,9 +48,8 @@ export const findFirstUnfinalizedStateBatchIndex = async (
while (lo !== hi) { while (lo !== hi) {
const mid = Math.floor((lo + hi) / 2) const mid = Math.floor((lo + hi) / 2)
const outputData = await findOutputForIndex(oracle, mid, logger) const outputData = await findOutputForIndex(oracle, mid, logger)
const eventTimestamp = outputData.l1Timestamp
if (eventTimestamp + fpw < latestBlock.timestamp) { if (outputData.l1Timestamp + fpw < latestBlock.timestamp) {
lo = mid + 1 lo = mid + 1
} else { } else {
hi = mid hi = mid
......
...@@ -41,7 +41,7 @@ describe('helpers', () => { ...@@ -41,7 +41,7 @@ describe('helpers', () => {
}) })
describe('findOutputForIndex', () => { describe('findOutputForIndex', () => {
describe('when the event exists once', () => { describe('when the output exists once', () => {
beforeEach(async () => { beforeEach(async () => {
const latestBlock = await hre.ethers.provider.getBlock('latest') const latestBlock = await hre.ethers.provider.getBlock('latest')
const params = { const params = {
...@@ -60,14 +60,14 @@ describe('helpers', () => { ...@@ -60,14 +60,14 @@ describe('helpers', () => {
) )
}) })
it('should return the event', async () => { it('should return the output', async () => {
const event = await findOutputForIndex(L2OutputOracle, 0) const output = await findOutputForIndex(L2OutputOracle, 0)
expect(event.l2OutputIndex).to.equal(0) expect(output.l2OutputIndex).to.equal(0)
}) })
}) })
describe('when the event does not exist', () => { describe('when the output does not exist', () => {
it('should throw an error', async () => { it('should throw an error', async () => {
await expect( await expect(
findOutputForIndex(L2OutputOracle, 0) findOutputForIndex(L2OutputOracle, 0)
......
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