Files
linea-monorepo/build.gradle
jonesho fad0db4fc6 3822 rejected transaction api service (#101)
* feat: first commit for transaction exclusion api service

* feat: removed debug logs and improved params error handling

* fix: jacocoRootReport error

* feat: improved json request param parsings

* feat: added docker container and github workflow pipeline for transaction exclusion api

* feat: added rejection stage in response and use txHash and rejectReason as primary key of tables

* feat: separate database into read and write config and each with dedicated connection

* fix: e2e testing error

* feat: removed redundant commands in Makefile

* feat: updated transaction exclusion api default image tag in compose file

* feat: added metric and change param name from reasonMessage to reason

* feat: added integration and unit tests and use reasonMessage for both request and response

* fix: transaction-exclusion-api unit test

* feat: added e2e tests and remove reasonMessage from get response and redundant codes

* feat: updated README.md and removed abi file

* feat: updated image version of transaction exclusion api service in compose file

* feat: updated README and added more test cases

* feat: updated transaction exclusion api default image tag in compose file

* feat: decoupled transaction exclusion api from coordinator package

* feat: removed unnecessary dependencies to prover client

* feat: moved persistence:db package to jvm-libs

* feat: removed migration file dir location config from transaction exclusion api

* fix: db migration location for fee history integration test

* changed db column name timestamp to reject_timestamp and add dto for ModuleOverflow to remove all jackson dependencies in core module

* feat: rejected transaction dao and config refactoring

* feat: removed repository service and using persistence retryer

* feat: updated transaction exclusion api default image tag in compose file

* feat: updated log and increase retry backoff delay to avoid repetitive error logs

* feat: added support of list request on save method and added dto for RejectedTransaction

* feat: revised gradle.build dependencies

* feat: switch from shadow jar to zipped jar

* feat: updated transaction exclusion api default image tag in compose file

* feat: updated sql and tables and changes for PR comments

* feat: improved log message for duplicate key error

* feat: updated transaction exclusion api default image tag in compose file

* feat: avoid redundant logs on periodic db cleanup

* feat: revised request handlers plus better test assertions on insertion

* fix: test case

* feat: parse save method json request with jackson

* feat: extracted db migrations from the coordinator and transaction-exclusion app

* feat: decoupled coordinator modules from jvm-libs persistence db test module

* feat: updated dockerfile of transaction-exclusion-api

* feat: removed the find check before metric increment on save rejected transaction

* feat: updated docker base image for tx-exclusion-api image buid and queryable window config

* feat: skip migration scripts on read db instance

* feat: updated more percise jvm-libs change filtering on transaction-exclusion-api

* feat: updated coordinator config for geth node l2 gas pricing recipients

* feat: update runners with specific version and removed the use of retry for transaction exclusion api testing

* feat: add integration test for transaction exclusion app

* feat: update local stack docker compose and workflow for transaction exclusion

* feat: add e2e test for transaction exclusion

* feat: skip the sequencer test in transaction exclusion e2e test

* feat: revert sequencer config poa-block-txs-selection-max-time

* feat: remove incorrect comment

* feat: added explicitly assertion if tx exclusion is not defined and simplify the localStackPostgresDbOnly in build.gradle

* feat: remove beforeAll in test suite with it.concurrent

* feat: set coordinator config blob-compressor-version as V1_0_1 explicitly for traces-v2

* feat: update coordinator config test

* feat: change default prefix not to be coordinator specific

* feat: place persistence:db under jvm-libs:generic and fixed conflicts from latest main

* fix: remove dependency to resolve circular dependency issue

* test: switch from localStackPostgresDbOnlyComposeUp to localStackComposeUp

* feat: replace GITHUB_SHA with github.event.pull_request.head.sha in computing commit tag

* feat: update filter change file lists for transaction exclusion api
2024-10-22 15:50:44 +08:00

175 lines
5.1 KiB
Groovy

import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.time.Duration
import java.time.Instant
plugins {
id 'net.consensys.zkevm.linea-contracts-helper'
alias(libs.plugins.spotless)
alias(libs.plugins.docker)
}
task compileAll
allprojects {
repositories { mavenCentral() }
apply plugin: 'java' // do not add kotlin plugin here, it will add unnecessary Kotlin runtime dependencies
apply plugin: 'jacoco'
tasks.withType(KotlinCompile).configureEach {
compileAll.dependsOn it
compilerOptions {
allWarningsAsErrors = true
}
}
tasks.withType(JavaCompile).configureEach {
compileAll.dependsOn it
options.encoding = 'UTF-8'
options.deprecation = true
options.compilerArgs.addAll([
'-parameters',
'-Xlint:cast',
'-Xlint:overloads',
'-Xlint:divzero',
'-Xlint:finally',
'-Xlint:static',
'-Xlint:deprecation',
'-Werror'
])
if (!project.path.contains("testing-tools")) {
// testing tools have 100+ errors because of this
// skipping them for now
options.compilerArgs.addAll(['-Xlint:rawtypes'])
}
}
jacoco {
toolVersion = '0.8.11'
if (project.tasks.findByName('integrationTest')) {
applyTo integrationTest
}
if (project.tasks.findByName('acceptanceTest')) {
applyTo acceptanceTest
}
}
jacocoTestReport {
dependsOn test
}
tasks.withType(Test).configureEach {
testLogging {
events = [
//TestLogEvent.STARTED,
//TestLogEvent.PASSED,
TestLogEvent.FAILED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR
]
exceptionFormat TestExceptionFormat.FULL
showCauses true
showExceptions true
showStackTraces true
// set showStandardStreams if you need to see test logs
showStandardStreams false
}
systemProperty("L1_RPC_URL", "http://localhost:8445")
systemProperty("L2_RPC_URL", "http://localhost:8545")
systemProperty("L1_GENESIS", "docker/config/l1-node/el/genesis.json")
systemProperty("L2_GENESIS", "docker/config/linea-local-dev-genesis.json")
systemProperties["junit.jupiter.execution.timeout.default"] = "5 m" // 5 minutes
systemProperties["junit.jupiter.execution.parallel.enabled"] = true
systemProperties["junit.jupiter.execution.parallel.mode.default"] = "concurrent"
systemProperties["junit.jupiter.execution.parallel.mode.classes.default"] = "concurrent"
maxParallelForks = Math.max(Runtime.runtime.availableProcessors(), 9)
}
afterEvaluate { subproject ->
if (hasJavaOrKotlinPlugins(subproject)) {
subproject.apply plugin: 'com.diffplug.spotless'
subproject.spotless {
if (hasKotlinPlugin(subproject)) {
kotlin {
// by default the target is every '.kt' and '.kts` file in the java sourcesets
//ktfmt()
ktlint(libs.versions.ktlint.get().toString()).setEditorConfigPath("$rootDir/.editorconfig")
}
}
}
}
}
}
task jacocoRootReport(type: JacocoReport) {
additionalSourceDirs.from files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories.from files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories.from files(subprojects.sourceSets.main.output)
executionData.from fileTree(dir: '.', includes: ['**/jacoco/*.exec'])
reports {
xml.required = true
// xml.enabled = true FIXME: deprecated, breaking latest versions of gradle.
csv.required = true
html.destination file("build/reports/jacocoHtml")
}
onlyIf = { true }
}
dockerCompose {
localStack {
startedServices = [
"postgres",
"sequencer",
"l1-node-genesis-generator",
"l1-el-node",
"l1-cl-node",
"l2-node",
// For debug
// "l1-blockscout",
// "l2-blockscout"
]
composeAdditionalArgs = ["--profile", "l1", "--profile", "l2"]
useComposeFiles = ["${project.rootDir.path}/docker/compose.yml"]
waitForHealthyStateTimeout = Duration.ofMinutes(3)
waitForTcpPorts = false
removeOrphans = true
// this is to avoid recreating the containers
// specially l1-node-genesis-generator which corrupts the state if run more than once
// without cleaning the volumes
noRecreate = true
projectName = "docker"
environment.put("L1_GENESIS_TIME", "${Instant.now().plusSeconds(3).getEpochSecond()}")
}
localStackPostgresDbOnly {
startedServices = [
"postgres"
]
useComposeFiles = ["${project.rootDir.path}/docker/compose.yml"]
waitForHealthyStateTimeout = Duration.ofMinutes(3)
waitForTcpPorts = false
removeOrphans = true
noRecreate = true
projectName = "docker"
}
}
static Boolean hasKotlinPlugin(Project proj) {
return proj.plugins.hasPlugin("org.jetbrains.kotlin.jvm")
}
static Boolean hasJavaPlugin(Project proj) {
return (proj.plugins.hasPlugin("java") || proj.plugins.hasPlugin("java-library"))
}
static Boolean hasJavaOrKotlinPlugins(Project proj) {
return (hasKotlinPlugin(proj) || hasJavaPlugin(proj))
}