Skip to content

Commit

Permalink
staterecovery: small log improvement and timeout increase for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnovais committed Feb 6, 2025
1 parent 45eada1 commit d46f0d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class StateRecoveryApp(
"contract address mismatch: config=${config.smartContractAddress} client=${lineaContractClient.getAddress()}"
}
}

private val l1EventsClient = LineaSubmissionEventsClientImpl(
logsSearcher = ethLogsSearcher,
smartContractAddress = config.smartContractAddress,
Expand Down Expand Up @@ -166,16 +167,25 @@ class StateRecoveryApp(
vertx = vertx,
backoffDelay = config.executionClientPollingInterval,
stopRetriesPredicate = { recoveryStatus ->
log.debug(
"waiting for node to sync until stateRecoverStartBlockNumber={} headBlockNumber={}",
recoveryStatus.stateRecoverStartBlockNumber,
recoveryStatus.headBlockNumber
)
// headBlockNumber shall be at least 1 block behind of stateRecoverStartBlockNumber
// if it is after it means it was already enabled
recoveryStatus.stateRecoverStartBlockNumber?.let { startBlockNumber ->
val hasReachedTargetBlock = recoveryStatus.stateRecoverStartBlockNumber?.let { startBlockNumber ->
recoveryStatus.headBlockNumber + 1u >= startBlockNumber
} ?: false
if (hasReachedTargetBlock) {
log.info(
"waiting for node to sync until stateRecoverStartBlockNumber={} - 1, headBlockNumber={}",
recoveryStatus.stateRecoverStartBlockNumber,
recoveryStatus.headBlockNumber
)
} else {
log.info(
"node reached recovery target block: stateRecoverStartBlockNumber={} headBlockNumber={}",
recoveryStatus.stateRecoverStartBlockNumber,
recoveryStatus.headBlockNumber
)
}
hasReachedTargetBlock
}
) {
elClient.lineaGetStateRecoveryStatus()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,11 @@ class StateRecoveryAppWithFakeExecutionClientIntTest {
log.debug("forceSyncStopBlockNumber={}", fakeStateManagerClient)

stateRecoverApp.start().get()
submitDataToL1ContactAndWaitExecution(waitTimeout = 1.minutes)
submitDataToL1ContactAndWaitExecution(waitTimeout = 3.minutes)

await()
.atMost(1.minutes.toJavaDuration())
.untilAsserted {
println(executionLayerClient.headBlock.number)
assertThat(executionLayerClient.headBlock.number).isGreaterThanOrEqualTo(debugForceSyncStopBlockNumber)
}

Expand Down

0 comments on commit d46f0d5

Please sign in to comment.