Commit 9c366e67 authored by Hamdi Allam's avatar Hamdi Allam

nits

parent 7fe5de7c
......@@ -148,7 +148,7 @@ export const findEventForStateBatch = async <TSubmissionEventArgs>(
}
// Update the event cache if we don't have the event.
logger?.info('event not cached from index. warming cache...', { index })
logger?.info('event not cached for index. warming cache...', { index })
await updateOracleCache(oracle, logger)
// Event better be in cache now!
......
......@@ -219,6 +219,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
// We use this a lot, a bit cleaner to pull out to the top level of the state object.
this.state.fpw = await this.state.messenger.getChallengePeriodSeconds()
this.logger.info(`fault proof window is ${this.state.fpw} seconds`)
if (this.options.bedrock) {
const oo = this.state.messenger.contracts.l1.L2OutputOracle
this.state.oo = {
......@@ -255,10 +257,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
// but it happens often on testnets because the FPW is very short.
if (firstUnfinalized === undefined) {
this.logger.info('no unfinalized batches found. skipping all batches.')
// `getTotalElements - 1` is the last batch. So the current count of batches
// represents the next expected batch to be published
const totalBatches = await this.state.oo.getTotalElements()
this.state.currentBatchIndex = totalBatches.toNumber()
this.state.currentBatchIndex = totalBatches.toNumber() - 1
} else {
this.state.currentBatchIndex = firstUnfinalized
}
......@@ -266,8 +266,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
this.state.currentBatchIndex = this.options.startBatchIndex
}
this.logger.info('starting height', {
startBatchIndex: this.state.currentBatchIndex,
this.logger.info('starting batch', {
batchIndex: this.state.currentBatchIndex,
})
// Set the initial metrics.
......@@ -287,7 +287,8 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
let latestBatchIndex: number
try {
latestBatchIndex = (await this.state.oo.getTotalElements()).toNumber() - 1
const totalBatches = await this.state.oo.getTotalElements()
latestBatchIndex = totalBatches.toNumber() - 1
} catch (err) {
this.logger.error('failed to query total # of batches', {
error: err,
......@@ -303,7 +304,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
}
if (this.state.currentBatchIndex > latestBatchIndex) {
this.logger.info('batch index is ahead of L1. waiting...', {
this.logger.info('batch index is ahead of the oracle. waiting...', {
batchIndex: this.state.currentBatchIndex,
latestBatchIndex,
})
......@@ -314,7 +315,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
this.metrics.highestBatchIndex.set({ type: 'known' }, latestBatchIndex)
this.logger.info('checking batch', {
batchIndex: this.state.currentBatchIndex,
latestIndex: latestBatchIndex,
latestBatchIndex,
})
let event: PartialEvent
......@@ -325,7 +326,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
this.logger
)
} catch (err) {
this.logger.error('failed to fetch event associated the batch', {
this.logger.error('failed to fetch event associated with batch', {
error: err,
node: 'l1',
section: 'findEventForStateBatch',
......@@ -448,7 +449,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
event.transactionHash
)
} catch (err) {
this.logger.error('failed to require acquire batch transaction', {
this.logger.error('failed to acquire batch transaction', {
error: err,
node: 'l1',
section: 'getTransaction',
......@@ -474,7 +475,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
this.logger.info('L2 node is behind. waiting for sync...', {
batchBlockStart: batchStart,
batchBlockEnd: batchEnd,
l2Block: latestBlock,
l2BlockHeight: latestBlock,
})
return
}
......
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