Skip to content

Commit

Permalink
staterecovery: add getLogsChunkSize config option
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnovais committed Feb 17, 2025
1 parent 0b16f20 commit 8ec4415
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ class LineaSubmissionEventsClientImpl(
private val smartContractAddress: String,
private val l1EarliestSearchBlock: BlockParameter = BlockParameter.Tag.EARLIEST,
private val l1LatestSearchBlock: BlockParameter = BlockParameter.Tag.FINALIZED,
private val logsBlockChunkSize: Int = 1000
private val logsBlockChunkSize: Int
) : LineaRollupSubmissionEventsClient {
init {
require(logsBlockChunkSize > 0) { "logsBlockChunkSize=$logsBlockChunkSize must be greater than 0" }
}

private fun findDataFinalizedEventContainingBlock(
fromBlock: BlockParameter,
l2BlockNumber: ULong
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ class StateRecoveryApp(
val l1EarliestSearchBlock: BlockParameter = BlockParameter.Tag.EARLIEST,
val l1LatestSearchBlock: BlockParameter = BlockParameter.Tag.FINALIZED,
val l1PollingInterval: Duration = 12.seconds,
val l1getLogsChunkSize: UInt,
val executionClientPollingInterval: Duration = 1.seconds,
val blobDecompressorVersion: BlobDecompressorVersion = BlobDecompressorVersion.V1_1_0,
val logsBlockChunkSize: UInt = 1000u,
/**
* The block number at which the recovery mode will start overriding the recovery start block number
* this is meant for testing purposes, not production
Expand All @@ -51,15 +51,17 @@ class StateRecoveryApp(
// TODO: set block of V6 Upgrade
l1EarliestSearchBlock = 1UL.toBlockParameter(),
l1LatestSearchBlock = BlockParameter.Tag.FINALIZED,
executionClientPollingInterval = 10.seconds,
l1PollingInterval = 12.seconds
l1PollingInterval = 12.seconds,
l1getLogsChunkSize = 10_000u,
executionClientPollingInterval = 10.seconds
)
val lineaSepolia = Config(
smartContractAddress = "0xb218f8a4bc926cf1ca7b3423c154a0d627bdb7e5",
l1EarliestSearchBlock = 7164537UL.toBlockParameter(),
l1LatestSearchBlock = BlockParameter.Tag.FINALIZED,
executionClientPollingInterval = 10.seconds,
l1PollingInterval = 12.seconds
l1PollingInterval = 12.seconds,
l1getLogsChunkSize = 10_000u,
executionClientPollingInterval = 10.seconds
)
}
}
Expand All @@ -75,7 +77,7 @@ class StateRecoveryApp(
smartContractAddress = config.smartContractAddress,
l1EarliestSearchBlock = config.l1EarliestSearchBlock,
l1LatestSearchBlock = config.l1LatestSearchBlock,
logsBlockChunkSize = config.logsBlockChunkSize.toInt()
logsBlockChunkSize = config.l1getLogsChunkSize.toInt()
)
private val log = LogManager.getLogger(this::class.java)
private val blockImporterAndStateVerifier = BlockImporterAndStateVerifierV1(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ open class LineaStateRecoveryPlugin : BesuPlugin {
blockHeaderStaticFields = blockHeaderStaticFields,
appConfig = StateRecoveryApp.Config(
smartContractAddress = config.l1SmartContractAddress.toString(),
l1getLogsChunkSize = config.l1GetLogsChunkSize,
l1LatestSearchBlock = net.consensys.linea.BlockParameter.Tag.LATEST,
overridingRecoveryStartBlockNumber = config.overridingRecoveryStartBlockNumber,
l1PollingInterval = config.l1PollingInterval,
overridingRecoveryStartBlockNumber = config.overridingRecoveryStartBlockNumber,
debugForceSyncStopBlockNumber = config.debugForceSyncStopBlockNumber
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ data class PluginConfig(
val l1SmartContractAddress: Address,
val l1Endpoint: URI,
val l1PollingInterval: kotlin.time.Duration,
val l1GetLogsChunkSize: UInt,
val l1RequestSuccessBackoffDelay: kotlin.time.Duration,
val l1RequestRetryConfig: RetryConfig,
val blobscanEndpoint: URI,
Expand Down Expand Up @@ -63,6 +64,13 @@ class PluginCliOptions {
)
var l1PollingInterval: java.time.Duration = java.time.Duration.ofSeconds(12)

@CommandLine.Option(
names = ["--$cliOptionsPrefix-l1-get-logs-chunk-size"],
description = ["Chuck size (fromBlock..toBlock) for eth_getLogs initial search loop. Default is 10_000"],
required = false
)
var l1GetLogsChunkSize: Int = 10_000

@CommandLine.Option(
names = ["--$cliOptionsPrefix-l1-success-backoff-delay"],
description = [
Expand Down Expand Up @@ -172,6 +180,7 @@ class PluginCliOptions {
l1SmartContractAddress = l1SmartContractAddress,
l1Endpoint = l1RpcEndpoint,
l1PollingInterval = l1PollingInterval.toKotlinDuration(),
l1GetLogsChunkSize = l1GetLogsChunkSize.toUInt(),
l1RequestSuccessBackoffDelay = l1RequestSuccessBackoffDelay?.toKotlinDuration() ?: 1.milliseconds,
l1RequestRetryConfig = RetryConfig(
backoffDelay = l1RequestRetryBackoffDelay?.toKotlinDuration() ?: 1.milliseconds,
Expand All @@ -180,7 +189,9 @@ class PluginCliOptions {
),
blobscanEndpoint = blobscanEndpoint,
blobScanRequestRetryConfig = RetryConfig(
backoffDelay = blobscanRequestRetryBackoffDelay.toKotlinDuration()
backoffDelay = blobscanRequestRetryBackoffDelay.toKotlinDuration(),
timeout = blobscanRequestRetryTimeout?.toKotlinDuration(),
maxRetries = blobscanRequestRetryLimit?.toUInt()
),
shomeiEndpoint = shomeiEndpoint,
overridingRecoveryStartBlockNumber = overridingRecoveryStartBlockNumber?.toULong(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TestRunner(
l1PollingInterval = 5.seconds,
executionClientPollingInterval = 1.seconds,
smartContractAddress = StateRecoveryApp.Config.lineaSepolia.smartContractAddress,
logsBlockChunkSize = 10_000u,
l1getLogsChunkSize = 10_000u,
debugForceSyncStopBlockNumber = debugForceSyncStopBlockNumber
)
val appClients = createAppClients(
Expand Down

0 comments on commit 8ec4415

Please sign in to comment.