diff --git a/LICENSE b/LICENSE index 261eeb9e..c05a0186 100644 --- a/LICENSE +++ b/LICENSE @@ -1,201 +1,21 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. +MIT License + +Copyright (c) 2023 optimism-java + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index af59c360..633a5c2f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![sui4j CI](https://github.com/GrapeBaBa/hildr/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/GrapeBaBa/hildr/actions/workflows/build.yml) -[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +[![hildr CI](https://github.com/GrapeBaBa/hildr/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/GrapeBaBa/hildr/actions/workflows/build.yml) +[![License](https://img.shields.io/badge/license-MIT-blue)](https://opensource.org/licenses/MIT) ![Coverage](.github/badges/jacoco.svg) ![Branches](.github/badges/branches.svg) diff --git a/config/checkstyle/google_checks.xml b/config/checkstyle/google_checks.xml deleted file mode 100644 index bb0ce092..00000000 --- a/config/checkstyle/google_checks.xml +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/config/ide/eclipse-java-google-style.xml b/config/ide/eclipse-java-google-style.xml deleted file mode 100644 index 56e50792..00000000 --- a/config/ide/eclipse-java-google-style.xml +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/config/ide/intellij-java-google-style.xml b/config/ide/intellij-java-google-style.xml deleted file mode 100644 index 45bf14cc..00000000 --- a/config/ide/intellij-java-google-style.xml +++ /dev/null @@ -1,598 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/config/spotless/besu.license b/config/spotless/besu.license deleted file mode 100644 index c936fcf4..00000000 --- a/config/spotless/besu.license +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ \ No newline at end of file diff --git a/config/spotless/java.license b/config/spotless/java.license deleted file mode 100644 index d0363ea9..00000000 --- a/config/spotless/java.license +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright $YEAR 281165273grape@gmail.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. - */ - diff --git a/docker/Dockerfile b/docker/Dockerfile index ec0c7dcd..54619b11 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -15,7 +15,7 @@ COPY . . #RUN ./gradlew -Pagent run --args="--network optimism-goerli --jwt-secret bf549f5188556ce0951048ef467ec93067bc4ea21acebe46ef675cd4e8e015ff --l1-rpc-url https://eth-goerli.g.alchemy.com/v2/4fUcO9-bSvCtGYwwibuWbz7ktjWwuoN3 --l2-rpc-url http://192.168.3.230:8545 --l2-engine-url http://192.168.3.230:8551 --rpc-port 9545 --sync-mode full" #RUN ./gradlew metadataCopy --task run --dir src/main/resources/META-INF/native-image #RUN ./gradlew buildJarForDocker -RUN #./gradlew :hildr-node:clean :hildr-node:nativeCompile -Pmusl +#RUN ./gradlew :hildr-node:clean :hildr-node:nativeCompile -Pmusl RUN ./gradlew :hildr-node:clean :hildr-node:buildBinary #RUN cd /root/hildr/hildr-node/build/docker && \ #native-image -jar hildr-node.jar --no-fallback --enable-http --enable-https --enable-preview --add-modules jdk.incubator.concurrent -H:EnableURLProtocols=http,https --initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback.core.CoreConstants,ch.qos.logback.core.util.Loader,ch.qos.logback.core.util.StatusPrinter,ch.qos.logback.core.status.InfoStatus,ch.qos.logback.classic.Logger,ch.qos.logback.core.rolling.helper.FileNamePattern,ch.qos.logback.classic.Level,ch.qos.logback.core.status.StatusBase,io.opentelemetry.api.trace.ArrayBasedTraceStateBuilder,io.opentelemetry.context.LazyStorage,ch.qos.logback.core.util.FileSize,ch.qos.logback.core.rolling.helper.RollingCalendar,io.opentelemetry.api.internal.ImmutableSpanContext,io.opentelemetry.api.internal.OtelEncodingUtils,ch.qos.logback.classic.PatternLayout,io.opentelemetry.context.ThreadLocalContextStorage,io.opentelemetry.api.trace.PropagatedSpan,io.opentelemetry.context.ContextStorageWrappers,ch.qos.logback.core.rolling.helper.Compressor$1,io.opentelemetry.api.trace.ImmutableTraceFlags,ch.qos.logback.core.rolling.helper.RollingCalendar$1,ch.qos.logback.classic.model.ConfigurationModel,ch.qos.logback.core.model.processor.DefaultProcessor$1,ch.qos.logback.core.model.processor.ImplicitModelHandler$1,ch.qos.logback.core.subst.Token,ch.qos.logback.core.pattern.parser.Parser,ch.qos.logback.core.subst.Parser$1,ch.qos.logback.core.util.Duration,ch.qos.logback.core.model.processor.ChainedModelFilter$1,ch.qos.logback.classic.model.processor.ConfigurationModelHandler,ch.qos.logback.classic.model.processor.LogbackClassicDefaultNestedComponentRules,ch.qos.logback.core.subst.NodeToStringTransformer$1,ch.qos.logback.core.pattern.parser.TokenStream$1,ch.qos.logback.core.subst.Tokenizer$1 --initialize-at-run-time=io.netty.channel.AbstractChannel,io.netty.channel.socket.nio.SelectorProviderUtil,io.netty.util.concurrent.DefaultPromise,io.netty,org.slf4j.MDC,org.github.gestalt.config hildr-node diff --git a/hildr-batcher/build.gradle b/hildr-batcher/build.gradle index 18f1edda..138cfb4b 100644 --- a/hildr-batcher/build.gradle +++ b/hildr-batcher/build.gradle @@ -9,7 +9,7 @@ plugins { } group = 'io.optimism' -version = '0.1.1' +version = '0.2.4' repositories { // Use Maven Central for resolving dependencies. @@ -194,13 +194,6 @@ spotless { palantirJavaFormat('2.38.0') // fix formatting of type annotations formatAnnotations() - // make sure every file has the following copyright header. - // optionally, Spotless can set copyright years by digging - // through git history (see "license" section below) - licenseHeaderFile(project(":").file("config/spotless/java.license")).named('hildr').onlyIfContentMatches('/*\n' + - ' * Copyright 2023 281165273grape@gmail.com') - licenseHeaderFile(project(":").file("config/spotless/besu.license")).named('besu').onlyIfContentMatches('/*\n' + - ' * Copyright ConsenSys AG') importOrder() diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/BatcherSubmitter.java b/hildr-batcher/src/main/java/io/optimism/batcher/BatcherSubmitter.java index 9b6103f6..f486e576 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/BatcherSubmitter.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/BatcherSubmitter.java @@ -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 com.google.common.util.concurrent.AbstractExecutionThreadService; @@ -89,7 +73,7 @@ private void handleReceipt(Frame tx, TransactionReceipt receipt) { } @Override - protected void run() throws Exception { + protected void run() { while (isRunning() && !this.isShutdownTriggered) { this.trySubmitBatchData(); } diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/channel/Channel.java b/hildr-batcher/src/main/java/io/optimism/batcher/channel/Channel.java index a3c1bc35..42c5f4e1 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/channel/Channel.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/channel/Channel.java @@ -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.channel; import io.optimism.type.BlockId; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelConfig.java b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelConfig.java index e0c936a0..d4114f7d 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelConfig.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelConfig.java @@ -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.channel; import io.optimism.batcher.config.Config; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelException.java b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelException.java index 606e1798..a9b99ed8 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelException.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelException.java @@ -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.channel; /** diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelFullException.java b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelFullException.java index fff50a86..474ce1dd 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelFullException.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelFullException.java @@ -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.channel; /** diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelImpl.java b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelImpl.java index 867c1581..6d22812d 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelImpl.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelImpl.java @@ -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.channel; import io.optimism.batcher.compressor.Compressor; @@ -147,10 +131,10 @@ public void splitToFrame() { @Override public Frame nextFrame() { - if (this.outputFrames.size() == 0) { + if (this.outputFrames.isEmpty()) { throw new ChannelException("not next frame"); } - var tx = this.outputFrames.remove(0); + var tx = this.outputFrames.removeFirst(); this.pendingTxs.put(tx.code(), tx); return tx; } @@ -175,7 +159,7 @@ public int pendingFrames() { @Override public boolean hasFrame() { - return this.outputFrames.size() > 0; + return !this.outputFrames.isEmpty(); } @Override @@ -234,7 +218,7 @@ public boolean isFull() { @Override public boolean noneSubmitted() { - return this.confirmedTxs.size() == 0 && this.pendingTxs.size() == 0; + return this.confirmedTxs.isEmpty() && this.pendingTxs.isEmpty(); } @Override @@ -248,7 +232,7 @@ public boolean isTimeout(BigInteger blockNumber) { } private boolean isTimeout() { - if (this.confirmedTxs.size() == 0) { + if (this.confirmedTxs.isEmpty()) { return false; } var min = BigInteger.valueOf(Long.MAX_VALUE); @@ -301,12 +285,13 @@ public void close() { } } + @SuppressWarnings({"rawtypes", "unchecked"}) private Tuple2 blockToBatch(EthBlock.Block block) { final List blockTxs = block.getTransactions(); - if (blockTxs == null || blockTxs.size() == 0) { + if (blockTxs == null || blockTxs.isEmpty()) { throw new ChannelException(String.format("block %s has no transations", block.getHash())); } - final EthBlock.TransactionObject depositTxObj = (EthBlock.TransactionObject) blockTxs.get(0); + final EthBlock.TransactionObject depositTxObj = (EthBlock.TransactionObject) blockTxs.getFirst(); if (!DEPOSIT_TX_TYPE.equalsIgnoreCase(depositTxObj.getType())) { throw new ChannelException("block txs not contains deposit tx"); } diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelManager.java b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelManager.java index c8955abd..a5674dca 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelManager.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ChannelManager.java @@ -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.channel; import io.optimism.batcher.compressor.CompressorConfig; @@ -181,7 +165,7 @@ public void txConfirmed(final Frame tx, final BlockId inclusionBlock) { } final var ch = this.txChMap.remove(code); List blocks = ch.txConfirmed(tx, inclusionBlock); - if (blocks != null && blocks.size() > 0) { + if (blocks != null && !blocks.isEmpty()) { this.blocks.addAll(blocks); } if (!ch.isFullySubmitted()) { diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ReorgException.java b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ReorgException.java index 8d673254..9a782daf 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/channel/ReorgException.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/channel/ReorgException.java @@ -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.channel; /** diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/cli/Cli.java b/hildr-batcher/src/main/java/io/optimism/batcher/cli/Cli.java index e4fc3f4d..ad3e93d9 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/cli/Cli.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/cli/Cli.java @@ -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.cli; import io.micrometer.tracing.Tracer; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/compressor/Compressor.java b/hildr-batcher/src/main/java/io/optimism/batcher/compressor/Compressor.java index 6b12e179..50d719b1 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/compressor/Compressor.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/compressor/Compressor.java @@ -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.compressor; import java.io.Closeable; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/compressor/CompressorConfig.java b/hildr-batcher/src/main/java/io/optimism/batcher/compressor/CompressorConfig.java index 3c278896..8d1b4097 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/compressor/CompressorConfig.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/compressor/CompressorConfig.java @@ -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.compressor; import io.optimism.batcher.config.Config; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/compressor/Compressors.java b/hildr-batcher/src/main/java/io/optimism/batcher/compressor/Compressors.java index 3082e7c9..afee1ae4 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/compressor/Compressors.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/compressor/Compressors.java @@ -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.compressor; import io.optimism.batcher.exception.UnsupportedException; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/compressor/RatioCompressor.java b/hildr-batcher/src/main/java/io/optimism/batcher/compressor/RatioCompressor.java index 769119bf..cea18bd5 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/compressor/RatioCompressor.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/compressor/RatioCompressor.java @@ -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.compressor; import io.optimism.batcher.compressor.exception.CompressorException; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/compressor/exception/CompressorException.java b/hildr-batcher/src/main/java/io/optimism/batcher/compressor/exception/CompressorException.java index b2ca998e..dc365559 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/compressor/exception/CompressorException.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/compressor/exception/CompressorException.java @@ -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.compressor.exception; /** diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/config/Config.java b/hildr-batcher/src/main/java/io/optimism/batcher/config/Config.java index 133c91fd..cc9bd77f 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/config/Config.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/config/Config.java @@ -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.config; import io.optimism.batcher.telemetry.BatcherMetrics; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/exception/BatcherExecutionException.java b/hildr-batcher/src/main/java/io/optimism/batcher/exception/BatcherExecutionException.java index 21eb144c..ae3a6048 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/exception/BatcherExecutionException.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/exception/BatcherExecutionException.java @@ -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.exception; /** diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/exception/UnsupportedException.java b/hildr-batcher/src/main/java/io/optimism/batcher/exception/UnsupportedException.java index 40bc7bef..1c035c88 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/exception/UnsupportedException.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/exception/UnsupportedException.java @@ -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.exception; /** diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/exception/Web3jCallException.java b/hildr-batcher/src/main/java/io/optimism/batcher/exception/Web3jCallException.java index 6feca97c..b894e70b 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/exception/Web3jCallException.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/exception/Web3jCallException.java @@ -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.exception; /** diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/loader/BlockLoader.java b/hildr-batcher/src/main/java/io/optimism/batcher/loader/BlockLoader.java index 9e7d809d..a8707b4c 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/loader/BlockLoader.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/loader/BlockLoader.java @@ -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.loader; import io.optimism.batcher.channel.ReorgException; @@ -164,8 +148,8 @@ Tuple2 calculateL2BlockRangeToStore() { } L2BlockRef l2BlockToBlockRef(final EthBlock.Block block, Genesis genesis) { - BlockId l1Origin = null; - BigInteger sequenceNumber = null; + BlockId l1Origin; + BigInteger sequenceNumber; if (block.getNumber().equals(genesis.l2().number())) { if (!block.getHash().equals(genesis.l2().hash())) { throw new BlockLoaderException(String.format( @@ -181,7 +165,7 @@ L2BlockRef l2BlockToBlockRef(final EthBlock.Block block, Genesis genesis) { String.format("l2 block is missing L1 info deposit tx, block hash: %s", block.getHash())); } EthBlock.TransactionObject tx = - (EthBlock.TransactionObject) txs.get(0).get(); + (EthBlock.TransactionObject) txs.getFirst().get(); if (!DEPOSIT_TX_TYPE.equalsIgnoreCase(tx.getType())) { throw new BlockLoaderException( String.format("first payload tx has unexpected tx type: %s", tx.getType())); diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/loader/BlockLoaderException.java b/hildr-batcher/src/main/java/io/optimism/batcher/loader/BlockLoaderException.java index c2b9b0a0..56669ffc 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/loader/BlockLoaderException.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/loader/BlockLoaderException.java @@ -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.loader; /** diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/loader/LoaderConfig.java b/hildr-batcher/src/main/java/io/optimism/batcher/loader/LoaderConfig.java index 667b5fb3..2333fc2d 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/loader/LoaderConfig.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/loader/LoaderConfig.java @@ -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.loader; import io.optimism.batcher.config.Config; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/loader/SyncStatusException.java b/hildr-batcher/src/main/java/io/optimism/batcher/loader/SyncStatusException.java index 5415e297..a2b7a6ee 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/loader/SyncStatusException.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/loader/SyncStatusException.java @@ -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.loader; /** diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/publisher/ChannelDataPublisher.java b/hildr-batcher/src/main/java/io/optimism/batcher/publisher/ChannelDataPublisher.java index 4f455f99..ac176659 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/publisher/ChannelDataPublisher.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/publisher/ChannelDataPublisher.java @@ -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.publisher; import io.optimism.batcher.exception.Web3jCallException; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/publisher/NoDataPublishException.java b/hildr-batcher/src/main/java/io/optimism/batcher/publisher/NoDataPublishException.java index e09976dd..7cf0d421 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/publisher/NoDataPublishException.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/publisher/NoDataPublishException.java @@ -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.publisher; /** diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/publisher/PublishException.java b/hildr-batcher/src/main/java/io/optimism/batcher/publisher/PublishException.java index 0f1e401a..30e49b32 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/publisher/PublishException.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/publisher/PublishException.java @@ -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.publisher; /** diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/publisher/PublisherConfig.java b/hildr-batcher/src/main/java/io/optimism/batcher/publisher/PublisherConfig.java index fb6e68e1..cb6ac784 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/publisher/PublisherConfig.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/publisher/PublisherConfig.java @@ -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.publisher; import io.optimism.batcher.config.Config; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetrics.java b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetrics.java index 4dcd7e15..a1825cc9 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetrics.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetrics.java @@ -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.telemetry; import io.optimism.type.L1BlockRef; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetricsRegistry.java b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetricsRegistry.java index 42986fe4..87876815 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetricsRegistry.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetricsRegistry.java @@ -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.telemetry; import io.micrometer.core.instrument.MeterRegistry; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetricsServer.java b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetricsServer.java index 2ae557a6..03c14a40 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetricsServer.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherMetricsServer.java @@ -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.telemetry; import io.micrometer.core.instrument.MeterRegistry; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherPrometheusMetrics.java b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherPrometheusMetrics.java index c7e4b8cd..74665581 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherPrometheusMetrics.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/BatcherPrometheusMetrics.java @@ -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.telemetry; import io.micrometer.core.instrument.Counter; @@ -275,6 +259,7 @@ private void recordRef(String layer, String type, BigInteger number, BigInteger hashGuage.getAndSet(Numeric.toBigInt(hash).longValue()); } + @SuppressWarnings("rawtypes") private long estimateBatchSize(EthBlock.Block block) { int size = 70; var txs = block.getTransactions(); diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/NoopBatcherMetrics.java b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/NoopBatcherMetrics.java index ac11c87f..cb9f45f7 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/NoopBatcherMetrics.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/NoopBatcherMetrics.java @@ -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.telemetry; import io.optimism.type.L1BlockRef; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/TxMetrics.java b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/TxMetrics.java index 9c6d07d9..a7690aef 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/TxMetrics.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/TxMetrics.java @@ -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.telemetry; import java.math.BigInteger; diff --git a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/TxPrometheusMetrics.java b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/TxPrometheusMetrics.java index f0f730e9..d01eaa73 100644 --- a/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/TxPrometheusMetrics.java +++ b/hildr-batcher/src/main/java/io/optimism/batcher/telemetry/TxPrometheusMetrics.java @@ -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.telemetry; import io.micrometer.core.instrument.MeterRegistry; diff --git a/hildr-batcher/src/main/java/io/optimism/type/OpEthSyncStatusRes.java b/hildr-batcher/src/main/java/io/optimism/type/OpEthSyncStatusRes.java index f12976cd..d53dc600 100644 --- a/hildr-batcher/src/main/java/io/optimism/type/OpEthSyncStatusRes.java +++ b/hildr-batcher/src/main/java/io/optimism/type/OpEthSyncStatusRes.java @@ -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 java.util.Objects; diff --git a/hildr-batcher/src/main/java/io/optimism/type/TxCandidate.java b/hildr-batcher/src/main/java/io/optimism/type/TxCandidate.java index 63a36d8f..074d71a5 100644 --- a/hildr-batcher/src/main/java/io/optimism/type/TxCandidate.java +++ b/hildr-batcher/src/main/java/io/optimism/type/TxCandidate.java @@ -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; /** diff --git a/hildr-batcher/src/test/java/io/optimism/batcher/TestConstants.java b/hildr-batcher/src/test/java/io/optimism/batcher/TestConstants.java index 812bece1..2400d444 100644 --- a/hildr-batcher/src/test/java/io/optimism/batcher/TestConstants.java +++ b/hildr-batcher/src/test/java/io/optimism/batcher/TestConstants.java @@ -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 java.util.Map; diff --git a/hildr-batcher/src/test/java/io/optimism/batcher/loader/BlockLoaderTest.java b/hildr-batcher/src/test/java/io/optimism/batcher/loader/BlockLoaderTest.java index 5710e803..ca43813d 100644 --- a/hildr-batcher/src/test/java/io/optimism/batcher/loader/BlockLoaderTest.java +++ b/hildr-batcher/src/test/java/io/optimism/batcher/loader/BlockLoaderTest.java @@ -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.loader; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hildr-batcher/src/test/java/io/optimism/batcher/publisher/ChannelDataPublisherTest.java b/hildr-batcher/src/test/java/io/optimism/batcher/publisher/ChannelDataPublisherTest.java index 183b8118..1f513390 100644 --- a/hildr-batcher/src/test/java/io/optimism/batcher/publisher/ChannelDataPublisherTest.java +++ b/hildr-batcher/src/test/java/io/optimism/batcher/publisher/ChannelDataPublisherTest.java @@ -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.publisher; /** diff --git a/hildr-node/build.gradle b/hildr-node/build.gradle index 2d303097..d25dfec5 100644 --- a/hildr-node/build.gradle +++ b/hildr-node/build.gradle @@ -245,13 +245,6 @@ spotless { palantirJavaFormat('2.38.0') // fix formatting of type annotations formatAnnotations() - // make sure every file has the following copyright header. - // optionally, Spotless can set copyright years by digging - // through git history (see "license" section below) - licenseHeaderFile(project(":").file("config/spotless/java.license")).named('hildr').onlyIfContentMatches('/*\n' + - ' * Copyright 2023 281165273grape@gmail.com') - licenseHeaderFile(project(":").file("config/spotless/besu.license")).named('besu').onlyIfContentMatches('/*\n' + - ' * Copyright ConsenSys AG') importOrder() diff --git a/hildr-node/src/main/java/io/optimism/Hildr.java b/hildr-node/src/main/java/io/optimism/Hildr.java index f98f7e80..617a60fc 100644 --- a/hildr-node/src/main/java/io/optimism/Hildr.java +++ b/hildr-node/src/main/java/io/optimism/Hildr.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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; import io.optimism.cli.Cli; diff --git a/hildr-node/src/main/java/io/optimism/cli/Cli.java b/hildr-node/src/main/java/io/optimism/cli/Cli.java index 0ff0971a..7c4e2a9d 100644 --- a/hildr-node/src/main/java/io/optimism/cli/Cli.java +++ b/hildr-node/src/main/java/io/optimism/cli/Cli.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.cli; import ch.qos.logback.classic.Level; diff --git a/hildr-node/src/main/java/io/optimism/cli/typeconverter/SyncModeConverter.java b/hildr-node/src/main/java/io/optimism/cli/typeconverter/SyncModeConverter.java index a711b791..77d90519 100644 --- a/hildr-node/src/main/java/io/optimism/cli/typeconverter/SyncModeConverter.java +++ b/hildr-node/src/main/java/io/optimism/cli/typeconverter/SyncModeConverter.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.cli.typeconverter; import io.optimism.config.Config; diff --git a/hildr-node/src/main/java/io/optimism/common/AbiFileLoadException.java b/hildr-node/src/main/java/io/optimism/common/AbiFileLoadException.java index 365460fa..71ab5395 100644 --- a/hildr-node/src/main/java/io/optimism/common/AbiFileLoadException.java +++ b/hildr-node/src/main/java/io/optimism/common/AbiFileLoadException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.common; /** diff --git a/hildr-node/src/main/java/io/optimism/common/AttributesDepositedCall.java b/hildr-node/src/main/java/io/optimism/common/AttributesDepositedCall.java index 686830c0..24fe8b91 100644 --- a/hildr-node/src/main/java/io/optimism/common/AttributesDepositedCall.java +++ b/hildr-node/src/main/java/io/optimism/common/AttributesDepositedCall.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.common; import java.math.BigInteger; diff --git a/hildr-node/src/main/java/io/optimism/common/BlockInfo.java b/hildr-node/src/main/java/io/optimism/common/BlockInfo.java index ccf29396..6d0b0bce 100644 --- a/hildr-node/src/main/java/io/optimism/common/BlockInfo.java +++ b/hildr-node/src/main/java/io/optimism/common/BlockInfo.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.common; import io.optimism.engine.ExecutionPayload; diff --git a/hildr-node/src/main/java/io/optimism/common/BlockNotIncludedException.java b/hildr-node/src/main/java/io/optimism/common/BlockNotIncludedException.java index f9373862..46440da3 100644 --- a/hildr-node/src/main/java/io/optimism/common/BlockNotIncludedException.java +++ b/hildr-node/src/main/java/io/optimism/common/BlockNotIncludedException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.common; /** diff --git a/hildr-node/src/main/java/io/optimism/common/Epoch.java b/hildr-node/src/main/java/io/optimism/common/Epoch.java index 479a5da1..e06f61cd 100644 --- a/hildr-node/src/main/java/io/optimism/common/Epoch.java +++ b/hildr-node/src/main/java/io/optimism/common/Epoch.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.common; import java.math.BigInteger; diff --git a/hildr-node/src/main/java/io/optimism/common/HildrServiceExecutionException.java b/hildr-node/src/main/java/io/optimism/common/HildrServiceExecutionException.java index 062314b9..53a45fbe 100644 --- a/hildr-node/src/main/java/io/optimism/common/HildrServiceExecutionException.java +++ b/hildr-node/src/main/java/io/optimism/common/HildrServiceExecutionException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.common; /** diff --git a/hildr-node/src/main/java/io/optimism/config/Config.java b/hildr-node/src/main/java/io/optimism/config/Config.java index e329d792..5ab153af 100644 --- a/hildr-node/src/main/java/io/optimism/config/Config.java +++ b/hildr-node/src/main/java/io/optimism/config/Config.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.config; import static java.util.Map.entry; diff --git a/hildr-node/src/main/java/io/optimism/config/ConfigLoadException.java b/hildr-node/src/main/java/io/optimism/config/ConfigLoadException.java index 9f47bfde..aa5cdb37 100644 --- a/hildr-node/src/main/java/io/optimism/config/ConfigLoadException.java +++ b/hildr-node/src/main/java/io/optimism/config/ConfigLoadException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.config; /** diff --git a/hildr-node/src/main/java/io/optimism/config/InvalidSyncModeException.java b/hildr-node/src/main/java/io/optimism/config/InvalidSyncModeException.java index d7683be1..96adb86b 100644 --- a/hildr-node/src/main/java/io/optimism/config/InvalidSyncModeException.java +++ b/hildr-node/src/main/java/io/optimism/config/InvalidSyncModeException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.config; /** diff --git a/hildr-node/src/main/java/io/optimism/derive/Pipeline.java b/hildr-node/src/main/java/io/optimism/derive/Pipeline.java index fa55a276..ab8fed99 100644 --- a/hildr-node/src/main/java/io/optimism/derive/Pipeline.java +++ b/hildr-node/src/main/java/io/optimism/derive/Pipeline.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive; import io.optimism.config.Config; diff --git a/hildr-node/src/main/java/io/optimism/derive/PurgeableIterator.java b/hildr-node/src/main/java/io/optimism/derive/PurgeableIterator.java index ff76f31f..5f87eae5 100644 --- a/hildr-node/src/main/java/io/optimism/derive/PurgeableIterator.java +++ b/hildr-node/src/main/java/io/optimism/derive/PurgeableIterator.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive; /** diff --git a/hildr-node/src/main/java/io/optimism/derive/State.java b/hildr-node/src/main/java/io/optimism/derive/State.java index da56b509..7bb380dc 100644 --- a/hildr-node/src/main/java/io/optimism/derive/State.java +++ b/hildr-node/src/main/java/io/optimism/derive/State.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive; import io.optimism.common.BlockInfo; diff --git a/hildr-node/src/main/java/io/optimism/derive/stages/Attributes.java b/hildr-node/src/main/java/io/optimism/derive/stages/Attributes.java index 1c6767aa..7f37e2e3 100644 --- a/hildr-node/src/main/java/io/optimism/derive/stages/Attributes.java +++ b/hildr-node/src/main/java/io/optimism/derive/stages/Attributes.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive.stages; import io.optimism.common.BlockNotIncludedException; diff --git a/hildr-node/src/main/java/io/optimism/derive/stages/BatcherTransactions.java b/hildr-node/src/main/java/io/optimism/derive/stages/BatcherTransactions.java index f66fba9b..d48f0acd 100644 --- a/hildr-node/src/main/java/io/optimism/derive/stages/BatcherTransactions.java +++ b/hildr-node/src/main/java/io/optimism/derive/stages/BatcherTransactions.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive.stages; import io.optimism.derive.PurgeableIterator; diff --git a/hildr-node/src/main/java/io/optimism/derive/stages/Batches.java b/hildr-node/src/main/java/io/optimism/derive/stages/Batches.java index c8af3237..f3fca0fe 100644 --- a/hildr-node/src/main/java/io/optimism/derive/stages/Batches.java +++ b/hildr-node/src/main/java/io/optimism/derive/stages/Batches.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive.stages; import com.google.common.collect.Lists; diff --git a/hildr-node/src/main/java/io/optimism/derive/stages/Channels.java b/hildr-node/src/main/java/io/optimism/derive/stages/Channels.java index 7ecda6fd..9337516e 100644 --- a/hildr-node/src/main/java/io/optimism/derive/stages/Channels.java +++ b/hildr-node/src/main/java/io/optimism/derive/stages/Channels.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive.stages; import com.google.common.collect.Lists; @@ -127,7 +111,7 @@ private Optional processFrames() { while (!this.frameBank.isEmpty()) { // Append the frame to the channel - Frame frame = this.frameBank.remove(0); + Frame frame = this.frameBank.removeFirst(); BigInteger frameChannelId = frame.channelId(); this.pushFrame(frame); this.prune(); @@ -145,7 +129,7 @@ private Optional removePendingChannel() { if (this.pendingChannels.isEmpty()) { return Optional.empty(); } else { - return Optional.of(this.pendingChannels.remove(0)); + return Optional.of(this.pendingChannels.removeFirst()); } } diff --git a/hildr-node/src/main/java/io/optimism/derive/stages/DecompressZlibException.java b/hildr-node/src/main/java/io/optimism/derive/stages/DecompressZlibException.java index 15733596..dadb9640 100644 --- a/hildr-node/src/main/java/io/optimism/derive/stages/DecompressZlibException.java +++ b/hildr-node/src/main/java/io/optimism/derive/stages/DecompressZlibException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive.stages; /** diff --git a/hildr-node/src/main/java/io/optimism/derive/stages/L1InfoNotFoundException.java b/hildr-node/src/main/java/io/optimism/derive/stages/L1InfoNotFoundException.java index a27ade55..c3e92e4f 100644 --- a/hildr-node/src/main/java/io/optimism/derive/stages/L1InfoNotFoundException.java +++ b/hildr-node/src/main/java/io/optimism/derive/stages/L1InfoNotFoundException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive.stages; /** diff --git a/hildr-node/src/main/java/io/optimism/driver/Driver.java b/hildr-node/src/main/java/io/optimism/driver/Driver.java index 90949f53..31fb7edf 100644 --- a/hildr-node/src/main/java/io/optimism/driver/Driver.java +++ b/hildr-node/src/main/java/io/optimism/driver/Driver.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.driver; import static java.lang.Thread.sleep; diff --git a/hildr-node/src/main/java/io/optimism/driver/EngineDriver.java b/hildr-node/src/main/java/io/optimism/driver/EngineDriver.java index 70b2655e..c1eb3d07 100644 --- a/hildr-node/src/main/java/io/optimism/driver/EngineDriver.java +++ b/hildr-node/src/main/java/io/optimism/driver/EngineDriver.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.driver; import io.optimism.common.BlockInfo; diff --git a/hildr-node/src/main/java/io/optimism/driver/ForkchoiceUpdateException.java b/hildr-node/src/main/java/io/optimism/driver/ForkchoiceUpdateException.java index 51ad80ab..2bdca386 100644 --- a/hildr-node/src/main/java/io/optimism/driver/ForkchoiceUpdateException.java +++ b/hildr-node/src/main/java/io/optimism/driver/ForkchoiceUpdateException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.driver; /** diff --git a/hildr-node/src/main/java/io/optimism/driver/HeadInfo.java b/hildr-node/src/main/java/io/optimism/driver/HeadInfo.java index 83e19345..918c4d5b 100644 --- a/hildr-node/src/main/java/io/optimism/driver/HeadInfo.java +++ b/hildr-node/src/main/java/io/optimism/driver/HeadInfo.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.driver; import io.optimism.common.AttributesDepositedCall; diff --git a/hildr-node/src/main/java/io/optimism/driver/InvalidAttributesException.java b/hildr-node/src/main/java/io/optimism/driver/InvalidAttributesException.java index 23977355..bfce8e29 100644 --- a/hildr-node/src/main/java/io/optimism/driver/InvalidAttributesException.java +++ b/hildr-node/src/main/java/io/optimism/driver/InvalidAttributesException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.driver; /** diff --git a/hildr-node/src/main/java/io/optimism/driver/InvalidExecutionPayloadException.java b/hildr-node/src/main/java/io/optimism/driver/InvalidExecutionPayloadException.java index b9f4dc36..cddd0e55 100644 --- a/hildr-node/src/main/java/io/optimism/driver/InvalidExecutionPayloadException.java +++ b/hildr-node/src/main/java/io/optimism/driver/InvalidExecutionPayloadException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.driver; /** diff --git a/hildr-node/src/main/java/io/optimism/driver/InvalidPayloadAttributesException.java b/hildr-node/src/main/java/io/optimism/driver/InvalidPayloadAttributesException.java index 24c6fc7b..f894e36f 100644 --- a/hildr-node/src/main/java/io/optimism/driver/InvalidPayloadAttributesException.java +++ b/hildr-node/src/main/java/io/optimism/driver/InvalidPayloadAttributesException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.driver; /** diff --git a/hildr-node/src/main/java/io/optimism/driver/L1AttributesDepositedTxNotFoundException.java b/hildr-node/src/main/java/io/optimism/driver/L1AttributesDepositedTxNotFoundException.java index 86e9f313..8c518d36 100644 --- a/hildr-node/src/main/java/io/optimism/driver/L1AttributesDepositedTxNotFoundException.java +++ b/hildr-node/src/main/java/io/optimism/driver/L1AttributesDepositedTxNotFoundException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.driver; /** diff --git a/hildr-node/src/main/java/io/optimism/driver/PayloadIdNotReturnedException.java b/hildr-node/src/main/java/io/optimism/driver/PayloadIdNotReturnedException.java index c543f823..d7800640 100644 --- a/hildr-node/src/main/java/io/optimism/driver/PayloadIdNotReturnedException.java +++ b/hildr-node/src/main/java/io/optimism/driver/PayloadIdNotReturnedException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.driver; /** diff --git a/hildr-node/src/main/java/io/optimism/engine/Engine.java b/hildr-node/src/main/java/io/optimism/engine/Engine.java index e2639549..5833b517 100644 --- a/hildr-node/src/main/java/io/optimism/engine/Engine.java +++ b/hildr-node/src/main/java/io/optimism/engine/Engine.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.engine; import io.optimism.engine.ExecutionPayload.PayloadAttributes; diff --git a/hildr-node/src/main/java/io/optimism/engine/EngineApi.java b/hildr-node/src/main/java/io/optimism/engine/EngineApi.java index cc4a1af9..00a03d89 100644 --- a/hildr-node/src/main/java/io/optimism/engine/EngineApi.java +++ b/hildr-node/src/main/java/io/optimism/engine/EngineApi.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.engine; import io.jsonwebtoken.Jwts; diff --git a/hildr-node/src/main/java/io/optimism/engine/ExecutionPayload.java b/hildr-node/src/main/java/io/optimism/engine/ExecutionPayload.java index fe1224e0..ed94f571 100644 --- a/hildr-node/src/main/java/io/optimism/engine/ExecutionPayload.java +++ b/hildr-node/src/main/java/io/optimism/engine/ExecutionPayload.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.engine; import io.optimism.common.Epoch; diff --git a/hildr-node/src/main/java/io/optimism/engine/ForkChoiceUpdate.java b/hildr-node/src/main/java/io/optimism/engine/ForkChoiceUpdate.java index 48d74e11..7f68bb80 100644 --- a/hildr-node/src/main/java/io/optimism/engine/ForkChoiceUpdate.java +++ b/hildr-node/src/main/java/io/optimism/engine/ForkChoiceUpdate.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.engine; import io.optimism.engine.ExecutionPayload.PayloadStatus; diff --git a/hildr-node/src/main/java/io/optimism/engine/OpEthExecutionPayload.java b/hildr-node/src/main/java/io/optimism/engine/OpEthExecutionPayload.java index d7f57dca..653e7b7a 100644 --- a/hildr-node/src/main/java/io/optimism/engine/OpEthExecutionPayload.java +++ b/hildr-node/src/main/java/io/optimism/engine/OpEthExecutionPayload.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.engine; import com.fasterxml.jackson.core.JsonParser; diff --git a/hildr-node/src/main/java/io/optimism/engine/OpEthForkChoiceUpdate.java b/hildr-node/src/main/java/io/optimism/engine/OpEthForkChoiceUpdate.java index dbd463d5..21ffc347 100644 --- a/hildr-node/src/main/java/io/optimism/engine/OpEthForkChoiceUpdate.java +++ b/hildr-node/src/main/java/io/optimism/engine/OpEthForkChoiceUpdate.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.engine; import io.optimism.engine.ForkChoiceUpdate.ForkChoiceUpdateRes; diff --git a/hildr-node/src/main/java/io/optimism/engine/OpEthPayloadStatus.java b/hildr-node/src/main/java/io/optimism/engine/OpEthPayloadStatus.java index a251e6c9..2e0ab5ce 100644 --- a/hildr-node/src/main/java/io/optimism/engine/OpEthPayloadStatus.java +++ b/hildr-node/src/main/java/io/optimism/engine/OpEthPayloadStatus.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.engine; import io.optimism.engine.ExecutionPayload.PayloadStatus; diff --git a/hildr-node/src/main/java/io/optimism/l1/BlockIsPreLondonException.java b/hildr-node/src/main/java/io/optimism/l1/BlockIsPreLondonException.java index fc6dba4a..e8a26b46 100644 --- a/hildr-node/src/main/java/io/optimism/l1/BlockIsPreLondonException.java +++ b/hildr-node/src/main/java/io/optimism/l1/BlockIsPreLondonException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.l1; /** diff --git a/hildr-node/src/main/java/io/optimism/l1/BlockUpdate.java b/hildr-node/src/main/java/io/optimism/l1/BlockUpdate.java index 54165b6b..ae996132 100644 --- a/hildr-node/src/main/java/io/optimism/l1/BlockUpdate.java +++ b/hildr-node/src/main/java/io/optimism/l1/BlockUpdate.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.l1; import java.math.BigInteger; diff --git a/hildr-node/src/main/java/io/optimism/l1/ChainWatcher.java b/hildr-node/src/main/java/io/optimism/l1/ChainWatcher.java index 3c90a34d..321e0300 100644 --- a/hildr-node/src/main/java/io/optimism/l1/ChainWatcher.java +++ b/hildr-node/src/main/java/io/optimism/l1/ChainWatcher.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.l1; import io.optimism.common.BlockInfo; diff --git a/hildr-node/src/main/java/io/optimism/l1/DepositsNotFoundException.java b/hildr-node/src/main/java/io/optimism/l1/DepositsNotFoundException.java index 141fad71..8fad12e5 100644 --- a/hildr-node/src/main/java/io/optimism/l1/DepositsNotFoundException.java +++ b/hildr-node/src/main/java/io/optimism/l1/DepositsNotFoundException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.l1; /** diff --git a/hildr-node/src/main/java/io/optimism/l1/InnerWatcher.java b/hildr-node/src/main/java/io/optimism/l1/InnerWatcher.java index fb3c237b..5863599d 100644 --- a/hildr-node/src/main/java/io/optimism/l1/InnerWatcher.java +++ b/hildr-node/src/main/java/io/optimism/l1/InnerWatcher.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.l1; import com.google.common.util.concurrent.AbstractExecutionThreadService; @@ -185,7 +169,7 @@ private void getMetadataFromL2(BigInteger l2StartBlock) { throw new L1AttributesDepositedTxNotFoundException(); } EthBlock.TransactionObject tx = - (EthBlock.TransactionObject) block.getTransactions().get(0).get(); + (EthBlock.TransactionObject) block.getTransactions().getFirst().get(); final byte[] input = Numeric.hexStringToByteArray(tx.getInput()); final String batchSender = Numeric.toHexString(Arrays.copyOfRange(input, 176, 196)); @@ -316,7 +300,7 @@ private void updateSystemConfig() throws ExecutionException, InterruptedExceptio if (updates.getLogs().isEmpty()) { this.systemConfigUpdate = new Tuple2<>(toBlock, null); } else { - LogResult update = updates.getLogs().iterator().next(); + LogResult update = updates.getLogs().getFirst(); BigInteger updateBlock = ((LogObject) update).getBlockNumber(); SystemConfigUpdate configUpdate = SystemConfigUpdate.tryFrom((LogObject) update); if (updateBlock == null) { @@ -456,7 +440,7 @@ private List getDeposits(BigInteger blockNum) var userDepositeds = InnerWatcher.this.deposits.computeIfAbsent(num, k -> new ArrayList<>()); userDepositeds.add(userDeposited); } else { - throw new IllegalStateException("Unexpected result type: " + log.get() + " required LogObject"); + throw new IllegalStateException("Unexpected result type: %s required LogObject".formatted(log.get())); } }); var max = (int) endBlock.subtract(blockNum).add(BigInteger.ONE).longValue(); diff --git a/hildr-node/src/main/java/io/optimism/l1/InvalidSystemConfigUpdateException.java b/hildr-node/src/main/java/io/optimism/l1/InvalidSystemConfigUpdateException.java index 6f153efa..6cb3d50d 100644 --- a/hildr-node/src/main/java/io/optimism/l1/InvalidSystemConfigUpdateException.java +++ b/hildr-node/src/main/java/io/optimism/l1/InvalidSystemConfigUpdateException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.l1; /** diff --git a/hildr-node/src/main/java/io/optimism/l1/L1Info.java b/hildr-node/src/main/java/io/optimism/l1/L1Info.java index aad66083..40b698d1 100644 --- a/hildr-node/src/main/java/io/optimism/l1/L1Info.java +++ b/hildr-node/src/main/java/io/optimism/l1/L1Info.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.l1; import static org.web3j.protocol.core.methods.response.EthBlock.Block; diff --git a/hildr-node/src/main/java/io/optimism/l1/SystemConfigUpdate.java b/hildr-node/src/main/java/io/optimism/l1/SystemConfigUpdate.java index 4928c402..250e59a0 100644 --- a/hildr-node/src/main/java/io/optimism/l1/SystemConfigUpdate.java +++ b/hildr-node/src/main/java/io/optimism/l1/SystemConfigUpdate.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.l1; import java.math.BigInteger; diff --git a/hildr-node/src/main/java/io/optimism/network/BlockV1TopicHandler.java b/hildr-node/src/main/java/io/optimism/network/BlockV1TopicHandler.java index 15e8d58f..36e465bc 100644 --- a/hildr-node/src/main/java/io/optimism/network/BlockV1TopicHandler.java +++ b/hildr-node/src/main/java/io/optimism/network/BlockV1TopicHandler.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; import static org.web3j.crypto.Sign.recoverFromSignature; diff --git a/hildr-node/src/main/java/io/optimism/network/BlockV2TopicHandler.java b/hildr-node/src/main/java/io/optimism/network/BlockV2TopicHandler.java index 26838f1c..aa795c0a 100644 --- a/hildr-node/src/main/java/io/optimism/network/BlockV2TopicHandler.java +++ b/hildr-node/src/main/java/io/optimism/network/BlockV2TopicHandler.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; import static org.web3j.crypto.Sign.recoverFromSignature; diff --git a/hildr-node/src/main/java/io/optimism/network/DecodingException.java b/hildr-node/src/main/java/io/optimism/network/DecodingException.java index 073397ba..f7d718ff 100644 --- a/hildr-node/src/main/java/io/optimism/network/DecodingException.java +++ b/hildr-node/src/main/java/io/optimism/network/DecodingException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; /** diff --git a/hildr-node/src/main/java/io/optimism/network/DiscV5Service.java b/hildr-node/src/main/java/io/optimism/network/DiscV5Service.java index c52ecc0d..c319d70a 100644 --- a/hildr-node/src/main/java/io/optimism/network/DiscV5Service.java +++ b/hildr-node/src/main/java/io/optimism/network/DiscV5Service.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; import static java.util.stream.Collectors.toList; diff --git a/hildr-node/src/main/java/io/optimism/network/ExecutionPayloadSSZ.java b/hildr-node/src/main/java/io/optimism/network/ExecutionPayloadSSZ.java index 479c3315..5ba80ed9 100644 --- a/hildr-node/src/main/java/io/optimism/network/ExecutionPayloadSSZ.java +++ b/hildr-node/src/main/java/io/optimism/network/ExecutionPayloadSSZ.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; import java.math.BigInteger; diff --git a/hildr-node/src/main/java/io/optimism/network/HildrNodeMetricsCategory.java b/hildr-node/src/main/java/io/optimism/network/HildrNodeMetricsCategory.java index 0e69ee08..f68fbcfa 100644 --- a/hildr-node/src/main/java/io/optimism/network/HildrNodeMetricsCategory.java +++ b/hildr-node/src/main/java/io/optimism/network/HildrNodeMetricsCategory.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; import java.util.Optional; diff --git a/hildr-node/src/main/java/io/optimism/network/NamedTopicHandler.java b/hildr-node/src/main/java/io/optimism/network/NamedTopicHandler.java index 9d61f1a1..4f7aa9ba 100644 --- a/hildr-node/src/main/java/io/optimism/network/NamedTopicHandler.java +++ b/hildr-node/src/main/java/io/optimism/network/NamedTopicHandler.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; import tech.pegasys.teku.networking.p2p.gossip.TopicHandler; diff --git a/hildr-node/src/main/java/io/optimism/network/NodeRecordConverter.java b/hildr-node/src/main/java/io/optimism/network/NodeRecordConverter.java index 96df1864..2ebae028 100644 --- a/hildr-node/src/main/java/io/optimism/network/NodeRecordConverter.java +++ b/hildr-node/src/main/java/io/optimism/network/NodeRecordConverter.java @@ -1,19 +1,3 @@ -/* - * Copyright ConsenSys Software Inc., 2022 - * - * 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.network; import java.net.InetSocketAddress; diff --git a/hildr-node/src/main/java/io/optimism/network/OpStackEnrData.java b/hildr-node/src/main/java/io/optimism/network/OpStackEnrData.java index 9bae6a2b..401f615e 100644 --- a/hildr-node/src/main/java/io/optimism/network/OpStackEnrData.java +++ b/hildr-node/src/main/java/io/optimism/network/OpStackEnrData.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; import com.google.common.base.Objects; @@ -101,7 +85,7 @@ public int hashCode() { @Override public String toString() { - return "OpStackEnrData{" + "chainId=" + chainId + ", version=" + version + '}'; + return "OpStackEnrData{chainId=%s, version=%s}".formatted(chainId, version); } /** diff --git a/hildr-node/src/main/java/io/optimism/network/OpStackNetwork.java b/hildr-node/src/main/java/io/optimism/network/OpStackNetwork.java index c59d0678..34857943 100644 --- a/hildr-node/src/main/java/io/optimism/network/OpStackNetwork.java +++ b/hildr-node/src/main/java/io/optimism/network/OpStackNetwork.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; import com.google.common.collect.ImmutableSet; @@ -163,9 +147,9 @@ public void start() { this.p2pNetwork .start() .thenAccept((Consumer) o -> { - LOGGER.info("P2P network started"); this.topicHandlers.forEach(topicHandler -> this.p2pNetwork.subscribe(((NamedTopicHandler) topicHandler).getTopic(), topicHandler)); + LOGGER.info("P2P network started"); }) .finish(error -> { if (error != null) { diff --git a/hildr-node/src/main/java/io/optimism/network/OpStackP2PNetwork.java b/hildr-node/src/main/java/io/optimism/network/OpStackP2PNetwork.java index 79628519..aa84f371 100644 --- a/hildr-node/src/main/java/io/optimism/network/OpStackP2PNetwork.java +++ b/hildr-node/src/main/java/io/optimism/network/OpStackP2PNetwork.java @@ -1,19 +1,3 @@ -/* - * Copyright ConsenSys Software Inc., 2022 - * - * 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.network; import java.util.Optional; diff --git a/hildr-node/src/main/java/io/optimism/network/OpStackP2PNetworkBuilder.java b/hildr-node/src/main/java/io/optimism/network/OpStackP2PNetworkBuilder.java index 2b1d300a..e5a96be0 100644 --- a/hildr-node/src/main/java/io/optimism/network/OpStackP2PNetworkBuilder.java +++ b/hildr-node/src/main/java/io/optimism/network/OpStackP2PNetworkBuilder.java @@ -1,19 +1,3 @@ -/* - * Copyright ConsenSys Software Inc., 2022 - * - * 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.network; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/hildr-node/src/main/java/io/optimism/network/PrivateKeyGenerator.java b/hildr-node/src/main/java/io/optimism/network/PrivateKeyGenerator.java index 8d078301..62ec7be7 100644 --- a/hildr-node/src/main/java/io/optimism/network/PrivateKeyGenerator.java +++ b/hildr-node/src/main/java/io/optimism/network/PrivateKeyGenerator.java @@ -1,19 +1,3 @@ -/* - * Copyright ConsenSys Software Inc., 2022 - * - * 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.network; import io.libp2p.core.crypto.KeyKt; diff --git a/hildr-node/src/main/java/io/optimism/network/SimplePeerSelectionStrategy.java b/hildr-node/src/main/java/io/optimism/network/SimplePeerSelectionStrategy.java index d49ebaea..600771d0 100644 --- a/hildr-node/src/main/java/io/optimism/network/SimplePeerSelectionStrategy.java +++ b/hildr-node/src/main/java/io/optimism/network/SimplePeerSelectionStrategy.java @@ -1,19 +1,3 @@ -/* - * Copyright ConsenSys Software Inc., 2022 - * - * 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.network; import static java.util.Collections.emptyList; diff --git a/hildr-node/src/main/java/io/optimism/network/SnappyPreparedGossipMessage.java b/hildr-node/src/main/java/io/optimism/network/SnappyPreparedGossipMessage.java index 2fb1fa68..90e11c26 100644 --- a/hildr-node/src/main/java/io/optimism/network/SnappyPreparedGossipMessage.java +++ b/hildr-node/src/main/java/io/optimism/network/SnappyPreparedGossipMessage.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; import io.netty.buffer.ByteBuf; diff --git a/hildr-node/src/main/java/io/optimism/network/SnappyPreparedGossipMessageFactory.java b/hildr-node/src/main/java/io/optimism/network/SnappyPreparedGossipMessageFactory.java index 600537ed..1b508a9c 100644 --- a/hildr-node/src/main/java/io/optimism/network/SnappyPreparedGossipMessageFactory.java +++ b/hildr-node/src/main/java/io/optimism/network/SnappyPreparedGossipMessageFactory.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; import org.apache.tuweni.bytes.Bytes; diff --git a/hildr-node/src/main/java/io/optimism/rpc/RpcMethod.java b/hildr-node/src/main/java/io/optimism/rpc/RpcMethod.java index b3226893..26ef214d 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/RpcMethod.java +++ b/hildr-node/src/main/java/io/optimism/rpc/RpcMethod.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.rpc; import java.util.HashSet; diff --git a/hildr-node/src/main/java/io/optimism/rpc/RpcServer.java b/hildr-node/src/main/java/io/optimism/rpc/RpcServer.java index 6c8d20d2..ae4c7c15 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/RpcServer.java +++ b/hildr-node/src/main/java/io/optimism/rpc/RpcServer.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.rpc; import io.micrometer.tracing.Span; diff --git a/hildr-node/src/main/java/io/optimism/rpc/execution/BaseJsonRpcProcessor.java b/hildr-node/src/main/java/io/optimism/rpc/execution/BaseJsonRpcProcessor.java index e90576a4..331ece0f 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/execution/BaseJsonRpcProcessor.java +++ b/hildr-node/src/main/java/io/optimism/rpc/execution/BaseJsonRpcProcessor.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.execution; import io.optimism.rpc.internal.JsonRpcRequestContext; diff --git a/hildr-node/src/main/java/io/optimism/rpc/execution/JsonRpcExecutor.java b/hildr-node/src/main/java/io/optimism/rpc/execution/JsonRpcExecutor.java index ecbcc10a..1f1ad681 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/execution/JsonRpcExecutor.java +++ b/hildr-node/src/main/java/io/optimism/rpc/execution/JsonRpcExecutor.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.rpc.execution; import static io.optimism.rpc.internal.response.JsonRpcError.INVALID_REQUEST; diff --git a/hildr-node/src/main/java/io/optimism/rpc/execution/JsonRpcProcessor.java b/hildr-node/src/main/java/io/optimism/rpc/execution/JsonRpcProcessor.java index 7476d3d2..5a6bdb3e 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/execution/JsonRpcProcessor.java +++ b/hildr-node/src/main/java/io/optimism/rpc/execution/JsonRpcProcessor.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.execution; import io.optimism.rpc.internal.JsonRpcRequestContext; diff --git a/hildr-node/src/main/java/io/optimism/rpc/execution/LoggedJsonRpcProcessor.java b/hildr-node/src/main/java/io/optimism/rpc/execution/LoggedJsonRpcProcessor.java index fb1a31d7..dbad41e7 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/execution/LoggedJsonRpcProcessor.java +++ b/hildr-node/src/main/java/io/optimism/rpc/execution/LoggedJsonRpcProcessor.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.execution; import io.optimism.rpc.internal.JsonRpcRequestContext; diff --git a/hildr-node/src/main/java/io/optimism/rpc/handler/JsonRpcExecutorHandler.java b/hildr-node/src/main/java/io/optimism/rpc/handler/JsonRpcExecutorHandler.java index d98fce4c..5dad13dc 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/handler/JsonRpcExecutorHandler.java +++ b/hildr-node/src/main/java/io/optimism/rpc/handler/JsonRpcExecutorHandler.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.rpc.handler; import static io.netty.handler.codec.http.HttpHeaderValues.APPLICATION_JSON; diff --git a/hildr-node/src/main/java/io/optimism/rpc/handler/JsonRpcParseHandler.java b/hildr-node/src/main/java/io/optimism/rpc/handler/JsonRpcParseHandler.java index 22893dda..ae97a6b2 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/handler/JsonRpcParseHandler.java +++ b/hildr-node/src/main/java/io/optimism/rpc/handler/JsonRpcParseHandler.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.handler; import io.netty.handler.codec.http.HttpResponseStatus; diff --git a/hildr-node/src/main/java/io/optimism/rpc/handler/TimeoutHandler.java b/hildr-node/src/main/java/io/optimism/rpc/handler/TimeoutHandler.java index 661efebf..a96c0058 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/handler/TimeoutHandler.java +++ b/hildr-node/src/main/java/io/optimism/rpc/handler/TimeoutHandler.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.handler; import io.vertx.core.Handler; diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequest.java b/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequest.java index dcf81d54..630a1d12 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequest.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequest.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.internal; import com.fasterxml.jackson.annotation.JsonCreator; @@ -27,7 +12,7 @@ import java.util.Objects; /** - * copied from project besu(https://github.com/hyperledger/besu). + * copied from project besu(...). * * @author thinkAfCod * @since 2023.06 @@ -137,11 +122,7 @@ public boolean hasParams() { } // Null Array: "params":[null] - if (params.length == 0 || params[0] == null) { - return false; - } - - return true; + return params.length != 0 && params[0] != null; } /** @@ -157,14 +138,9 @@ public void setId(final JsonRpcRequestId id) { } @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || !(o instanceof JsonRpcRequest)) { - return false; - } - final JsonRpcRequest that = (JsonRpcRequest) o; + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof JsonRpcRequest that)) return false; return isNotification == that.isNotification && Objects.equals(id, that.id) && Objects.equals(method, that.method) @@ -174,7 +150,9 @@ public boolean equals(final Object o) { @Override public int hashCode() { - return Objects.hash(id, method, Arrays.hashCode(params), version, isNotification); + int result = Objects.hash(id, method, version, isNotification); + result = 31 * result + Arrays.hashCode(params); + return result; } /** @@ -185,6 +163,7 @@ public int hashCode() { * @param paramClass the param class * @return the parameter */ + @SuppressWarnings("unchecked") public T getParameter(final int index, final Class paramClass) { if (params == null || params.length <= index || params[index] == null) { return null; @@ -212,19 +191,7 @@ public T getParameter(final int index, final Class paramClass) { @Override public String toString() { - return "JsonRpcRequest{" - + "id=" - + id - + ", method='" - + method - + '\'' - + ", params=" - + Arrays.toString(params) - + ", version='" - + version - + '\'' - + ", isNotification=" - + isNotification - + '}'; + return "JsonRpcRequest{id=%s, method='%s', params=%s, version='%s', isNotification=%s}" + .formatted(id, method, Arrays.toString(params), version, isNotification); } } diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequestContext.java b/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequestContext.java index 867e8b27..7fdd0972 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequestContext.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequestContext.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.internal; import io.vertx.ext.web.RoutingContext; @@ -64,19 +49,14 @@ public T getParameter(final int index, final Class paramClass) { } @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || (o instanceof JsonRpcRequestContext)) { - return false; - } - final JsonRpcRequestContext that = (JsonRpcRequestContext) o; - return Objects.equals(jsonRpcRequest, that.jsonRpcRequest); + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof JsonRpcRequestContext that)) return false; + return Objects.equals(context, that.context) && Objects.equals(jsonRpcRequest, that.jsonRpcRequest); } @Override public int hashCode() { - return Objects.hash(jsonRpcRequest); + return Objects.hash(context, jsonRpcRequest); } } diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequestId.java b/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequestId.java index bcb5260b..43fc0c14 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequestId.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/JsonRpcRequestId.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.internal; import com.fasterxml.jackson.annotation.JsonCreator; @@ -79,19 +64,14 @@ private boolean isTypeInvalid(final Object id) { } @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || !(o instanceof JsonRpcRequestId)) { - return false; - } - final JsonRpcRequestId that = (JsonRpcRequestId) o; + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof JsonRpcRequestId that)) return false; return Objects.equals(id, that.id); } @Override public int hashCode() { - return Objects.hashCode(id); + return Objects.hash(id); } } diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcError.java b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcError.java index 3a3d1865..d1a9a27a 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcError.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcError.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.internal.response; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcErrorResponse.java b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcErrorResponse.java index 3c044e0b..7f0affa1 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcErrorResponse.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcErrorResponse.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.internal.response; import com.fasterxml.jackson.annotation.JsonGetter; diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcNoResponse.java b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcNoResponse.java index 7fe8e0b1..1f88b2a6 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcNoResponse.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcNoResponse.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.internal.response; /** The type Json rpc no response. */ diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponse.java b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponse.java index 953e28ff..1eb55a64 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponse.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponse.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.internal.response; import com.fasterxml.jackson.annotation.JsonGetter; diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponseType.java b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponseType.java index 8bc5a56a..af309981 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponseType.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponseType.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.internal.response; /** Various types of responses that the JSON-RPC component may produce. */ diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcSuccessResponse.java b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcSuccessResponse.java index 495d582c..a9f38b7d 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcSuccessResponse.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/response/JsonRpcSuccessResponse.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.internal.response; import com.fasterxml.jackson.annotation.JsonGetter; diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/result/EthGetProof.java b/hildr-node/src/main/java/io/optimism/rpc/internal/result/EthGetProof.java index 5a7d635b..2176700c 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/result/EthGetProof.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/result/EthGetProof.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.rpc.internal.result; import com.fasterxml.jackson.core.JsonParser; @@ -25,6 +9,7 @@ import java.io.IOException; import java.math.BigInteger; import java.util.List; +import java.util.Objects; import org.web3j.protocol.ObjectMapperFactory; import org.web3j.protocol.core.Response; import org.web3j.utils.Numeric; @@ -243,10 +228,9 @@ public boolean equals(Object o) { if (this == o) { return true; } - if (!(o instanceof EthGetProof.Proof)) { + if (!(o instanceof Proof proof)) { return false; } - EthGetProof.Proof proof = (EthGetProof.Proof) o; if (getAddress() != null ? !getAddress().equals(proof.getAddress()) : proof.getAddress() != null) { return false; @@ -377,30 +361,16 @@ public void setProof(List proof) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof StorageProof)) { - return false; - } - - StorageProof proof = (EthGetProof.StorageProof) o; - - if (getKey() != null ? !getKey().equals(proof.getKey()) : proof.getKey() != null) { - return false; - } - if (getValue() != null ? !getValue().equals(proof.getValue()) : proof.getValue() != null) { - return false; - } - return getProof() != null ? getProof().equals(proof.getProof()) : proof.getProof() == null; + if (this == o) return true; + if (!(o instanceof StorageProof that)) return false; + return Objects.equals(key, that.key) + && Objects.equals(value, that.value) + && Objects.equals(proof, that.proof); } @Override public int hashCode() { - int result = getKey() != null ? getKey().hashCode() : 0; - result = 31 * result + (getValue() != null ? getValue().hashCode() : 0); - result = 31 * result + (getProof() != null ? getProof().hashCode() : 0); - return result; + return Objects.hash(key, value, proof); } } diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/result/OutputRootResult.java b/hildr-node/src/main/java/io/optimism/rpc/internal/result/OutputRootResult.java index ce068e04..2e6610ee 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/result/OutputRootResult.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/result/OutputRootResult.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.rpc.internal.result; /** diff --git a/hildr-node/src/main/java/io/optimism/rpc/internal/result/SyncStatusResult.java b/hildr-node/src/main/java/io/optimism/rpc/internal/result/SyncStatusResult.java index cbf484d0..b28ff094 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/internal/result/SyncStatusResult.java +++ b/hildr-node/src/main/java/io/optimism/rpc/internal/result/SyncStatusResult.java @@ -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.rpc.internal.result; import io.optimism.common.BlockInfo; diff --git a/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethod.java b/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethod.java index be9197ae..542feec6 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethod.java +++ b/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethod.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.methods; import io.optimism.rpc.internal.JsonRpcRequestContext; diff --git a/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethodAdapter.java b/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethodAdapter.java index 99ab0850..7abf9d56 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethodAdapter.java +++ b/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethodAdapter.java @@ -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.rpc.methods; import io.optimism.common.HildrServiceExecutionException; diff --git a/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethodsFactory.java b/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethodsFactory.java index ebf97fba..b2d0985b 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethodsFactory.java +++ b/hildr-node/src/main/java/io/optimism/rpc/methods/JsonRpcMethodsFactory.java @@ -1,18 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc.methods; import io.optimism.config.Config; diff --git a/hildr-node/src/main/java/io/optimism/rpc/methods/OutputAtBlock.java b/hildr-node/src/main/java/io/optimism/rpc/methods/OutputAtBlock.java index 63128095..cd1f2ce0 100644 --- a/hildr-node/src/main/java/io/optimism/rpc/methods/OutputAtBlock.java +++ b/hildr-node/src/main/java/io/optimism/rpc/methods/OutputAtBlock.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.rpc.methods; import io.optimism.common.HildrServiceExecutionException; diff --git a/hildr-node/src/main/java/io/optimism/runner/DriverInitException.java b/hildr-node/src/main/java/io/optimism/runner/DriverInitException.java index c1763dc1..f7200672 100644 --- a/hildr-node/src/main/java/io/optimism/runner/DriverInitException.java +++ b/hildr-node/src/main/java/io/optimism/runner/DriverInitException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.runner; /** diff --git a/hildr-node/src/main/java/io/optimism/runner/Runner.java b/hildr-node/src/main/java/io/optimism/runner/Runner.java index 97772d10..90cb998e 100644 --- a/hildr-node/src/main/java/io/optimism/runner/Runner.java +++ b/hildr-node/src/main/java/io/optimism/runner/Runner.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.runner; import com.google.common.util.concurrent.AbstractExecutionThreadService; diff --git a/hildr-node/src/main/java/io/optimism/runner/SyncUrlMissingException.java b/hildr-node/src/main/java/io/optimism/runner/SyncUrlMissingException.java index 395b5c4b..e75daedf 100644 --- a/hildr-node/src/main/java/io/optimism/runner/SyncUrlMissingException.java +++ b/hildr-node/src/main/java/io/optimism/runner/SyncUrlMissingException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.runner; /** diff --git a/hildr-node/src/main/java/io/optimism/runner/TransactionNotFoundException.java b/hildr-node/src/main/java/io/optimism/runner/TransactionNotFoundException.java index 47a456a7..492e1079 100644 --- a/hildr-node/src/main/java/io/optimism/runner/TransactionNotFoundException.java +++ b/hildr-node/src/main/java/io/optimism/runner/TransactionNotFoundException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.runner; /** diff --git a/hildr-node/src/main/java/io/optimism/runner/TrustedPeerAddedException.java b/hildr-node/src/main/java/io/optimism/runner/TrustedPeerAddedException.java index d29769bc..172b20fe 100644 --- a/hildr-node/src/main/java/io/optimism/runner/TrustedPeerAddedException.java +++ b/hildr-node/src/main/java/io/optimism/runner/TrustedPeerAddedException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.runner; /** diff --git a/hildr-node/src/main/java/io/optimism/telemetry/InnerMetrics.java b/hildr-node/src/main/java/io/optimism/telemetry/InnerMetrics.java index b8028f7e..943d619b 100644 --- a/hildr-node/src/main/java/io/optimism/telemetry/InnerMetrics.java +++ b/hildr-node/src/main/java/io/optimism/telemetry/InnerMetrics.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.telemetry; import io.micrometer.core.instrument.Gauge; diff --git a/hildr-node/src/test/java/io/optimism/HildrTest.java b/hildr-node/src/test/java/io/optimism/HildrTest.java index 8f2fbce5..1c2ae8aa 100644 --- a/hildr-node/src/test/java/io/optimism/HildrTest.java +++ b/hildr-node/src/test/java/io/optimism/HildrTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hildr-node/src/test/java/io/optimism/TestConstants.java b/hildr-node/src/test/java/io/optimism/TestConstants.java index 620e826c..d9d3c3b4 100644 --- a/hildr-node/src/test/java/io/optimism/TestConstants.java +++ b/hildr-node/src/test/java/io/optimism/TestConstants.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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; import io.optimism.config.Config; diff --git a/hildr-node/src/test/java/io/optimism/common/EpochTest.java b/hildr-node/src/test/java/io/optimism/common/EpochTest.java index 25bac137..e640bcf3 100644 --- a/hildr-node/src/test/java/io/optimism/common/EpochTest.java +++ b/hildr-node/src/test/java/io/optimism/common/EpochTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.common; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hildr-node/src/test/java/io/optimism/config/ConfigTest.java b/hildr-node/src/test/java/io/optimism/config/ConfigTest.java index 554afd57..676b3723 100644 --- a/hildr-node/src/test/java/io/optimism/config/ConfigTest.java +++ b/hildr-node/src/test/java/io/optimism/config/ConfigTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.config; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; diff --git a/hildr-node/src/test/java/io/optimism/derive/stages/BatcherTransactionsTest.java b/hildr-node/src/test/java/io/optimism/derive/stages/BatcherTransactionsTest.java index e82bd4a3..e664f6f6 100644 --- a/hildr-node/src/test/java/io/optimism/derive/stages/BatcherTransactionsTest.java +++ b/hildr-node/src/test/java/io/optimism/derive/stages/BatcherTransactionsTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive.stages; import static org.junit.jupiter.api.Assertions.assertArrayEquals; diff --git a/hildr-node/src/test/java/io/optimism/derive/stages/BatchesTest.java b/hildr-node/src/test/java/io/optimism/derive/stages/BatchesTest.java index 9f37d643..db8bd077 100644 --- a/hildr-node/src/test/java/io/optimism/derive/stages/BatchesTest.java +++ b/hildr-node/src/test/java/io/optimism/derive/stages/BatchesTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive.stages; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hildr-node/src/test/java/io/optimism/derive/stages/ChannelsTest.java b/hildr-node/src/test/java/io/optimism/derive/stages/ChannelsTest.java index df9765b2..655ea86a 100644 --- a/hildr-node/src/test/java/io/optimism/derive/stages/ChannelsTest.java +++ b/hildr-node/src/test/java/io/optimism/derive/stages/ChannelsTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive.stages; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hildr-node/src/test/java/io/optimism/derive/stages/UserDepositedTest.java b/hildr-node/src/test/java/io/optimism/derive/stages/UserDepositedTest.java index 7de55d1b..4ce90dc4 100644 --- a/hildr-node/src/test/java/io/optimism/derive/stages/UserDepositedTest.java +++ b/hildr-node/src/test/java/io/optimism/derive/stages/UserDepositedTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.derive.stages; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hildr-node/src/test/java/io/optimism/driver/DriverTest.java b/hildr-node/src/test/java/io/optimism/driver/DriverTest.java index 7e54f210..c3b25323 100644 --- a/hildr-node/src/test/java/io/optimism/driver/DriverTest.java +++ b/hildr-node/src/test/java/io/optimism/driver/DriverTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.driver; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hildr-node/src/test/java/io/optimism/driver/HeadInfoTest.java b/hildr-node/src/test/java/io/optimism/driver/HeadInfoTest.java index 6cc79cec..bda81f48 100644 --- a/hildr-node/src/test/java/io/optimism/driver/HeadInfoTest.java +++ b/hildr-node/src/test/java/io/optimism/driver/HeadInfoTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.driver; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hildr-node/src/test/java/io/optimism/engine/EngineApiTest.java b/hildr-node/src/test/java/io/optimism/engine/EngineApiTest.java index aa9dd9dd..de34a74d 100644 --- a/hildr-node/src/test/java/io/optimism/engine/EngineApiTest.java +++ b/hildr-node/src/test/java/io/optimism/engine/EngineApiTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.engine; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hildr-node/src/test/java/io/optimism/l1/InnerWatcherTest.java b/hildr-node/src/test/java/io/optimism/l1/InnerWatcherTest.java index fa37794f..6ec2094c 100644 --- a/hildr-node/src/test/java/io/optimism/l1/InnerWatcherTest.java +++ b/hildr-node/src/test/java/io/optimism/l1/InnerWatcherTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.l1; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hildr-node/src/test/java/io/optimism/network/ExecutionPayloadSSZTest.java b/hildr-node/src/test/java/io/optimism/network/ExecutionPayloadSSZTest.java index 022e08fd..3e2771ad 100644 --- a/hildr-node/src/test/java/io/optimism/network/ExecutionPayloadSSZTest.java +++ b/hildr-node/src/test/java/io/optimism/network/ExecutionPayloadSSZTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.network; import org.apache.tuweni.bytes.Bytes; diff --git a/hildr-node/src/test/java/io/optimism/rpc/RpcServerTest.java b/hildr-node/src/test/java/io/optimism/rpc/RpcServerTest.java index b2a8cbec..c4663de6 100644 --- a/hildr-node/src/test/java/io/optimism/rpc/RpcServerTest.java +++ b/hildr-node/src/test/java/io/optimism/rpc/RpcServerTest.java @@ -1,21 +1,3 @@ -/* - * Copyright 2023-2811 281165273grape@gmail.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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - package io.optimism.rpc; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -34,7 +16,6 @@ import java.time.Duration; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.ExecutionException; import java.util.concurrent.StructuredTaskScope; import java.util.function.Function; import okhttp3.MediaType; @@ -73,6 +54,7 @@ RpcServer createRpcServer(Config config) { } @Test + @SuppressWarnings("rawtypes") void testRpcServerStart() throws Exception { if (!TestConstants.isConfiguredApiKeyEnv) { return; @@ -120,7 +102,8 @@ void testRpcServerStart() throws Exception { } @Test - void testRpcServerRegister() throws IOException, InterruptedException, ExecutionException { + @SuppressWarnings("rawtypes") + void testRpcServerRegister() throws IOException, InterruptedException { RpcServer rpcServer = createRpcServer( new Config(null, null, "http://fakeurl", null, null, null, 9545, false, Config.ChainConfig.optimism())); rpcServer.start(); @@ -135,10 +118,12 @@ void testRpcServerRegister() throws IOException, InterruptedException, Execution JsonRpcRequest jsonRpcRequest = new JsonRpcRequest("2.0", "test_url", new Object[] {"7900000"}); jsonRpcRequest.setId(new JsonRpcRequestId("1")); try { - Response response = sendRequest(okHttpClient, jsonRpcRequest); - assertEquals(200, response.code()); - assertNotNull(response.body()); - Map jsonRpcResp = mapper.readValue(response.body().string(), Map.class); + Map jsonRpcResp; + try (Response response = sendRequest(okHttpClient, jsonRpcRequest)) { + assertEquals(200, response.code()); + assertNotNull(response.body()); + jsonRpcResp = mapper.readValue(response.body().string(), Map.class); + } System.out.println(jsonRpcResp); } finally { rpcServer.stop(); @@ -146,7 +131,7 @@ void testRpcServerRegister() throws IOException, InterruptedException, Execution } private Response sendRequest(OkHttpClient okHttpClient, JsonRpcRequest jsonRpcRequest) - throws JsonProcessingException, InterruptedException, ExecutionException { + throws JsonProcessingException, InterruptedException { var postBody = mapper.writeValueAsBytes(jsonRpcRequest); RequestBody requestBody = RequestBody.create(postBody, MediaType.get("application/json")); diff --git a/hildr-node/src/test/java/io/optimism/telemetry/InnerMetricsTest.java b/hildr-node/src/test/java/io/optimism/telemetry/InnerMetricsTest.java index 755f09fd..b9599e8b 100644 --- a/hildr-node/src/test/java/io/optimism/telemetry/InnerMetricsTest.java +++ b/hildr-node/src/test/java/io/optimism/telemetry/InnerMetricsTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.telemetry; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/hildr-node/src/test/java/io/optimism/telemetry/LoggingExampleTest.java b/hildr-node/src/test/java/io/optimism/telemetry/LoggingExampleTest.java index 126e05fe..da8ccd55 100644 --- a/hildr-node/src/test/java/io/optimism/telemetry/LoggingExampleTest.java +++ b/hildr-node/src/test/java/io/optimism/telemetry/LoggingExampleTest.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.telemetry; import io.micrometer.tracing.Span; diff --git a/hildr-utilities/build.gradle b/hildr-utilities/build.gradle index 3e047575..d986cac8 100644 --- a/hildr-utilities/build.gradle +++ b/hildr-utilities/build.gradle @@ -7,7 +7,7 @@ plugins { } group = 'io.optimism' -version = '0.1.1' +version = '0.2.4' repositories { // Use Maven Central for resolving dependencies. @@ -157,13 +157,6 @@ spotless { palantirJavaFormat('2.38.0') // fix formatting of type annotations formatAnnotations() - // make sure every file has the following copyright header. - // optionally, Spotless can set copyright years by digging - // through git history (see "license" section below) - licenseHeaderFile(project(":").file("config/spotless/java.license")).named('hildr').onlyIfContentMatches('/*\n' + - ' * Copyright 2023 281165273grape@gmail.com') - licenseHeaderFile(project(":").file("config/spotless/besu.license")).named('besu').onlyIfContentMatches('/*\n' + - ' * Copyright ConsenSys AG') importOrder() diff --git a/hildr-utilities/src/main/java/io/optimism/type/BlockId.java b/hildr-utilities/src/main/java/io/optimism/type/BlockId.java index e0069a26..ab1db52c 100644 --- a/hildr-utilities/src/main/java/io/optimism/type/BlockId.java +++ b/hildr-utilities/src/main/java/io/optimism/type/BlockId.java @@ -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 java.math.BigInteger; @@ -41,6 +25,6 @@ public static BlockId from(EthBlock.Block block) { @Override public String toString() { - return "BlockId{" + "hash='" + hash + '\'' + ", number=" + number + '}'; + return "BlockId{hash='%s', number=%s}".formatted(hash, number); } } diff --git a/hildr-utilities/src/main/java/io/optimism/type/DepositTransaction.java b/hildr-utilities/src/main/java/io/optimism/type/DepositTransaction.java index a8f20e27..65710716 100644 --- a/hildr-utilities/src/main/java/io/optimism/type/DepositTransaction.java +++ b/hildr-utilities/src/main/java/io/optimism/type/DepositTransaction.java @@ -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 java.math.BigInteger; diff --git a/hildr-utilities/src/main/java/io/optimism/type/Genesis.java b/hildr-utilities/src/main/java/io/optimism/type/Genesis.java index c2227935..6703f4a3 100644 --- a/hildr-utilities/src/main/java/io/optimism/type/Genesis.java +++ b/hildr-utilities/src/main/java/io/optimism/type/Genesis.java @@ -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 java.math.BigInteger; diff --git a/hildr-utilities/src/main/java/io/optimism/type/L1BlockInfo.java b/hildr-utilities/src/main/java/io/optimism/type/L1BlockInfo.java index 23810ba1..ae4a3c33 100644 --- a/hildr-utilities/src/main/java/io/optimism/type/L1BlockInfo.java +++ b/hildr-utilities/src/main/java/io/optimism/type/L1BlockInfo.java @@ -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 java.math.BigInteger; diff --git a/hildr-utilities/src/main/java/io/optimism/type/L1BlockRef.java b/hildr-utilities/src/main/java/io/optimism/type/L1BlockRef.java index a2602dd2..d5dc7c5f 100644 --- a/hildr-utilities/src/main/java/io/optimism/type/L1BlockRef.java +++ b/hildr-utilities/src/main/java/io/optimism/type/L1BlockRef.java @@ -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 java.math.BigInteger; @@ -59,49 +43,22 @@ public static L1BlockRef from(EthBlock.Block block) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || !(o instanceof L1BlockRef)) { - return false; - } - - L1BlockRef that = (L1BlockRef) o; - - if (!Objects.equals(hash, that.hash)) { - return false; - } - if (!Objects.equals(number, that.number)) { - return false; - } - if (!Objects.equals(parentHash, that.parentHash)) { - return false; - } - return Objects.equals(timestamp, that.timestamp); + if (this == o) return true; + if (!(o instanceof L1BlockRef that)) return false; + return Objects.equals(hash, that.hash) + && Objects.equals(number, that.number) + && Objects.equals(parentHash, that.parentHash) + && Objects.equals(timestamp, that.timestamp); } @Override public int hashCode() { - int result = hash != null ? hash.hashCode() : 0; - result = 31 * result + (number != null ? number.hashCode() : 0); - result = 31 * result + (parentHash != null ? parentHash.hashCode() : 0); - result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0); - return result; + return Objects.hash(hash, number, parentHash, timestamp); } @Override public String toString() { - return "L1BlockRef{" - + "hash='" - + hash - + '\'' - + ", number=" - + number - + ", parentHash='" - + parentHash - + '\'' - + ", timestamp=" - + timestamp - + '}'; + return "L1BlockRef{hash='%s', number=%s, parentHash='%s', timestamp=%s}" + .formatted(hash, number, parentHash, timestamp); } } diff --git a/hildr-utilities/src/main/java/io/optimism/type/L2BlockRef.java b/hildr-utilities/src/main/java/io/optimism/type/L2BlockRef.java index 6ad7ef54..b085b33c 100644 --- a/hildr-utilities/src/main/java/io/optimism/type/L2BlockRef.java +++ b/hildr-utilities/src/main/java/io/optimism/type/L2BlockRef.java @@ -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 java.math.BigInteger; @@ -27,7 +11,7 @@ * @param number L1 block number * @param parentHash L1 block parent hash * @param timestamp L1 Block timestamp - * @param l1origin L1 block Id information + * @param l1origin L1 blockId information * @param sequenceNumber sequence number that distance to first block of epoch * @author thinkAfCod * @since 0.1.1 @@ -70,42 +54,18 @@ public static L2BlockRef fromBlockAndL1Info(EthBlock.Block block, L1BlockInfo l1 @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - - if (o == null || !(o instanceof L2BlockRef)) { - return false; - } - - L2BlockRef that = (L2BlockRef) o; - - if (!Objects.equals(hash, that.hash)) { - return false; - } - if (!Objects.equals(number, that.number)) { - return false; - } - if (!Objects.equals(parentHash, that.parentHash)) { - return false; - } - if (!Objects.equals(timestamp, that.timestamp)) { - return false; - } - if (!Objects.equals(l1origin, that.l1origin)) { - return false; - } - return Objects.equals(sequenceNumber, that.sequenceNumber); + if (this == o) return true; + if (!(o instanceof L2BlockRef that)) return false; + return Objects.equals(hash, that.hash) + && Objects.equals(number, that.number) + && Objects.equals(parentHash, that.parentHash) + && Objects.equals(timestamp, that.timestamp) + && Objects.equals(l1origin, that.l1origin) + && Objects.equals(sequenceNumber, that.sequenceNumber); } @Override public int hashCode() { - int result = hash != null ? hash.hashCode() : 0; - result = 31 * result + (number != null ? number.hashCode() : 0); - result = 31 * result + (parentHash != null ? parentHash.hashCode() : 0); - result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0); - result = 31 * result + (l1origin != null ? l1origin.hashCode() : 0); - result = 31 * result + (sequenceNumber != null ? sequenceNumber.hashCode() : 0); - return result; + return Objects.hash(hash, number, parentHash, timestamp, l1origin, sequenceNumber); } } diff --git a/hildr-utilities/src/main/java/io/optimism/type/ParseBlockException.java b/hildr-utilities/src/main/java/io/optimism/type/ParseBlockException.java index ad38e045..585d2e6f 100644 --- a/hildr-utilities/src/main/java/io/optimism/type/ParseBlockException.java +++ b/hildr-utilities/src/main/java/io/optimism/type/ParseBlockException.java @@ -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; /** diff --git a/hildr-utilities/src/main/java/io/optimism/type/RollupConfigResult.java b/hildr-utilities/src/main/java/io/optimism/type/RollupConfigResult.java index 42d60309..d7762526 100644 --- a/hildr-utilities/src/main/java/io/optimism/type/RollupConfigResult.java +++ b/hildr-utilities/src/main/java/io/optimism/type/RollupConfigResult.java @@ -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 com.fasterxml.jackson.annotation.JsonProperty; diff --git a/hildr-utilities/src/main/java/io/optimism/type/SystemConfig.java b/hildr-utilities/src/main/java/io/optimism/type/SystemConfig.java index e5f9b716..d028ed36 100644 --- a/hildr-utilities/src/main/java/io/optimism/type/SystemConfig.java +++ b/hildr-utilities/src/main/java/io/optimism/type/SystemConfig.java @@ -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 java.math.BigInteger; diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/TxDecoder.java b/hildr-utilities/src/main/java/io/optimism/utilities/TxDecoder.java index f06e44e6..bcb04eaf 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/TxDecoder.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/TxDecoder.java @@ -50,16 +50,16 @@ public static DepositTransaction decodeToDeposit(final String hexTransaction) { } final byte[] encodedTx = Arrays.copyOfRange(transaction, 1, transaction.length); final RlpList rlpList = RlpDecoder.decode(encodedTx); - var values = ((RlpList) rlpList.getValues().get(0)).getValues(); - final String sourceHash = ((RlpString) values.get(0)).asString(); - final String from = ((RlpString) values.get(0)).asString(); - final String to = ((RlpString) values.get(0)).asString(); - final BigInteger mint = ((RlpString) values.get(0)).asPositiveBigInteger(); - final BigInteger value = ((RlpString) values.get(0)).asPositiveBigInteger(); - final BigInteger gas = ((RlpString) values.get(0)).asPositiveBigInteger(); + var values = ((RlpList) rlpList.getValues().getFirst()).getValues(); + final String sourceHash = ((RlpString) values.getFirst()).asString(); + final String from = ((RlpString) values.getFirst()).asString(); + final String to = ((RlpString) values.getFirst()).asString(); + final BigInteger mint = ((RlpString) values.getFirst()).asPositiveBigInteger(); + final BigInteger value = ((RlpString) values.getFirst()).asPositiveBigInteger(); + final BigInteger gas = ((RlpString) values.getFirst()).asPositiveBigInteger(); final boolean isSystemTx = - ((RlpString) values.get(0)).asPositiveBigInteger().compareTo(BigInteger.ONE) == 0; - final String data = ((RlpString) values.get(0)).asString(); + ((RlpString) values.getFirst()).asPositiveBigInteger().compareTo(BigInteger.ONE) == 0; + final String data = ((RlpString) values.getFirst()).asString(); return new DepositTransaction(sourceHash, from, to, mint, value, gas, isSystemTx, data); } } diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/Batch.java b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/Batch.java index c9e79ea6..f9a0caf8 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/Batch.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/Batch.java @@ -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.utilities.derive.stages; import java.math.BigInteger; diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/BatchType.java b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/BatchType.java index 5da1cab9..333a136a 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/BatchType.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/BatchType.java @@ -2,6 +2,9 @@ /** * The enum Batch type. + * + * @author grapebaba + * @since 0.2.4 */ public enum BatchType { /** @@ -50,6 +53,6 @@ public static BatchType from(int code) { return batchType; } } - throw new IllegalArgumentException("Invalid BatchType code: " + code); + throw new IllegalArgumentException("Invalid BatchType code: %d".formatted(code)); } } diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/Frame.java b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/Frame.java index 6c3288bb..fe6911ce 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/Frame.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/Frame.java @@ -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.utilities.derive.stages; import com.google.common.base.Objects; diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/InvalidFrameSizeException.java b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/InvalidFrameSizeException.java index 9fabc8b6..17b48df7 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/InvalidFrameSizeException.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/InvalidFrameSizeException.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.utilities.derive.stages; /** diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/RLPEncodingHelpers.java b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/RLPEncodingHelpers.java index 0b12210e..7247459f 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/RLPEncodingHelpers.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/RLPEncodingHelpers.java @@ -1,17 +1,3 @@ -/* - * Copyright ConsenSys AG. - * - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ package io.optimism.utilities.derive.stages; import org.apache.tuweni.bytes.Bytes; diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchLegacyTxData.java b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchLegacyTxData.java index 7eabb0c1..6e231e7a 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchLegacyTxData.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchLegacyTxData.java @@ -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.utilities.derive.stages; import org.apache.tuweni.bytes.Bytes; diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchTx.java b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchTx.java index f7a434b5..9b4c3aec 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchTx.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchTx.java @@ -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.utilities.derive.stages; import static org.hyperledger.besu.ethereum.core.Transaction.REPLAY_PROTECTED_V_BASE; diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchTxs.java b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchTxs.java index 0ce7c9c2..66e0c42f 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchTxs.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/derive/stages/SpanBatchTxs.java @@ -751,12 +751,12 @@ public static Pair readTxData(RLPInput input, boolean is } /** - * Last current list as bytes bytes. + * Last current list as bytes. * * @param input the input * @return the bytes */ - public static Bytes lastCurrentListAsBytes(RLPInput input) { + private static Bytes lastCurrentListAsBytes(RLPInput input) { if (!input.nextIsList()) { throw new RuntimeException("Cannot read list, current item is not a list list"); } diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/exception/GasOverflowException.java b/hildr-utilities/src/main/java/io/optimism/utilities/exception/GasOverflowException.java index 1640d840..59056fd7 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/exception/GasOverflowException.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/exception/GasOverflowException.java @@ -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.utilities.exception; /** diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/gas/GasCalculator.java b/hildr-utilities/src/main/java/io/optimism/utilities/gas/GasCalculator.java index 8ca45111..fb1dc887 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/gas/GasCalculator.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/gas/GasCalculator.java @@ -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.utilities.gas; import java.math.BigInteger; diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/rpc/RetryRateLimitInterceptor.java b/hildr-utilities/src/main/java/io/optimism/utilities/rpc/RetryRateLimitInterceptor.java index e84337e6..04f3cd3e 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/rpc/RetryRateLimitInterceptor.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/rpc/RetryRateLimitInterceptor.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.utilities.rpc; import com.fasterxml.jackson.core.type.TypeReference; @@ -79,7 +63,7 @@ public RetryRateLimitInterceptor() { } @NotNull @Override - public Response intercept(@NotNull final Chain chain) throws IOException { + public Response intercept(@NotNull final Chain chain) { try { return this.retryer.call(() -> { if (!this.rateLimiter.tryAcquire()) { diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/rpc/Web3jProvider.java b/hildr-utilities/src/main/java/io/optimism/utilities/rpc/Web3jProvider.java index a1165eb2..a9857c6d 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/rpc/Web3jProvider.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/rpc/Web3jProvider.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.utilities.rpc; import java.net.ConnectException; @@ -55,7 +39,7 @@ public static Web3j createClient(String url) { * @return web3j client and web3j service */ public static Tuple2 create(String url) { - Web3jService web3Srv = null; + Web3jService web3Srv; if (Web3jProvider.isHttp(url)) { OkHttpClient okHttpClient = new OkHttpClient.Builder() .addInterceptor(new RetryRateLimitInterceptor()) @@ -66,7 +50,7 @@ public static Tuple2 create(String url) { wsConnect(web3finalSrv); web3Srv = web3finalSrv; } else { - throw new IllegalArgumentException("not supported scheme:" + url); + throw new IllegalArgumentException("not supported scheme:%s".formatted(url)); } return new Tuple2<>(Web3j.build(web3Srv), web3Srv); } diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/EventMeter.java b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/EventMeter.java index deabef3c..79e660cd 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/EventMeter.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/EventMeter.java @@ -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.utilities.telemetry; import io.micrometer.core.instrument.Counter; diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/LazyInitRollingFileAppender.java b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/LazyInitRollingFileAppender.java index 57060f06..e008ee9e 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/LazyInitRollingFileAppender.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/LazyInitRollingFileAppender.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.utilities.telemetry; import ch.qos.logback.core.rolling.RollingFileAppender; diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/Logging.java b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/Logging.java index f9c3ceaf..84b8526e 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/Logging.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/Logging.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.utilities.telemetry; import io.micrometer.tracing.Tracer; diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsServer.java b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsServer.java index 0cdb74af..7f945ecf 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsServer.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsServer.java @@ -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.utilities.telemetry; import com.sun.net.httpserver.HttpServer; diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsServerException.java b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsServerException.java index 2b61e948..e144edf1 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsServerException.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsServerException.java @@ -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.utilities.telemetry; /** diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsSupplier.java b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsSupplier.java index e5f1ef37..db52a432 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsSupplier.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/MetricsSupplier.java @@ -78,6 +78,7 @@ public MetricsSupplier(MeterRegistry registry, String namespace, Map getOrCreateGaugeDecimal(String name, final Map tagKeyValue) { final String label = name + tagKeyValue.toString(); var value = this.numberMap.computeIfAbsent(label, key -> { @@ -85,7 +86,7 @@ public AtomicReference getOrCreateGaugeDecimal(String name, final Ma Gauge.Builder> gaugeBuilder = Gauge.builder( withPrefix(name), guage, ref -> ref.get().doubleValue()) .description(descMap.get(name)); - if (tagKeyValue.size() > 0) { + if (!tagKeyValue.isEmpty()) { final List tags = toList(tagKeyValue); gaugeBuilder.tags(Tags.of(tags)); } @@ -112,7 +113,7 @@ public AtomicLong getOrCreateGauge(String name, final Map tagKey final AtomicLong guage = new AtomicLong(); Gauge.Builder gaugeBuilder = Gauge.builder(withPrefix(name), guage, AtomicLong::doubleValue) .description(descMap.get(name)); - if (tagKeyValue.size() > 0) { + if (!tagKeyValue.isEmpty()) { final List tags = toList(tagKeyValue); gaugeBuilder.tags(Tags.of(tags)); } @@ -141,7 +142,7 @@ public DistributionSummary getOrCreateHistogram( if (StringUtils.isNotEmpty(baseUnit)) { builder.baseUnit(baseUnit); } - if (tagKeyValue.size() > 0) { + if (!tagKeyValue.isEmpty()) { final List tags = toList(tagKeyValue); builder.tags(Tags.of(tags)); } @@ -161,7 +162,7 @@ public Counter getOrCreateCounter(String name, final Map tagKeyV final String label = name + tagKeyValue.toString(); return this.counterMap.computeIfAbsent(label, key -> { Counter.Builder counterBuilder = Counter.builder(withPrefix(name)).description(descMap.get(name)); - if (tagKeyValue.size() > 0) { + if (!tagKeyValue.isEmpty()) { final List tags = toList(tagKeyValue); counterBuilder.tags(Tags.of(tags)); } @@ -177,16 +178,16 @@ public Counter getOrCreateCounter(String name, final Map tagKeyV * @return the event meter. */ public EventMeter getOrCreateEventMeter(String name, final Map tagKeyValue) { - final String eventLabel = name + "_event"; + final String eventLabel = "%s_event".formatted(name); return this.eventMap.computeIfAbsent(eventLabel, label -> { - Counter.Builder counterBuilder = - Counter.builder(withPrefix(name + "_total")).description(String.format("Count of %s events", name)); + Counter.Builder counterBuilder = Counter.builder(withPrefix("%s_total".formatted(name))) + .description(String.format("Count of %s events", name)); final AtomicLong guage = new AtomicLong(); Gauge.Builder gaugeBuilder = Gauge.builder( withPrefix(String.format("last_%s_unix", name)), guage, AtomicLong::doubleValue) .description(String.format("Timestamp of last %s event", name)); - if (tagKeyValue.size() > 0) { + if (!tagKeyValue.isEmpty()) { final List tags = toList(tagKeyValue); counterBuilder.tags(Tags.of(tags)); gaugeBuilder.tags(Tags.of(tags)); diff --git a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/TracerTaskWrapper.java b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/TracerTaskWrapper.java index 5d7663be..3569c4bc 100644 --- a/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/TracerTaskWrapper.java +++ b/hildr-utilities/src/main/java/io/optimism/utilities/telemetry/TracerTaskWrapper.java @@ -1,19 +1,3 @@ -/* - * Copyright 2023 281165273grape@gmail.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.utilities.telemetry; import io.micrometer.tracing.Span; diff --git a/hildr-utilities/src/test/java/io/optimism/utilities/derive/stages/SpanBatchTest.java b/hildr-utilities/src/test/java/io/optimism/utilities/derive/stages/SpanBatchTest.java index 5b44db5b..1ab78f00 100644 --- a/hildr-utilities/src/test/java/io/optimism/utilities/derive/stages/SpanBatchTest.java +++ b/hildr-utilities/src/test/java/io/optimism/utilities/derive/stages/SpanBatchTest.java @@ -21,13 +21,18 @@ import org.web3j.utils.Numeric; /** - * Created by IntelliJ IDEA. - * Author: kaichen - * Date: 2024/1/24 - * Time: 17:51 + * The SpanBatchTest type. + * + * @author grapebaba + * @since 0.2.4 */ class SpanBatchTest { + /** + * Test span batch for batch interface. + * + * @throws IOException the io exception + */ @Test void testSpanBatchForBatchInterface() throws IOException { URL url = Resources.getResource("spanbatchfromsingular.txt"); @@ -53,6 +58,9 @@ void testSpanBatchForBatchInterface() throws IOException { Bytes.fromHexString(singularBatches1.getFirst().parentHash().substring(0, 40)))); } + /** + * Test empty span batch. + */ @Test void testEmptySpanBatch() { SpanBatchTxs txs = SpanBatchTxs.newSpanBatchTxs(new ArrayList<>(), BigInteger.valueOf(28)); @@ -80,6 +88,11 @@ void testEmptySpanBatch() { "block count cannot be zero"); } + /** + * Test span batch origin bits. + * + * @throws IOException the io exception + */ @Test void testSpanBatchOriginBits() throws IOException { URL url = Resources.getResource("spanbatchoriginbits.txt"); @@ -107,6 +120,11 @@ void testSpanBatchOriginBits() throws IOException { rawSpanBatch1.spanbatchPayload().originBits()); } + /** + * Test span batch prefix. + * + * @throws IOException the io exception + */ @Test void testSpanBatchPrefix() throws IOException { URL url = Resources.getResource("spanbatchoriginbits.txt"); @@ -125,6 +143,9 @@ void testSpanBatchPrefix() throws IOException { assertEquals(rawSpanBatch, rawSpanBatch1); } + /** + * Test span batch max origin bits length. + */ @Test void testSpanBatchRelTimestamp() throws IOException { URL url = Resources.getResource("spanbatchoriginbits.txt"); @@ -348,6 +369,11 @@ void testSpanBatchMaxOriginBitsLength() { () -> rawSpanBatch.spanbatchPayload().decodeOriginBits(Unpooled.wrappedBuffer(new byte[] {}))); } + /** + * Test span batch max block count. + * + * @throws IOException the io exception + */ @Test void testSpanBatchMaxBlockCount() throws IOException { URL url = Resources.getResource("spanbatchoriginbits.txt"); @@ -368,6 +394,11 @@ void testSpanBatchMaxBlockCount() throws IOException { "span batch size limit reached"); } + /** + * Test span batch max block tx count. + * + * @throws IOException the io exception + */ @Test void testSpanBatchMaxBlockTxCount() throws IOException { URL url = Resources.getResource("spanbatchoriginbits.txt"); @@ -393,6 +424,11 @@ void testSpanBatchMaxBlockTxCount() throws IOException { "span batch size limit reached"); } + /** + * Test span batch total block tx count not overflow. + * + * @throws IOException the io exception + */ @Test void testSpanBatchTotalBlockTxCountNotOverflow() throws IOException { URL url = Resources.getResource("spanbatchoriginbits.txt"); diff --git a/hildr-utilities/src/test/java/io/optimism/utilities/derive/stages/SpanBatchTxsTest.java b/hildr-utilities/src/test/java/io/optimism/utilities/derive/stages/SpanBatchTxsTest.java index 029732da..bbeb7b21 100644 --- a/hildr-utilities/src/test/java/io/optimism/utilities/derive/stages/SpanBatchTxsTest.java +++ b/hildr-utilities/src/test/java/io/optimism/utilities/derive/stages/SpanBatchTxsTest.java @@ -27,7 +27,16 @@ import org.junit.jupiter.api.Test; import org.web3j.utils.Numeric; +/** + * The type SpanBatchTxsTest. + * + * @author grapebaba + * @since 0.2.4 + */ public class SpanBatchTxsTest { + /** + * Decode and encode span batch bits. + */ @Test void decodeAndEncodeSpanBatchBits() { String test = @@ -38,6 +47,11 @@ void decodeAndEncodeSpanBatchBits() { assertArrayEquals(Numeric.hexStringToByteArray(test), res1); } + /** + * Decode and encode tx sigs. + * + * @throws IOException the io exception + */ @Test void decodeAndEncodeTxSigs() throws IOException { URL url = Resources.getResource("txsigs.txt"); @@ -50,6 +64,11 @@ void decodeAndEncodeTxSigs() throws IOException { assertArrayEquals(Numeric.hexStringToByteArray(test), res); } + /** + * Decode and encode tx nonces. + * + * @throws IOException the io exception + */ @Test void decodeAndEncodeTxNonces() throws IOException { URL url = Resources.getResource("txnonces.txt"); @@ -62,6 +81,11 @@ void decodeAndEncodeTxNonces() throws IOException { assertArrayEquals(Numeric.hexStringToByteArray(test), res); } + /** + * Decode and encode tx gases. + * + * @throws IOException the io exception + */ @Test void decodeAndEncodeTxGases() throws IOException { URL url = Resources.getResource("txgases.txt"); @@ -74,6 +98,11 @@ void decodeAndEncodeTxGases() throws IOException { assertArrayEquals(Numeric.hexStringToByteArray(test), res); } + /** + * Decode and encode tx tos. + * + * @throws IOException the io exception + */ @Test void decodeAndEncodeTxTos() throws IOException { URL url = Resources.getResource("txtos.txt"); @@ -89,6 +118,11 @@ void decodeAndEncodeTxTos() throws IOException { assertArrayEquals(Numeric.hexStringToByteArray(test), res); } + /** + * Decode and encode tx datas. + * + * @throws IOException the io exception + */ @Test void decodeAndEncodeTxDatas() throws IOException { URL url = Resources.getResource("txdatas.txt"); @@ -101,6 +135,11 @@ void decodeAndEncodeTxDatas() throws IOException { assertArrayEquals(Numeric.hexStringToByteArray(test), res); } + /** + * Decode and encode contract creation bits. + * + * @throws IOException the io exception + */ @Test void decodeAndEncodeContractCreationBits() throws IOException { URL url = Resources.getResource("contractcreationbits.txt"); @@ -114,6 +153,11 @@ void decodeAndEncodeContractCreationBits() throws IOException { assertArrayEquals(Numeric.hexStringToByteArray(test), res); } + /** + * Decode and encode y parity bits. + * + * @throws IOException the io exception + */ @Test void decodeAndEncodeYParityBits() throws IOException { URL url = Resources.getResource("yparitybits.txt"); @@ -126,6 +170,11 @@ void decodeAndEncodeYParityBits() throws IOException { assertArrayEquals(Numeric.hexStringToByteArray(test), res); } + /** + * Decode and encode protected bits. + * + * @throws IOException the io exception + */ @Test void decodeAndEncodeProtectedBits() throws IOException { URL url = Resources.getResource("protectedbits.txt"); @@ -138,6 +187,11 @@ void decodeAndEncodeProtectedBits() throws IOException { assertArrayEquals(Numeric.hexStringToByteArray(test), res); } + /** + * Decode and encode. + * + * @throws IOException the io exception + */ @Test void decodeAndEncode() throws IOException { URL url = Resources.getResource("spanbatchtxs.txt"); @@ -150,6 +204,11 @@ void decodeAndEncode() throws IOException { assertArrayEquals(Numeric.hexStringToByteArray(test), res); } + /** + * Recovery v unprotected. + * + * @throws IOException the io exception + */ @Test void recoveryVUnprotected() throws IOException { SpanBatchTxs txs = new SpanBatchTxs(); @@ -184,6 +243,11 @@ void recoveryVUnprotected() throws IOException { assertArrayEquals(vs, res); } + /** + * Recovery v legacy. + * + * @throws IOException the io exception + */ @Test void recoveryVLegacy() throws IOException { SpanBatchTxs txs = new SpanBatchTxs(); @@ -219,6 +283,11 @@ void recoveryVLegacy() throws IOException { assertArrayEquals(vs, res); } + /** + * Recovery v access list. + * + * @throws IOException the io exception + */ @Test void recoveryVAccessList() throws IOException { SpanBatchTxs txs = new SpanBatchTxs(); @@ -253,6 +322,11 @@ void recoveryVAccessList() throws IOException { assertArrayEquals(vs, res); } + /** + * Recovery ve 1559. + * + * @throws IOException the io exception + */ @Test void recoveryVE1559() throws IOException { SpanBatchTxs txs = new SpanBatchTxs(); @@ -287,6 +361,11 @@ void recoveryVE1559() throws IOException { assertArrayEquals(vs, res); } + /** + * Full tx unprotected. + * + * @throws IOException the io exception + */ @Test void fullTxUnprotected() throws IOException { URL url = Resources.getResource("fulltxunprotected.txt"); @@ -302,6 +381,11 @@ void fullTxUnprotected() throws IOException { assertEquals(txs, txs1); } + /** + * Full tx legacy. + * + * @throws IOException the io exception + */ @Test void fullTxLegacy() throws IOException { URL url = Resources.getResource("fulltxlegacy.txt"); @@ -317,6 +401,11 @@ void fullTxLegacy() throws IOException { assertEquals(txs, txs1); } + /** + * Full tx access list. + * + * @throws IOException the io exception + */ @Test void fullTxAccessList() throws IOException { URL url = Resources.getResource("fulltxacc.txt"); @@ -332,6 +421,11 @@ void fullTxAccessList() throws IOException { assertEquals(txs, txs1); } + /** + * Full tx dynamic. + * + * @throws IOException the io exception + */ @Test void fullTxDynamic() throws IOException { URL url = Resources.getResource("fulltxdyn.txt"); @@ -347,6 +441,9 @@ void fullTxDynamic() throws IOException { assertEquals(txs, txs1); } + /** + * Test span batch max tx data. + */ @Test void testSpanBatchMaxTxData() { Transaction.Builder builder = Transaction.builder(); diff --git a/hildr-utilities/src/test/java/io/optimism/utilities/telemetry/MetricsServerTest.java b/hildr-utilities/src/test/java/io/optimism/utilities/telemetry/MetricsServerTest.java index 7983fdb0..973c40c9 100644 --- a/hildr-utilities/src/test/java/io/optimism/utilities/telemetry/MetricsServerTest.java +++ b/hildr-utilities/src/test/java/io/optimism/utilities/telemetry/MetricsServerTest.java @@ -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.utilities.telemetry; import static org.junit.jupiter.api.Assertions.assertFalse;