diff --git a/CHANGELOG.md b/CHANGELOG.md index f9bffda3d31..e1e20bc9d74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,5 +9,6 @@ ### Breaking Changes ### Additions and Improvements +- Clean up old beacon states when switching from ARCHIVE to PRUNE or MINIMAL data storage mode ### Bug Fixes diff --git a/acceptance-tests/build.gradle b/acceptance-tests/build.gradle index 5136e15a20e..f732ec2b4fa 100644 --- a/acceptance-tests/build.gradle +++ b/acceptance-tests/build.gradle @@ -28,7 +28,7 @@ dependencies { testFixturesImplementation 'io.libp2p:jvm-libp2p' testFixturesImplementation 'org.apache.commons:commons-lang3' testFixturesImplementation 'commons-io:commons-io' - testFixturesImplementation 'org.apache.tuweni:tuweni-bytes' + testFixturesImplementation 'io.tmio:tuweni-bytes' testFixturesImplementation 'org.junit.jupiter:junit-jupiter-api' testFixturesImplementation 'org.testcontainers:testcontainers' testFixturesImplementation 'org.testcontainers:junit-jupiter' diff --git a/beacon/pow/build.gradle b/beacon/pow/build.gradle index 80e89168f32..d5e8f10e189 100644 --- a/beacon/pow/build.gradle +++ b/beacon/pow/build.gradle @@ -18,7 +18,7 @@ dependencies { api 'org.web3j:core' - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' testImplementation testFixtures(project(':infrastructure:async')) testImplementation testFixtures(project(':infrastructure:time')) diff --git a/beacon/sync/build.gradle b/beacon/sync/build.gradle index 35a17772b5b..63feb29193d 100644 --- a/beacon/sync/build.gradle +++ b/beacon/sync/build.gradle @@ -16,7 +16,7 @@ dependencies { implementation project(':storage:api') implementation project(':infrastructure:events') - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' testImplementation testFixtures(project(':ethereum:spec')) testImplementation testFixtures(project(':ethereum:statetransition')) diff --git a/beacon/validator/build.gradle b/beacon/validator/build.gradle index d069f585e01..e100f1d6407 100644 --- a/beacon/validator/build.gradle +++ b/beacon/validator/build.gradle @@ -33,8 +33,8 @@ dependencies { implementation project(':ethereum:json-types') implementation 'it.unimi.dsi:fastutil' - implementation 'org.apache.tuweni:tuweni-bytes' - implementation 'org.apache.tuweni:tuweni-ssz' + implementation 'io.tmio:tuweni-bytes' + implementation 'io.tmio:tuweni-ssz' testImplementation project(':infrastructure:metrics') testImplementation testFixtures(project(':ethereum:spec')) diff --git a/build.gradle b/build.gradle index d59bfffd00f..7026207ea71 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,8 @@ import tech.pegasys.teku.depcheck.DepCheckPlugin import java.text.SimpleDateFormat +import groovy.json.JsonSlurper + import static tech.pegasys.teku.repackage.Repackage.repackage buildscript { @@ -318,7 +320,8 @@ allprojects { } } -def refTestVersion = 'v1.5.0-alpha.8' +def nightly = System.getenv("NIGHTLY") != null +def refTestVersion = nightly ? "nightly" : "v1.5.0-alpha.8" def blsRefTestVersion = 'v0.1.2' def slashingProtectionInterchangeRefTestVersion = 'v5.3.0' def refTestBaseUrl = 'https://github.com/ethereum/consensus-spec-tests/releases/download' @@ -329,7 +332,87 @@ def blsRefTestDownloadDir = "${buildDir}/blsRefTests/${blsRefTestVersion}" def slashingProtectionInterchangeRefTestDownloadDir = "${buildDir}/slashingProtectionInterchangeRefTests/${slashingProtectionInterchangeRefTestVersion}" def refTestExpandDir = "${project.rootDir}/eth-reference-tests/src/referenceTest/resources/consensus-spec-tests/" -task downloadEthRefTests(type: Download) { +def downloadFile(String url, String token, File outputFile) { + println "Download ${outputFile.getName()} (${url})" + def connection = new URL(url).openConnection() + connection.setRequestProperty("Authorization", "token ${token}") + connection.getInputStream().withCloseable { inputStream -> + outputFile.withOutputStream { outputStream -> + outputStream << inputStream + } + } +} + +def downloadArtifacts(String repo, Long runId, String token, String downloadDir) { + def artifactsApiUrl = "https://api.github.com/repos/${repo}/actions/runs/${runId}/artifacts" + def connection = new URL(artifactsApiUrl).openConnection() + connection.setRequestProperty("Authorization", "token ${token}") + connection.setRequestProperty("Accept", "application/vnd.github.v3+json") + + def response = new JsonSlurper().parse(connection.getInputStream()) + if (response.artifacts && response.artifacts.size() > 0) { + response.artifacts.each { artifact -> + // We can skip the log file + if (artifact.name.contains("consensustestgen.log")) { + return + } + + def fileOutput = new File(downloadDir, "${artifact.name}.zip") + downloadFile(artifact.archive_download_url, token, fileOutput) + ant.unzip(src: fileOutput, dest: downloadDir) + fileOutput.delete() + } + return true + } + return false +} + +static def getLatestRunId(String repo, String workflow, String branch, String token) { + def apiUrl = "https://api.github.com/repos/${repo}/actions/workflows/${workflow}/runs?branch=${branch}&status=success&per_page=1" + def connection = new URL(apiUrl).openConnection() + connection.setRequestProperty("Authorization", "token ${token}") + connection.setRequestProperty("Accept", "application/vnd.github.v3+json") + + // Query & parse the ID out of the response + def response = new JsonSlurper().parse(connection.getInputStream()) + if (response.workflow_runs && response.workflow_runs.size() > 0) { + return response.workflow_runs[0].id + } + return null +} + +task downloadEthRefTestsNightly { + doLast { + def repo = "ethereum/consensus-specs" + def workflowFileName = "generate_vectors.yml" + def branch = "dev" + + // We need a GitHub API token to download the artifacts + def githubToken = System.getenv("GITHUB_TOKEN") + if (!githubToken) { + println "Error: GITHUB_TOKEN environment variable is not set" + return + } + + // Get the latest workflow run ID + def runId = getLatestRunId(repo, workflowFileName, branch, githubToken) + if (!runId) { + println "Error: Failed to get latest run ID" + return + } + + // Create the download directory + file(refTestDownloadDir).mkdirs() + + // Download artifacts for the run + def success = downloadArtifacts(repo, runId, githubToken, refTestDownloadDir) + if (!success) { + println "Error: Failed to download artifacts" + } + } +} + +task downloadEthRefTestsStable(type: Download) { src([ "${refTestBaseUrl}/${refTestVersion}/general.tar.gz", "${refTestBaseUrl}/${refTestVersion}/minimal.tar.gz", @@ -339,6 +422,14 @@ task downloadEthRefTests(type: Download) { overwrite false } +task downloadEthRefTests { + if (nightly) { + dependsOn tasks.findByName("downloadEthRefTestsNightly") + } else { + dependsOn tasks.findByName("downloadEthRefTestsStable") + } +} + task downloadBlsRefTests(type: Download) { src([ "${blsRefTestBaseUrl}/${blsRefTestVersion}/bls_tests_yaml.tar.gz" @@ -887,7 +978,7 @@ subprojects { runtimeOnly 'org.apache.logging.log4j:log4j-core' runtimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl' - testImplementation 'org.apache.tuweni:tuweni-junit' + testImplementation 'io.tmio:tuweni-junit' testImplementation 'org.assertj:assertj-core' testImplementation 'org.mockito:mockito-core' testImplementation 'org.junit.jupiter:junit-jupiter-api' diff --git a/data/beaconrestapi/build.gradle b/data/beaconrestapi/build.gradle index b743075279c..64d2f16aa84 100644 --- a/data/beaconrestapi/build.gradle +++ b/data/beaconrestapi/build.gradle @@ -28,7 +28,7 @@ dependencies { implementation 'io.swagger.core.v3:swagger-annotations' implementation 'io.github.classgraph:classgraph' implementation 'io.javalin:javalin' - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' implementation 'org.webjars:swagger-ui' testImplementation testFixtures(project(':storage')) diff --git a/data/provider/build.gradle b/data/provider/build.gradle index 4cc4a6eaf06..7ebbfbdfa02 100644 --- a/data/provider/build.gradle +++ b/data/provider/build.gradle @@ -17,7 +17,7 @@ dependencies { implementation project(':ethereum:json-types') - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' testImplementation testFixtures(project(':ethereum:spec')) testImplementation testFixtures(project(':infrastructure:async')) diff --git a/data/serializer/build.gradle b/data/serializer/build.gradle index 12b1e3d679f..4302d4d8e80 100644 --- a/data/serializer/build.gradle +++ b/data/serializer/build.gradle @@ -10,7 +10,7 @@ dependencies { implementation project(':infrastructure:jackson') implementation project(':infrastructure:async') - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' testImplementation project(':data:provider') testImplementation testFixtures(project(':ethereum:spec')) diff --git a/eth-benchmark-tests/build.gradle b/eth-benchmark-tests/build.gradle index cd91412cdac..5114ae3208a 100644 --- a/eth-benchmark-tests/build.gradle +++ b/eth-benchmark-tests/build.gradle @@ -17,10 +17,10 @@ dependencies { implementation testFixtures(project(':ethereum:statetransition')) jmhImplementation testFixtures(project(':eth-benchmark-tests')) - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' jmhImplementation project(':infrastructure:crypto') - jmhImplementation 'org.apache.tuweni:tuweni-ssz' + jmhImplementation 'io.tmio:tuweni-ssz' jmhImplementation testFixtures(project(':ethereum:weaksubjectivity')) jmhImplementation testFixtures(project(':infrastructure:async')) @@ -34,6 +34,6 @@ dependencies { testFixturesImplementation testFixtures(project(':ethereum:statetransition')) testFixturesImplementation testFixtures(project(':storage')) - testFixturesImplementation 'org.apache.tuweni:tuweni-bytes' - testFixturesImplementation 'org.apache.tuweni:tuweni-ssz' + testFixturesImplementation 'io.tmio:tuweni-bytes' + testFixturesImplementation 'io.tmio:tuweni-ssz' } \ No newline at end of file diff --git a/eth-reference-tests/build.gradle b/eth-reference-tests/build.gradle index fede0acf83f..91cb2a10c90 100644 --- a/eth-reference-tests/build.gradle +++ b/eth-reference-tests/build.gradle @@ -24,9 +24,9 @@ dependencies { referenceTestImplementation 'org.hyperledger.besu:plugin-api' referenceTestImplementation 'com.fasterxml.jackson.core:jackson-databind' referenceTestImplementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' - referenceTestImplementation 'org.apache.tuweni:tuweni-bytes' - referenceTestImplementation 'org.apache.tuweni:tuweni-junit' - referenceTestImplementation 'org.apache.tuweni:tuweni-ssz' + referenceTestImplementation 'io.tmio:tuweni-bytes' + referenceTestImplementation 'io.tmio:tuweni-junit' + referenceTestImplementation 'io.tmio:tuweni-ssz' referenceTestImplementation 'org.xerial.snappy:snappy-java' } diff --git a/eth-tests/build.gradle b/eth-tests/build.gradle index 4536695d768..8b36a75caf4 100644 --- a/eth-tests/build.gradle +++ b/eth-tests/build.gradle @@ -11,7 +11,7 @@ dependencies { implementation 'com.fasterxml.jackson.core:jackson-databind' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' implementation 'org.apache.commons:commons-text' - implementation 'org.apache.tuweni:tuweni-bytes' - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-bytes' + implementation 'io.tmio:tuweni-units' implementation 'org.junit.jupiter:junit-jupiter-params' } diff --git a/ethereum/dataproviders/build.gradle b/ethereum/dataproviders/build.gradle index 5628beade60..62b4dfc745d 100644 --- a/ethereum/dataproviders/build.gradle +++ b/ethereum/dataproviders/build.gradle @@ -3,7 +3,7 @@ dependencies { implementation project(':infrastructure:async') implementation project(':infrastructure:metrics') - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' testImplementation testFixtures(project(':ethereum:spec')) testImplementation testFixtures(project(':ethereum:networks')) diff --git a/ethereum/executionclient/build.gradle b/ethereum/executionclient/build.gradle index b841ed91e78..24346553426 100644 --- a/ethereum/executionclient/build.gradle +++ b/ethereum/executionclient/build.gradle @@ -14,7 +14,7 @@ dependencies { implementation project(':ethereum:events') api 'org.web3j:core' - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' implementation 'io.jsonwebtoken:jjwt-api' runtimeOnly 'io.jsonwebtoken:jjwt-impl' diff --git a/ethereum/json-types/build.gradle b/ethereum/json-types/build.gradle index f9b26eeae30..3fac462fbee 100644 --- a/ethereum/json-types/build.gradle +++ b/ethereum/json-types/build.gradle @@ -5,7 +5,7 @@ dependencies { implementation project(':infrastructure:restapi') implementation project(':infrastructure:http') - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' testImplementation testFixtures(project(':ethereum:spec')) } \ No newline at end of file diff --git a/ethereum/networks/build.gradle b/ethereum/networks/build.gradle index 2d3ed76ec26..442bb20fe18 100644 --- a/ethereum/networks/build.gradle +++ b/ethereum/networks/build.gradle @@ -7,7 +7,7 @@ dependencies { implementation project(':infrastructure:io') implementation project(':infrastructure:exceptions') implementation project(':infrastructure:time') - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' testImplementation 'tech.pegasys.discovery:discovery' diff --git a/ethereum/signingrecord/build.gradle b/ethereum/signingrecord/build.gradle index dfbe033c8e6..b1b545b1dff 100644 --- a/ethereum/signingrecord/build.gradle +++ b/ethereum/signingrecord/build.gradle @@ -1,6 +1,6 @@ dependencies { implementation project(':infrastructure:yaml') - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' implementation 'com.fasterxml.jackson.core:jackson-databind' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' } diff --git a/ethereum/spec/build.gradle b/ethereum/spec/build.gradle index be9b639afe6..33bd692413c 100644 --- a/ethereum/spec/build.gradle +++ b/ethereum/spec/build.gradle @@ -1,6 +1,6 @@ dependencies { api 'it.unimi.dsi:fastutil' - api 'org.apache.tuweni:tuweni-bytes' + api 'io.tmio:tuweni-bytes' api project(':infrastructure:bls') api project(':infrastructure:bytes') api project(':infrastructure:collections') @@ -9,9 +9,9 @@ dependencies { implementation 'com.fasterxml.jackson.core:jackson-databind' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' - implementation 'org.apache.tuweni:tuweni-bytes' - implementation 'org.apache.tuweni:tuweni-ssz' - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-bytes' + implementation 'io.tmio:tuweni-ssz' + implementation 'io.tmio:tuweni-units' implementation project(':ethereum:performance-trackers') implementation project(':ethereum:execution-types') implementation project(':ethereum:pow:api') @@ -28,7 +28,7 @@ dependencies { implementation project(':infrastructure:time') testFixturesApi 'com.google.guava:guava' - testFixturesApi 'org.apache.tuweni:tuweni-bytes' + testFixturesApi 'io.tmio:tuweni-bytes' testFixturesApi project(':ethereum:pow:api') testFixturesApi project(':infrastructure:ssz') testFixturesApi project(':infrastructure:unsigned') @@ -36,8 +36,8 @@ dependencies { testFixturesImplementation 'com.fasterxml.jackson.core:jackson-databind' testFixturesImplementation 'net.jqwik:jqwik' testFixturesImplementation 'org.apache.logging.log4j:log4j-api' - testFixturesImplementation 'org.apache.tuweni:tuweni-units' - testFixturesImplementation 'org.apache.tuweni:tuweni-ssz' + testFixturesImplementation 'io.tmio:tuweni-units' + testFixturesImplementation 'io.tmio:tuweni-ssz' testFixturesImplementation 'org.hyperledger.besu.internal:core' testFixturesImplementation 'org.hyperledger.besu.internal:config' testFixturesImplementation 'org.hyperledger.besu:besu-datatypes' diff --git a/ethereum/statetransition/build.gradle b/ethereum/statetransition/build.gradle index 71e77a9d590..b1007fb0aa0 100644 --- a/ethereum/statetransition/build.gradle +++ b/ethereum/statetransition/build.gradle @@ -25,7 +25,7 @@ dependencies { implementation project(':storage') implementation project(':storage:api') - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' testImplementation testFixtures(project(':ethereum:spec')) testImplementation testFixtures(project(':ethereum:networks')) diff --git a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java index 1fce18dd2aa..8b90393da57 100644 --- a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java +++ b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/BlockBlobSidecarsTrackersPoolImpl.java @@ -499,7 +499,7 @@ private BlockBlobSidecarsTracker internalOnNewBlock( .finish( error -> LOG.error( - "An occurred while attempting to fetch blobs via local EL")); + "An error occurred while attempting to fetch blobs via local EL")); } } }); @@ -576,7 +576,7 @@ private void onFirstSeen(final SlotAndBlockRoot slotAndBlockRoot) { error -> LOG.warn( "Local EL blobs lookup failed: {}", - ExceptionUtils.getMessage(error))) + ExceptionUtils.getRootCauseMessage(error))) .thenRun(() -> this.fetchMissingContentFromRemotePeers(slotAndBlockRoot)), fetchDelay) .finish( diff --git a/fork-choice-tests/build.gradle b/fork-choice-tests/build.gradle index 0f948ea186c..0225812d304 100644 --- a/fork-choice-tests/build.gradle +++ b/fork-choice-tests/build.gradle @@ -18,6 +18,6 @@ dependencies { integrationTestImplementation 'com.fasterxml.jackson.core:jackson-databind' integrationTestImplementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' - integrationTestImplementation 'org.apache.tuweni:tuweni-bytes' - integrationTestImplementation 'org.apache.tuweni:tuweni-junit' + integrationTestImplementation 'io.tmio:tuweni-bytes' + integrationTestImplementation 'io.tmio:tuweni-junit' } diff --git a/fuzz/build.gradle b/fuzz/build.gradle index 4c3b69b3989..66e809ff2e8 100644 --- a/fuzz/build.gradle +++ b/fuzz/build.gradle @@ -5,7 +5,7 @@ dependencies { implementation project(':infrastructure:bls') implementation project(':infrastructure:ssz') - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' implementation 'it.unimi.dsi:fastutil' testImplementation 'org.xerial.snappy:snappy-java' diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 6c987549df0..fc471b2a5c5 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -76,7 +76,7 @@ dependencyManagement { dependency 'javax.annotation:javax.annotation-api:1.3.2' - dependencySet(group: 'org.apache.tuweni', version: '2.3.1') { + dependencySet(group: 'io.tmio', version: '2.4.2') { entry 'tuweni-bytes' entry 'tuweni-crypto' entry 'tuweni-junit' diff --git a/infrastructure/bls-keystore/build.gradle b/infrastructure/bls-keystore/build.gradle index 7507f4ea06e..23b7d8d4612 100644 --- a/infrastructure/bls-keystore/build.gradle +++ b/infrastructure/bls-keystore/build.gradle @@ -18,8 +18,8 @@ dependencies { implementation 'org.bouncycastle:bcprov-jdk18on' implementation 'com.google.guava:guava' implementation 'org.apache.logging.log4j:log4j-api' - implementation 'org.apache.tuweni:tuweni-bytes' - implementation 'org.apache.tuweni:tuweni-crypto' + implementation 'io.tmio:tuweni-bytes' + implementation 'io.tmio:tuweni-crypto' testImplementation 'org.assertj:assertj-core' testImplementation 'org.junit.jupiter:junit-jupiter-engine' diff --git a/infrastructure/bls/build.gradle b/infrastructure/bls/build.gradle index a4631dbbee4..25d40259232 100644 --- a/infrastructure/bls/build.gradle +++ b/infrastructure/bls/build.gradle @@ -1,12 +1,12 @@ dependencies { api 'org.bouncycastle:bcprov-jdk18on' - implementation 'org.apache.tuweni:tuweni-bytes' - implementation 'org.apache.tuweni:tuweni-ssz' + implementation 'io.tmio:tuweni-bytes' + implementation 'io.tmio:tuweni-ssz' implementation 'commons-io:commons-io' implementation 'tech.pegasys:jblst' implementation project(':infrastructure:crypto') implementation project(':infrastructure:logging') - testFixturesImplementation 'org.apache.tuweni:tuweni-bytes' + testFixturesImplementation 'io.tmio:tuweni-bytes' } diff --git a/infrastructure/bytes/build.gradle b/infrastructure/bytes/build.gradle index 37b84d355ca..721a4ec7ea8 100644 --- a/infrastructure/bytes/build.gradle +++ b/infrastructure/bytes/build.gradle @@ -1,3 +1,3 @@ dependencies { - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' } \ No newline at end of file diff --git a/infrastructure/crypto/build.gradle b/infrastructure/crypto/build.gradle index 8e2596508c9..8a49605500f 100644 --- a/infrastructure/crypto/build.gradle +++ b/infrastructure/crypto/build.gradle @@ -1,6 +1,6 @@ dependencies { api 'org.bouncycastle:bcprov-jdk18on' - api 'org.apache.tuweni:tuweni-bytes' + api 'io.tmio:tuweni-bytes' jmhImplementation 'org.bouncycastle:bcprov-jdk18on' diff --git a/infrastructure/io/build.gradle b/infrastructure/io/build.gradle index 13c2646774c..7bfa324f856 100644 --- a/infrastructure/io/build.gradle +++ b/infrastructure/io/build.gradle @@ -1,5 +1,5 @@ dependencies { - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' implementation 'net.java.dev.jna:jna' implementation project(':infrastructure:exceptions') diff --git a/infrastructure/jackson/build.gradle b/infrastructure/jackson/build.gradle index 2cc47ef419e..3f1451d6923 100644 --- a/infrastructure/jackson/build.gradle +++ b/infrastructure/jackson/build.gradle @@ -4,5 +4,5 @@ dependencies { implementation project(':infrastructure:bytes') - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' } \ No newline at end of file diff --git a/infrastructure/json/build.gradle b/infrastructure/json/build.gradle index e4497753d55..71fdb655df2 100644 --- a/infrastructure/json/build.gradle +++ b/infrastructure/json/build.gradle @@ -5,7 +5,7 @@ dependencies { implementation project(':infrastructure:logging') implementation 'com.fasterxml.jackson.core:jackson-databind' - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' testFixturesImplementation 'com.fasterxml.jackson.core:jackson-databind' testFixturesImplementation 'commons-io:commons-io' diff --git a/infrastructure/kzg/build.gradle b/infrastructure/kzg/build.gradle index bdf4961f58e..26c06ca24c0 100644 --- a/infrastructure/kzg/build.gradle +++ b/infrastructure/kzg/build.gradle @@ -2,8 +2,8 @@ dependencies { implementation project(':infrastructure:io') implementation project(':infrastructure:http') - implementation 'org.apache.tuweni:tuweni-bytes' - implementation 'org.apache.tuweni:tuweni-ssz' + implementation 'io.tmio:tuweni-bytes' + implementation 'io.tmio:tuweni-ssz' implementation 'io.consensys.protocols:jc-kzg-4844' implementation 'commons-io:commons-io' diff --git a/infrastructure/logging/build.gradle b/infrastructure/logging/build.gradle index 3c5d07970de..7687836b6ee 100644 --- a/infrastructure/logging/build.gradle +++ b/infrastructure/logging/build.gradle @@ -1,6 +1,6 @@ dependencies { - api 'org.apache.tuweni:tuweni-bytes' - api 'org.apache.tuweni:tuweni-units' + api 'io.tmio:tuweni-bytes' + api 'io.tmio:tuweni-units' implementation 'org.web3j:utils' implementation 'org.apache.logging.log4j:log4j-core' diff --git a/infrastructure/metrics/build.gradle b/infrastructure/metrics/build.gradle index 48464631b65..f300d1146e7 100644 --- a/infrastructure/metrics/build.gradle +++ b/infrastructure/metrics/build.gradle @@ -8,7 +8,7 @@ dependencies { implementation 'io.prometheus:simpleclient' implementation 'io.vertx:vertx-core' implementation 'io.vertx:vertx-web' - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' implementation 'org.hdrhistogram:HdrHistogram' implementation 'org.hyperledger.besu.internal:metrics-core' diff --git a/infrastructure/ssz/build.gradle b/infrastructure/ssz/build.gradle index 856f5dc971e..c48f6db72a6 100644 --- a/infrastructure/ssz/build.gradle +++ b/infrastructure/ssz/build.gradle @@ -8,13 +8,13 @@ dependencies { implementation 'it.unimi.dsi:fastutil' implementation 'org.apache.commons:commons-lang3' - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' testImplementation testFixtures(project(':infrastructure:collections')) testImplementation testFixtures(project(':infrastructure:serviceutils')) - testFixturesApi 'org.apache.tuweni:tuweni-bytes' - testFixturesApi 'org.apache.tuweni:tuweni-units' + testFixturesApi 'io.tmio:tuweni-bytes' + testFixturesApi 'io.tmio:tuweni-units' testFixturesApi project(':infrastructure:unsigned') testFixturesImplementation project(':infrastructure:bytes') testFixturesImplementation 'it.unimi.dsi:fastutil' diff --git a/infrastructure/ssz/generator/build.gradle b/infrastructure/ssz/generator/build.gradle index c566f99fbd8..5503820a404 100644 --- a/infrastructure/ssz/generator/build.gradle +++ b/infrastructure/ssz/generator/build.gradle @@ -1,5 +1,5 @@ dependencies { - compileOnly 'org.apache.tuweni:tuweni-bytes' + compileOnly 'io.tmio:tuweni-bytes' implementation project(':infrastructure:ssz') } diff --git a/infrastructure/yaml/build.gradle b/infrastructure/yaml/build.gradle index 90a59dbdeb6..e184a680e03 100644 --- a/infrastructure/yaml/build.gradle +++ b/infrastructure/yaml/build.gradle @@ -1,6 +1,6 @@ dependencies { implementation project(':infrastructure:jackson') - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' implementation 'com.fasterxml.jackson.core:jackson-databind' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' } diff --git a/networking/eth2/build.gradle b/networking/eth2/build.gradle index a001b17005d..9f1ccd3082d 100644 --- a/networking/eth2/build.gradle +++ b/networking/eth2/build.gradle @@ -19,7 +19,7 @@ dependencies { implementation 'io.libp2p:jvm-libp2p' implementation 'io.netty:netty-codec-http' - implementation 'org.apache.tuweni:tuweni-ssz' + implementation 'io.tmio:tuweni-ssz' implementation 'org.xerial.snappy:snappy-java' testImplementation testFixtures(project(':infrastructure:metrics')) diff --git a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/ActiveEth2P2PNetwork.java b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/ActiveEth2P2PNetwork.java index 4851bf01133..6dd13b98f27 100644 --- a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/ActiveEth2P2PNetwork.java +++ b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/ActiveEth2P2PNetwork.java @@ -168,6 +168,8 @@ private synchronized void stopGossip() { @Override public void onSyncStateChanged(final boolean isInSync, final boolean isOptimistic) { + gossipForkManager.onOptimisticHeadChanged(isOptimistic); + if (state.get() != State.RUNNING) { return; } @@ -176,7 +178,6 @@ public void onSyncStateChanged(final boolean isInSync, final boolean isOptimisti } else { stopGossip(); } - gossipForkManager.onOptimisticHeadChanged(isOptimistic); } @VisibleForTesting diff --git a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/gossip/forks/GossipForkManager.java b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/gossip/forks/GossipForkManager.java index 52462fa0390..3220469395c 100644 --- a/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/gossip/forks/GossipForkManager.java +++ b/networking/eth2/src/main/java/tech/pegasys/teku/networking/eth2/gossip/forks/GossipForkManager.java @@ -63,6 +63,7 @@ public class GossipForkManager { private final IntSet currentSyncCommitteeSubnets = new IntOpenHashSet(); private Optional currentEpoch = Optional.empty(); + private boolean isHeadOptimistic; private GossipForkManager( final Spec spec, @@ -71,6 +72,7 @@ private GossipForkManager( this.spec = spec; this.recentChainData = recentChainData; this.forksByActivationEpoch = forksByActivationEpoch; + this.isHeadOptimistic = recentChainData.isChainHeadOptimistic(); } public static GossipForkManager.Builder builder() { @@ -141,6 +143,7 @@ public synchronized void stopGossip() { } public synchronized void onOptimisticHeadChanged(final boolean isHeadOptimistic) { + this.isHeadOptimistic = isHeadOptimistic; if (isHeadOptimistic) { activeSubscriptions.forEach(GossipForkSubscriptions::stopGossipForOptimisticSync); } else { @@ -279,7 +282,7 @@ private void startSubscriptions(final GossipForkSubscriptions subscription) { if (activeSubscriptions.add(subscription)) { subscription.startGossip( recentChainData.getGenesisData().orElseThrow().getGenesisValidatorsRoot(), - recentChainData.isChainHeadOptimistic()); + isHeadOptimistic); currentAttestationSubnets.forEach(subscription::subscribeToAttestationSubnetId); currentSyncCommitteeSubnets.forEach(subscription::subscribeToSyncCommitteeSubnet); } diff --git a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/gossip/forks/GossipForkManagerTest.java b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/gossip/forks/GossipForkManagerTest.java index f4460d3fe01..06a7cd3c39b 100644 --- a/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/gossip/forks/GossipForkManagerTest.java +++ b/networking/eth2/src/test/java/tech/pegasys/teku/networking/eth2/gossip/forks/GossipForkManagerTest.java @@ -568,6 +568,19 @@ void shouldStartSubscriptionsInOptimisticSyncMode() { verify(subscriptions).startGossip(GENESIS_VALIDATORS_ROOT, true); } + @Test + void shouldStartSubscriptionsInNonOptimisticSyncModeWhenSyncStateChangedBeforeStart() { + when(recentChainData.isChainHeadOptimistic()).thenReturn(true); + + final GossipForkSubscriptions subscriptions = forkAtEpoch(0); + final GossipForkManager manager = managerForForks(subscriptions); + + manager.onOptimisticHeadChanged(false); + manager.configureGossipForEpoch(UInt64.ZERO); + + verify(subscriptions).startGossip(GENESIS_VALIDATORS_ROOT, false); + } + private GossipForkSubscriptions forkAtEpoch(final long epoch) { final GossipForkSubscriptions subscriptions = mock(GossipForkSubscriptions.class, "subscriptionsForEpoch" + epoch); diff --git a/networking/p2p/build.gradle b/networking/p2p/build.gradle index 3117d70ee21..249e25c194c 100644 --- a/networking/p2p/build.gradle +++ b/networking/p2p/build.gradle @@ -20,8 +20,8 @@ dependencies { implementation 'io.libp2p:jvm-libp2p' implementation 'io.netty:netty-handler' implementation 'io.projectreactor:reactor-core' - implementation 'org.apache.tuweni:tuweni-units' - implementation 'org.apache.tuweni:tuweni-crypto' + implementation 'io.tmio:tuweni-units' + implementation 'io.tmio:tuweni-crypto' implementation 'tech.pegasys.discovery:discovery' testImplementation testFixtures(project(':ethereum:statetransition')) @@ -32,7 +32,7 @@ dependencies { testImplementation 'org.hyperledger.besu.internal:metrics-core' - testFixturesApi 'org.apache.tuweni:tuweni-bytes' + testFixturesApi 'io.tmio:tuweni-bytes' testFixturesCompileOnly 'org.jetbrains.kotlin:kotlin-stdlib' diff --git a/services/chainstorage/build.gradle b/services/chainstorage/build.gradle index c338497010e..d147836fa60 100644 --- a/services/chainstorage/build.gradle +++ b/services/chainstorage/build.gradle @@ -12,4 +12,7 @@ dependencies { implementation project(':infrastructure:events') implementation 'org.hyperledger.besu:plugin-api' + + testImplementation testFixtures(project(':infrastructure:async')) + testImplementation testFixtures(project(':ethereum:execution-types')) } diff --git a/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java b/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java index 9e243e6fd05..53f43bdc332 100644 --- a/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java +++ b/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java @@ -16,7 +16,9 @@ import static tech.pegasys.teku.infrastructure.async.AsyncRunnerFactory.DEFAULT_MAX_QUEUE_SIZE; import static tech.pegasys.teku.spec.config.Constants.STORAGE_QUERY_CHANNEL_PARALLELISM; +import com.google.common.annotations.VisibleForTesting; import java.nio.file.Path; +import java.time.Duration; import java.util.Optional; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -52,6 +54,7 @@ import tech.pegasys.teku.storage.server.pruner.StatePruner; public class StorageService extends Service implements StorageServiceFacade { + public static final Duration STATE_PRUNING_INTERVAL = Duration.ofMinutes(1); private final StorageConfiguration config; private volatile ChainStorage chainStorage; private final ServiceConfig serviceConfig; @@ -130,28 +133,25 @@ protected SafeFuture doStart() { } if (config.getDataStorageMode().storesFinalizedStates() && config.getRetainedSlots() > 0) { - if (config.getDataStorageCreateDbVersion() == DatabaseVersion.LEVELDB_TREE) { - throw new InvalidConfigurationException( - "State pruning is not supported with leveldb_tree database."); - } else { - LOG.info( - "State pruner will run every: {} minute(s), retaining states for the last {} finalized slots. Limited to {} state prune per execution. ", - config.getStatePruningInterval().toMinutes(), - config.getRetainedSlots(), - config.getStatePruningLimit()); - statePruner = - Optional.of( - new StatePruner( - config.getSpec(), - database, - storagePrunerAsyncRunner, - config.getStatePruningInterval(), - config.getRetainedSlots(), - config.getStatePruningLimit(), - "state", - pruningTimingsLabelledGauge, - pruningActiveLabelledGauge)); - } + configureStatePruner( + config.getRetainedSlots(), + storagePrunerAsyncRunner, + config.getStatePruningInterval(), + pruningTimingsLabelledGauge, + pruningActiveLabelledGauge); + } else if (!config.getDataStorageMode().storesFinalizedStates()) { + final Duration statePruningInterval = + config + .getStatePruningInterval() + .equals(StorageConfiguration.DEFAULT_STATE_PRUNING_INTERVAL) + ? STATE_PRUNING_INTERVAL + : config.getStatePruningInterval(); + configureStatePruner( + StorageConfiguration.DEFAULT_STORAGE_RETAINED_SLOTS, + storagePrunerAsyncRunner, + statePruningInterval, + pruningTimingsLabelledGauge, + pruningActiveLabelledGauge); } final DataArchive dataArchive = @@ -228,6 +228,42 @@ protected SafeFuture doStart() { .orElseGet(() -> SafeFuture.completedFuture(null))); } + void configureStatePruner( + final long slotsToRetain, + final AsyncRunner storagePrunerAsyncRunner, + final Duration pruningInterval, + final SettableLabelledGauge pruningTimingsLabelledGauge, + final SettableLabelledGauge pruningActiveLabelledGauge) { + if (config.getDataStorageCreateDbVersion() == DatabaseVersion.LEVELDB_TREE) { + throw new InvalidConfigurationException( + "State pruning is not supported with leveldb_tree database."); + } + + LOG.info( + "State pruner will run every: {} minute(s), retaining states for the last {} finalized slots. Limited to {} state prune per execution.", + config.getStatePruningInterval().toMinutes(), + slotsToRetain, + config.getStatePruningLimit()); + + statePruner = + Optional.of( + new StatePruner( + config.getSpec(), + database, + storagePrunerAsyncRunner, + pruningInterval, + slotsToRetain, + config.getStatePruningLimit(), + "state", + pruningTimingsLabelledGauge, + pruningActiveLabelledGauge)); + } + + @VisibleForTesting + public Optional getStatePruner() { + return statePruner; + } + @Override protected SafeFuture doStop() { return blockPruner diff --git a/services/chainstorage/src/test/java/tech/pegasys/teku/services/chainstorage/StorageServiceTest.java b/services/chainstorage/src/test/java/tech/pegasys/teku/services/chainstorage/StorageServiceTest.java new file mode 100644 index 00000000000..87176ec3319 --- /dev/null +++ b/services/chainstorage/src/test/java/tech/pegasys/teku/services/chainstorage/StorageServiceTest.java @@ -0,0 +1,140 @@ +/* + * Copyright Consensys Software Inc., 2024 + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package tech.pegasys.teku.services.chainstorage; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.nio.file.Path; +import java.time.Duration; +import java.util.Optional; +import org.hyperledger.besu.plugin.services.MetricsSystem; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; +import tech.pegasys.teku.ethereum.execution.types.Eth1Address; +import tech.pegasys.teku.infrastructure.async.SafeFuture; +import tech.pegasys.teku.infrastructure.async.StubAsyncRunner; +import tech.pegasys.teku.infrastructure.async.StubAsyncRunnerFactory; +import tech.pegasys.teku.infrastructure.events.EventChannels; +import tech.pegasys.teku.service.serviceutils.ServiceConfig; +import tech.pegasys.teku.service.serviceutils.layout.DataDirLayout; +import tech.pegasys.teku.spec.Spec; +import tech.pegasys.teku.storage.server.DatabaseVersion; +import tech.pegasys.teku.storage.server.StateStorageMode; +import tech.pegasys.teku.storage.server.StorageConfiguration; +import tech.pegasys.teku.storage.server.pruner.StatePruner; + +class StorageServiceTest { + + private final ServiceConfig serviceConfig = mock(ServiceConfig.class); + private final StorageConfiguration storageConfiguration = mock(StorageConfiguration.class); + private final MetricsSystem metricsSystem = mock(MetricsSystem.class); + private final DataDirLayout dataDirLayout = mock(DataDirLayout.class); + private final Eth1Address eth1DepositContract = mock(Eth1Address.class); + private final Spec spec = mock(Spec.class); + private final EventChannels eventChannels = mock(EventChannels.class); + private StorageService storageService; + + @BeforeEach + void setUp(@TempDir final Path tempDir) { + when(serviceConfig.getMetricsSystem()).thenReturn(metricsSystem); + when(dataDirLayout.getBeaconDataDirectory()).thenReturn(tempDir); + when(serviceConfig.getDataDirLayout()).thenReturn(dataDirLayout); + when(storageConfiguration.getDataStorageCreateDbVersion()).thenReturn(DatabaseVersion.NOOP); + when(storageConfiguration.getMaxKnownNodeCacheSize()) + .thenReturn(StorageConfiguration.DEFAULT_MAX_KNOWN_NODE_CACHE_SIZE); + when(storageConfiguration.getDataStorageFrequency()) + .thenReturn(StorageConfiguration.DEFAULT_STORAGE_FREQUENCY); + when(storageConfiguration.getStatePruningLimit()) + .thenReturn(StorageConfiguration.DEFAULT_STATE_PRUNING_LIMIT); + when(storageConfiguration.getStatePruningInterval()) + .thenReturn(StorageConfiguration.DEFAULT_STATE_PRUNING_INTERVAL); + when(storageConfiguration.getEth1DepositContract()).thenReturn(eth1DepositContract); + when(storageConfiguration.isStoreNonCanonicalBlocksEnabled()).thenReturn(false); + when(storageConfiguration.getSpec()).thenReturn(spec); + + when(eventChannels.subscribe(any(), any())).thenReturn(eventChannels); + when(serviceConfig.getEventChannels()).thenReturn(eventChannels); + + final StubAsyncRunnerFactory asyncRunnerFactory = new StubAsyncRunnerFactory(); + when(serviceConfig.getAsyncRunnerFactory()).thenReturn(asyncRunnerFactory); + + final StubAsyncRunner stubAsyncRunner = new StubAsyncRunner(); + when(serviceConfig.createAsyncRunner(any(), anyInt(), anyInt(), anyInt())) + .thenReturn(stubAsyncRunner); + + storageService = new StorageService(serviceConfig, storageConfiguration, false, false); + } + + @Test + void shouldNotSetupStatePrunerWhenArchiveMode() { + when(storageConfiguration.getDataStorageMode()).thenReturn(StateStorageMode.ARCHIVE); + final SafeFuture future = storageService.doStart(); + final Optional maybeStatePruner = storageService.getStatePruner(); + assertThat(future).isCompleted(); + assertThat(maybeStatePruner).isEmpty(); + } + + @Test + void shouldSetupStatePrunerWhenArchiveModeAndRetentionSlotsEnabled() { + when(storageConfiguration.getDataStorageMode()).thenReturn(StateStorageMode.ARCHIVE); + when(storageConfiguration.getRetainedSlots()).thenReturn(5L); + final SafeFuture future = storageService.doStart(); + final Optional maybeStatePruner = storageService.getStatePruner(); + assertThat(future).isCompleted(); + assertThat(maybeStatePruner).isPresent(); + final StatePruner statePruner = maybeStatePruner.get(); + assertThat(statePruner.isRunning()).isTrue(); + assertThat(statePruner.getPruneInterval()) + .isEqualTo(StorageConfiguration.DEFAULT_STATE_PRUNING_INTERVAL); + } + + @ParameterizedTest + @EnumSource( + value = StateStorageMode.class, + names = {"PRUNE", "MINIMAL"}) + void shouldSetupStatePrunerWhenPruneMode(final StateStorageMode stateStorageMode) { + when(storageConfiguration.getDataStorageMode()).thenReturn(stateStorageMode); + final SafeFuture future = storageService.doStart(); + final Optional maybeStatePruner = storageService.getStatePruner(); + assertThat(future).isCompleted(); + assertThat(maybeStatePruner).isPresent(); + final StatePruner statePruner = maybeStatePruner.get(); + assertThat(statePruner.isRunning()).isTrue(); + assertThat(statePruner.getPruneInterval()).isEqualTo(StorageService.STATE_PRUNING_INTERVAL); + } + + @ParameterizedTest + @EnumSource( + value = StateStorageMode.class, + names = {"PRUNE", "MINIMAL"}) + void shouldSetupStatePrunerWithCustomInterval(final StateStorageMode stateStorageMode) { + when(storageConfiguration.getDataStorageMode()).thenReturn(stateStorageMode); + final Duration customPruningInterval = Duration.ofSeconds(8); + when(storageConfiguration.getStatePruningInterval()).thenReturn(customPruningInterval); + final SafeFuture future = storageService.doStart(); + final Optional maybeStatePruner = storageService.getStatePruner(); + assertThat(future).isCompleted(); + assertThat(maybeStatePruner).isPresent(); + final StatePruner statePruner = maybeStatePruner.get(); + assertThat(statePruner.isRunning()).isTrue(); + assertThat(statePruner.getPruneInterval()).isEqualTo(customPruningInterval); + } +} diff --git a/services/executionlayer/build.gradle b/services/executionlayer/build.gradle index e8514d86122..3561b902efe 100644 --- a/services/executionlayer/build.gradle +++ b/services/executionlayer/build.gradle @@ -14,7 +14,7 @@ dependencies { implementation project(':infrastructure:serviceutils') implementation project(':validator:client') - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' testImplementation testFixtures(project(':ethereum:spec')) } \ No newline at end of file diff --git a/services/powchain/build.gradle b/services/powchain/build.gradle index 46eca84490f..942c2219abe 100644 --- a/services/powchain/build.gradle +++ b/services/powchain/build.gradle @@ -18,7 +18,7 @@ dependencies { implementation project(':infrastructure:serviceutils') implementation project(':validator:client') - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-units' testImplementation project(':ethereum:pow:merkletree') diff --git a/storage/api/build.gradle b/storage/api/build.gradle index 7be498e6d10..cc0a791e2be 100644 --- a/storage/api/build.gradle +++ b/storage/api/build.gradle @@ -4,7 +4,7 @@ dependencies { implementation project(':ethereum:pow:api') implementation project(':ethereum:spec') - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' } publishing { diff --git a/storage/build.gradle b/storage/build.gradle index fd19d858348..2f5febe79ed 100644 --- a/storage/build.gradle +++ b/storage/build.gradle @@ -22,7 +22,7 @@ dependencies { implementation 'com.fasterxml.jackson.core:jackson-databind' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' implementation 'io.prometheus:simpleclient' - implementation 'org.apache.tuweni:tuweni-ssz' + implementation 'io.tmio:tuweni-ssz' implementation 'org.hyperledger.besu.internal:metrics-core' implementation 'org.hyperledger.besu:plugin-api' implementation 'org.rocksdb:rocksdbjni' @@ -64,7 +64,7 @@ dependencies { testFixturesImplementation 'org.junit.jupiter:junit-jupiter-api' testFixturesImplementation 'org.junit.jupiter:junit-jupiter-params' testFixturesImplementation 'com.google.guava:guava' - testFixturesImplementation 'org.apache.tuweni:tuweni-bytes' + testFixturesImplementation 'io.tmio:tuweni-bytes' testFixturesImplementation 'org.hyperledger.besu.internal:metrics-core' testFixturesImplementation 'org.hyperledger.besu:plugin-api' diff --git a/storage/src/main/java/tech/pegasys/teku/storage/server/pruner/StatePruner.java b/storage/src/main/java/tech/pegasys/teku/storage/server/pruner/StatePruner.java index 49e41da20c0..2a6536822b0 100644 --- a/storage/src/main/java/tech/pegasys/teku/storage/server/pruner/StatePruner.java +++ b/storage/src/main/java/tech/pegasys/teku/storage/server/pruner/StatePruner.java @@ -13,6 +13,7 @@ package tech.pegasys.teku.storage.server.pruner; +import com.google.common.annotations.VisibleForTesting; import java.time.Duration; import java.util.Optional; import java.util.concurrent.RejectedExecutionException; @@ -114,4 +115,9 @@ private void pruneStates() { LOG.debug("Shutting down", ex); } } + + @VisibleForTesting + public Duration getPruneInterval() { + return pruneInterval; + } } diff --git a/teku/build.gradle b/teku/build.gradle index 28937b2033d..8efcf968ceb 100644 --- a/teku/build.gradle +++ b/teku/build.gradle @@ -52,8 +52,8 @@ dependencies { implementation 'io.vertx:vertx-core' implementation 'org.apache.logging.log4j:log4j-slf4j-impl' implementation 'org.apache.logging.log4j:log4j-slf4j2-impl' - implementation 'org.apache.tuweni:tuweni-ssz' - implementation 'org.apache.tuweni:tuweni-units' + implementation 'io.tmio:tuweni-ssz' + implementation 'io.tmio:tuweni-units' implementation 'org.hyperledger.besu.internal:metrics-core' implementation 'com.fasterxml.jackson.core:jackson-databind' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' diff --git a/validator/beaconnode/build.gradle b/validator/beaconnode/build.gradle index 0fef9cf2e57..ff770ea9be7 100644 --- a/validator/beaconnode/build.gradle +++ b/validator/beaconnode/build.gradle @@ -8,7 +8,7 @@ dependencies { implementation project(':validator:api') implementation project(':data:serializer') - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' implementation 'com.google.guava:guava' implementation 'org.apache.logging.log4j:log4j-api' diff --git a/validator/client/build.gradle b/validator/client/build.gradle index 04d7bb23a60..64cc30b7181 100644 --- a/validator/client/build.gradle +++ b/validator/client/build.gradle @@ -28,7 +28,7 @@ dependencies { implementation project(':infrastructure:bls-keystore') implementation project(':infrastructure:subscribers') - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' implementation 'commons-io:commons-io' implementation 'com.fasterxml.jackson.core:jackson-databind' diff --git a/validator/eventadapter/build.gradle b/validator/eventadapter/build.gradle index 7548edfc9f9..400d88b2973 100644 --- a/validator/eventadapter/build.gradle +++ b/validator/eventadapter/build.gradle @@ -11,7 +11,7 @@ dependencies { implementation project(':validator:api') implementation project(':validator:beaconnode') - implementation 'org.apache.tuweni:tuweni-bytes' + implementation 'io.tmio:tuweni-bytes' implementation 'com.google.guava:guava' implementation 'org.apache.logging.log4j:log4j-api'