Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Florentine <[email protected]>
  • Loading branch information
jflo committed Nov 8, 2023
1 parent b04ffed commit 8d13680
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1097,23 +1097,23 @@ public static class Builder {
private BlobsWithCommitments blobsWithCommitments;

public Builder copiedFrom(final Transaction toCopy) {
this.transactionType = toCopy.transactionType;
this.nonce = toCopy.nonce;
this.gasPrice = toCopy.gasPrice.orElse(null);
this.maxPriorityFeePerGas = toCopy.maxPriorityFeePerGas.orElse(null);
this.maxFeePerGas = toCopy.maxFeePerGas.orElse(null);
this.maxFeePerBlobGas = toCopy.maxFeePerBlobGas.orElse(null);
this.gasLimit = toCopy.gasLimit;
this.to = toCopy.to;
this.value = toCopy.value;
this.signature = toCopy.signature;
this.payload = toCopy.payload;
this.accessList = toCopy.maybeAccessList;
this.sender = toCopy.sender;
this.chainId = toCopy.chainId;
this.versionedHashes = toCopy.versionedHashes.orElse(null);
this.blobsWithCommitments = toCopy.blobsWithCommitments.orElse(null);
return this;
this.transactionType = toCopy.transactionType;
this.nonce = toCopy.nonce;
this.gasPrice = toCopy.gasPrice.orElse(null);
this.maxPriorityFeePerGas = toCopy.maxPriorityFeePerGas.orElse(null);
this.maxFeePerGas = toCopy.maxFeePerGas.orElse(null);
this.maxFeePerBlobGas = toCopy.maxFeePerBlobGas.orElse(null);
this.gasLimit = toCopy.gasLimit;
this.to = toCopy.to;
this.value = toCopy.value;
this.signature = toCopy.signature;
this.payload = toCopy.payload;
this.accessList = toCopy.maybeAccessList;
this.sender = toCopy.sender;
this.chainId = toCopy.chainId;
this.versionedHashes = toCopy.versionedHashes.orElse(null);
this.blobsWithCommitments = toCopy.blobsWithCommitments.orElse(null);
return this;
}

public Builder type(final TransactionType transactionType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ public Transaction createTransaction(final KeyPair keys) {
builder.maxFeePerGas(maxFeePerGas.orElse(Wei.of(5000)));
builder.accessList(accessListEntries.orElse(List.of()));
builder.maxFeePerBlobGas(maxFeePerBlobGas.orElse(Wei.ONE));
if(blobs.isPresent()) {
builder.kzgBlobs(blobs.get().getKzgCommitments(), blobs.get().getBlobs(), blobs.get().getKzgProofs());
} else if(versionedHashes.isPresent()){
if (blobs.isPresent()) {
builder.kzgBlobs(
blobs.get().getKzgCommitments(), blobs.get().getBlobs(), blobs.get().getKzgProofs());
} else if (versionedHashes.isPresent()) {
builder.versionedHashes(versionedHashes.get());
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;

import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.DelegatingBytes;
import org.apache.tuweni.bytes.MutableBytes;
import org.hyperledger.besu.crypto.KeyPair;
import org.hyperledger.besu.crypto.SignatureAlgorithm;
import org.hyperledger.besu.crypto.SignatureAlgorithmFactory;
import org.hyperledger.besu.datatypes.AccessListEntry;
import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;

import java.math.BigInteger;
import java.util.List;
Expand All @@ -38,8 +36,6 @@
import java.util.stream.Stream;

import com.google.common.base.Suppliers;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
import org.junit.jupiter.api.Test;

public class TransactionBuilderTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ private ValidationResult<TransactionInvalidReason> addTransaction(
// from cache.
if (transaction.getType().supportsBlob() && transaction.getBlobsWithCommitments().isEmpty()) {
final Optional<Transaction> maybeCachedBlob = pendingTransactions.restoreBlob(transaction);
if(maybeCachedBlob.isPresent()) {
if (maybeCachedBlob.isPresent()) {
toAdd = maybeCachedBlob.get();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import static org.hyperledger.besu.ethereum.eth.transactions.layered.TransactionsLayer.RemovalReason.REPLACED;

import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Blob;
import org.hyperledger.besu.datatypes.BlobsWithCommitments;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.core.BlockHeader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,9 @@ public synchronized String logStats() {
public Optional<Transaction> restoreBlob(final Transaction transaction) {
Transaction.Builder txBuilder = Transaction.builder();
txBuilder.copiedFrom(transaction);
final BlobsWithCommitments bwc = prioritizedTransactions.getBlobCache().getIfPresent(transaction.getHash());
if(bwc != null) {
final BlobsWithCommitments bwc =
prioritizedTransactions.getBlobCache().getIfPresent(transaction.getHash());
if (bwc != null) {
txBuilder.blobsWithCommitments(bwc);
return Optional.of(txBuilder.build());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ public Optional<Transaction> restoreBlob(final Transaction transaction) {
Transaction.Builder txBuilder = Transaction.builder();
txBuilder.copiedFrom(transaction);
final BlobsWithCommitments bwc = blobCache.getIfPresent(transaction.getHash());
if(bwc != null) {
if (bwc != null) {
txBuilder.blobsWithCommitments(bwc);
return Optional.of(txBuilder.build());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
import static java.util.Comparator.comparing;

import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.eth.transactions.PendingTransaction;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.plugin.services.MetricsSystem;

import java.time.Clock;
import java.util.Iterator;
import java.util.NavigableSet;
import java.util.Optional;
import java.util.TreeSet;
import java.util.function.Supplier;

Expand Down Expand Up @@ -59,7 +57,6 @@ public void reset() {
prioritizedTransactions.clear();
}


@Override
public void manageBlockAdded(final BlockHeader blockHeader) {
// nothing to do
Expand All @@ -84,5 +81,4 @@ protected void removePrioritizedTransaction(final PendingTransaction removedPend
protected PendingTransaction getLeastPriorityTransaction() {
return prioritizedTransactions.last();
}

}

0 comments on commit 8d13680

Please sign in to comment.