diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d287fae6..05bbeee1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: add: '*.svg' - name: Upload JaCoCo coverage report - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: jacoco-report path: build/reports/jacoco/ diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 8bd8f134..f81b0105 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -32,7 +32,7 @@ jobs: echo "branch coverage = ${{ steps.jacoco.outputs.branches }}" - name: Upload JaCoCo coverage report - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: jacoco-report path: build/reports/jacoco/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c6a77011..0c3c2ec8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,7 +54,7 @@ jobs: ./gradlew buildJarForDocker - name: 📤 Upload ${{ matrix.os }} native image - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: hildr-jar path: | diff --git a/src/main/java/io/optimism/cli/Cli.java b/src/main/java/io/optimism/cli/Cli.java index 77039d7a..12adcbcb 100644 --- a/src/main/java/io/optimism/cli/Cli.java +++ b/src/main/java/io/optimism/cli/Cli.java @@ -7,8 +7,8 @@ import io.optimism.exceptions.HildrServiceExecutionException; import io.optimism.runner.Runner; import io.optimism.telemetry.InnerMetrics; -import io.optimism.telemetry.Logging; import io.optimism.telemetry.TracerTaskWrapper; +import io.optimism.types.enums.Logging; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; diff --git a/src/main/java/io/optimism/derive/Pipeline.java b/src/main/java/io/optimism/derive/Pipeline.java index a537be7e..5ead685a 100644 --- a/src/main/java/io/optimism/derive/Pipeline.java +++ b/src/main/java/io/optimism/derive/Pipeline.java @@ -6,7 +6,7 @@ import io.optimism.derive.stages.BatcherTransactions.BatcherTransactionMessage; import io.optimism.derive.stages.Batches; import io.optimism.derive.stages.Channels; -import io.optimism.engine.ExecutionPayload.PayloadAttributes; +import io.optimism.types.ExecutionPayload.PayloadAttributes; import java.math.BigInteger; import java.util.List; import java.util.concurrent.atomic.AtomicReference; diff --git a/src/main/java/io/optimism/derive/State.java b/src/main/java/io/optimism/derive/State.java index 74f8501d..b39c83b8 100644 --- a/src/main/java/io/optimism/derive/State.java +++ b/src/main/java/io/optimism/derive/State.java @@ -3,9 +3,9 @@ import io.optimism.config.Config; import io.optimism.driver.HeadInfo; import io.optimism.driver.L1AttributesDepositedTxNotFoundException; -import io.optimism.l1.L1Info; import io.optimism.types.BlockInfo; import io.optimism.types.Epoch; +import io.optimism.types.L1Info; import java.math.BigInteger; import java.util.Map.Entry; import java.util.TreeMap; diff --git a/src/main/java/io/optimism/derive/stages/Attributes.java b/src/main/java/io/optimism/derive/stages/Attributes.java index 9ec3a662..4e870e25 100644 --- a/src/main/java/io/optimism/derive/stages/Attributes.java +++ b/src/main/java/io/optimism/derive/stages/Attributes.java @@ -5,13 +5,13 @@ import io.optimism.derive.ForkUpgradeTransactions; import io.optimism.derive.PurgeableIterator; import io.optimism.derive.State; -import io.optimism.engine.ExecutionPayload.PayloadAttributes; import io.optimism.exceptions.BlockNotIncludedException; import io.optimism.exceptions.L1InfoNotFoundException; -import io.optimism.l1.L1Info; import io.optimism.types.Batch; import io.optimism.types.BlockInfo; import io.optimism.types.Epoch; +import io.optimism.types.ExecutionPayload.PayloadAttributes; +import io.optimism.types.L1Info; import io.optimism.types.SingularBatch; import io.optimism.utilities.gas.GasCalculator; import java.math.BigInteger; diff --git a/src/main/java/io/optimism/derive/stages/Batches.java b/src/main/java/io/optimism/derive/stages/Batches.java index 6a80e6d0..253e7858 100644 --- a/src/main/java/io/optimism/derive/stages/Batches.java +++ b/src/main/java/io/optimism/derive/stages/Batches.java @@ -6,11 +6,11 @@ import io.optimism.derive.State; import io.optimism.derive.stages.Channels.Channel; import io.optimism.exceptions.DecompressException; -import io.optimism.l1.L1Info; import io.optimism.types.Batch; import io.optimism.types.BlockInfo; import io.optimism.types.Epoch; import io.optimism.types.IBatch; +import io.optimism.types.L1Info; import io.optimism.types.SingularBatch; import io.optimism.types.SpanBatch; import io.optimism.types.SpanBatchElement; diff --git a/src/main/java/io/optimism/driver/Driver.java b/src/main/java/io/optimism/driver/Driver.java index f4b4d233..b787236a 100644 --- a/src/main/java/io/optimism/driver/Driver.java +++ b/src/main/java/io/optimism/driver/Driver.java @@ -11,10 +11,7 @@ import io.optimism.derive.Pipeline; import io.optimism.engine.Engine; import io.optimism.engine.EngineApi; -import io.optimism.engine.ExecutionPayload; -import io.optimism.engine.ExecutionPayload.PayloadAttributes; import io.optimism.exceptions.HildrServiceExecutionException; -import io.optimism.l1.BlockUpdate; import io.optimism.l1.ChainWatcher; import io.optimism.network.OpStackNetwork; import io.optimism.rpc.RpcMethod; @@ -25,8 +22,11 @@ import io.optimism.telemetry.TracerTaskWrapper; import io.optimism.types.BlockId; import io.optimism.types.BlockInfo; +import io.optimism.types.BlockUpdate; import io.optimism.types.DepositTransaction; import io.optimism.types.Epoch; +import io.optimism.types.ExecutionPayload; +import io.optimism.types.ExecutionPayload.PayloadAttributes; import io.optimism.types.Genesis; import io.optimism.types.L1BlockInfo; import io.optimism.types.L2BlockRef; diff --git a/src/main/java/io/optimism/driver/EngineDriver.java b/src/main/java/io/optimism/driver/EngineDriver.java index 0af0117f..f1adb522 100644 --- a/src/main/java/io/optimism/driver/EngineDriver.java +++ b/src/main/java/io/optimism/driver/EngineDriver.java @@ -3,19 +3,19 @@ import io.optimism.config.Config; import io.optimism.engine.Engine; import io.optimism.engine.EngineApi; -import io.optimism.engine.ExecutionPayload; -import io.optimism.engine.ExecutionPayload.PayloadAttributes; -import io.optimism.engine.ExecutionPayload.PayloadStatus; -import io.optimism.engine.ExecutionPayload.Status; -import io.optimism.engine.ForkChoiceUpdate; -import io.optimism.engine.ForkChoiceUpdate.ForkchoiceState; import io.optimism.engine.OpEthExecutionPayload; import io.optimism.engine.OpEthForkChoiceUpdate; import io.optimism.engine.OpEthPayloadStatus; -import io.optimism.network.ExecutionPayloadEnvelop; import io.optimism.telemetry.TracerTaskWrapper; import io.optimism.types.BlockInfo; import io.optimism.types.Epoch; +import io.optimism.types.ExecutionPayload; +import io.optimism.types.ExecutionPayload.PayloadAttributes; +import io.optimism.types.ExecutionPayload.PayloadStatus; +import io.optimism.types.ExecutionPayload.Status; +import io.optimism.types.ExecutionPayloadEnvelop; +import io.optimism.types.ForkChoiceUpdate; +import io.optimism.types.ForkChoiceUpdate.ForkchoiceState; import io.optimism.types.L2BlockRef; import io.optimism.types.PayloadInfo; import io.optimism.types.enums.BlockInsertion; diff --git a/src/main/java/io/optimism/driver/ISequencer.java b/src/main/java/io/optimism/driver/ISequencer.java index 05ce0b3d..95f17020 100644 --- a/src/main/java/io/optimism/driver/ISequencer.java +++ b/src/main/java/io/optimism/driver/ISequencer.java @@ -1,6 +1,6 @@ package io.optimism.driver; -import io.optimism.network.ExecutionPayloadEnvelop; +import io.optimism.types.ExecutionPayloadEnvelop; import io.optimism.types.L2BlockRef; /** diff --git a/src/main/java/io/optimism/driver/Sequencer.java b/src/main/java/io/optimism/driver/Sequencer.java index 32d6ce0b..cb3e2dfc 100644 --- a/src/main/java/io/optimism/driver/Sequencer.java +++ b/src/main/java/io/optimism/driver/Sequencer.java @@ -5,7 +5,7 @@ import io.optimism.exceptions.ResetException; import io.optimism.exceptions.SequencerException; import io.optimism.exceptions.TemporaryException; -import io.optimism.network.ExecutionPayloadEnvelop; +import io.optimism.types.ExecutionPayloadEnvelop; import io.optimism.types.L2BlockRef; import io.optimism.types.enums.BlockInsertion; import java.time.Duration; diff --git a/src/main/java/io/optimism/engine/Engine.java b/src/main/java/io/optimism/engine/Engine.java index a50068f0..9a67e09e 100644 --- a/src/main/java/io/optimism/engine/Engine.java +++ b/src/main/java/io/optimism/engine/Engine.java @@ -1,7 +1,8 @@ package io.optimism.engine; -import io.optimism.engine.ExecutionPayload.PayloadAttributes; -import io.optimism.engine.ForkChoiceUpdate.ForkchoiceState; +import io.optimism.types.ExecutionPayload; +import io.optimism.types.ExecutionPayload.PayloadAttributes; +import io.optimism.types.ForkChoiceUpdate.ForkchoiceState; import java.io.IOException; import java.math.BigInteger; diff --git a/src/main/java/io/optimism/engine/EngineApi.java b/src/main/java/io/optimism/engine/EngineApi.java index 941ab304..659b6ec4 100644 --- a/src/main/java/io/optimism/engine/EngineApi.java +++ b/src/main/java/io/optimism/engine/EngineApi.java @@ -4,9 +4,10 @@ import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.security.Keys; import io.optimism.config.Config; -import io.optimism.engine.ExecutionPayload.PayloadAttributes; -import io.optimism.engine.ForkChoiceUpdate.ForkchoiceState; import io.optimism.rpc.Web3jProvider; +import io.optimism.types.ExecutionPayload; +import io.optimism.types.ExecutionPayload.PayloadAttributes; +import io.optimism.types.ForkChoiceUpdate.ForkchoiceState; import java.io.IOException; import java.math.BigInteger; import java.security.Key; diff --git a/src/main/java/io/optimism/engine/OpEthExecutionPayload.java b/src/main/java/io/optimism/engine/OpEthExecutionPayload.java index 51863f83..c789f27b 100644 --- a/src/main/java/io/optimism/engine/OpEthExecutionPayload.java +++ b/src/main/java/io/optimism/engine/OpEthExecutionPayload.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import io.optimism.types.ExecutionPayload; import java.io.IOException; import java.util.Objects; import org.web3j.protocol.ObjectMapperFactory; diff --git a/src/main/java/io/optimism/engine/OpEthForkChoiceUpdate.java b/src/main/java/io/optimism/engine/OpEthForkChoiceUpdate.java index 21ffc347..6377d3b5 100644 --- a/src/main/java/io/optimism/engine/OpEthForkChoiceUpdate.java +++ b/src/main/java/io/optimism/engine/OpEthForkChoiceUpdate.java @@ -1,6 +1,7 @@ package io.optimism.engine; -import io.optimism.engine.ForkChoiceUpdate.ForkChoiceUpdateRes; +import io.optimism.types.ForkChoiceUpdate; +import io.optimism.types.ForkChoiceUpdate.ForkChoiceUpdateRes; import org.web3j.protocol.core.Response; /** The type Op eth fork choice update. */ diff --git a/src/main/java/io/optimism/engine/OpEthPayloadStatus.java b/src/main/java/io/optimism/engine/OpEthPayloadStatus.java index 2e0ab5ce..1548299f 100644 --- a/src/main/java/io/optimism/engine/OpEthPayloadStatus.java +++ b/src/main/java/io/optimism/engine/OpEthPayloadStatus.java @@ -1,6 +1,6 @@ package io.optimism.engine; -import io.optimism.engine.ExecutionPayload.PayloadStatus; +import io.optimism.types.ExecutionPayload.PayloadStatus; import org.web3j.protocol.core.Response; /** The type OpEthPayloadStatus. */ diff --git a/src/main/java/io/optimism/l1/BlockIsPreLondonException.java b/src/main/java/io/optimism/exceptions/BlockIsPreLondonException.java similarity index 90% rename from src/main/java/io/optimism/l1/BlockIsPreLondonException.java rename to src/main/java/io/optimism/exceptions/BlockIsPreLondonException.java index e8a26b46..6e8a449e 100644 --- a/src/main/java/io/optimism/l1/BlockIsPreLondonException.java +++ b/src/main/java/io/optimism/exceptions/BlockIsPreLondonException.java @@ -1,4 +1,4 @@ -package io.optimism.l1; +package io.optimism.exceptions; /** * The type BlockIsPreLondonException. diff --git a/src/main/java/io/optimism/network/DecodingException.java b/src/main/java/io/optimism/exceptions/DecodingException.java similarity index 94% rename from src/main/java/io/optimism/network/DecodingException.java rename to src/main/java/io/optimism/exceptions/DecodingException.java index f7d718ff..ad0a3035 100644 --- a/src/main/java/io/optimism/network/DecodingException.java +++ b/src/main/java/io/optimism/exceptions/DecodingException.java @@ -1,4 +1,4 @@ -package io.optimism.network; +package io.optimism.exceptions; /** * The type DecodingException. diff --git a/src/main/java/io/optimism/l1/DepositsNotFoundException.java b/src/main/java/io/optimism/exceptions/DepositsNotFoundException.java similarity index 94% rename from src/main/java/io/optimism/l1/DepositsNotFoundException.java rename to src/main/java/io/optimism/exceptions/DepositsNotFoundException.java index 8fad12e5..26b8fee8 100644 --- a/src/main/java/io/optimism/l1/DepositsNotFoundException.java +++ b/src/main/java/io/optimism/exceptions/DepositsNotFoundException.java @@ -1,4 +1,4 @@ -package io.optimism.l1; +package io.optimism.exceptions; /** * The type DepositsNotFoundException. diff --git a/src/main/java/io/optimism/l1/InvalidSystemConfigUpdateException.java b/src/main/java/io/optimism/exceptions/InvalidSystemConfigUpdateException.java similarity index 91% rename from src/main/java/io/optimism/l1/InvalidSystemConfigUpdateException.java rename to src/main/java/io/optimism/exceptions/InvalidSystemConfigUpdateException.java index 6cb3d50d..4c531007 100644 --- a/src/main/java/io/optimism/l1/InvalidSystemConfigUpdateException.java +++ b/src/main/java/io/optimism/exceptions/InvalidSystemConfigUpdateException.java @@ -1,4 +1,4 @@ -package io.optimism.l1; +package io.optimism.exceptions; /** * The type InvalidSystemConfigUpdateException. diff --git a/src/main/java/io/optimism/telemetry/MetricsServerException.java b/src/main/java/io/optimism/exceptions/MetricsServerException.java similarity index 95% rename from src/main/java/io/optimism/telemetry/MetricsServerException.java rename to src/main/java/io/optimism/exceptions/MetricsServerException.java index ac67d2c1..feea4816 100644 --- a/src/main/java/io/optimism/telemetry/MetricsServerException.java +++ b/src/main/java/io/optimism/exceptions/MetricsServerException.java @@ -1,4 +1,4 @@ -package io.optimism.telemetry; +package io.optimism.exceptions; /** * MetricsServerException class. diff --git a/src/main/java/io/optimism/rpc/execution/Web3jCallException.java b/src/main/java/io/optimism/exceptions/Web3jCallException.java similarity index 95% rename from src/main/java/io/optimism/rpc/execution/Web3jCallException.java rename to src/main/java/io/optimism/exceptions/Web3jCallException.java index e052a6f4..d4463c14 100644 --- a/src/main/java/io/optimism/rpc/execution/Web3jCallException.java +++ b/src/main/java/io/optimism/exceptions/Web3jCallException.java @@ -1,4 +1,4 @@ -package io.optimism.rpc.execution; +package io.optimism.exceptions; /** * Web3jCallException class. Throws it when the call of web3j request task failed. diff --git a/src/main/java/io/optimism/l1/ChainWatcher.java b/src/main/java/io/optimism/l1/ChainWatcher.java index ebdc0049..dfd896fb 100644 --- a/src/main/java/io/optimism/l1/ChainWatcher.java +++ b/src/main/java/io/optimism/l1/ChainWatcher.java @@ -2,6 +2,7 @@ import io.optimism.config.Config; import io.optimism.types.BlockInfo; +import io.optimism.types.BlockUpdate; import java.math.BigInteger; import org.jctools.queues.MessagePassingQueue; import org.jctools.queues.MpscGrowableArrayQueue; diff --git a/src/main/java/io/optimism/l1/InnerWatcher.java b/src/main/java/io/optimism/l1/InnerWatcher.java index ebc87887..8a4e4d09 100644 --- a/src/main/java/io/optimism/l1/InnerWatcher.java +++ b/src/main/java/io/optimism/l1/InnerWatcher.java @@ -9,14 +9,18 @@ import io.optimism.derive.stages.Attributes.UserDeposited; import io.optimism.driver.L1AttributesDepositedTxNotFoundException; import io.optimism.exceptions.BlockNotIncludedException; +import io.optimism.exceptions.DepositsNotFoundException; import io.optimism.exceptions.HildrServiceExecutionException; -import io.optimism.l1.BlockUpdate.FinalityUpdate; import io.optimism.rpc.Web3jProvider; -import io.optimism.telemetry.Logging; import io.optimism.telemetry.TracerTaskWrapper; import io.optimism.types.BeaconSignedBlockHeader; import io.optimism.types.BlobSidecar; import io.optimism.types.BlockInfo; +import io.optimism.types.BlockUpdate; +import io.optimism.types.BlockUpdate.FinalityUpdate; +import io.optimism.types.L1Info; +import io.optimism.types.SystemConfigUpdate; +import io.optimism.types.enums.Logging; import io.optimism.utilities.blob.BlobCodec; import io.reactivex.disposables.Disposable; import java.math.BigInteger; diff --git a/src/main/java/io/optimism/network/AbstractTopicHandler.java b/src/main/java/io/optimism/network/AbstractTopicHandler.java index 141dc1ab..8f5eff12 100644 --- a/src/main/java/io/optimism/network/AbstractTopicHandler.java +++ b/src/main/java/io/optimism/network/AbstractTopicHandler.java @@ -6,7 +6,11 @@ import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import io.libp2p.core.pubsub.ValidationResult; -import io.optimism.engine.ExecutionPayload; +import io.optimism.exceptions.DecodingException; +import io.optimism.types.ExecutionPayload; +import io.optimism.types.ExecutionPayloadEnvelop; +import io.optimism.types.ExecutionPayloadSSZ; +import io.optimism.types.enums.BlockVersion; import java.math.BigInteger; import java.security.SignatureException; import java.time.Instant; diff --git a/src/main/java/io/optimism/network/BlockV1TopicHandler.java b/src/main/java/io/optimism/network/BlockV1TopicHandler.java index 593b976c..8b05d237 100644 --- a/src/main/java/io/optimism/network/BlockV1TopicHandler.java +++ b/src/main/java/io/optimism/network/BlockV1TopicHandler.java @@ -1,6 +1,7 @@ package io.optimism.network; -import io.optimism.engine.ExecutionPayload; +import io.optimism.types.ExecutionPayload; +import io.optimism.types.enums.BlockVersion; import org.apache.tuweni.units.bigints.UInt64; import org.jctools.queues.MessagePassingQueue; import tech.pegasys.teku.infrastructure.async.AsyncRunner; diff --git a/src/main/java/io/optimism/network/BlockV2TopicHandler.java b/src/main/java/io/optimism/network/BlockV2TopicHandler.java index 30693409..88ed79c8 100644 --- a/src/main/java/io/optimism/network/BlockV2TopicHandler.java +++ b/src/main/java/io/optimism/network/BlockV2TopicHandler.java @@ -1,6 +1,7 @@ package io.optimism.network; -import io.optimism.engine.ExecutionPayload; +import io.optimism.types.ExecutionPayload; +import io.optimism.types.enums.BlockVersion; import org.apache.tuweni.units.bigints.UInt64; import org.jctools.queues.MessagePassingQueue; import tech.pegasys.teku.infrastructure.async.AsyncRunner; diff --git a/src/main/java/io/optimism/network/BlockV3TopicHandler.java b/src/main/java/io/optimism/network/BlockV3TopicHandler.java index d4ef7031..5ce2a650 100644 --- a/src/main/java/io/optimism/network/BlockV3TopicHandler.java +++ b/src/main/java/io/optimism/network/BlockV3TopicHandler.java @@ -1,6 +1,7 @@ package io.optimism.network; -import io.optimism.engine.ExecutionPayload; +import io.optimism.types.ExecutionPayload; +import io.optimism.types.enums.BlockVersion; import org.apache.tuweni.units.bigints.UInt64; import org.jctools.queues.MessagePassingQueue; import tech.pegasys.teku.infrastructure.async.AsyncRunner; diff --git a/src/main/java/io/optimism/network/OpStackNetwork.java b/src/main/java/io/optimism/network/OpStackNetwork.java index 3b878e94..823be119 100644 --- a/src/main/java/io/optimism/network/OpStackNetwork.java +++ b/src/main/java/io/optimism/network/OpStackNetwork.java @@ -2,7 +2,8 @@ import com.google.common.collect.ImmutableSet; import io.optimism.config.Config; -import io.optimism.engine.ExecutionPayload; +import io.optimism.types.ExecutionPayload; +import io.optimism.types.enums.HildrNodeMetricsCategory; import java.util.ArrayList; import java.util.Collections; import java.util.EnumSet; diff --git a/src/main/java/io/optimism/rpc/RpcServer.java b/src/main/java/io/optimism/rpc/RpcServer.java index 58e43d78..5b70e8d8 100644 --- a/src/main/java/io/optimism/rpc/RpcServer.java +++ b/src/main/java/io/optimism/rpc/RpcServer.java @@ -11,7 +11,7 @@ import io.optimism.rpc.methods.JsonRpcMethod; import io.optimism.rpc.methods.JsonRpcMethodAdapter; import io.optimism.rpc.methods.JsonRpcMethodsFactory; -import io.optimism.telemetry.Logging; +import io.optimism.types.enums.Logging; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.VertxOptions; diff --git a/src/main/java/io/optimism/rpc/Web3jUtil.java b/src/main/java/io/optimism/rpc/Web3jUtil.java index 58cbf5f4..cc6548ed 100644 --- a/src/main/java/io/optimism/rpc/Web3jUtil.java +++ b/src/main/java/io/optimism/rpc/Web3jUtil.java @@ -1,6 +1,6 @@ package io.optimism.rpc; -import io.optimism.rpc.execution.Web3jCallException; +import io.optimism.exceptions.Web3jCallException; import io.optimism.telemetry.TracerTaskWrapper; import java.math.BigInteger; import java.util.List; diff --git a/src/main/java/io/optimism/rpc/execution/BaseJsonRpcProcessor.java b/src/main/java/io/optimism/rpc/execution/BaseJsonRpcProcessor.java index 331ece0f..70e0ccdd 100644 --- a/src/main/java/io/optimism/rpc/execution/BaseJsonRpcProcessor.java +++ b/src/main/java/io/optimism/rpc/execution/BaseJsonRpcProcessor.java @@ -1,10 +1,10 @@ package io.optimism.rpc.execution; import io.optimism.rpc.internal.JsonRpcRequestContext; -import io.optimism.rpc.internal.response.JsonRpcError; import io.optimism.rpc.internal.response.JsonRpcErrorResponse; import io.optimism.rpc.internal.response.JsonRpcResponse; import io.optimism.rpc.methods.JsonRpcMethod; +import io.optimism.types.enums.JsonRpcError; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import org.slf4j.Logger; diff --git a/src/main/java/io/optimism/rpc/execution/JsonRpcExecutor.java b/src/main/java/io/optimism/rpc/execution/JsonRpcExecutor.java index 1f1ad681..550d5a71 100644 --- a/src/main/java/io/optimism/rpc/execution/JsonRpcExecutor.java +++ b/src/main/java/io/optimism/rpc/execution/JsonRpcExecutor.java @@ -1,16 +1,16 @@ package io.optimism.rpc.execution; -import static io.optimism.rpc.internal.response.JsonRpcError.INVALID_REQUEST; +import static io.optimism.types.enums.JsonRpcError.INVALID_REQUEST; import io.optimism.rpc.RpcMethod; import io.optimism.rpc.internal.JsonRpcRequest; import io.optimism.rpc.internal.JsonRpcRequestContext; import io.optimism.rpc.internal.JsonRpcRequestId; -import io.optimism.rpc.internal.response.JsonRpcError; import io.optimism.rpc.internal.response.JsonRpcErrorResponse; import io.optimism.rpc.internal.response.JsonRpcNoResponse; import io.optimism.rpc.internal.response.JsonRpcResponse; import io.optimism.rpc.methods.JsonRpcMethod; +import io.optimism.types.enums.JsonRpcError; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import java.util.Map; diff --git a/src/main/java/io/optimism/rpc/execution/LoggedJsonRpcProcessor.java b/src/main/java/io/optimism/rpc/execution/LoggedJsonRpcProcessor.java index dbad41e7..ba576127 100644 --- a/src/main/java/io/optimism/rpc/execution/LoggedJsonRpcProcessor.java +++ b/src/main/java/io/optimism/rpc/execution/LoggedJsonRpcProcessor.java @@ -3,8 +3,8 @@ import io.optimism.rpc.internal.JsonRpcRequestContext; import io.optimism.rpc.internal.response.JsonRpcErrorResponse; import io.optimism.rpc.internal.response.JsonRpcResponse; -import io.optimism.rpc.internal.response.JsonRpcResponseType; import io.optimism.rpc.methods.JsonRpcMethod; +import io.optimism.types.enums.JsonRpcResponseType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/io/optimism/rpc/handler/JsonRpcExecutorHandler.java b/src/main/java/io/optimism/rpc/handler/JsonRpcExecutorHandler.java index 5dad13dc..24bf2565 100644 --- a/src/main/java/io/optimism/rpc/handler/JsonRpcExecutorHandler.java +++ b/src/main/java/io/optimism/rpc/handler/JsonRpcExecutorHandler.java @@ -8,11 +8,11 @@ import io.optimism.rpc.execution.JsonRpcProcessor; import io.optimism.rpc.internal.JsonRpcRequest; import io.optimism.rpc.internal.JsonRpcRequestContext; -import io.optimism.rpc.internal.response.JsonRpcError; import io.optimism.rpc.internal.response.JsonRpcErrorResponse; import io.optimism.rpc.internal.response.JsonRpcResponse; -import io.optimism.rpc.internal.response.JsonRpcResponseType; import io.optimism.rpc.methods.JsonRpcMethod; +import io.optimism.types.enums.JsonRpcError; +import io.optimism.types.enums.JsonRpcResponseType; import io.vertx.core.Handler; import io.vertx.core.http.HttpServerResponse; import io.vertx.core.json.Json; diff --git a/src/main/java/io/optimism/rpc/handler/JsonRpcParseHandler.java b/src/main/java/io/optimism/rpc/handler/JsonRpcParseHandler.java index ae97a6b2..33507fc9 100644 --- a/src/main/java/io/optimism/rpc/handler/JsonRpcParseHandler.java +++ b/src/main/java/io/optimism/rpc/handler/JsonRpcParseHandler.java @@ -1,8 +1,8 @@ package io.optimism.rpc.handler; import io.netty.handler.codec.http.HttpResponseStatus; -import io.optimism.rpc.internal.response.JsonRpcError; import io.optimism.rpc.internal.response.JsonRpcErrorResponse; +import io.optimism.types.enums.JsonRpcError; import io.vertx.core.Handler; import io.vertx.core.http.HttpServerResponse; import io.vertx.core.json.DecodeException; diff --git a/src/main/java/io/optimism/rpc/internal/response/JsonRpcErrorResponse.java b/src/main/java/io/optimism/rpc/internal/response/JsonRpcErrorResponse.java index 7f0affa1..48ce01e8 100644 --- a/src/main/java/io/optimism/rpc/internal/response/JsonRpcErrorResponse.java +++ b/src/main/java/io/optimism/rpc/internal/response/JsonRpcErrorResponse.java @@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.google.common.base.MoreObjects; +import io.optimism.types.enums.JsonRpcError; +import io.optimism.types.enums.JsonRpcResponseType; import java.util.Objects; /** The type Json rpc error response. */ diff --git a/src/main/java/io/optimism/rpc/internal/response/JsonRpcNoResponse.java b/src/main/java/io/optimism/rpc/internal/response/JsonRpcNoResponse.java index 1f88b2a6..ad14518c 100644 --- a/src/main/java/io/optimism/rpc/internal/response/JsonRpcNoResponse.java +++ b/src/main/java/io/optimism/rpc/internal/response/JsonRpcNoResponse.java @@ -1,5 +1,7 @@ package io.optimism.rpc.internal.response; +import io.optimism.types.enums.JsonRpcResponseType; + /** The type Json rpc no response. */ public class JsonRpcNoResponse implements JsonRpcResponse { diff --git a/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponse.java b/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponse.java index 1eb55a64..3a0b3c36 100644 --- a/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponse.java +++ b/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponse.java @@ -1,6 +1,7 @@ package io.optimism.rpc.internal.response; import com.fasterxml.jackson.annotation.JsonGetter; +import io.optimism.types.enums.JsonRpcResponseType; /** The interface Json rpc response. */ public interface JsonRpcResponse { diff --git a/src/main/java/io/optimism/rpc/internal/response/JsonRpcSuccessResponse.java b/src/main/java/io/optimism/rpc/internal/response/JsonRpcSuccessResponse.java index a9f38b7d..5766078c 100644 --- a/src/main/java/io/optimism/rpc/internal/response/JsonRpcSuccessResponse.java +++ b/src/main/java/io/optimism/rpc/internal/response/JsonRpcSuccessResponse.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonGetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.optimism.types.enums.JsonRpcResponseType; import java.util.Objects; /** diff --git a/src/main/java/io/optimism/runner/Runner.java b/src/main/java/io/optimism/runner/Runner.java index 8eb48d45..f5404a7f 100644 --- a/src/main/java/io/optimism/runner/Runner.java +++ b/src/main/java/io/optimism/runner/Runner.java @@ -8,9 +8,6 @@ import io.optimism.driver.ForkchoiceUpdateException; import io.optimism.driver.InvalidExecutionPayloadException; import io.optimism.engine.EngineApi; -import io.optimism.engine.ExecutionPayload; -import io.optimism.engine.ExecutionPayload.Status; -import io.optimism.engine.ForkChoiceUpdate.ForkchoiceState; import io.optimism.engine.OpEthForkChoiceUpdate; import io.optimism.engine.OpEthPayloadStatus; import io.optimism.exceptions.BlockNotIncludedException; @@ -21,6 +18,9 @@ import io.optimism.rpc.Web3jProvider; import io.optimism.rpc.response.OpEthBlock; import io.optimism.telemetry.TracerTaskWrapper; +import io.optimism.types.ExecutionPayload; +import io.optimism.types.ExecutionPayload.Status; +import io.optimism.types.ForkChoiceUpdate.ForkchoiceState; import java.math.BigInteger; import java.time.Duration; import java.util.Arrays; @@ -52,20 +52,20 @@ public class Runner extends AbstractExecutionThreadService { private static final String TRUSTED_PEER_ENODE = "enode://e85ba0beec172b17f53b373b0ab72238754259aa39f1ae5290e3244e0120882f4cf95acd203661a27" + "c8618b27ca014d4e193266cb3feae43655ed55358eedb06@3.86.143.120:30303?discport=21693"; - private Config config; + private final Config config; private SyncMode syncMode; private String checkpointHash; - private EngineApi engineApi; + private final EngineApi engineApi; private Driver driver; private boolean isShutdownTriggered = false; - private CountDownLatch latch = new CountDownLatch(1); + private final CountDownLatch latch = new CountDownLatch(1); - private Executor executor; + private final Executor executor; /** * Instantiates a new Runner. @@ -184,16 +184,11 @@ public void checkpointSync() throws ExecutionException, InterruptedException { OpEthBlock checkpointBlock = null; if (StringUtils.isNotEmpty(this.checkpointHash)) { Tuple2 isEpochBoundary = isEpochBoundary(this.checkpointHash, checkpointSyncUrl); - if (isEpochBoundary.component1()) { - checkpointBlock = isEpochBoundary.component2(); - if (checkpointBlock == null) { - LOGGER.error("could not get checkpoint block"); - throw new BlockNotIncludedException("could not get checkpoint block"); - } - } else { + if (!isEpochBoundary.component1() || isEpochBoundary.component2() == null) { LOGGER.error("could not get checkpoint block"); throw new BlockNotIncludedException("could not get checkpoint block"); } + checkpointBlock = isEpochBoundary.component2(); } else { LOGGER.info("finding the latest epoch boundary to use as checkpoint"); BigInteger blockNumber = getEthBlockNumber(checkpointSyncUrl); diff --git a/src/main/java/io/optimism/telemetry/EventMeter.java b/src/main/java/io/optimism/telemetry/EventMeter.java index b8d3ee3f..a59fbc2e 100644 --- a/src/main/java/io/optimism/telemetry/EventMeter.java +++ b/src/main/java/io/optimism/telemetry/EventMeter.java @@ -12,9 +12,9 @@ */ public class EventMeter { - private Counter total; + private final Counter total; - private AtomicLong lastTime; + private final AtomicLong lastTime; /** * The EventMeter constructor. diff --git a/src/main/java/io/optimism/telemetry/MetricsServer.java b/src/main/java/io/optimism/telemetry/MetricsServer.java index f7c33862..fc34945b 100644 --- a/src/main/java/io/optimism/telemetry/MetricsServer.java +++ b/src/main/java/io/optimism/telemetry/MetricsServer.java @@ -4,6 +4,7 @@ import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.prometheus.PrometheusConfig; import io.micrometer.prometheus.PrometheusMeterRegistry; +import io.optimism.exceptions.MetricsServerException; import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; diff --git a/src/main/java/io/optimism/telemetry/MetricsSupplier.java b/src/main/java/io/optimism/telemetry/MetricsSupplier.java index c12d7625..cd06fdeb 100644 --- a/src/main/java/io/optimism/telemetry/MetricsSupplier.java +++ b/src/main/java/io/optimism/telemetry/MetricsSupplier.java @@ -6,6 +6,7 @@ import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.Tags; +import io.optimism.exceptions.MetricsServerException; import java.math.BigDecimal; import java.util.Arrays; import java.util.HashMap; diff --git a/src/main/java/io/optimism/telemetry/TracerTaskWrapper.java b/src/main/java/io/optimism/telemetry/TracerTaskWrapper.java index 3bd42697..8abb7ed1 100644 --- a/src/main/java/io/optimism/telemetry/TracerTaskWrapper.java +++ b/src/main/java/io/optimism/telemetry/TracerTaskWrapper.java @@ -13,8 +13,6 @@ */ public class TracerTaskWrapper { - private static String DEFAULT_TRACER_NAME = "structure-task-scope"; - private static Function tracerSupplier; /** @@ -39,6 +37,7 @@ public static void setTracerSupplier(Function supplier) { * @return the callable */ public static Callable wrap(Callable call) { + String DEFAULT_TRACER_NAME = "structure-task-scope"; return TracerTaskWrapper.wrap(DEFAULT_TRACER_NAME, call); } diff --git a/src/main/java/io/optimism/types/BlockInfo.java b/src/main/java/io/optimism/types/BlockInfo.java index aebaf241..f92c345a 100644 --- a/src/main/java/io/optimism/types/BlockInfo.java +++ b/src/main/java/io/optimism/types/BlockInfo.java @@ -1,6 +1,5 @@ package io.optimism.types; -import io.optimism.engine.ExecutionPayload; import io.optimism.exceptions.BlockNotIncludedException; import java.math.BigInteger; import java.util.Objects; diff --git a/src/main/java/io/optimism/l1/BlockUpdate.java b/src/main/java/io/optimism/types/BlockUpdate.java similarity index 98% rename from src/main/java/io/optimism/l1/BlockUpdate.java rename to src/main/java/io/optimism/types/BlockUpdate.java index ae996132..20ae3e18 100644 --- a/src/main/java/io/optimism/l1/BlockUpdate.java +++ b/src/main/java/io/optimism/types/BlockUpdate.java @@ -1,4 +1,4 @@ -package io.optimism.l1; +package io.optimism.types; import java.math.BigInteger; diff --git a/src/main/java/io/optimism/engine/ExecutionPayload.java b/src/main/java/io/optimism/types/ExecutionPayload.java similarity index 98% rename from src/main/java/io/optimism/engine/ExecutionPayload.java rename to src/main/java/io/optimism/types/ExecutionPayload.java index 00f61c19..62adcd39 100644 --- a/src/main/java/io/optimism/engine/ExecutionPayload.java +++ b/src/main/java/io/optimism/types/ExecutionPayload.java @@ -1,13 +1,7 @@ -package io.optimism.engine; +package io.optimism.types; import io.optimism.config.Config; -import io.optimism.network.ExecutionPayloadSSZ; import io.optimism.rpc.response.OpEthBlock; -import io.optimism.types.BlockInfo; -import io.optimism.types.DepositTransaction; -import io.optimism.types.Epoch; -import io.optimism.types.L1BlockInfo; -import io.optimism.types.L2BlockRef; import io.optimism.types.enums.TxType; import io.optimism.utilities.encoding.TxDecoder; import io.optimism.utilities.encoding.TxEncoder; diff --git a/src/main/java/io/optimism/network/ExecutionPayloadEnvelop.java b/src/main/java/io/optimism/types/ExecutionPayloadEnvelop.java similarity index 94% rename from src/main/java/io/optimism/network/ExecutionPayloadEnvelop.java rename to src/main/java/io/optimism/types/ExecutionPayloadEnvelop.java index a2263ea8..af851283 100644 --- a/src/main/java/io/optimism/network/ExecutionPayloadEnvelop.java +++ b/src/main/java/io/optimism/types/ExecutionPayloadEnvelop.java @@ -1,6 +1,6 @@ -package io.optimism.network; +package io.optimism.types; -import io.optimism.engine.ExecutionPayload; +import io.optimism.types.enums.BlockVersion; import org.apache.tuweni.bytes.Bytes; /** diff --git a/src/main/java/io/optimism/network/ExecutionPayloadSSZ.java b/src/main/java/io/optimism/types/ExecutionPayloadSSZ.java similarity index 99% rename from src/main/java/io/optimism/network/ExecutionPayloadSSZ.java rename to src/main/java/io/optimism/types/ExecutionPayloadSSZ.java index d612b2ff..2063669e 100644 --- a/src/main/java/io/optimism/network/ExecutionPayloadSSZ.java +++ b/src/main/java/io/optimism/types/ExecutionPayloadSSZ.java @@ -1,5 +1,6 @@ -package io.optimism.network; +package io.optimism.types; +import io.optimism.types.enums.BlockVersion; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/io/optimism/engine/ForkChoiceUpdate.java b/src/main/java/io/optimism/types/ForkChoiceUpdate.java similarity index 96% rename from src/main/java/io/optimism/engine/ForkChoiceUpdate.java rename to src/main/java/io/optimism/types/ForkChoiceUpdate.java index 7f68bb80..f273a04f 100644 --- a/src/main/java/io/optimism/engine/ForkChoiceUpdate.java +++ b/src/main/java/io/optimism/types/ForkChoiceUpdate.java @@ -1,6 +1,6 @@ -package io.optimism.engine; +package io.optimism.types; -import io.optimism.engine.ExecutionPayload.PayloadStatus; +import io.optimism.types.ExecutionPayload.PayloadStatus; import java.math.BigInteger; import org.web3j.utils.Numeric; diff --git a/src/main/java/io/optimism/l1/L1Info.java b/src/main/java/io/optimism/types/L1Info.java similarity index 98% rename from src/main/java/io/optimism/l1/L1Info.java rename to src/main/java/io/optimism/types/L1Info.java index 79069a38..1c5f4aa7 100644 --- a/src/main/java/io/optimism/l1/L1Info.java +++ b/src/main/java/io/optimism/types/L1Info.java @@ -1,10 +1,11 @@ -package io.optimism.l1; +package io.optimism.types; import static org.web3j.protocol.core.methods.response.EthBlock.Block; import static org.web3j.protocol.core.methods.response.EthBlock.TransactionObject; import io.optimism.config.Config.SystemConfig; import io.optimism.derive.stages.Attributes.UserDeposited; +import io.optimism.exceptions.BlockIsPreLondonException; import io.optimism.exceptions.BlockNotIncludedException; import java.math.BigInteger; import java.util.List; diff --git a/src/main/java/io/optimism/l1/SystemConfigUpdate.java b/src/main/java/io/optimism/types/SystemConfigUpdate.java similarity index 98% rename from src/main/java/io/optimism/l1/SystemConfigUpdate.java rename to src/main/java/io/optimism/types/SystemConfigUpdate.java index 34d97aa5..0f266032 100644 --- a/src/main/java/io/optimism/l1/SystemConfigUpdate.java +++ b/src/main/java/io/optimism/types/SystemConfigUpdate.java @@ -1,5 +1,6 @@ -package io.optimism.l1; +package io.optimism.types; +import io.optimism.exceptions.InvalidSystemConfigUpdateException; import java.math.BigInteger; import java.util.Arrays; import org.web3j.protocol.core.methods.response.EthLog; diff --git a/src/main/java/io/optimism/network/BlockVersion.java b/src/main/java/io/optimism/types/enums/BlockVersion.java similarity index 81% rename from src/main/java/io/optimism/network/BlockVersion.java rename to src/main/java/io/optimism/types/enums/BlockVersion.java index d9f30f56..b02a6dc7 100644 --- a/src/main/java/io/optimism/network/BlockVersion.java +++ b/src/main/java/io/optimism/types/enums/BlockVersion.java @@ -1,4 +1,4 @@ -package io.optimism.network; +package io.optimism.types.enums; /** * The type BlockVersion. @@ -31,7 +31,7 @@ public enum BlockVersion { * * @return the boolean */ - boolean hasWithdrawals() { + public boolean hasWithdrawals() { return this == V2 || this == V3; } @@ -40,7 +40,7 @@ boolean hasWithdrawals() { * * @return the boolean */ - boolean hasBlobProperties() { + public boolean hasBlobProperties() { return this == V3; } @@ -49,7 +49,7 @@ boolean hasBlobProperties() { * * @return the boolean */ - boolean hasParentBeaconBlockRoot() { + public boolean hasParentBeaconBlockRoot() { return this == V3; } @@ -58,7 +58,7 @@ boolean hasParentBeaconBlockRoot() { * * @return the version */ - int getVersion() { + public int getVersion() { return version; } } diff --git a/src/main/java/io/optimism/network/HildrNodeMetricsCategory.java b/src/main/java/io/optimism/types/enums/HildrNodeMetricsCategory.java similarity index 95% rename from src/main/java/io/optimism/network/HildrNodeMetricsCategory.java rename to src/main/java/io/optimism/types/enums/HildrNodeMetricsCategory.java index f68fbcfa..7138fc64 100644 --- a/src/main/java/io/optimism/network/HildrNodeMetricsCategory.java +++ b/src/main/java/io/optimism/types/enums/HildrNodeMetricsCategory.java @@ -1,4 +1,4 @@ -package io.optimism.network; +package io.optimism.types.enums; import java.util.Optional; import org.hyperledger.besu.plugin.services.metrics.MetricCategory; diff --git a/src/main/java/io/optimism/rpc/internal/response/JsonRpcError.java b/src/main/java/io/optimism/types/enums/JsonRpcError.java similarity index 98% rename from src/main/java/io/optimism/rpc/internal/response/JsonRpcError.java rename to src/main/java/io/optimism/types/enums/JsonRpcError.java index d1a9a27a..fa060a20 100644 --- a/src/main/java/io/optimism/rpc/internal/response/JsonRpcError.java +++ b/src/main/java/io/optimism/types/enums/JsonRpcError.java @@ -1,4 +1,4 @@ -package io.optimism.rpc.internal.response; +package io.optimism.types.enums; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonFormat; diff --git a/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponseType.java b/src/main/java/io/optimism/types/enums/JsonRpcResponseType.java similarity index 88% rename from src/main/java/io/optimism/rpc/internal/response/JsonRpcResponseType.java rename to src/main/java/io/optimism/types/enums/JsonRpcResponseType.java index af309981..415f821d 100644 --- a/src/main/java/io/optimism/rpc/internal/response/JsonRpcResponseType.java +++ b/src/main/java/io/optimism/types/enums/JsonRpcResponseType.java @@ -1,4 +1,4 @@ -package io.optimism.rpc.internal.response; +package io.optimism.types.enums; /** Various types of responses that the JSON-RPC component may produce. */ public enum JsonRpcResponseType { diff --git a/src/main/java/io/optimism/telemetry/Logging.java b/src/main/java/io/optimism/types/enums/Logging.java similarity index 98% rename from src/main/java/io/optimism/telemetry/Logging.java rename to src/main/java/io/optimism/types/enums/Logging.java index 0c87e1f3..02286af9 100644 --- a/src/main/java/io/optimism/telemetry/Logging.java +++ b/src/main/java/io/optimism/types/enums/Logging.java @@ -1,4 +1,4 @@ -package io.optimism.telemetry; +package io.optimism.types.enums; import io.micrometer.tracing.Tracer; import io.micrometer.tracing.otel.bridge.OtelBaggageManager; diff --git a/src/main/java/io/optimism/utilities/spanbatch/RLPEncodingHelpers.java b/src/main/java/io/optimism/utilities/spanbatch/RLPEncodingHelpers.java index c675ab78..054c8c4d 100644 --- a/src/main/java/io/optimism/utilities/spanbatch/RLPEncodingHelpers.java +++ b/src/main/java/io/optimism/utilities/spanbatch/RLPEncodingHelpers.java @@ -10,19 +10,42 @@ public class RLPEncodingHelpers { private RLPEncodingHelpers() {} + /** + * Is single rlp byte boolean. + * + * @param value the value + * @return the boolean + */ public static boolean isSingleRLPByte(final Bytes value) { return value.size() == 1 && value.get(0) >= 0; } + /** + * Is short element boolean. + * + * @param value the value + * @return the boolean + */ public static boolean isShortElement(final Bytes value) { return value.size() <= 55; } + /** + * Is short list boolean. + * + * @param payloadSize the payload size + * @return the boolean + */ public static boolean isShortList(final int payloadSize) { return payloadSize <= 55; } - /** The encoded size of the provided value. */ + /** + * The encoded size of the provided value. @param value the value + * + * @param value the value + * @return the int + */ public static int elementSize(final Bytes value) { if (isSingleRLPByte(value)) return 1; @@ -31,7 +54,12 @@ public static int elementSize(final Bytes value) { return 1 + sizeLength(value.size()) + value.size(); } - /** The encoded size of a list given the encoded size of its payload. */ + /** + * The encoded size of a list given the encoded size of its payload. @param payloadSize the payload size + * + * @param payloadSize the payload size + * @return the int + */ public static int listSize(final int payloadSize) { int size = 1 + payloadSize; if (!isShortList(payloadSize)) size += sizeLength(payloadSize); @@ -41,6 +69,11 @@ public static int listSize(final int payloadSize) { /** * Writes the result of encoding the provided value to the provided destination (which must be big * enough). + * + * @param value the value + * @param dest the dest + * @param destOffset the dest offset + * @return the int */ public static int writeElement(final Bytes value, final MutableBytes dest, final int destOffset) { final int size = value.size(); @@ -63,6 +96,11 @@ public static int writeElement(final Bytes value, final MutableBytes dest, final /** * Writes the encoded header of a list provided its encoded payload size to the provided * destination (which must be big enough). + * + * @param payloadSize the payload size + * @param dest the dest + * @param destOffset the dest offset + * @return the int */ public static int writeListHeader(final int payloadSize, final MutableBytes dest, final int destOffset) { if (isShortList(payloadSize)) { diff --git a/src/test/java/io/optimism/engine/EngineApiTest.java b/src/test/java/io/optimism/engine/EngineApiTest.java index 9359202f..d3e0e086 100644 --- a/src/test/java/io/optimism/engine/EngineApiTest.java +++ b/src/test/java/io/optimism/engine/EngineApiTest.java @@ -10,13 +10,13 @@ import io.jsonwebtoken.Jwts; import io.jsonwebtoken.security.Keys; import io.optimism.TestConstants; -import io.optimism.engine.ExecutionPayload.ExecutionPayloadRes; -import io.optimism.engine.ExecutionPayload.PayloadAttributes; -import io.optimism.engine.ExecutionPayload.PayloadStatus; -import io.optimism.engine.ExecutionPayload.Status; -import io.optimism.engine.ForkChoiceUpdate.ForkChoiceUpdateRes; -import io.optimism.engine.ForkChoiceUpdate.ForkchoiceState; import io.optimism.types.Epoch; +import io.optimism.types.ExecutionPayload.ExecutionPayloadRes; +import io.optimism.types.ExecutionPayload.PayloadAttributes; +import io.optimism.types.ExecutionPayload.PayloadStatus; +import io.optimism.types.ExecutionPayload.Status; +import io.optimism.types.ForkChoiceUpdate.ForkChoiceUpdateRes; +import io.optimism.types.ForkChoiceUpdate.ForkchoiceState; import java.io.IOException; import java.math.BigInteger; import java.security.Key; diff --git a/src/test/java/io/optimism/l1/InnerWatcherTest.java b/src/test/java/io/optimism/l1/InnerWatcherTest.java index d18dde53..7f9d012c 100644 --- a/src/test/java/io/optimism/l1/InnerWatcherTest.java +++ b/src/test/java/io/optimism/l1/InnerWatcherTest.java @@ -4,8 +4,9 @@ import io.optimism.TestConstants; import io.optimism.config.Config; -import io.optimism.telemetry.Logging; import io.optimism.telemetry.TracerTaskWrapper; +import io.optimism.types.BlockUpdate; +import io.optimism.types.enums.Logging; import java.math.BigInteger; import org.jctools.queues.MessagePassingQueue; import org.jctools.queues.MpscGrowableArrayQueue; diff --git a/src/test/java/io/optimism/network/AbstractTopicHandlerTest.java b/src/test/java/io/optimism/network/AbstractTopicHandlerTest.java index 6bef0502..f4bbdc5d 100644 --- a/src/test/java/io/optimism/network/AbstractTopicHandlerTest.java +++ b/src/test/java/io/optimism/network/AbstractTopicHandlerTest.java @@ -4,7 +4,9 @@ import com.google.common.collect.ImmutableSet; import io.libp2p.core.pubsub.ValidationResult; -import io.optimism.engine.ExecutionPayload; +import io.optimism.types.ExecutionPayload; +import io.optimism.types.enums.BlockVersion; +import io.optimism.types.enums.HildrNodeMetricsCategory; import java.util.EnumSet; import java.util.concurrent.ExecutionException; import org.apache.tuweni.bytes.Bytes; diff --git a/src/test/java/io/optimism/network/ExecutionPayloadEnvelopTest.java b/src/test/java/io/optimism/network/ExecutionPayloadEnvelopTest.java index 1509e836..5c8b8e9d 100644 --- a/src/test/java/io/optimism/network/ExecutionPayloadEnvelopTest.java +++ b/src/test/java/io/optimism/network/ExecutionPayloadEnvelopTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; +import io.optimism.types.ExecutionPayloadEnvelop; import java.math.BigInteger; import org.apache.tuweni.bytes.Bytes; import org.junit.jupiter.api.Test; diff --git a/src/test/java/io/optimism/network/ExecutionPayloadSSZTest.java b/src/test/java/io/optimism/network/ExecutionPayloadSSZTest.java index 1b96fe1b..660561d5 100644 --- a/src/test/java/io/optimism/network/ExecutionPayloadSSZTest.java +++ b/src/test/java/io/optimism/network/ExecutionPayloadSSZTest.java @@ -1,5 +1,7 @@ package io.optimism.network; +import io.optimism.types.ExecutionPayloadSSZ; +import io.optimism.types.enums.BlockVersion; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.units.bigints.UInt256; import org.junit.jupiter.api.Assertions; diff --git a/src/test/java/io/optimism/network/OpStackNetworkTest.java b/src/test/java/io/optimism/network/OpStackNetworkTest.java index 2d905fa6..1f025935 100644 --- a/src/test/java/io/optimism/network/OpStackNetworkTest.java +++ b/src/test/java/io/optimism/network/OpStackNetworkTest.java @@ -3,7 +3,7 @@ import static java.lang.Thread.sleep; import io.optimism.config.Config; -import io.optimism.engine.ExecutionPayload; +import io.optimism.types.ExecutionPayload; import org.jctools.queues.MpscUnboundedXaddArrayQueue; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/src/test/java/io/optimism/rpc/RpcServerTest.java b/src/test/java/io/optimism/rpc/RpcServerTest.java index c47a6b29..d44ebe2f 100644 --- a/src/test/java/io/optimism/rpc/RpcServerTest.java +++ b/src/test/java/io/optimism/rpc/RpcServerTest.java @@ -10,8 +10,8 @@ import io.optimism.rpc.internal.JsonRpcRequest; import io.optimism.rpc.internal.JsonRpcRequestId; import io.optimism.rpc.internal.result.OutputRootResult; -import io.optimism.telemetry.Logging; import io.optimism.telemetry.TracerTaskWrapper; +import io.optimism.types.enums.Logging; import java.io.IOException; import java.time.Duration; import java.util.HashMap; diff --git a/src/test/java/io/optimism/telemetry/LoggingExampleTest.java b/src/test/java/io/optimism/telemetry/LoggingExampleTest.java index 98e807d9..7a458d81 100644 --- a/src/test/java/io/optimism/telemetry/LoggingExampleTest.java +++ b/src/test/java/io/optimism/telemetry/LoggingExampleTest.java @@ -2,6 +2,7 @@ import io.micrometer.tracing.Span; import io.micrometer.tracing.Tracer; +import io.optimism.types.enums.Logging; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory;