Commit f37c283c authored by kf's avatar kf

fix(sdk): correctly handle no batch case

Fixes the SDK so that it correctly handles the case where no batches
have been submitted to the StateCommitmentChain yet. Only happens in
development or immediately after a new chain is started.
parent 25d140ee
---
'@eth-optimism/sdk': patch
---
Have SDK properly handle case when no batches are submitted yet
......@@ -654,6 +654,11 @@ export class CrossChainMessenger implements ICrossChainMessenger {
let batchEvent: ethers.Event | null =
await this.getStateBatchAppendedEventByBatchIndex(upperBound)
// Only happens when no batches have been submitted yet.
if (batchEvent === null) {
return null
}
if (isEventLo(batchEvent, transactionIndex)) {
// Upper bound is too low, means this transaction doesn't have a corresponding state batch yet.
return null
......
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