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 (
while (lo !== hi) {
const mid = Math.floor((lo + hi) / 2)
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
} else {
hi = mid
......
......@@ -41,7 +41,7 @@ describe('helpers', () => {
})
describe('findOutputForIndex', () => {
describe('when the event exists once', () => {
describe('when the output exists once', () => {
beforeEach(async () => {
const latestBlock = await hre.ethers.provider.getBlock('latest')
const params = {
......@@ -60,14 +60,14 @@ describe('helpers', () => {
)
})
it('should return the event', async () => {
const event = await findOutputForIndex(L2OutputOracle, 0)
it('should return the output', async () => {
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 () => {
await expect(
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