From 14563898793026e0faad1a55b0f0380b37b7b242 Mon Sep 17 00:00:00 2001 From: Pedro Novais <1478752+jpnovais@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:50:17 +0100 Subject: [PATCH] Coordinator: DRY refactor test helpers and data for future reuse (#100) * coordinator: adds slice ByteArrayExtensions.kt * coordinator: adds testing file system helper * coordinator: adds testing l1-blob-proof-submission submitter * coordinator: rename findFile function * coordinator: move prover responses to common test data for code reuse * coordinator: fix ByteArray.sliceOf off-by-one bug * coordinator: remove unnecessary!! * coordinator: fix gradle deps * coordinator: fix test * coordinator: reduce transitive dependencies --- .../file-based-client/build.gradle | 2 - .../ethereum/blob-submitter/build.gradle | 1 + .../BlobAndAggregationFinalizationIntTest.kt | 81 ++----------- coordinator/ethereum/test-utils/build.gradle | 1 + .../zkevm/ethereum/AccountManager.kt | 5 +- .../MakefileContractDeploymentHelper.kt | 17 +-- .../net/consensys/ByteArrayExtensions.kt | 50 ++++++++ .../kotlin/net/consensys/TypingsExtensions.kt | 13 -- .../net/consensys/ByteArrayExtensionsTest.kt | 112 ++++++++++++++++++ .../net/consensys/TypingsExtensionsTest.kt | 51 -------- jvm-libs/testing/file-system/build.gradle | 7 ++ .../linea/testing/filesystem/Files.kt | 43 +++++++ .../linea/testing/filesystem/FilesTest.kt | 24 ++++ .../l1-blob-and-proof-submission/build.gradle | 11 ++ .../submission/ProverResponsesFileLoader.kt | 60 ++++++++++ settings.gradle | 2 + testdata/coordinator/README.md | 3 + .../responses/1-7-getZkAggregatedProof.json | 0 .../responses/15-21-getZkAggregatedProof.json | 0 .../responses/8-14-getZkAggregatedProof.json | 0 .../1-1-getZkBlobCompressionProof.json | 0 .../10-10-getZkBlobCompressionProof.json | 0 .../11-11-getZkBlobCompressionProof.json | 0 .../12-12-getZkBlobCompressionProof.json | 0 .../13-13-getZkBlobCompressionProof.json | 0 .../14-14-getZkBlobCompressionProof.json | 0 .../15-15-getZkBlobCompressionProof.json | 0 .../16-16-getZkBlobCompressionProof.json | 0 .../17-17-getZkBlobCompressionProof.json | 0 .../18-18-getZkBlobCompressionProof.json | 0 .../19-19-getZkBlobCompressionProof.json | 0 .../2-2-getZkBlobCompressionProof.json | 0 .../20-20-getZkBlobCompressionProof.json | 0 .../21-21-getZkBlobCompressionProof.json | 0 .../22-22-getZkBlobCompressionProof.json | 0 .../23-23-getZkBlobCompressionProof.json | 0 .../24-24-getZkBlobCompressionProof.json | 0 .../25-25-getZkBlobCompressionProof.json | 0 .../26-26-getZkBlobCompressionProof.json | 0 .../3-3-getZkBlobCompressionProof.json | 0 .../4-4-getZkBlobCompressionProof.json | 0 .../5-5-getZkBlobCompressionProof.json | 0 .../6-6-getZkBlobCompressionProof.json | 0 .../7-7-getZkBlobCompressionProof.json | 0 .../8-8-getZkBlobCompressionProof.json | 0 .../9-9-getZkBlobCompressionProof.json | 0 46 files changed, 332 insertions(+), 151 deletions(-) create mode 100644 jvm-libs/kotlin-extensions/src/main/kotlin/net/consensys/ByteArrayExtensions.kt create mode 100644 jvm-libs/kotlin-extensions/src/test/kotlin/net/consensys/ByteArrayExtensionsTest.kt create mode 100644 jvm-libs/testing/file-system/build.gradle create mode 100644 jvm-libs/testing/file-system/src/main/kotlin/net/consensys/linea/testing/filesystem/Files.kt create mode 100644 jvm-libs/testing/file-system/src/test/kotlin/net/consensys/linea/testing/filesystem/FilesTest.kt create mode 100644 jvm-libs/testing/l1-blob-and-proof-submission/build.gradle create mode 100644 jvm-libs/testing/l1-blob-and-proof-submission/src/main/kotlin/net/consensys/linea/testing/submission/ProverResponsesFileLoader.kt create mode 100644 testdata/coordinator/README.md rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-aggregation => testdata/coordinator/prover/v2/aggregation}/responses/1-7-getZkAggregatedProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-aggregation => testdata/coordinator/prover/v2/aggregation}/responses/15-21-getZkAggregatedProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-aggregation => testdata/coordinator/prover/v2/aggregation}/responses/8-14-getZkAggregatedProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/1-1-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/10-10-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/11-11-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/12-12-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/13-13-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/14-14-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/15-15-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/16-16-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/17-17-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/18-18-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/19-19-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/2-2-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/20-20-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/21-21-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/22-22-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/23-23-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/24-24-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/25-25-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/26-26-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/3-3-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/4-4-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/5-5-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/6-6-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/7-7-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/8-8-getZkBlobCompressionProof.json (100%) rename {coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression => testdata/coordinator/prover/v2/compression}/responses/9-9-getZkBlobCompressionProof.json (100%) diff --git a/coordinator/clients/prover-client/file-based-client/build.gradle b/coordinator/clients/prover-client/file-based-client/build.gradle index 92c42e738..46b6320b1 100644 --- a/coordinator/clients/prover-client/file-based-client/build.gradle +++ b/coordinator/clients/prover-client/file-based-client/build.gradle @@ -29,6 +29,4 @@ dependencies { testImplementation "io.vertx:vertx-junit5" testImplementation "tech.pegasys.teku.internal:spec:${libs.versions.teku.get()}" testImplementation "tech.pegasys.teku.internal:spec:${libs.versions.teku.get()}:test-fixtures" - - testFixturesImplementation(testFixtures(project(":coordinator:persistence:db"))) } diff --git a/coordinator/ethereum/blob-submitter/build.gradle b/coordinator/ethereum/blob-submitter/build.gradle index ddec526ab..27a0ac993 100644 --- a/coordinator/ethereum/blob-submitter/build.gradle +++ b/coordinator/ethereum/blob-submitter/build.gradle @@ -23,6 +23,7 @@ dependencies { } implementation project(":jvm-libs:teku-execution-client") + testImplementation(project(":jvm-libs:testing:l1-blob-and-proof-submission")) testImplementation(project(":coordinator:persistence:aggregation")) testImplementation(testFixtures(project(":coordinator:persistence:db"))) testImplementation(testFixtures(project(":coordinator:ethereum:gas-pricing"))) diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/kotlin/net/consensys/zkevm/ethereum/finalization/BlobAndAggregationFinalizationIntTest.kt b/coordinator/ethereum/blob-submitter/src/integrationTest/kotlin/net/consensys/zkevm/ethereum/finalization/BlobAndAggregationFinalizationIntTest.kt index 242156acb..6790f43b0 100644 --- a/coordinator/ethereum/blob-submitter/src/integrationTest/kotlin/net/consensys/zkevm/ethereum/finalization/BlobAndAggregationFinalizationIntTest.kt +++ b/coordinator/ethereum/blob-submitter/src/integrationTest/kotlin/net/consensys/zkevm/ethereum/finalization/BlobAndAggregationFinalizationIntTest.kt @@ -6,19 +6,14 @@ import io.vertx.junit5.VertxExtension import io.vertx.junit5.VertxTestContext import net.consensys.FakeFixedClock import net.consensys.linea.ethereum.gaspricing.FakeGasPriceCapProvider -import net.consensys.zkevm.coordinator.clients.prover.serialization.BlobCompressionProofJsonResponse -import net.consensys.zkevm.coordinator.clients.prover.serialization.ProofToFinalizeJsonResponse +import net.consensys.linea.testing.submission.loadBlobsAndAggregations import net.consensys.zkevm.coordinator.clients.smartcontract.LineaContractVersion import net.consensys.zkevm.coordinator.clients.smartcontract.LineaRollupSmartContractClient import net.consensys.zkevm.domain.Aggregation import net.consensys.zkevm.domain.BlobRecord -import net.consensys.zkevm.domain.Constants.LINEA_BLOCK_INTERVAL -import net.consensys.zkevm.domain.createAggregation -import net.consensys.zkevm.domain.createBlobRecords import net.consensys.zkevm.ethereum.Account import net.consensys.zkevm.ethereum.ContractsManager import net.consensys.zkevm.ethereum.MakeFileDelegatedContractsManager -import net.consensys.zkevm.ethereum.findFile import net.consensys.zkevm.ethereum.submission.BlobSubmissionCoordinator import net.consensys.zkevm.ethereum.submission.L1ShnarfBasedAlreadySubmittedBlobsFilter import net.consensys.zkevm.persistence.AggregationsRepository @@ -34,7 +29,6 @@ import org.awaitility.Awaitility.waitAtMost import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith import tech.pegasys.teku.infrastructure.async.SafeFuture -import java.io.File import java.util.concurrent.TimeUnit import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds @@ -50,7 +44,7 @@ class BlobAndAggregationFinalizationIntTest : CleanDbTestSuiteParallel() { private lateinit var blobsRepository: BlobsRepository private lateinit var blobSubmissionCoordinator: BlobSubmissionCoordinator private lateinit var aggregationFinalizationCoordinator: AggregationFinalizationCoordinator - private val testDataDir = "coordinator/ethereum/blob-submitter/src/integrationTest/test-data" + private val testDataDir = "testdata/coordinator/prover/v2/" // 1-block-per-blob test data has 3 aggregations: 1..7, 8..14, 15..21. // We will upgrade the contract in the middle of 2nd aggregation: 12 @@ -61,13 +55,19 @@ class BlobAndAggregationFinalizationIntTest : CleanDbTestSuiteParallel() { private fun setupTest( vertx: Vertx, - smartContractVersion: LineaContractVersion, - overridingTestDataDir: String? = null + smartContractVersion: LineaContractVersion ) { + if (smartContractVersion != LineaContractVersion.V5) { + // V6 with prover V3 is soon comming, so we will need to update/extend this test setup + throw IllegalArgumentException("Only V5 contract version is supported") + } val rollupDeploymentFuture = ContractsManager.get() .deployLineaRollup(numberOfOperators = 2, contractVersion = LineaContractVersion.V5) // load files from FS while smc deploy - loadBlobsAndAggregations(smartContractVersion, overridingTestDataDir) + loadBlobsAndAggregations( + blobsResponsesDir = "$testDataDir/compression/responses", + aggregationsResponsesDir = "$testDataDir/aggregation/responses" + ) .let { (blobs, aggregations) -> this.blobs = blobs this.aggregations = aggregations @@ -149,10 +149,9 @@ class BlobAndAggregationFinalizationIntTest : CleanDbTestSuiteParallel() { private fun testSubmission( vertx: Vertx, testContext: VertxTestContext, - smartContractVersion: LineaContractVersion, - overridingTestDataDir: String? = null + smartContractVersion: LineaContractVersion ) { - setupTest(vertx, smartContractVersion, overridingTestDataDir) + setupTest(vertx, smartContractVersion) SafeFuture.allOf( SafeFuture.collectAll(blobs.map { blobsRepository.saveNewBlob(it) }.stream()), @@ -177,58 +176,4 @@ class BlobAndAggregationFinalizationIntTest : CleanDbTestSuiteParallel() { testContext.completeNow() }.whenException(testContext::failNow) } - - private fun proverResponsesFromDir(dir: String): List { - return findFile(dir) - .toFile() - .listFiles() - ?.filter { it.name.endsWith(".json") } - ?: emptyList() - } - - private fun loadProverResponses(responsesDir: String, mapper: (String) -> T): List { - return proverResponsesFromDir(responsesDir) - .map { mapper.invoke(it.readText()) } - } - - private fun loadAggregations(aggregationsDir: String): List { - return loadProverResponses(aggregationsDir) { - createAggregation(aggregationProof = ProofToFinalizeJsonResponse.fromJsonString(it).toDomainObject()) - }.sortedBy { it.startBlockNumber } - } - - private fun loadBlobs(blobsDir: String, aggregations: List): List { - return loadProverResponses(blobsDir) { - BlobCompressionProofJsonResponse.fromJsonString(it).toDomainObject() - } - .let { compressionProofs -> - val firstAggregationBlockTime = aggregations.first().let { agg -> - agg.aggregationProof!!.finalTimestamp - .minus(LINEA_BLOCK_INTERVAL.times((agg.endBlockNumber - agg.startBlockNumber).toInt())) - } - createBlobRecords( - compressionProofs = compressionProofs, - firstBlockStartBlockTime = firstAggregationBlockTime - ) - } - .sortedBy { it.startBlockNumber } - } - - private fun loadBlobsAndAggregations( - smartContractVersion: LineaContractVersion, - overridingTestDataDir: String? = null - ): Pair, List> { - val testCaseDataDir = overridingTestDataDir - ?: ( - testDataDir + if (smartContractVersion == LineaContractVersion.V5) { - "/start-at-v5" - } else { - throw IllegalArgumentException("Unsupported contract version: $smartContractVersion") - } - ) - - val aggregations = loadAggregations("$testCaseDataDir/prover-aggregation/responses") - val blobs = loadBlobs("$testCaseDataDir/prover-compression/responses", aggregations) - return blobs to aggregations - } } diff --git a/coordinator/ethereum/test-utils/build.gradle b/coordinator/ethereum/test-utils/build.gradle index 7ae6baa83..38a4a9c41 100644 --- a/coordinator/ethereum/test-utils/build.gradle +++ b/coordinator/ethereum/test-utils/build.gradle @@ -10,6 +10,7 @@ dependencies { implementation(project(":coordinator:clients:smart-contract-client")) implementation(project(":jvm-libs:web3j-extensions")) implementation(project(":coordinator:ethereum:common")) + implementation(project(":jvm-libs:testing:file-system")) implementation("org.web3j:core:${libs.versions.web3j.get()}") { exclude group: 'org.slf4j', module: 'slf4j-nop' } diff --git a/coordinator/ethereum/test-utils/src/main/kotlin/net/consensys/zkevm/ethereum/AccountManager.kt b/coordinator/ethereum/test-utils/src/main/kotlin/net/consensys/zkevm/ethereum/AccountManager.kt index f8d0c1105..f073ca1e2 100644 --- a/coordinator/ethereum/test-utils/src/main/kotlin/net/consensys/zkevm/ethereum/AccountManager.kt +++ b/coordinator/ethereum/test-utils/src/main/kotlin/net/consensys/zkevm/ethereum/AccountManager.kt @@ -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.testing.filesystem.getPathTo import net.consensys.toULong import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.Logger @@ -221,12 +222,12 @@ private open class WhaleBasedAccountManager( object L1AccountManager : AccountManager by WhaleBasedAccountManager( web3jClient = Web3jClientManager.l1Client, - genesisFile = findFile(System.getProperty("L1_GENESIS", "docker/config/l1-node/el/genesis.json")), + genesisFile = getPathTo(System.getProperty("L1_GENESIS", "docker/config/l1-node/el/genesis.json")), log = LogManager.getLogger(L1AccountManager::class.java) ) object L2AccountManager : AccountManager by WhaleBasedAccountManager( web3jClient = Web3jClientManager.l2Client, - genesisFile = findFile(System.getProperty("L2_GENESIS", "docker/config/linea-local-dev-genesis.json")), + genesisFile = getPathTo(System.getProperty("L2_GENESIS", "docker/config/linea-local-dev-genesis.json")), log = LogManager.getLogger(L2AccountManager::class.java) ) diff --git a/coordinator/ethereum/test-utils/src/main/kotlin/net/consensys/zkevm/ethereum/MakefileContractDeploymentHelper.kt b/coordinator/ethereum/test-utils/src/main/kotlin/net/consensys/zkevm/ethereum/MakefileContractDeploymentHelper.kt index 34bf26c9b..07f80faea 100644 --- a/coordinator/ethereum/test-utils/src/main/kotlin/net/consensys/zkevm/ethereum/MakefileContractDeploymentHelper.kt +++ b/coordinator/ethereum/test-utils/src/main/kotlin/net/consensys/zkevm/ethereum/MakefileContractDeploymentHelper.kt @@ -1,29 +1,16 @@ package net.consensys.zkevm.ethereum import net.consensys.linea.async.toSafeFuture +import net.consensys.linea.testing.filesystem.getPathTo import net.consensys.zkevm.coordinator.clients.smartcontract.LineaContractVersion import org.apache.logging.log4j.LogManager import tech.pegasys.teku.infrastructure.async.SafeFuture import java.io.BufferedReader import java.io.File import java.io.InputStreamReader -import java.nio.file.Path -import java.nio.file.Paths import java.util.regex.Matcher import java.util.regex.Pattern -fun findFile(target: String): Path { - var current = Paths.get("").toAbsolutePath() - while (current != Paths.get("/")) { - val targetFile = current.resolve(target).toFile() - if (targetFile.exists()) { - return targetFile.toPath() - } - current = current.parent - } - throw IllegalStateException("Couldn't find file $target") -} - data class CommandResult( val exitCode: Int, val stdOut: List, @@ -33,7 +20,7 @@ data class CommandResult( fun executeCommand( command: String, envVars: Map = emptyMap(), - executionDir: File = findFile("Makefile").parent.toFile() + executionDir: File = getPathTo("Makefile").parent.toFile() ): SafeFuture { val log = LogManager.getLogger("net.consensys.zkevm.ethereum.CommandExecutor") val processBuilder = ProcessBuilder("/bin/sh", "-c", command) diff --git a/jvm-libs/kotlin-extensions/src/main/kotlin/net/consensys/ByteArrayExtensions.kt b/jvm-libs/kotlin-extensions/src/main/kotlin/net/consensys/ByteArrayExtensions.kt new file mode 100644 index 000000000..9e9fd6ec2 --- /dev/null +++ b/jvm-libs/kotlin-extensions/src/main/kotlin/net/consensys/ByteArrayExtensions.kt @@ -0,0 +1,50 @@ +package net.consensys + +fun ByteArray.assertSize(expectedSize: UInt, fieldName: String = ""): ByteArray = apply { + require(size == expectedSize.toInt()) { "$fieldName expected to have $expectedSize bytes, but got $size" } +} + +fun ByteArray.assertIs32Bytes(fieldName: String = ""): ByteArray = assertSize(32u, fieldName) + +fun ByteArray.assertIs20Bytes(fieldName: String = ""): ByteArray = assertSize(20u, fieldName) + +fun ByteArray.setFirstByteToZero(): ByteArray { + this[0] = 0 + return this +} + +/** + * Slices the ByteArray into sliceSize bytes chunks and returns the sliceNumber-th chunk. + */ +fun ByteArray.sliceOf( + sliceSize: Int, + sliceNumber: Int, + allowIncompleteLastSlice: Boolean = false +): ByteArray { + assert(sliceSize > 0) { + "sliceSize=$sliceSize should be greater than 0" + } + + val startIndex = sliceNumber * sliceSize + val endIndex = (sliceNumber * sliceSize + sliceSize - 1) + .let { + if (it >= this.size && allowIncompleteLastSlice) { + this.size - 1 + } else { + it + } + } + + assert(startIndex <= this.size && endIndex < this.size) { + "slice $startIndex..$endIndex is out of array size=${this.size}" + } + + return this.sliceArray(startIndex..endIndex) +} + +/** + * Slices the ByteArray into 32 bytes chunks and returns the sliceNumber-th chunk. + */ +fun ByteArray.sliceOf32(sliceNumber: Int): ByteArray { + return this.sliceOf(sliceSize = 32, sliceNumber) +} diff --git a/jvm-libs/kotlin-extensions/src/main/kotlin/net/consensys/TypingsExtensions.kt b/jvm-libs/kotlin-extensions/src/main/kotlin/net/consensys/TypingsExtensions.kt index f9b85ac61..4a1d2505d 100644 --- a/jvm-libs/kotlin-extensions/src/main/kotlin/net/consensys/TypingsExtensions.kt +++ b/jvm-libs/kotlin-extensions/src/main/kotlin/net/consensys/TypingsExtensions.kt @@ -73,16 +73,3 @@ fun > ClosedRange.toIntervalString(): String { } return "[${this.start}..${this.endInclusive}]${size.toInt()}" } - -fun ByteArray.assertSize(expectedSize: UInt, fieldName: String = ""): ByteArray = apply { - require(size == expectedSize.toInt()) { "$fieldName expected to have $expectedSize bytes, but got $size" } -} - -fun ByteArray.assertIs32Bytes(fieldName: String = ""): ByteArray = assertSize(32u, fieldName) - -fun ByteArray.assertIs20Bytes(fieldName: String = ""): ByteArray = assertSize(20u, fieldName) - -fun ByteArray.setFirstByteToZero(): ByteArray { - this[0] = 0 - return this -} diff --git a/jvm-libs/kotlin-extensions/src/test/kotlin/net/consensys/ByteArrayExtensionsTest.kt b/jvm-libs/kotlin-extensions/src/test/kotlin/net/consensys/ByteArrayExtensionsTest.kt new file mode 100644 index 000000000..91baea7be --- /dev/null +++ b/jvm-libs/kotlin-extensions/src/test/kotlin/net/consensys/ByteArrayExtensionsTest.kt @@ -0,0 +1,112 @@ +package net.consensys + +import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.Assertions.assertThatThrownBy +import org.junit.jupiter.api.Test +import kotlin.random.Random + +class ByteArrayExtensionsTest { + @Test + fun `ByteArray#encodeHex`() { + assertThat(byteArrayOf().encodeHex()).isEqualTo("0x") + assertThat(byteArrayOf(0).encodeHex()).isEqualTo("0x00") + assertThat(byteArrayOf(1).encodeHex()).isEqualTo("0x01") + assertThat(byteArrayOf(0x12, 0x34, 0x56).encodeHex()).isEqualTo("0x123456") + } + + @Test + fun `ByteArray#assertSize`() { + assertThatThrownBy { + byteArrayOf(1, 2, 3).assertSize(2u, "shortNumber") + }.isInstanceOf(IllegalArgumentException::class.java) + .hasMessage("shortNumber expected to have 2 bytes, but got 3") + + assertThat(byteArrayOf(1, 2, 3).assertSize(3u)).isEqualTo(byteArrayOf(1, 2, 3)) + } + + @Test + fun `ByteArray#assertIs32Bytes`() { + assertThatThrownBy { + byteArrayOf(1, 2, 3).assertIs32Bytes("hash") + }.isInstanceOf(IllegalArgumentException::class.java) + .hasMessage("hash expected to have 32 bytes, but got 3") + ByteArray(32).assertIs32Bytes() + } + + @Test + fun `ByteArray#assertIs20Bytes`() { + assertThatThrownBy { + byteArrayOf(1, 2, 3).assertIs20Bytes("address") + }.isInstanceOf(IllegalArgumentException::class.java) + .hasMessage("address expected to have 20 bytes, but got 3") + ByteArray(20).assertIs20Bytes() + } + + @Test + fun `ByteArray#setFirstByteToZero`() { + assertThat(Random.Default.nextBytes(32).setFirstByteToZero()[0]).isEqualTo(0) + } + + @Test + fun `BigInteger#toKWei`() { + assertThat(1_234_000.toBigInteger().toKWei().toUInt()).isEqualTo(1234u) + assertThat(1_234_400.toBigInteger().toKWei().toUInt()).isEqualTo(1234u) + assertThat(1_234_500.toBigInteger().toKWei().toUInt()).isEqualTo(1235u) + assertThat(1_234_600.toBigInteger().toKWei().toUInt()).isEqualTo(1235u) + } + + @Test + fun `ByteArray#sliceOf`() { + val bytes = Random.Default.nextBytes(64) + bytes.sliceOf(sliceSize = 5, sliceNumber = 0).also { + assertThat(it).hasSize(5) + assertThat(it).isEqualTo(bytes.sliceArray(0..4)) + } + bytes.sliceOf(sliceSize = 10, sliceNumber = 0).also { + assertThat(it).hasSize(10) + assertThat(it).isEqualTo(bytes.sliceArray(0..9)) + } + bytes.sliceOf(sliceSize = 10, sliceNumber = 2).also { + assertThat(it).hasSize(10) + assertThat(it).isEqualTo(bytes.sliceArray(20..29)) + } + bytes.sliceOf(sliceSize = 1, sliceNumber = 63, allowIncompleteLastSlice = false).also { + assertThat(it).hasSize(1) + assertThat(it).isEqualTo(bytes.sliceArray(63..63)) + } + assertThatThrownBy { + bytes.sliceOf(sliceSize = 1, sliceNumber = 64, allowIncompleteLastSlice = false) + } + .isInstanceOf(AssertionError::class.java) + .hasMessage("slice 64..64 is out of array size=64") + + bytes.sliceOf(sliceSize = 10, sliceNumber = 6, allowIncompleteLastSlice = true).also { + assertThat(it).hasSize(4) + assertThat(it).isEqualTo(bytes.sliceArray(60..63)) + } + + assertThatThrownBy { + bytes.sliceOf(sliceSize = 10, sliceNumber = 6, allowIncompleteLastSlice = false) + } + .isInstanceOf(AssertionError::class.java) + .hasMessage("slice 60..69 is out of array size=64") + + assertThatThrownBy { + bytes.sliceOf(sliceSize = 10, sliceNumber = 7) + } + .isInstanceOf(AssertionError::class.java) + .hasMessage("slice 70..79 is out of array size=64") + } + + @Test + fun `ByteArray#sliceOf32Bytes`() { + val bytes = Random.Default.nextBytes(64) + assertThat(bytes.sliceOf32(0)).isEqualTo(bytes.sliceArray(0..31)) + assertThat(bytes.sliceOf32(1)).isEqualTo(bytes.sliceArray(32..63)) + assertThatThrownBy { + Random.Default.nextBytes(64 + 16).sliceOf32(sliceNumber = 2) + } + .isInstanceOf(AssertionError::class.java) + .hasMessage("slice 64..95 is out of array size=80") + } +} diff --git a/jvm-libs/kotlin-extensions/src/test/kotlin/net/consensys/TypingsExtensionsTest.kt b/jvm-libs/kotlin-extensions/src/test/kotlin/net/consensys/TypingsExtensionsTest.kt index 1381c53a6..8cfc36ce9 100644 --- a/jvm-libs/kotlin-extensions/src/test/kotlin/net/consensys/TypingsExtensionsTest.kt +++ b/jvm-libs/kotlin-extensions/src/test/kotlin/net/consensys/TypingsExtensionsTest.kt @@ -1,11 +1,9 @@ package net.consensys import org.assertj.core.api.Assertions.assertThat -import org.assertj.core.api.Assertions.assertThatThrownBy import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import java.math.BigInteger -import kotlin.random.Random class TypingsExtensionsTest { @@ -81,53 +79,4 @@ class TypingsExtensionsTest { assertThat("this includes lorem ipsum".containsAny(stringList, ignoreCase = true)).isTrue() assertThat("this string won't match".containsAny(stringList, ignoreCase = true)).isFalse() } - - @Test - fun `ByteArray#encodeHex`() { - assertThat(byteArrayOf().encodeHex()).isEqualTo("0x") - assertThat(byteArrayOf(0).encodeHex()).isEqualTo("0x00") - assertThat(byteArrayOf(1).encodeHex()).isEqualTo("0x01") - assertThat(byteArrayOf(0x12, 0x34, 0x56).encodeHex()).isEqualTo("0x123456") - } - - @Test - fun `ByteArray#assertSize`() { - assertThatThrownBy { - byteArrayOf(1, 2, 3).assertSize(2u, "shortNumber") - }.isInstanceOf(IllegalArgumentException::class.java) - .hasMessage("shortNumber expected to have 2 bytes, but got 3") - - assertThat(byteArrayOf(1, 2, 3).assertSize(3u)).isEqualTo(byteArrayOf(1, 2, 3)) - } - - @Test - fun `ByteArray#assertIs32Bytes`() { - assertThatThrownBy { - byteArrayOf(1, 2, 3).assertIs32Bytes("hash") - }.isInstanceOf(IllegalArgumentException::class.java) - .hasMessage("hash expected to have 32 bytes, but got 3") - ByteArray(32).assertIs32Bytes() - } - - @Test - fun `ByteArray#assertIs20Bytes`() { - assertThatThrownBy { - byteArrayOf(1, 2, 3).assertIs20Bytes("address") - }.isInstanceOf(IllegalArgumentException::class.java) - .hasMessage("address expected to have 20 bytes, but got 3") - ByteArray(20).assertIs20Bytes() - } - - @Test - fun `ByteArray#setFirstByteToZero`() { - assertThat(Random.Default.nextBytes(32).setFirstByteToZero()[0]).isEqualTo(0) - } - - @Test - fun `BigInteger#toKWei`() { - assertThat(1_234_000.toBigInteger().toKWei().toUInt()).isEqualTo(1234u) - assertThat(1_234_400.toBigInteger().toKWei().toUInt()).isEqualTo(1234u) - assertThat(1_234_500.toBigInteger().toKWei().toUInt()).isEqualTo(1235u) - assertThat(1_234_600.toBigInteger().toKWei().toUInt()).isEqualTo(1235u) - } } diff --git a/jvm-libs/testing/file-system/build.gradle b/jvm-libs/testing/file-system/build.gradle new file mode 100644 index 000000000..15bdaad2a --- /dev/null +++ b/jvm-libs/testing/file-system/build.gradle @@ -0,0 +1,7 @@ +plugins { + id 'net.consensys.zkevm.kotlin-library-conventions' +} + +dependencies { + testImplementation(project(':jvm-libs:kotlin-extensions')) +} diff --git a/jvm-libs/testing/file-system/src/main/kotlin/net/consensys/linea/testing/filesystem/Files.kt b/jvm-libs/testing/file-system/src/main/kotlin/net/consensys/linea/testing/filesystem/Files.kt new file mode 100644 index 000000000..7d0d56a16 --- /dev/null +++ b/jvm-libs/testing/file-system/src/main/kotlin/net/consensys/linea/testing/filesystem/Files.kt @@ -0,0 +1,43 @@ +package net.consensys.linea.testing.filesystem + +import java.nio.file.Path +import java.nio.file.Paths + +/** + * Look for a file in the current directory and its parents. + * Starts on the JVM running dir, + * very useful for tests where this path changes dynamically when running in different + * environments (e.g IntellIJ vs Gradle) we just want to hit play and have it work. + */ +fun findPathTo( + targetFileOrDir: String, + lookupDir: Path = Paths.get("").toAbsolutePath(), + lookupParentDir: Boolean = true +): Path? { + var current: Path = lookupDir + var keepSearching = true + + do { + val targetFile = current.resolve(targetFileOrDir).toFile() + if (targetFile.exists()) { + return targetFile.toPath() + } + + if (lookupParentDir && current.parent != null) { + current = current.parent + } else { + keepSearching = false + } + } while (keepSearching) + + return null +} + +fun getPathTo( + targetFileOrDir: String, + lookupDir: Path = Paths.get("").toAbsolutePath(), + lookupParentDir: Boolean = true +): Path { + return findPathTo(targetFileOrDir, lookupDir, lookupParentDir) + ?: throw IllegalArgumentException("Could not find file or directory in path: $lookupDir or its parent directories") +} diff --git a/jvm-libs/testing/file-system/src/test/kotlin/net/consensys/linea/testing/filesystem/FilesTest.kt b/jvm-libs/testing/file-system/src/test/kotlin/net/consensys/linea/testing/filesystem/FilesTest.kt new file mode 100644 index 000000000..643ed1737 --- /dev/null +++ b/jvm-libs/testing/file-system/src/test/kotlin/net/consensys/linea/testing/filesystem/FilesTest.kt @@ -0,0 +1,24 @@ +package net.consensys.linea.testing.filesystem + +import net.consensys.encodeHex +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import kotlin.random.Random + +class FilesTest { + @Test + fun `when file exists shall return path to it`() { + val file = findPathTo("build.gradle") + assertThat(file).isNotNull + assertThat(file.toString()).contains("jvm-libs/testing/file-system") + + assertThat(findPathTo("settings.gradle", lookupParentDir = false)).isNull() + assertThat(findPathTo("settings.gradle", lookupParentDir = true)).exists() + } + + @Test + fun `when file does not exists shall return null`() { + val file = findPathTo("non-existing-file-${Random.nextBytes(10).encodeHex()}") + assertThat(file).isNull() + } +} diff --git a/jvm-libs/testing/l1-blob-and-proof-submission/build.gradle b/jvm-libs/testing/l1-blob-and-proof-submission/build.gradle new file mode 100644 index 000000000..76f1acb79 --- /dev/null +++ b/jvm-libs/testing/l1-blob-and-proof-submission/build.gradle @@ -0,0 +1,11 @@ +plugins { + id 'net.consensys.zkevm.kotlin-library-conventions' +} + +dependencies { + api(project(':jvm-libs:core:domain-models')) + implementation(project(':jvm-libs:kotlin-extensions')) + implementation(project(':jvm-libs:testing:file-system')) + implementation(project(':coordinator:clients:prover-client:serialization')) + implementation(testFixtures(project(":coordinator:core"))) +} diff --git a/jvm-libs/testing/l1-blob-and-proof-submission/src/main/kotlin/net/consensys/linea/testing/submission/ProverResponsesFileLoader.kt b/jvm-libs/testing/l1-blob-and-proof-submission/src/main/kotlin/net/consensys/linea/testing/submission/ProverResponsesFileLoader.kt new file mode 100644 index 000000000..70663df89 --- /dev/null +++ b/jvm-libs/testing/l1-blob-and-proof-submission/src/main/kotlin/net/consensys/linea/testing/submission/ProverResponsesFileLoader.kt @@ -0,0 +1,60 @@ +package net.consensys.linea.testing.submission + +import kotlinx.datetime.Instant +import net.consensys.linea.testing.filesystem.getPathTo +import net.consensys.zkevm.coordinator.clients.prover.serialization.BlobCompressionProofJsonResponse +import net.consensys.zkevm.coordinator.clients.prover.serialization.ProofToFinalizeJsonResponse +import net.consensys.zkevm.domain.Aggregation +import net.consensys.zkevm.domain.BlobRecord +import net.consensys.zkevm.domain.Constants.LINEA_BLOCK_INTERVAL +import net.consensys.zkevm.domain.createAggregation +import net.consensys.zkevm.domain.createBlobRecords +import java.io.File + +fun proverResponsesFromDir(dir: String): List { + return getPathTo(dir) + .toFile() + .listFiles() + ?.filter { it.name.endsWith(".json") } + ?: emptyList() +} + +fun loadProverResponses(responsesDir: String, mapper: (String) -> T): List { + return proverResponsesFromDir(responsesDir) + .map { mapper.invoke(it.readText()) } +} + +fun loadAggregations(aggregationsDir: String): List { + return loadProverResponses(aggregationsDir) { + createAggregation(aggregationProof = ProofToFinalizeJsonResponse.fromJsonString(it).toDomainObject()) + }.sortedBy { it.startBlockNumber } +} + +fun loadBlobs( + blobsDir: String, + firstBlockStartBlockTime: Instant +): List { + return loadProverResponses(blobsDir) { + BlobCompressionProofJsonResponse.fromJsonString(it).toDomainObject() + } + .let { compressionProofs -> + createBlobRecords( + compressionProofs = compressionProofs, + firstBlockStartBlockTime = firstBlockStartBlockTime + ) + } + .sortedBy { it.startBlockNumber } +} + +fun loadBlobsAndAggregations( + blobsResponsesDir: String, + aggregationsResponsesDir: String +): Pair, List> { + val aggregations = loadAggregations(aggregationsResponsesDir) + val firstAggregationBlockTime = aggregations.first().let { agg -> + agg.aggregationProof!!.finalTimestamp + .minus(LINEA_BLOCK_INTERVAL.times((agg.endBlockNumber - agg.startBlockNumber).toInt())) + } + val blobs = loadBlobs(blobsResponsesDir, firstAggregationBlockTime) + return blobs to aggregations +} diff --git a/settings.gradle b/settings.gradle index 185e18734..674fb5b9b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -19,6 +19,8 @@ include 'jvm-libs:linea-contracts:l1-rollup' include 'jvm-libs:linea-contracts:l2-message-service' include 'jvm-libs:metrics:micrometer' include 'jvm-libs:teku-execution-client' +include 'jvm-libs:testing:l1-blob-and-proof-submission' +include 'jvm-libs:testing:file-system' include 'coordinator:app' include 'coordinator:core' include 'coordinator:utilities' diff --git a/testdata/coordinator/README.md b/testdata/coordinator/README.md new file mode 100644 index 000000000..ecf50ea5d --- /dev/null +++ b/testdata/coordinator/README.md @@ -0,0 +1,3 @@ +This directory contains blob and aggregation proof response used for +integration testing of the coordinator and other components that interact +with smart contract depend on it's state. diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-aggregation/responses/1-7-getZkAggregatedProof.json b/testdata/coordinator/prover/v2/aggregation/responses/1-7-getZkAggregatedProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-aggregation/responses/1-7-getZkAggregatedProof.json rename to testdata/coordinator/prover/v2/aggregation/responses/1-7-getZkAggregatedProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-aggregation/responses/15-21-getZkAggregatedProof.json b/testdata/coordinator/prover/v2/aggregation/responses/15-21-getZkAggregatedProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-aggregation/responses/15-21-getZkAggregatedProof.json rename to testdata/coordinator/prover/v2/aggregation/responses/15-21-getZkAggregatedProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-aggregation/responses/8-14-getZkAggregatedProof.json b/testdata/coordinator/prover/v2/aggregation/responses/8-14-getZkAggregatedProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-aggregation/responses/8-14-getZkAggregatedProof.json rename to testdata/coordinator/prover/v2/aggregation/responses/8-14-getZkAggregatedProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/1-1-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/1-1-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/1-1-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/1-1-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/10-10-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/10-10-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/10-10-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/10-10-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/11-11-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/11-11-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/11-11-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/11-11-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/12-12-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/12-12-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/12-12-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/12-12-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/13-13-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/13-13-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/13-13-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/13-13-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/14-14-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/14-14-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/14-14-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/14-14-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/15-15-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/15-15-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/15-15-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/15-15-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/16-16-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/16-16-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/16-16-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/16-16-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/17-17-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/17-17-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/17-17-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/17-17-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/18-18-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/18-18-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/18-18-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/18-18-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/19-19-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/19-19-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/19-19-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/19-19-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/2-2-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/2-2-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/2-2-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/2-2-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/20-20-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/20-20-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/20-20-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/20-20-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/21-21-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/21-21-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/21-21-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/21-21-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/22-22-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/22-22-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/22-22-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/22-22-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/23-23-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/23-23-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/23-23-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/23-23-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/24-24-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/24-24-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/24-24-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/24-24-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/25-25-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/25-25-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/25-25-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/25-25-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/26-26-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/26-26-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/26-26-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/26-26-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/3-3-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/3-3-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/3-3-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/3-3-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/4-4-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/4-4-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/4-4-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/4-4-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/5-5-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/5-5-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/5-5-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/5-5-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/6-6-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/6-6-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/6-6-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/6-6-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/7-7-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/7-7-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/7-7-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/7-7-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/8-8-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/8-8-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/8-8-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/8-8-getZkBlobCompressionProof.json diff --git a/coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/9-9-getZkBlobCompressionProof.json b/testdata/coordinator/prover/v2/compression/responses/9-9-getZkBlobCompressionProof.json similarity index 100% rename from coordinator/ethereum/blob-submitter/src/integrationTest/test-data/start-at-v5/prover-compression/responses/9-9-getZkBlobCompressionProof.json rename to testdata/coordinator/prover/v2/compression/responses/9-9-getZkBlobCompressionProof.json