Commit f9b579d5 authored by Kelvin Fichter's avatar Kelvin Fichter

fix(fd): use correct fn for getTotalElements

Fault detector was using L2OutputOracle.latestOutputIndex() to query the
total number of outputs submitted, which was off by one. Correct
function is L2OutputOracle.nextOutputIndex(). Caused crashes of the
fault detector on startup if no outputs had been submitted to the L2OO
yet.
parent 576a8fcb
---
'@eth-optimism/fault-detector': patch
---
Fixes a bug that would cause the fault detector to error out if no outputs had been proposed yet.
......@@ -124,7 +124,7 @@ export class FaultDetector extends BaseServiceV2<Options, Metrics, State> {
this.state.oo = {
contract: oo,
filter: oo.filters.OutputProposed(),
getTotalElements: async () => oo.latestOutputIndex(),
getTotalElements: async () => oo.nextOutputIndex(),
getEventIndex: (args) => args.l2OutputIndex,
}
} else {
......
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