Skip to content

Commit

Permalink
finalized-tag-plugin-update (#685)
Browse files Browse the repository at this point in the history
* rename to linea-finalized-tag-plugin
---------

Co-authored-by: jonesho <[email protected]>
Co-authored-by: jonesho <[email protected]>
  • Loading branch information
3 people authored Feb 19, 2025
1 parent 6a81227 commit 2f5dd49
Show file tree
Hide file tree
Showing 17 changed files with 90 additions and 79 deletions.
2 changes: 1 addition & 1 deletion docker/compose-spec-l1-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:
l1-el-node:
container_name: l1-el-node
hostname: l1-el-node
image: consensys/linea-besu-package:${BESU_PACKAGE_TAG:-mainnet-fc27c01}
image: consensys/linea-besu-package:${BESU_PACKAGE_TAG:-mainnet-f2ff06c}
profiles: [ "l1", "debug", "external-to-monorepo" ]
depends_on:
l1-node-genesis-generator:
Expand Down
16 changes: 8 additions & 8 deletions docker/compose-spec-l2-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
sequencer:
hostname: sequencer
container_name: sequencer
image: consensys/linea-besu-package:${BESU_PACKAGE_TAG:-mainnet-fc27c01}
image: consensys/linea-besu-package:${BESU_PACKAGE_TAG:-mainnet-f2ff06c}
profiles: [ "l2", "l2-bc", "debug", "external-to-monorepo" ]
ports:
- "8545:8545"
Expand Down Expand Up @@ -82,7 +82,7 @@ services:
l2-node-besu:
hostname: l2-node-besu
container_name: l2-node-besu
image: consensys/linea-besu-package:${BESU_PACKAGE_TAG:-mainnet-fc27c01}
image: consensys/linea-besu-package:${BESU_PACKAGE_TAG:-mainnet-f2ff06c}
profiles: [ "l2", "l2-bc", "debug", "external-to-monorepo" ]
depends_on:
sequencer:
Expand Down Expand Up @@ -162,7 +162,7 @@ services:
traces-node-v2:
hostname: traces-node-v2
container_name: traces-node-v2
image: consensys/linea-besu-package:devnet-ceeabfa
image: consensys/linea-besu-package:devnet-9136b07
profiles: [ "l2", "l2-bc", "debug", "external-to-monorepo" ]
depends_on:
sequencer:
Expand Down Expand Up @@ -226,7 +226,7 @@ services:
prover-v3: # prover compatible with the traces from zkbesu
container_name: prover-v3
hostname: prover-v3
image: consensys/linea-prover:${PROVER_TAG:-543aedd}
image: consensys/linea-prover:${PROVER_TAG:-cd7228e}
platform: linux/amd64
# to avoid spinning up on CI for now
profiles: [ "l2" ]
Expand All @@ -247,7 +247,7 @@ services:
postman:
container_name: postman
hostname: postman
image: consensys/linea-postman:${POSTMAN_TAG:-1f8647e}
image: consensys/linea-postman:${POSTMAN_TAG:-cd7228e}
profiles: [ "l2", "debug" ]
platform: linux/amd64
restart: on-failure
Expand All @@ -266,7 +266,7 @@ services:
traces-api:
hostname: traces-api
container_name: traces-api
image: consensys/linea-traces-api-facade:${TRACES_API_TAG:-1f8647e}
image: consensys/linea-traces-api-facade:${TRACES_API_TAG:-cd7228e}
profiles: [ "l2", "debug" ]
restart: on-failure
depends_on:
Expand All @@ -287,7 +287,7 @@ services:
coordinator:
hostname: coordinator
container_name: coordinator
image: consensys/linea-coordinator:${COORDINATOR_TAG:-c08e279}
image: consensys/linea-coordinator:${COORDINATOR_TAG:-cd7228e}
platform: linux/amd64
profiles: [ "l2", "debug" ]
depends_on:
Expand Down Expand Up @@ -490,7 +490,7 @@ services:
transaction-exclusion-api:
hostname: transaction-exclusion-api
container_name: transaction-exclusion-api
image: consensys/linea-transaction-exclusion-api:${TRANSACTION_EXCLUSION_API_TAG:-1f8647e}
image: consensys/linea-transaction-exclusion-api:${TRANSACTION_EXCLUSION_API_TAG:-cd7228e}
profiles: [ "l2", "debug" ]
restart: on-failure
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion docker/compose-tracing-v1-ci-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
extends:
file: compose-spec-l2-services.yml
service: l2-node-besu
image: consensys/linea-besu-package:${BESU_PACKAGE_TAG:-mainnet-fc27c01}
image: consensys/linea-besu-package:${BESU_PACKAGE_TAG:-mainnet-f2ff06c}
volumes:
- ../config/common/traces-limits-besu-v1.toml:/var/lib/besu/traces-limits.toml:ro

Expand Down
2 changes: 1 addition & 1 deletion docker/compose-tracing-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ services:
extends:
file: compose-spec-l2-services.yml
service: sequencer
image: consensys/linea-besu-package:${BESU_PACKAGE_TAG:-mainnet-fc27c01}
image: consensys/linea-besu-package:${BESU_PACKAGE_TAG:-mainnet-f2ff06c}
volumes:
- ../config/common/traces-limits-besu-v1.toml:/var/lib/besu/traces-limits.toml:ro

Expand Down
2 changes: 1 addition & 1 deletion docker/compose-tracing-v2-ci-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
extends:
file: compose-spec-l2-services.yml
service: l2-node-besu
image: consensys/linea-besu-package:devnet-811f30b
image: consensys/linea-besu-package:devnet-9136b07
volumes:
- ../config/common/traces-limits-besu-v2.toml:/var/lib/besu/traces-limits.toml:ro

Expand Down
2 changes: 1 addition & 1 deletion docker/compose-tracing-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:
extends:
file: compose-spec-l2-services.yml
service: sequencer
image: consensys/linea-besu-package:devnet-ceeabfa
image: consensys/linea-besu-package:devnet-9136b07
volumes:
- ../config/common/traces-limits-besu-v2.toml:/var/lib/besu/traces-limits.toml:ro

Expand Down
5 changes: 4 additions & 1 deletion docker/config/l2-node-besu/l2-node-besu-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ metrics-port=9545
data-storage-format="BONSAI"

# plugins
plugins=["LineaEstimateGasEndpointPlugin","L1FinalizationTagUpdaterPlugin","LineaExtraDataPlugin", "LineaTransactionPoolValidatorPlugin"]
plugins=["LineaEstimateGasEndpointPlugin","LineaL1FinalizationTagUpdaterPlugin","LineaExtraDataPlugin", "LineaTransactionPoolValidatorPlugin"]
plugin-linea-module-limit-file-path="/var/lib/besu/traces-limits.toml"
plugin-linea-deny-list-path="/var/lib/besu/deny-list.txt"
plugin-linea-l1l2-bridge-contract="0xe537D669CA013d86EBeF1D64e40fC74CADC91987"
Expand All @@ -56,3 +56,6 @@ plugin-linea-estimate-gas-min-margin="1.2"

Xbonsai-limit-trie-logs-enabled=false
bonsai-historical-block-limit=1024

Xin-process-rpc-enabled=true
Xin-process-rpc-apis=["ETH", "MINER"]
2 changes: 1 addition & 1 deletion docker/config/linea-besu-sequencer/sequencer.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ api-gas-and-priority-fee-upper-bound-coefficient=300
poa-block-txs-selection-max-time=1000

# plugins
plugins=["LineaEstimateGasEndpointPlugin","L1FinalizationTagUpdaterPlugin","LineaExtraDataPlugin", "LineaTransactionPoolValidatorPlugin"]
plugins=["LineaEstimateGasEndpointPlugin","LineaL1FinalizationTagUpdaterPlugin","LineaExtraDataPlugin", "LineaTransactionPoolValidatorPlugin"]
plugin-linea-module-limit-file-path="/var/lib/besu/traces-limits.toml"
plugin-linea-deny-list-path="/var/lib/besu/deny-list.txt"
plugin-linea-estimate-gas-compatibility-mode-enabled=false
Expand Down
11 changes: 6 additions & 5 deletions finalized-tag-updater/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
}

archivesBaseName = 'linea-finalized-tag-updater'

repositories {
maven {
url "https://artifacts.consensys.net/public/linea-besu/maven/"
Expand Down Expand Up @@ -35,6 +37,8 @@ shadowJar {
if ("${project.version}" != 'unspecified') {
archiveClassifier.set('')
archiveVersion.set("${project.version}")
} else {
archiveClassifier.set('SNAPSHOT')
}

dependencies {
Expand All @@ -55,10 +59,7 @@ shadowJar {
}

dependencies {
annotationProcessor 'com.google.auto.service:auto-service:1.1.1'
compileOnly 'com.google.auto.service:auto-service:1.1.1'
compileOnly 'com.google.auto.service:auto-service-annotations:1.1.1'
compileOnly 'io.consensys.linea-besu:plugin-api:24.11-delivery39'
compileOnly project(":jvm-libs:linea:besu-libs")
compileOnly 'info.picocli:picocli:4.7.6'
compileOnly 'io.vertx:vertx-core'

Expand All @@ -76,7 +77,7 @@ dependencies {
}

tasks.register('copyShadowJarToLocalBesu', Copy) {
def jarFileSuffix = "${project.version}" != 'unspecified' ? "${project.version}" : "all"
def jarFileSuffix = "${project.version}" != 'unspecified' ? "${project.version}" : "SNAPSHOT"
def jarFiles = project.getLayout().buildDirectory.dir("libs").get()
.asFileTree
.filter { it.name.endsWith("-${jarFileSuffix}.jar") }
Expand Down
6 changes: 3 additions & 3 deletions finalized-tag-updater/jreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ project:
java:
version: '21'
groupId: build.linea
artifactId: finalized-tag-updater
artifactId: linea-finalized-tag-updater

release:
github:
overwrite: true
releaseName: 'Finalized Tag Updater {{version}}'
releaseName: 'Linea Finalized Tag Updater {{version}}'
changelog:
enabled: false
commitAuthor:
Expand All @@ -28,4 +28,4 @@ distributions:
finalized-tag-updater:
type: SINGLE_JAR
artifacts:
- path: 'build/libs/finalized-tag-updater-{{version}}.jar'
- path: 'build/libs/linea-finalized-tag-updater-{{version}}.jar'

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package linea.consensus

interface EngineBlockTagUpdater {
fun lineaUpdateFinalizedBlockV1(finalizedBlockNumber: Long)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package linea.consensus

import io.vertx.core.Vertx
import net.consensys.linea.LineaBesuEngineBlockTagUpdater
import net.consensys.linea.LineaL1FinalizationUpdaterService
import net.consensys.linea.PluginCliOptions
import net.consensys.linea.async.toSafeFuture
import org.hyperledger.besu.plugin.BesuPlugin
import org.hyperledger.besu.plugin.ServiceManager
import org.hyperledger.besu.plugin.services.BlockchainService
import org.hyperledger.besu.plugin.services.PicoCLIOptions

class LineaL1FinalizationTagUpdaterPlugin : BesuPlugin {
private val cliOptions = PluginCliOptions()
private val vertx: Vertx = Vertx.vertx()
private lateinit var service: LineaL1FinalizationUpdaterService
private lateinit var blockchainService: BlockchainService

override fun register(serviceManager: ServiceManager) {
val cmdlineOptions = serviceManager.getService(PicoCLIOptions::class.java)
.orElseThrow { IllegalStateException("Failed to obtain PicoCLI options from the BesuContext") }
cmdlineOptions.addPicoCLIOptions(CLI_OPTIONS_PREFIX, cliOptions)

blockchainService = serviceManager.getService(BlockchainService::class.java)
.orElseThrow { RuntimeException("Failed to obtain BlockchainService from the BesuContext.") }
}

override fun start() {
service = LineaL1FinalizationUpdaterService(
vertx,
cliOptions.getConfig(),
LineaBesuEngineBlockTagUpdater(blockchainService)
)
service.start()
}

override fun stop() {
service.stop()
.thenCompose {
vertx.close().toSafeFuture()
}.get()
}

companion object {
private const val CLI_OPTIONS_PREFIX = "linea"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package net.consensys.linea

import build.linea.contract.l1.Web3JLineaRollupSmartContractClientReadOnly
import io.vertx.core.Vertx
import net.consensys.linea.consensus.EngineBlockTagUpdater
import linea.consensus.EngineBlockTagUpdater
import net.consensys.linea.web3j.okHttpClientBuilder
import net.consensys.zkevm.LongRunningService
import net.consensys.zkevm.ethereum.finalization.FinalizationUpdatePoller
Expand All @@ -15,7 +15,8 @@ import org.web3j.protocol.Web3j
import org.web3j.protocol.http.HttpService
import java.util.concurrent.CompletableFuture

class LineaBesuEngineBlockTagUpdater(private val blockchainService: BlockchainService) : EngineBlockTagUpdater {
class LineaBesuEngineBlockTagUpdater(private val blockchainService: BlockchainService) :
EngineBlockTagUpdater {
private val log: Logger = LoggerFactory.getLogger(this::class.java)
private fun setFinalizedAndSafeBlock(finalizedBlockNumber: Long): Boolean {
// lookup finalized block by number in local chain
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linea.consensus.LineaL1FinalizationTagUpdaterPlugin
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package net.consensys.linea.consensus

import io.vertx.core.Vertx
import linea.consensus.EngineBlockTagUpdater
import net.consensys.linea.LineaL1FinalizationUpdaterService
import net.consensys.linea.PluginConfig
import net.consensys.linea.async.get
import org.hyperledger.besu.datatypes.Address
import java.net.URI
import kotlin.time.Duration.Companion.seconds

class FakeEngineBlockTagUpdater : EngineBlockTagUpdater {
override fun lineaUpdateFinalizedBlockV1(
finalizedBlockNumber: Long
) {}
) {
println("Linea finalized block update: blockNumber=$finalizedBlockNumber")
}
}

fun main() {
Expand All @@ -25,5 +29,6 @@ fun main() {
service.start().get()
println("service started")
Thread.sleep(10000)
service.stop()
service.stop().get()
vertx.close().get()
}

0 comments on commit 2f5dd49

Please sign in to comment.