coordinator: update besu dependency (#475)

* coordinator: update besu dependency and fix coordinator integration tests with retries
This commit is contained in:
Pedro Novais
2025-01-06 16:04:41 +00:00
committed by GitHub
parent 87163c936e
commit 6daac298e4
10 changed files with 66 additions and 89 deletions

View File

@@ -51,7 +51,7 @@ concurrency:
jobs:
build-and-publish:
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-large
name: Coordinator build
env:
COMMIT_TAG: ${{ inputs.commit_tag }}
@@ -78,7 +78,7 @@ jobs:
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 #v4.2.1
- name: Build dist
run: |
./gradlew coordinator:app:installDist --no-daemon
./gradlew coordinator:app:installDist
- name: Login to Docker Hub
if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
uses: docker/login-action@v3

View File

@@ -20,6 +20,12 @@ repositories {
url "https://hyperledger.jfrog.io/artifactory/besu-maven/"
content { includeGroupAndSubgroups('org.hyperledger.besu') }
}
maven {
url "https://artifacts.consensys.net/public/linea-besu/maven/"
content {
includeGroupAndSubgroups('io.consensys')
}
}
maven {
url "https://artifacts.consensys.net/public/maven/maven/"
}

View File

@@ -260,7 +260,7 @@ class BlockCreationMonitorTest {
await().atLeast(config.pollingInterval.times(2).toJavaDuration())
fakeL2RpcNode.resumeHttpServer()
await()
.atMost(20.seconds.toJavaDuration())
.atMost(40.seconds.toJavaDuration())
.untilAsserted {
assertThat(blockCreationListener.blocksReceived).isNotEmpty
assertThat(blockCreationListener.blocksReceived.last().number).isGreaterThan(lastBlockReceived)

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import kotlinx.datetime.Clock
import net.consensys.linea.contract.AsyncFriendlyTransactionManager
import net.consensys.linea.jsonrpc.JsonRpcErrorResponseException
import net.consensys.linea.testing.filesystem.getPathTo
import net.consensys.toULong
import org.apache.logging.log4j.LogManager
@@ -136,35 +137,38 @@ private open class WhaleBasedAccountManager(
(0..numberOfAccounts).map {
val randomPrivKey = Bytes.random(32).toHexString().replace("0x", "")
val newAccount = Account(randomPrivKey, Credentials.create(randomPrivKey).address)
val transferResult = whaleTxManager.sendTransaction(
/*gasPrice*/ 300_000_000.toBigInteger(),
/*gasLimit*/ 21000.toBigInteger(),
newAccount.address,
"",
initialBalanceWei
)
if (transferResult.hasError()) {
val transactionHash = try {
retry {
whaleTxManager.sendTransaction(
/*gasPrice*/ 300_000_000.toBigInteger(),
/*gasLimit*/ 21000.toBigInteger(),
newAccount.address,
"",
initialBalanceWei
)
}
} catch (e: Exception) {
val accountBalance =
web3jClient.ethGetBalance(whaleAccount.address, DefaultBlockParameterName.LATEST).send().result
throw RuntimeException(
"Failed to send funds from accAddress=${whaleAccount.address}, " +
"accBalance=$accountBalance, " +
"accPrivKey=0x...${whaleAccount.privateKey.takeLast(8)}, " +
"error: ${transferResult.error.asString()}"
"error: ${e.message}"
)
}
newAccount to transferResult
newAccount to transactionHash
}
}
result.forEach { (account, transferTx) ->
result.forEach { (account, transactionHash) ->
log.debug(
"Waiting for account funding: newAccount={} txHash={} whaleAccount={}",
account.address,
transferTx.transactionHash,
transactionHash,
whaleAccount.address
)
web3jClient.waitForTxReceipt(
transferTx.transactionHash,
transactionHash,
expectedStatus = "0x1",
timeout = 40.seconds,
pollingInterval = 500.milliseconds
@@ -180,10 +184,6 @@ private open class WhaleBasedAccountManager(
return result.map { it.first }
}
fun Response.Error.asString(): String {
return "Response.Error(code=$code, message=$message)"
}
override fun getTransactionManager(account: Account): AsyncFriendlyTransactionManager {
return getTransactionManager(
web3jClient,
@@ -231,3 +231,32 @@ object L2AccountManager : AccountManager by WhaleBasedAccountManager(
genesisFile = getPathTo(System.getProperty("L2_GENESIS", "docker/config/linea-local-dev-genesis.json")),
log = LogManager.getLogger(L2AccountManager::class.java)
)
fun <R, T : Response<R>> retry(
timeout: Duration = 30.seconds,
retryInterval: Duration = 1.seconds,
action: () -> T
): R {
val start = Clock.System.now()
var response: T? = null
var latestError: Exception? = null
do {
try {
response = action()
if (response.hasError()) {
Thread.sleep(retryInterval.inWholeMilliseconds)
}
} catch (e: Exception) {
latestError = e
Thread.sleep(retryInterval.inWholeMilliseconds)
}
} while (response?.hasError() == true && Clock.System.now() < start + timeout)
return response?.let {
if (it.hasError()) {
throw JsonRpcErrorResponseException(it.error.code, it.error.message, it.error.data)
} else {
it.result
}
} ?: throw latestError!!
}

View File

@@ -267,7 +267,7 @@ services:
coordinator:
hostname: coordinator
container_name: coordinator
image: consensys/linea-coordinator:${COORDINATOR_TAG:-bb7cd3d}
image: consensys/linea-coordinator:${COORDINATOR_TAG:-a5119c4}
platform: linux/amd64
profiles: [ "l2", "debug" ]
depends_on:

View File

@@ -8,7 +8,7 @@ jreleaser = {id = "org.jreleaser", version = "1.15.0"}
jreleaser = { group = "org.jreleaser", name = "jreleaser-gradle-plugin", version = "1.15.0" }
[versions]
besu = "24.10.0"
besu = "24.12.2"
caffeine = "3.1.6"
hoplite = "2.7.5"
jackson = "2.18.0"

View File

@@ -3,25 +3,27 @@ plugins {
id 'java-library'
}
def besuArtifactGroup="org.hyperledger.besu"
dependencies {
api("org.hyperledger.besu:besu-datatypes:${libs.versions.besu.get()}") {
api("${besuArtifactGroup}:besu-datatypes:${libs.versions.besu.get()}") {
transitive = false
}
api("org.hyperledger.besu:evm:${libs.versions.besu.get()}") {
api("${besuArtifactGroup}:evm:${libs.versions.besu.get()}") {
transitive = false
}
api("org.hyperledger.besu.internal:core:${libs.versions.besu.get()}") {
api("${besuArtifactGroup}.internal:core:${libs.versions.besu.get()}") {
transitive = false
}
api("org.hyperledger.besu.internal:algorithms:${libs.versions.besu.get()}") {
api("${besuArtifactGroup}.internal:algorithms:${libs.versions.besu.get()}") {
transitive = false
}
api("org.hyperledger.besu:plugin-api:${libs.versions.besu.get()}") {
api("${besuArtifactGroup}:plugin-api:${libs.versions.besu.get()}") {
transitive = false
}
api("org.hyperledger.besu.internal:rlp:${libs.versions.besu.get()}") {
api("${besuArtifactGroup}.internal:rlp:${libs.versions.besu.get()}") {
transitive = false
}

View File

@@ -14,11 +14,7 @@ dependencies {
testImplementation(testFixtures(project(":jvm-libs:linea:blob-compressor")))
testImplementation(project(":jvm-libs:linea:testing:file-system"))
testImplementation("io.tmio:tuweni-bytes:${libs.versions.tuweni.get()}")
testImplementation("org.hyperledger.besu:besu-datatypes:${libs.versions.besu.get()}")
testImplementation "org.hyperledger.besu:evm:${libs.versions.besu.get()}"
testImplementation("org.hyperledger.besu.internal:core:${libs.versions.besu.get()}")
testImplementation("org.hyperledger.besu:plugin-api:${libs.versions.besu.get()}")
testImplementation("org.hyperledger.besu.internal:rlp:${libs.versions.besu.get()}")
testImplementation(project(":jvm-libs:linea:besu-libs"))
}
jar {

View File

@@ -71,5 +71,4 @@ include 'state-recover:appcore:domain-models'
include 'state-recover:appcore:clients-interfaces'
include 'state-recover:clients:blobscan-client'
include 'state-recover:clients:execution-layer-json-rpc-client'
include 'state-recover:clients:smartcontract'
include 'state-recover:clients:eth-api'

View File

@@ -1,55 +0,0 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id 'net.consensys.zkevm.kotlin-library-conventions'
}
dependencies {
implementation(project(':jvm-libs:generic:extensions:kotlin'))
implementation(project(':jvm-libs:linea:web3j-extensions'))
implementation(project(':state-recover:appcore:clients-interfaces'))
implementation(project(':coordinator:clients:smart-contract-client'))
implementation('build.linea:l1-rollup-contract-client:6.0.0-rc2')
testImplementation(project(':coordinator:core'))
testImplementation(project(":coordinator:ethereum:test-utils"))
testImplementation(project(":jvm-libs:linea:testing:l1-blob-and-proof-submission"))
testImplementation("io.vertx:vertx-junit5")
}
sourceSets {
integrationTest {
kotlin {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
compileClasspath += sourceSets.main.output + sourceSets.main.compileClasspath + sourceSets.test.compileClasspath
runtimeClasspath += sourceSets.main.output + sourceSets.main.runtimeClasspath + sourceSets.test.runtimeClasspath
}
}
task integrationTest(type: Test) { test ->
description = "Runs integration tests."
group = "verification"
useJUnitPlatform()
classpath = sourceSets.integrationTest.runtimeClasspath
testClassesDirs = sourceSets.integrationTest.output.classesDirs
dependsOn(":localStackComposeUp")
testLogging {
events TestLogEvent.FAILED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STARTED,
TestLogEvent.PASSED
exceptionFormat TestExceptionFormat.FULL
showCauses true
showExceptions true
showStackTraces true
// set showStandardStreams if you need to see test logs
showStandardStreams false
}
}