Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hildr proposer #163

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions hildr-batcher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
}

group = 'me.grapebaba'
group = 'io.optimism'
version = '0.4.0'

repositories {
Expand All @@ -33,7 +33,7 @@ repositories {

application {
// Define the main class for the application.
mainClass = 'io.optimism.HildrBatcher'
mainClass = 'io.optimism.batcher.HildrBatcher'
}

tasks.withType(JavaCompile).configureEach {
Expand Down Expand Up @@ -160,18 +160,6 @@ jacocoTestCoverageVerification {
}
}

//checkstyle {
// toolVersion = '10.10.0'
// // default checkstyle config -- specific to your team agreement
// configFile = project(":").file("config/checkstyle/google_checks.xml")
// // Google style (idiosyncratic to Google):
// // configFile = project(":").file("config/checkstyle/google_checks.xml")
// // SUN style (closest to modern Java styles) -- the basis for this project:
// // configFile = project(":").file("config/checkstyle/sun_checks.xml")
//// ignoreFailures = false
//// maxWarnings = 0
//}

spotless {
// optional: limit format enforcement to just the files changed by this feature branch
// ratchetFrom 'origin/main'
Expand Down
16 changes: 0 additions & 16 deletions hildr-batcher/src/main/java/io/optimism/batcher/HildrBatcher.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
/*
* Copyright 2023 q315xia@163.com
*
* 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 io.optimism.batcher;

import io.optimism.batcher.cli.Cli;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Cli implements Runnable {

private static final Logger LOGGER = LoggerFactory.getLogger(Cli.class);

@Option(names = "--l1-rpc-url", required = true, description = "The base chain RPC URL")
@Option(names = "--l1-rpc-url", required = true, description = "The L1 chain RPC URL")
String l1RpcUrl;

@Option(names = "--l2-rpc-url", required = true, description = "The L2 engine RPC URL")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.optimism.batcher.exception;

/**
* The execution exception of Bathcer.
* The bathcer execution exception.
*
* @author thinkAfCod
* @since 0.1.1
Expand Down
16 changes: 0 additions & 16 deletions hildr-batcher/src/main/java/io/optimism/type/RollupConfigRes.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
/*
* Copyright 2023 q315xia@163.com
*
* 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 io.optimism.type;

import org.web3j.protocol.core.Response;
Expand Down
8 changes: 1 addition & 7 deletions hildr-node/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plugins {
// id 'signing'
}

group 'me.grapebaba'
group 'io.optimism'
version '0.4.0'

repositories {
Expand Down Expand Up @@ -74,12 +74,6 @@ dependencies {
implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.14")
implementation("com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.14")

implementation('org.web3j:core:4.11.2') {
exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on'
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
exclude group: 'com.squareup.okhttp3', module: 'logging-interceptor'
}

implementation('net.osslabz.evm:evm-abi-decoder:0.0.6')
implementation 'com.github.gestalt-config:gestalt-core:0.20.4'
implementation 'com.github.gestalt-config:gestalt-toml:0.20.4'
Expand Down
246 changes: 246 additions & 0 deletions hildr-proposer/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
plugins {
id 'java'
id 'application'
id "jacoco"
id "com.diffplug.spotless" version "6.22.0"
id "net.ltgt.errorprone" version "3.1.0"
id 'org.graalvm.buildtools.native' version '0.9.28'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}

group = 'io.optimism'
version = '0.4.0'

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
maven {
url "https://artifacts.consensys.net/public/teku/maven/"
}
maven {
url "https://dl.cloudsmith.io/public/libp2p/jvm-libp2p/maven/"
}
maven {
url "https://hyperledger.jfrog.io/artifactory/besu-maven/"
}
maven {
url "https://artifacts.consensys.net/public/maven/maven/"
}
maven { url "https://jitpack.io" }
google()
}

application {
// Define the main class for the application.
mainClass = 'io.optimism.proposer.HildrProposer'
}

tasks.withType(JavaCompile).configureEach {
options.annotationProcessorPath = configurations.annotationProcessor
options.compilerArgs += "--enable-preview"
options.compilerArgs += "-Xlint:preview"
options.compilerArgs += ["-Aproject=${project.group}/${project.name}"]
}

tasks.withType(JavaCompile).configureEach {
options.annotationProcessorPath = configurations.annotationProcessor
options.compilerArgs += "--enable-preview"
options.compilerArgs += "-Xlint:preview"
options.compilerArgs += ["-Aproject=${project.group}/${project.name}"]
}

tasks.withType(Test).configureEach {
jvmArgs += "--enable-preview"
}

tasks.withType(JavaExec).configureEach {
jvmArgs += "--enable-preview"
}

dependencies {
implementation project(':hildr-utilities')
implementation 'com.github.gestalt-config:gestalt-core:0.20.4'
implementation 'com.github.gestalt-config:gestalt-toml:0.20.4'

implementation 'com.fasterxml.jackson:jackson-bom:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-core'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-toml'
implementation 'org.jctools:jctools-core:4.0.1'

implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'

//jsonrpc
implementation('io.vertx:vertx-auth-jwt:4.4.2')
implementation('io.vertx:vertx-core:4.4.2')
implementation('io.vertx:vertx-web:4.4.2')

implementation 'io.micrometer:micrometer-registry-prometheus:1.11.0'
implementation platform('io.micrometer:micrometer-tracing-bom:1.1.1')
implementation 'io.micrometer:micrometer-tracing'
implementation 'io.micrometer:micrometer-tracing-bridge-otel'

// Logback
implementation 'ch.qos.logback:logback-core:1.4.12'
implementation 'ch.qos.logback:logback-classic:1.4.14'
implementation 'org.slf4j:slf4j-api:2.0.7'

implementation platform("io.opentelemetry:opentelemetry-bom-alpha:1.26.0-alpha")
// OpenTelemetry core
implementation(platform("io.opentelemetry:opentelemetry-bom:1.26.0"))
implementation 'io.opentelemetry:opentelemetry-api'
implementation 'io.opentelemetry:opentelemetry-sdk'
implementation 'io.opentelemetry:opentelemetry-sdk-logs'

// OpenTelemetry log4j appenders
implementation platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.26.0-alpha")
runtimeOnly 'io.opentelemetry.instrumentation:opentelemetry-logback-mdc-1.0'

implementation('io.tmio:tuweni-crypto:2.4.2'){
exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on'
exclude group: 'org.apache.tuweni', module: 'tuweni-bytes'
exclude group: 'org.apache.tuweni', module: 'tuweni-units'
exclude group: 'org.apache.tuweni', module: 'tuweni-rlp'
exclude group: 'org.apache.tuweni', module: 'tuweni-crypto'
}

implementation 'info.picocli:picocli:4.7.3'
annotationProcessor 'info.picocli:picocli-codegen:4.7.3'

implementation 'io.tmio:tuweni-crypto:2.4.2'

// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
// https://mvnrepository.com/artifact/org.junit.platform/junit-platform-suite-api
testImplementation 'org.junit.platform:junit-platform-suite-api:1.9.1'
// https://mvnrepository.com/artifact/org.junit.platform/junit-platform-suite-engine
testRuntimeOnly 'org.junit.platform:junit-platform-suite-engine:1.9.1'

testRuntimeOnly 'org.junit.platform:junit-platform-reporting:1.9.1'

testImplementation 'org.mockito:mockito-junit-jupiter:2.19.0'
testImplementation("com.squareup.okhttp3:mockwebserver:5.0.0-alpha.14")

errorprone("com.google.errorprone:error_prone_core:2.18.0")
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
finalizedBy jacocoTestReport
}

jacoco {
toolVersion = "0.8.12"
}

jacocoTestReport {
dependsOn test

reports {
csv.required = true
}
}

jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0
}
}
}
}

spotless {
// optional: limit format enforcement to just the files changed by this feature branch
// ratchetFrom 'origin/main'

format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'

// define the steps to apply to those files
trimTrailingWhitespace()
indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// Use the default importOrder configuration

// don't need to set target, it is inferred from java

// apply a specific flavor of google-java-format
palantirJavaFormat('2.38.0')
// fix formatting of type annotations
formatAnnotations()

importOrder()

removeUnusedImports()
}
}

tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

check {
dependsOn += jacocoTestCoverageVerification
// dependsOn += integrationTest
}

tasks.withType(Test).configureEach {
def outputDir = reports.junitXml.outputLocation
jvmArgumentProviders << ({
[
"-Djunit.platform.reporting.open.xml.enabled=true",
"-Djunit.platform.reporting.output.dir=${outputDir.get().asFile.absolutePath}",
"--enable-preview"
]
} as CommandLineArgumentProvider)
}

java {
withJavadocJar()
withSourcesJar()
}


javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
options.addBooleanOption('-enable-preview', true)
options.addStringOption('-release', '21')
}

jar {
enabled = false
manifest {
attributes "Main-Class": "io.optimism.proposer.HildrProposer"
attributes "Multi-Release": "true"
}
dependsOn(shadowJar)
}

shadowJar {
archiveFileName = "${project.name}-${project.version}.jar"
transform(com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer)
}

nativeCompile {
enabled = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.optimism.proposer;

import io.optimism.proposer.cli.Cli;
import picocli.CommandLine;

/**
* Batcher main method.
*
* @author thinkAfCod
* @since 0.1.1
*/
public class HildrProposer {

/** Constructor of HildrBatcher. */
public HildrProposer() {}

/**
* Main method of HildrBatcher.
*
* @param args Starts arguments
*/
public static void main(String[] args) {
int exitCode = new CommandLine(new Cli()).execute(args);
System.exit(exitCode);
}
}
Loading
Loading