Skip to content

Commit

Permalink
fix:cleancode
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Kai <281165273grape@gmail.com>
  • Loading branch information
GrapeBaBa committed Sep 11, 2024
1 parent 0c12598 commit 9982b5c
Show file tree
Hide file tree
Showing 68 changed files with 164 additions and 104 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/optimism/cli/Cli.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/optimism/derive/Pipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/optimism/derive/State.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/optimism/derive/stages/Attributes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/optimism/derive/stages/Batches.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/optimism/driver/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/io/optimism/driver/EngineDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/optimism/driver/ISequencer.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.optimism.driver;

import io.optimism.network.ExecutionPayloadEnvelop;
import io.optimism.types.ExecutionPayloadEnvelop;
import io.optimism.types.L2BlockRef;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/optimism/driver/Sequencer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/io/optimism/engine/Engine.java
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/io/optimism/engine/EngineApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/optimism/engine/OpEthForkChoiceUpdate.java
Original file line number Diff line number Diff line change
@@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/optimism/engine/OpEthPayloadStatus.java
Original file line number Diff line number Diff line change
@@ -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. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.optimism.l1;
package io.optimism.exceptions;

/**
* The type BlockIsPreLondonException.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.optimism.network;
package io.optimism.exceptions;

/**
* The type DecodingException.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.optimism.l1;
package io.optimism.exceptions;

/**
* The type DepositsNotFoundException.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.optimism.l1;
package io.optimism.exceptions;

/**
* The type InvalidSystemConfigUpdateException.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.optimism.telemetry;
package io.optimism.exceptions;

/**
* MetricsServerException class.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/optimism/l1/ChainWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/io/optimism/l1/InnerWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/io/optimism/network/AbstractTopicHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/optimism/network/BlockV1TopicHandler.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/optimism/network/BlockV2TopicHandler.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/optimism/network/BlockV3TopicHandler.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/optimism/network/OpStackNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/optimism/rpc/RpcServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/optimism/rpc/Web3jUtil.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/optimism/rpc/execution/JsonRpcExecutor.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading

0 comments on commit 9982b5c

Please sign in to comment.