fix spotless

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
pull/7871/head
Gabriel-Trintinalia 3 weeks ago
parent 910b88ce8f
commit ea6494ccf4
  1. 1
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/privacy/TestSigningPrivateMarkerTransactionFactory.java
  2. 2
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/TxParseSubCommand.java
  3. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugGetRawTransaction.java
  4. 12
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockResultFactory.java
  5. 3
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/EngineGetPayloadBodiesResultV1.java
  6. 5
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionPendingResult.java
  7. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/util/DomainObjectDecodeUtils.java
  8. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionByHashTest.java
  9. 3
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3Test.java
  10. 3
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/util/DomainObjectDecodeUtilsTest.java
  11. 2
      ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/vm/TraceTransactionIntegrationTest.java
  12. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java
  13. 18
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/MainnetTransactionDecoder.java
  14. 13
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/MainnetTransactionEncoder.java
  15. 51
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/PooledMainnetTransactionDecoder.java
  16. 9
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/PooledMainnetTransactionEncoder.java
  17. 14
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/SignatureEncoder.java
  18. 3
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/RlpDecoder.java
  19. 1
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/RlpEncoder.java
  20. 36
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/RlpPooledTransactionProvider.java
  21. 22
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/RlpRegistry.java
  22. 35
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/RlpTransactionProvider.java
  23. 17
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/TransactionDecoder.java
  24. 20
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/TransactionEncoder.java
  25. 6
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BodyValidation.java
  26. 1
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/markertransaction/SigningPrivateMarkerTransactionFactory.java
  27. 12
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/BlobTransactionEncodingTest.java
  28. 23
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/TransactionRLPDecoderTest.java
  29. 18
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/TransactionRLPEncoderTest.java
  30. 6
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/markertransaction/FixedKeySigningPrivateMarkerTransactionFactoryTest.java
  31. 6
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/markertransaction/RandomSigningPrivateMarkerTransactionFactoryTest.java
  32. 1
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthServer.java
  33. 10
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/PooledTransactionsMessage.java
  34. 8
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java
  35. 10
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredPendingTransactions.java
  36. 5
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/AbstractPendingTransactionsSorter.java
  37. 27
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/PendingTransactionEstimatedMemorySizeTest.java
  38. 3
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/T8nExecutor.java

@ -25,7 +25,6 @@ import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.datatypes.TransactionType; import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import org.hyperledger.besu.plugin.data.PrivateTransaction; import org.hyperledger.besu.plugin.data.PrivateTransaction;
import org.hyperledger.besu.plugin.data.UnsignedPrivateMarkerTransaction; import org.hyperledger.besu.plugin.data.UnsignedPrivateMarkerTransaction;
import org.hyperledger.besu.plugin.services.privacy.PrivateMarkerTransactionFactory; import org.hyperledger.besu.plugin.services.privacy.PrivateMarkerTransactionFactory;

@ -19,6 +19,7 @@ import static org.hyperledger.besu.cli.subcommands.TxParseSubCommand.COMMAND_NAM
import org.hyperledger.besu.cli.util.VersionProvider; import org.hyperledger.besu.cli.util.VersionProvider;
import org.hyperledger.besu.crypto.SignatureAlgorithmFactory; import org.hyperledger.besu.crypto.SignatureAlgorithmFactory;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@ -29,7 +30,6 @@ import java.nio.file.Paths;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import picocli.CommandLine; import picocli.CommandLine;
/** /**

@ -24,7 +24,6 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSucces
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
public class DebugGetRawTransaction implements JsonRpcMethod { public class DebugGetRawTransaction implements JsonRpcMethod {

@ -95,8 +95,7 @@ public class BlockResultFactory {
public EngineGetPayloadResultV1 payloadTransactionCompleteV1(final Block block) { public EngineGetPayloadResultV1 payloadTransactionCompleteV1(final Block block) {
final List<String> txs = final List<String> txs =
block.getBody().getTransactions().stream() block.getBody().getTransactions().stream()
.map( .map(RlpTransactionProvider::encodeOpaqueBytes)
RlpTransactionProvider::encodeOpaqueBytes)
.map(Bytes::toHexString) .map(Bytes::toHexString)
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -107,8 +106,7 @@ public class BlockResultFactory {
final var blockWithReceipts = payload.blockWithReceipts(); final var blockWithReceipts = payload.blockWithReceipts();
final List<String> txs = final List<String> txs =
blockWithReceipts.getBlock().getBody().getTransactions().stream() blockWithReceipts.getBlock().getBody().getTransactions().stream()
.map( .map(RlpTransactionProvider::encodeOpaqueBytes)
RlpTransactionProvider::encodeOpaqueBytes)
.map(Bytes::toHexString) .map(Bytes::toHexString)
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -132,8 +130,7 @@ public class BlockResultFactory {
final var blockWithReceipts = payload.blockWithReceipts(); final var blockWithReceipts = payload.blockWithReceipts();
final List<String> txs = final List<String> txs =
blockWithReceipts.getBlock().getBody().getTransactions().stream() blockWithReceipts.getBlock().getBody().getTransactions().stream()
.map( .map(RlpTransactionProvider::encodeOpaqueBytes)
RlpTransactionProvider::encodeOpaqueBytes)
.map(Bytes::toHexString) .map(Bytes::toHexString)
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -151,8 +148,7 @@ public class BlockResultFactory {
final var blockWithReceipts = payload.blockWithReceipts(); final var blockWithReceipts = payload.blockWithReceipts();
final List<String> txs = final List<String> txs =
blockWithReceipts.getBlock().getBody().getTransactions().stream() blockWithReceipts.getBlock().getBody().getTransactions().stream()
.map( .map(RlpTransactionProvider::encodeOpaqueBytes)
RlpTransactionProvider::encodeOpaqueBytes)
.map(Bytes::toHexString) .map(Bytes::toHexString)
.collect(Collectors.toList()); .collect(Collectors.toList());
final Optional<List<String>> requestsWithoutRequestId = final Optional<List<String>> requestsWithoutRequestId =

@ -52,8 +52,7 @@ public class EngineGetPayloadBodiesResultV1 {
public PayloadBody(final BlockBody blockBody) { public PayloadBody(final BlockBody blockBody) {
this.transactions = this.transactions =
blockBody.getTransactions().stream() blockBody.getTransactions().stream()
.map( .map(RlpTransactionProvider::encodeOpaqueBytes)
RlpTransactionProvider::encodeOpaqueBytes)
.map(Bytes::toHexString) .map(Bytes::toHexString)
.collect(Collectors.toList()); .collect(Collectors.toList());
this.withdrawals = this.withdrawals =

@ -22,7 +22,6 @@ import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider; import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.annotation.JsonGetter; import com.fasterxml.jackson.annotation.JsonGetter;
@ -102,9 +101,7 @@ public class TransactionPendingResult implements TransactionResult {
this.input = transaction.getPayload().toString(); this.input = transaction.getPayload().toString();
this.nonce = Quantity.create(transaction.getNonce()); this.nonce = Quantity.create(transaction.getNonce());
this.publicKey = transaction.getPublicKey().orElse(null); this.publicKey = transaction.getPublicKey().orElse(null);
this.raw = this.raw = RlpPooledTransactionProvider.encodeOpaqueBytes(transaction).toString();
RlpPooledTransactionProvider.encodeOpaqueBytes(transaction)
.toString();
this.to = transaction.getTo().map(Address::toHexString).orElse(null); this.to = transaction.getTo().map(Address::toHexString).orElse(null);
if (transactionType == TransactionType.FRONTIER) { if (transactionType == TransactionType.FRONTIER) {
this.type = Quantity.create(0); this.type = Quantity.create(0);

@ -28,7 +28,7 @@ public class DomainObjectDecodeUtils {
throws InvalidJsonRpcRequestException { throws InvalidJsonRpcRequestException {
try { try {
Bytes txnBytes = Bytes.fromHexString(rawTransaction); Bytes txnBytes = Bytes.fromHexString(rawTransaction);
return RlpPooledTransactionProvider.decodeOpaqueBytes(txnBytes); return RlpPooledTransactionProvider.decodeOpaqueBytes(txnBytes);
} catch (final IllegalArgumentException e) { } catch (final IllegalArgumentException e) {
throw new InvalidJsonRpcRequestException( throw new InvalidJsonRpcRequestException(
"Invalid raw transaction hex", RpcErrorType.INVALID_TRANSACTION_PARAMS, e); "Invalid raw transaction hex", RpcErrorType.INVALID_TRANSACTION_PARAMS, e);

@ -109,8 +109,7 @@ class EthGetTransactionByHashTest {
@Test @Test
void shouldReturnPendingTransactionWhenTransactionExistsAndIsPending() { void shouldReturnPendingTransactionWhenTransactionExistsAndIsPending() {
final org.hyperledger.besu.ethereum.core.Transaction transaction = final org.hyperledger.besu.ethereum.core.Transaction transaction =
RlpTransactionProvider.readFrom( RlpTransactionProvider.readFrom(Bytes.fromHexString(VALID_TRANSACTION));
Bytes.fromHexString(VALID_TRANSACTION));
when(transactionPool.getTransactionByHash(transaction.getHash())) when(transactionPool.getTransactionByHash(transaction.getHash()))
.thenReturn(Optional.of(transaction)); .thenReturn(Optional.of(transaction));
@ -132,8 +131,7 @@ class EthGetTransactionByHashTest {
@Test @Test
void shouldReturnCompleteTransactionWhenTransactionExistsInBlockchain() { void shouldReturnCompleteTransactionWhenTransactionExistsInBlockchain() {
final org.hyperledger.besu.ethereum.core.Transaction transaction = final org.hyperledger.besu.ethereum.core.Transaction transaction =
RlpTransactionProvider.readFrom( RlpTransactionProvider.readFrom(Bytes.fromHexString(VALID_TRANSACTION));
Bytes.fromHexString(VALID_TRANSACTION));
final TransactionWithMetadata transactionWithMetadata = final TransactionWithMetadata transactionWithMetadata =
new TransactionWithMetadata(transaction, 1, Optional.empty(), Hash.ZERO, 0); new TransactionWithMetadata(transaction, 1, Optional.empty(), Hash.ZERO, 0);

@ -225,8 +225,7 @@ public class EngineNewPayloadV3Test extends EngineNewPayloadV2Test {
public void shouldRejectTransactionsWithFullBlobs() { public void shouldRejectTransactionsWithFullBlobs() {
Bytes transactionWithBlobsBytes = Bytes transactionWithBlobsBytes =
RlpPooledTransactionProvider.encodeOpaqueBytes( RlpPooledTransactionProvider.encodeOpaqueBytes(createTransactionWithBlobs());
createTransactionWithBlobs());
List<String> transactions = List.of(transactionWithBlobsBytes.toString()); List<String> transactions = List.of(transactionWithBlobsBytes.toString());

@ -66,8 +66,7 @@ public class DomainObjectDecodeUtilsTest {
@Test @Test
public void testAccessList2718OpaqueSerDes() { public void testAccessList2718OpaqueSerDes() {
final Bytes encoded = final Bytes encoded = RlpPooledTransactionProvider.encodeOpaqueBytes(accessListTxn);
RlpPooledTransactionProvider.encodeOpaqueBytes(accessListTxn);
Transaction decoded = DomainObjectDecodeUtils.decodeRawTransaction(encoded.toString()); Transaction decoded = DomainObjectDecodeUtils.decodeRawTransaction(encoded.toString());
Assertions.assertThat(decoded.getAccessList().isPresent()).isTrue(); Assertions.assertThat(decoded.getAccessList().isPresent()).isTrue();
Assertions.assertThat(decoded.getAccessList().map(List::size).get()).isEqualTo(1); Assertions.assertThat(decoded.getAccessList().map(List::size).get()).isEqualTo(1);

@ -171,7 +171,7 @@ public class TraceTransactionIntegrationTest {
final DebugOperationTracer tracer = final DebugOperationTracer tracer =
new DebugOperationTracer(new TraceOptions(true, true, true), false); new DebugOperationTracer(new TraceOptions(true, true, true), false);
final Transaction transaction = final Transaction transaction =
RlpTransactionProvider.readFrom( RlpTransactionProvider.readFrom(
new BytesValueRLPInput(Bytes.fromHexString(CONTRACT_CREATION_TX), false)); new BytesValueRLPInput(Bytes.fromHexString(CONTRACT_CREATION_TX), false));
final BlockHeader genesisBlockHeader = genesisBlock.getHeader(); final BlockHeader genesisBlockHeader = genesisBlock.getHeader();
transactionProcessor.processTransaction( transactionProcessor.processTransaction(

@ -40,7 +40,6 @@ import org.hyperledger.besu.ethereum.core.encoding.AccessListTransactionEncoder;
import org.hyperledger.besu.ethereum.core.encoding.BlobTransactionEncoder; import org.hyperledger.besu.ethereum.core.encoding.BlobTransactionEncoder;
import org.hyperledger.besu.ethereum.core.encoding.CodeDelegationEncoder; import org.hyperledger.besu.ethereum.core.encoding.CodeDelegationEncoder;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider; import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider; import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput; import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import org.hyperledger.besu.ethereum.rlp.RLP; import org.hyperledger.besu.ethereum.rlp.RLP;
@ -541,8 +540,7 @@ public class Transaction
final Bytes bytes = RlpTransactionProvider.encodeOpaqueBytes(this); final Bytes bytes = RlpTransactionProvider.encodeOpaqueBytes(this);
hash = Hash.hash(bytes); hash = Hash.hash(bytes);
if (transactionType.supportsBlob() && getBlobsWithCommitments().isPresent()) { if (transactionType.supportsBlob() && getBlobsWithCommitments().isPresent()) {
final Bytes pooledBytes = final Bytes pooledBytes = RlpPooledTransactionProvider.encodeOpaqueBytes(this);
RlpPooledTransactionProvider.encodeOpaqueBytes(this);
size = pooledBytes.size(); size = pooledBytes.size();
return; return;
} }

@ -16,7 +16,6 @@ package org.hyperledger.besu.ethereum.core.encoding;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.VisibleForTesting;
import org.hyperledger.besu.datatypes.TransactionType; import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoder; import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoder;
@ -25,6 +24,7 @@ import org.hyperledger.besu.ethereum.rlp.RLPInput;
import java.util.Optional; import java.util.Optional;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
@ -53,8 +53,7 @@ public class MainnetTransactionDecoder implements TransactionDecoder {
* @param rlpInput the RLP input * @param rlpInput the RLP input
* @return the decoded transaction * @return the decoded transaction
*/ */
public Transaction readFrom( public Transaction readFrom(final RLPInput rlpInput) {
final RLPInput rlpInput) {
if (!rlpInput.nextIsList()) { if (!rlpInput.nextIsList()) {
return decodeTypedTransaction(rlpInput); return decodeTypedTransaction(rlpInput);
} else { } else {
@ -73,8 +72,7 @@ public class MainnetTransactionDecoder implements TransactionDecoder {
* @param rlpInput the RLP input * @param rlpInput the RLP input
* @return the decoded transaction * @return the decoded transaction
*/ */
private Transaction decodeTypedTransaction( private Transaction decodeTypedTransaction(final RLPInput rlpInput) {
final RLPInput rlpInput) {
// Read the typed transaction bytes from the RLP input // Read the typed transaction bytes from the RLP input
final Bytes typedTransactionBytes = rlpInput.readBytes(); final Bytes typedTransactionBytes = rlpInput.readBytes();
@ -95,8 +93,7 @@ public class MainnetTransactionDecoder implements TransactionDecoder {
* @return the decoded transaction * @return the decoded transaction
*/ */
private Transaction decodeTypedTransaction( private Transaction decodeTypedTransaction(
final Bytes transactionBytes, final Bytes transactionBytes, final TransactionType transactionType) {
final TransactionType transactionType) {
// Slice the transaction bytes to exclude the transaction type and prepare for decoding // Slice the transaction bytes to exclude the transaction type and prepare for decoding
final RLPInput transactionInput = RLP.input(transactionBytes.slice(1)); final RLPInput transactionInput = RLP.input(transactionBytes.slice(1));
// Use the appropriate decoder for the transaction type to decode the remaining bytes // Use the appropriate decoder for the transaction type to decode the remaining bytes
@ -111,8 +108,7 @@ public class MainnetTransactionDecoder implements TransactionDecoder {
* @param opaqueBytes the opaque bytes * @param opaqueBytes the opaque bytes
* @return the decoded transaction * @return the decoded transaction
*/ */
public Transaction decodeOpaqueBytes( public Transaction decodeOpaqueBytes(final Bytes opaqueBytes) {
final Bytes opaqueBytes) {
var transactionType = getTransactionType(opaqueBytes); var transactionType = getTransactionType(opaqueBytes);
if (transactionType.isPresent()) { if (transactionType.isPresent()) {
return decodeTypedTransaction(opaqueBytes, transactionType.get()); return decodeTypedTransaction(opaqueBytes, transactionType.get());
@ -140,7 +136,6 @@ public class MainnetTransactionDecoder implements TransactionDecoder {
} }
} }
/** /**
* Gets the decoder for a given transaction type * Gets the decoder for a given transaction type
* *
@ -148,8 +143,7 @@ public class MainnetTransactionDecoder implements TransactionDecoder {
* @return the decoder * @return the decoder
*/ */
@VisibleForTesting @VisibleForTesting
protected Decoder getDecoder( protected Decoder getDecoder(final TransactionType transactionType) {
final TransactionType transactionType) {
return checkNotNull( return checkNotNull(
TYPED_TRANSACTION_DECODERS.get(transactionType), TYPED_TRANSACTION_DECODERS.get(transactionType),
"Developer Error. A supported transaction type %s has no associated decoding logic", "Developer Error. A supported transaction type %s has no associated decoding logic",

@ -16,7 +16,6 @@ package org.hyperledger.besu.ethereum.core.encoding;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.VisibleForTesting;
import org.hyperledger.besu.datatypes.TransactionType; import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoder; import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoder;
@ -24,6 +23,7 @@ import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import org.hyperledger.besu.ethereum.rlp.RLP; import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPOutput; import org.hyperledger.besu.ethereum.rlp.RLPOutput;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
@ -51,9 +51,7 @@ public class MainnetTransactionEncoder implements TransactionEncoder {
* @param transaction the transaction to encode * @param transaction the transaction to encode
* @param rlpOutput the RLP output stream * @param rlpOutput the RLP output stream
*/ */
public void writeTo( public void writeTo(final Transaction transaction, final RLPOutput rlpOutput) {
final Transaction transaction,
final RLPOutput rlpOutput) {
final TransactionType transactionType = getTransactionType(transaction); final TransactionType transactionType = getTransactionType(transaction);
Bytes opaqueBytes = encodeOpaqueBytes(transaction); Bytes opaqueBytes = encodeOpaqueBytes(transaction);
encodeRLP(transactionType, opaqueBytes, rlpOutput); encodeRLP(transactionType, opaqueBytes, rlpOutput);
@ -83,8 +81,7 @@ public class MainnetTransactionEncoder implements TransactionEncoder {
* @param transaction the transaction to encode * @param transaction the transaction to encode
* @return the encoded transaction as bytes * @return the encoded transaction as bytes
*/ */
public Bytes encodeOpaqueBytes( public Bytes encodeOpaqueBytes(final Transaction transaction) {
final Transaction transaction) {
final TransactionType transactionType = getTransactionType(transaction); final TransactionType transactionType = getTransactionType(transaction);
if (TransactionType.FRONTIER.equals(transactionType)) { if (TransactionType.FRONTIER.equals(transactionType)) {
return RLP.encode(rlpOutput -> FrontierTransactionEncoder.encode(transaction, rlpOutput)); return RLP.encode(rlpOutput -> FrontierTransactionEncoder.encode(transaction, rlpOutput));
@ -97,15 +94,13 @@ public class MainnetTransactionEncoder implements TransactionEncoder {
} }
} }
private static TransactionType getTransactionType(final Transaction transaction) { private static TransactionType getTransactionType(final Transaction transaction) {
return checkNotNull( return checkNotNull(
transaction.getType(), "Transaction type for %s was not specified.", transaction); transaction.getType(), "Transaction type for %s was not specified.", transaction);
} }
@VisibleForTesting @VisibleForTesting
protected Encoder getEncoder( protected Encoder getEncoder(final TransactionType transactionType) {
final TransactionType transactionType) {
return checkNotNull( return checkNotNull(
TYPED_TRANSACTION_ENCODERS.get(transactionType), TYPED_TRANSACTION_ENCODERS.get(transactionType),
"Developer Error. A supported transaction type %s has no associated encoding logic", "Developer Error. A supported transaction type %s has no associated encoding logic",

@ -1,23 +1,39 @@
/*
* Copyright contributors to Besu.
*
* 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 org.hyperledger.besu.ethereum.core.encoding; package org.hyperledger.besu.ethereum.core.encoding;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import org.hyperledger.besu.datatypes.TransactionType;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.hyperledger.besu.datatypes.TransactionType;
public class PooledMainnetTransactionDecoder extends MainnetTransactionDecoder { public class PooledMainnetTransactionDecoder extends MainnetTransactionDecoder {
private static final ImmutableMap<TransactionType, MainnetTransactionDecoder.Decoder> POOLED_TRANSACTION_DECODERS = private static final ImmutableMap<TransactionType, MainnetTransactionDecoder.Decoder>
ImmutableMap.of( POOLED_TRANSACTION_DECODERS =
TransactionType.ACCESS_LIST, ImmutableMap.of(
AccessListTransactionDecoder::decode, TransactionType.ACCESS_LIST,
TransactionType.EIP1559, AccessListTransactionDecoder::decode,
EIP1559TransactionDecoder::decode, TransactionType.EIP1559,
TransactionType.BLOB, EIP1559TransactionDecoder::decode,
BlobPooledTransactionDecoder::decode , TransactionType.BLOB,
TransactionType.DELEGATE_CODE, BlobPooledTransactionDecoder::decode,
CodeDelegationTransactionDecoder::decode); TransactionType.DELEGATE_CODE,
CodeDelegationTransactionDecoder::decode);
/** /**
* Gets the decoder for a given transaction type * Gets the decoder for a given transaction type
@ -25,13 +41,12 @@ public class PooledMainnetTransactionDecoder extends MainnetTransactionDecoder {
* @param transactionType the transaction type * @param transactionType the transaction type
* @return the decoder * @return the decoder
*/ */
@VisibleForTesting @VisibleForTesting
@Override @Override
protected MainnetTransactionDecoder.Decoder getDecoder( protected MainnetTransactionDecoder.Decoder getDecoder(final TransactionType transactionType) {
final TransactionType transactionType) {
return checkNotNull( return checkNotNull(
POOLED_TRANSACTION_DECODERS.get(transactionType), POOLED_TRANSACTION_DECODERS.get(transactionType),
"Developer Error. A supported transaction type %s has no associated decoding logic", "Developer Error. A supported transaction type %s has no associated decoding logic",
transactionType); transactionType);
} }
} }

@ -16,10 +16,10 @@ package org.hyperledger.besu.ethereum.core.encoding;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import org.hyperledger.besu.datatypes.TransactionType;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
public class PooledMainnetTransactionEncoder extends MainnetTransactionEncoder { public class PooledMainnetTransactionEncoder extends MainnetTransactionEncoder {
@ -35,10 +35,9 @@ public class PooledMainnetTransactionEncoder extends MainnetTransactionEncoder {
CodeDelegationEncoder::encode); CodeDelegationEncoder::encode);
@VisibleForTesting @VisibleForTesting
protected Encoder getEncoder( protected Encoder getEncoder(final TransactionType transactionType) {
final TransactionType transactionType) {
return checkNotNull( return checkNotNull(
POOLED_TRANSACTION_ENCODERS.get(transactionType), POOLED_TRANSACTION_ENCODERS.get(transactionType),
"Developer Error. A supported transaction type %s has no associated encoding logic", "Developer Error. A supported transaction type %s has no associated encoding logic",
transactionType); transactionType);
} }

@ -1,3 +1,17 @@
/*
* Copyright contributors to Besu.
*
* 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 org.hyperledger.besu.ethereum.core.encoding; package org.hyperledger.besu.ethereum.core.encoding;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;

@ -14,10 +14,11 @@
*/ */
package org.hyperledger.besu.ethereum.core.encoding.registry; package org.hyperledger.besu.ethereum.core.encoding.registry;
import org.apache.tuweni.bytes.Bytes;
import org.hyperledger.besu.ethereum.rlp.RLP; import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPInput; import org.hyperledger.besu.ethereum.rlp.RLPInput;
import org.apache.tuweni.bytes.Bytes;
public interface RlpDecoder<T> { public interface RlpDecoder<T> {
T readFrom(final RLPInput input); T readFrom(final RLPInput input);

@ -14,7 +14,6 @@
*/ */
package org.hyperledger.besu.ethereum.core.encoding.registry; package org.hyperledger.besu.ethereum.core.encoding.registry;
import org.hyperledger.besu.ethereum.rlp.RLPOutput; import org.hyperledger.besu.ethereum.rlp.RLPOutput;
public interface RlpEncoder<T> { public interface RlpEncoder<T> {

@ -1,23 +1,38 @@
/*
* Copyright contributors to Besu.
*
* 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 org.hyperledger.besu.ethereum.core.encoding.registry; package org.hyperledger.besu.ethereum.core.encoding.registry;
import org.apache.tuweni.bytes.Bytes;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.rlp.RLPInput; import org.hyperledger.besu.ethereum.rlp.RLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPOutput; import org.hyperledger.besu.ethereum.rlp.RLPOutput;
import org.apache.tuweni.bytes.Bytes;
public class RlpPooledTransactionProvider { public class RlpPooledTransactionProvider {
private RlpPooledTransactionProvider(){} private RlpPooledTransactionProvider() {}
public static Transaction readFrom(final RLPInput rlpInput){ public static Transaction readFrom(final RLPInput rlpInput) {
return getDecoder().readFrom(rlpInput); return getDecoder().readFrom(rlpInput);
} }
public static Transaction readFrom(final Bytes bytes){ public static Transaction readFrom(final Bytes bytes) {
return getDecoder().readFrom(bytes); return getDecoder().readFrom(bytes);
} }
public static Transaction decodeOpaqueBytes(final Bytes bytes){ public static Transaction decodeOpaqueBytes(final Bytes bytes) {
return getDecoder().decodeOpaqueBytes(bytes); return getDecoder().decodeOpaqueBytes(bytes);
} }
@ -25,18 +40,15 @@ public class RlpPooledTransactionProvider {
getEncoder().writeTo(transaction, output); getEncoder().writeTo(transaction, output);
} }
public static Bytes encodeOpaqueBytes(Transaction transaction){ public static Bytes encodeOpaqueBytes(Transaction transaction) {
return getEncoder().encodeOpaqueBytes(transaction); return getEncoder().encodeOpaqueBytes(transaction);
} }
private static private static TransactionEncoder getEncoder() {
TransactionEncoder getEncoder(){
return RlpRegistry.getInstance().getPooledTransactionEncoder(); return RlpRegistry.getInstance().getPooledTransactionEncoder();
} }
private static private static TransactionDecoder getDecoder() {
TransactionDecoder getDecoder(){
return RlpRegistry.getInstance().getPooledTransactionDecoder(); return RlpRegistry.getInstance().getPooledTransactionDecoder();
} }
} }

@ -25,13 +25,13 @@ public class RlpRegistry {
private TransactionDecoder transactionDecoder; private TransactionDecoder transactionDecoder;
private TransactionDecoder pooledTransactionDecoder; private TransactionDecoder pooledTransactionDecoder;
private TransactionEncoder transactionEncoder; private TransactionEncoder transactionEncoder;
private TransactionEncoder pooledTransactionEncoder; private TransactionEncoder pooledTransactionEncoder;
private RlpRegistry() { private RlpRegistry() {
transactionDecoder = new MainnetTransactionDecoder(); transactionDecoder = new MainnetTransactionDecoder();
pooledTransactionDecoder = new PooledMainnetTransactionDecoder(); pooledTransactionDecoder = new PooledMainnetTransactionDecoder();
transactionEncoder =new MainnetTransactionEncoder(); transactionEncoder = new MainnetTransactionEncoder();
pooledTransactionEncoder = new PooledMainnetTransactionEncoder(); pooledTransactionEncoder = new PooledMainnetTransactionEncoder();
} }
@ -42,35 +42,35 @@ public class RlpRegistry {
return INSTANCE; return INSTANCE;
} }
public void setTransactionDecoder(final TransactionDecoder decoder){ public void setTransactionDecoder(final TransactionDecoder decoder) {
this.transactionDecoder = decoder; this.transactionDecoder = decoder;
} }
public TransactionDecoder getTransactionDecoder(){ public TransactionDecoder getTransactionDecoder() {
return transactionDecoder; return transactionDecoder;
} }
public void setPooledTransactionDecoder(final TransactionDecoder pooledTransactionDecoder){ public void setPooledTransactionDecoder(final TransactionDecoder pooledTransactionDecoder) {
this.pooledTransactionDecoder = pooledTransactionDecoder; this.pooledTransactionDecoder = pooledTransactionDecoder;
} }
public TransactionDecoder getPooledTransactionDecoder(){ public TransactionDecoder getPooledTransactionDecoder() {
return pooledTransactionDecoder; return pooledTransactionDecoder;
} }
public void setTransactionEncoder(final TransactionEncoder encoder){ public void setTransactionEncoder(final TransactionEncoder encoder) {
this.transactionEncoder = encoder; this.transactionEncoder = encoder;
} }
public TransactionEncoder getTransactionEncoder(){ public TransactionEncoder getTransactionEncoder() {
return transactionEncoder; return transactionEncoder;
} }
public void setPooledTransactionEncoder(final TransactionEncoder pooledTransactionEncoder){ public void setPooledTransactionEncoder(final TransactionEncoder pooledTransactionEncoder) {
this.pooledTransactionEncoder = pooledTransactionEncoder; this.pooledTransactionEncoder = pooledTransactionEncoder;
} }
public TransactionEncoder getPooledTransactionEncoder(){ public TransactionEncoder getPooledTransactionEncoder() {
return pooledTransactionEncoder; return pooledTransactionEncoder;
} }
} }

@ -1,22 +1,37 @@
/*
* Copyright contributors to Besu.
*
* 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 org.hyperledger.besu.ethereum.core.encoding.registry; package org.hyperledger.besu.ethereum.core.encoding.registry;
import org.apache.tuweni.bytes.Bytes;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.rlp.RLPInput; import org.hyperledger.besu.ethereum.rlp.RLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPOutput; import org.hyperledger.besu.ethereum.rlp.RLPOutput;
import org.apache.tuweni.bytes.Bytes;
public class RlpTransactionProvider { public class RlpTransactionProvider {
private RlpTransactionProvider(){} private RlpTransactionProvider() {}
public static Transaction readFrom(final RLPInput rlpInput){ public static Transaction readFrom(final RLPInput rlpInput) {
return getDecoder().readFrom(rlpInput); return getDecoder().readFrom(rlpInput);
} }
public static Transaction readFrom(final Bytes bytes){ public static Transaction readFrom(final Bytes bytes) {
return getDecoder().readFrom(bytes); return getDecoder().readFrom(bytes);
} }
public static Transaction decodeOpaqueBytes(final Bytes bytes){ public static Transaction decodeOpaqueBytes(final Bytes bytes) {
return getDecoder().decodeOpaqueBytes(bytes); return getDecoder().decodeOpaqueBytes(bytes);
} }
@ -24,17 +39,15 @@ public class RlpTransactionProvider {
getEncoder().writeTo(transaction, output); getEncoder().writeTo(transaction, output);
} }
public static Bytes encodeOpaqueBytes(Transaction transaction){ public static Bytes encodeOpaqueBytes(Transaction transaction) {
return getEncoder().encodeOpaqueBytes(transaction); return getEncoder().encodeOpaqueBytes(transaction);
} }
private static private static TransactionDecoder getDecoder() {
TransactionDecoder getDecoder(){
return RlpRegistry.getInstance().getTransactionDecoder(); return RlpRegistry.getInstance().getTransactionDecoder();
} }
private static private static TransactionEncoder getEncoder() {
TransactionEncoder getEncoder(){
return RlpRegistry.getInstance().getTransactionEncoder(); return RlpRegistry.getInstance().getTransactionEncoder();
} }
} }

@ -1,8 +1,23 @@
/*
* Copyright contributors to Besu.
*
* 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 org.hyperledger.besu.ethereum.core.encoding.registry; package org.hyperledger.besu.ethereum.core.encoding.registry;
import org.apache.tuweni.bytes.Bytes;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.apache.tuweni.bytes.Bytes;
public interface TransactionDecoder extends RlpDecoder<Transaction> { public interface TransactionDecoder extends RlpDecoder<Transaction> {
Transaction decodeOpaqueBytes(Bytes bytes); Transaction decodeOpaqueBytes(Bytes bytes);

@ -1,10 +1,24 @@
/*
* Copyright contributors to Besu.
*
* 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 org.hyperledger.besu.ethereum.core.encoding.registry; package org.hyperledger.besu.ethereum.core.encoding.registry;
import org.apache.tuweni.bytes.Bytes;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.apache.tuweni.bytes.Bytes;
public interface TransactionEncoder extends RlpEncoder<Transaction> { public interface TransactionEncoder extends RlpEncoder<Transaction> {
Bytes encodeOpaqueBytes( Bytes encodeOpaqueBytes(final Transaction transaction);
final Transaction transaction);
} }

@ -23,8 +23,8 @@ import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.Withdrawal; import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.WithdrawalEncoder; import org.hyperledger.besu.ethereum.core.encoding.WithdrawalEncoder;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.RLP; import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.trie.MerkleTrie; import org.hyperledger.besu.ethereum.trie.MerkleTrie;
import org.hyperledger.besu.ethereum.trie.patricia.SimpleMerklePatriciaTrie; import org.hyperledger.besu.ethereum.trie.patricia.SimpleMerklePatriciaTrie;
@ -65,9 +65,7 @@ public final class BodyValidation {
.forEach( .forEach(
i -> i ->
trie.put( trie.put(
indexKey(i), indexKey(i), RlpTransactionProvider.encodeOpaqueBytes(transactions.get(i))));
RlpTransactionProvider.encodeOpaqueBytes(
transactions.get(i))));
return Hash.wrap(trie.getRootHash()); return Hash.wrap(trie.getRootHash());
} }

@ -18,7 +18,6 @@ import org.hyperledger.besu.crypto.KeyPair;
import org.hyperledger.besu.datatypes.TransactionType; import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import org.hyperledger.besu.plugin.data.UnsignedPrivateMarkerTransaction; import org.hyperledger.besu.plugin.data.UnsignedPrivateMarkerTransaction;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;

@ -18,7 +18,6 @@ import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider; import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider; import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput; import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
@ -60,15 +59,13 @@ public class BlobTransactionEncodingTest {
final TypedTransactionBytesArgument argument) { final TypedTransactionBytesArgument argument) {
Bytes bytes = argument.bytes; Bytes bytes = argument.bytes;
// Decode the transaction from the wire using the TransactionDecoder. // Decode the transaction from the wire using the TransactionDecoder.
final Transaction transaction = final Transaction transaction = RlpPooledTransactionProvider.decodeOpaqueBytes(bytes);
RlpPooledTransactionProvider.decodeOpaqueBytes(bytes);
final BytesValueRLPOutput output = new BytesValueRLPOutput(); final BytesValueRLPOutput output = new BytesValueRLPOutput();
new MainnetTransactionEncoder().encodeRLP(transaction.getType(), bytes, output); new MainnetTransactionEncoder().encodeRLP(transaction.getType(), bytes, output);
final BytesValueRLPOutput bytesValueRLPOutput = new BytesValueRLPOutput(); final BytesValueRLPOutput bytesValueRLPOutput = new BytesValueRLPOutput();
RlpPooledTransactionProvider.writeTo( RlpPooledTransactionProvider.writeTo(transaction, bytesValueRLPOutput);
transaction, bytesValueRLPOutput);
assertThat(transaction.getSize()).isEqualTo(bytes.size()); assertThat(transaction.getSize()).isEqualTo(bytes.size());
} }
@ -77,8 +74,7 @@ public class BlobTransactionEncodingTest {
public void blobTransactionEncodingDecodingTest(final TypedTransactionBytesArgument argument) { public void blobTransactionEncodingDecodingTest(final TypedTransactionBytesArgument argument) {
Bytes bytes = argument.bytes; Bytes bytes = argument.bytes;
// Decode the transaction from the wire using the TransactionDecoder. // Decode the transaction from the wire using the TransactionDecoder.
final Transaction transaction = final Transaction transaction = RlpTransactionProvider.decodeOpaqueBytes(bytes);
RlpTransactionProvider.decodeOpaqueBytes(bytes);
// Encode the transaction for wire using the TransactionEncoder. // Encode the transaction for wire using the TransactionEncoder.
Bytes encoded = RlpTransactionProvider.encodeOpaqueBytes(transaction); Bytes encoded = RlpTransactionProvider.encodeOpaqueBytes(transaction);
@ -86,7 +82,7 @@ public class BlobTransactionEncodingTest {
assertThat(encoded.toHexString()).isEqualTo(bytes.toHexString()); assertThat(encoded.toHexString()).isEqualTo(bytes.toHexString());
final BytesValueRLPOutput rlpOutput = new BytesValueRLPOutput(); final BytesValueRLPOutput rlpOutput = new BytesValueRLPOutput();
new MainnetTransactionEncoder().encodeRLP(transaction.getType(), bytes, rlpOutput); new MainnetTransactionEncoder().encodeRLP(transaction.getType(), bytes, rlpOutput);
assertThat(transaction.getSize()).isEqualTo(bytes.size()); assertThat(transaction.getSize()).isEqualTo(bytes.size());
} }

@ -24,7 +24,6 @@ import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider; import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider; import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.RLP; import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPException; import org.hyperledger.besu.ethereum.rlp.RLPException;
@ -71,9 +70,7 @@ class TransactionRLPDecoderTest {
final String txWithBigFees = final String txWithBigFees =
"0x02f84e0101a1648a5f8b2dcad5ea5ba6b720ff069c1d87c21a4a6a5b3766b39e2c2792367bb066a1ffa5ffaf5b0560d3a9fb186c2ede2ae6751bc0b4fef9107cf36389630b6196a38805800180c0010203"; "0x02f84e0101a1648a5f8b2dcad5ea5ba6b720ff069c1d87c21a4a6a5b3766b39e2c2792367bb066a1ffa5ffaf5b0560d3a9fb186c2ede2ae6751bc0b4fef9107cf36389630b6196a38805800180c0010203";
assertThatThrownBy( assertThatThrownBy(
() -> () -> RlpTransactionProvider.decodeOpaqueBytes(Bytes.fromHexString(txWithBigFees)))
RlpTransactionProvider.decodeOpaqueBytes(
Bytes.fromHexString(txWithBigFees)))
.isInstanceOf(RLPException.class); .isInstanceOf(RLPException.class);
} }
@ -118,8 +115,7 @@ class TransactionRLPDecoderTest {
final Bytes bytes = Bytes.fromHexString(rlp_tx); final Bytes bytes = Bytes.fromHexString(rlp_tx);
// Decode bytes into a transaction // Decode bytes into a transaction
final Transaction transaction = decodeRLP(RLP.input(bytes)); final Transaction transaction = decodeRLP(RLP.input(bytes));
Bytes transactionBytes = Bytes transactionBytes = RlpPooledTransactionProvider.encodeOpaqueBytes(transaction);
RlpPooledTransactionProvider.encodeOpaqueBytes(transaction);
// Bytes size should be equal to transaction size // Bytes size should be equal to transaction size
assertThat(transaction.getSize()).isEqualTo(transactionBytes.size()); assertThat(transaction.getSize()).isEqualTo(transactionBytes.size());
} }
@ -147,13 +143,16 @@ class TransactionRLPDecoderTest {
} }
@Test @Test
void shouldHaveDecodersForAllTransactionTypes(){ void shouldHaveDecodersForAllTransactionTypes() {
Stream.of(TransactionType.values()) Stream.of(TransactionType.values())
.filter(v -> v != TransactionType.FRONTIER).forEach( v -> { .filter(v -> v != TransactionType.FRONTIER)
assertThatNoException().isThrownBy(() -> new MainnetTransactionDecoder().getDecoder(v)); .forEach(
assertThatNoException().isThrownBy(() -> new PooledMainnetTransactionDecoder().getDecoder(v)); v -> {
} assertThatNoException()
); .isThrownBy(() -> new MainnetTransactionDecoder().getDecoder(v));
assertThatNoException()
.isThrownBy(() -> new PooledMainnetTransactionDecoder().getDecoder(v));
});
} }
private Transaction decodeRLP(final RLPInput input) { private Transaction decodeRLP(final RLPInput input) {

@ -17,7 +17,6 @@ package org.hyperledger.besu.ethereum.core.encoding;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatNoException; import static org.assertj.core.api.Assertions.assertThatNoException;
import java.util.stream.Stream;
import org.hyperledger.besu.datatypes.TransactionType; import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
@ -28,6 +27,8 @@ import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import org.hyperledger.besu.ethereum.rlp.RLP; import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPInput; import org.hyperledger.besu.ethereum.rlp.RLPInput;
import java.util.stream.Stream;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -80,13 +81,16 @@ class TransactionRLPEncoderTest {
} }
@Test @Test
void shouldHaveEncodersForAllTransactionTypes(){ void shouldHaveEncodersForAllTransactionTypes() {
Stream.of(TransactionType.values()) Stream.of(TransactionType.values())
.filter(v -> v != TransactionType.FRONTIER).forEach( v -> { .filter(v -> v != TransactionType.FRONTIER)
assertThatNoException().isThrownBy(() -> new MainnetTransactionEncoder().getEncoder(v)); .forEach(
assertThatNoException().isThrownBy(() -> new PooledMainnetTransactionEncoder().getEncoder(v)); v -> {
} assertThatNoException()
); .isThrownBy(() -> new MainnetTransactionEncoder().getEncoder(v));
assertThatNoException()
.isThrownBy(() -> new PooledMainnetTransactionEncoder().getEncoder(v));
});
} }
private Transaction decodeRLP(final RLPInput input) { private Transaction decodeRLP(final RLPInput input) {

@ -65,7 +65,8 @@ public class FixedKeySigningPrivateMarkerTransactionFactoryTest {
.build(); .build();
final Transaction transaction = final Transaction transaction =
RlpTransactionProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, "")); RlpTransactionProvider.readFrom(
factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
assertThat(transaction.getNonce()).isEqualTo(providedNonce); assertThat(transaction.getNonce()).isEqualTo(providedNonce);
assertThat(transaction.getGasLimit()).isEqualTo(gasLimit); assertThat(transaction.getGasLimit()).isEqualTo(gasLimit);
@ -77,7 +78,8 @@ public class FixedKeySigningPrivateMarkerTransactionFactoryTest {
assertThat(transaction.getPayload()).isEqualTo(Bytes.fromBase64String(enclaveKey)); assertThat(transaction.getPayload()).isEqualTo(Bytes.fromBase64String(enclaveKey));
final Transaction nextTransaction = final Transaction nextTransaction =
RlpTransactionProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, "")); RlpTransactionProvider.readFrom(
factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
assertThat(nextTransaction.getSender()).isEqualTo(transaction.getSender()); assertThat(nextTransaction.getSender()).isEqualTo(transaction.getSender());
} }
} }

@ -61,7 +61,8 @@ public class RandomSigningPrivateMarkerTransactionFactoryTest {
new RandomSigningPrivateMarkerTransactionFactory(); new RandomSigningPrivateMarkerTransactionFactory();
final Transaction transaction = final Transaction transaction =
RlpTransactionProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, "")); RlpTransactionProvider.readFrom(
factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
assertThat(transaction.getNonce()).isEqualTo(0); assertThat(transaction.getNonce()).isEqualTo(0);
assertThat(transaction.getGasLimit()).isEqualTo(gasLimit); assertThat(transaction.getGasLimit()).isEqualTo(gasLimit);
@ -71,7 +72,8 @@ public class RandomSigningPrivateMarkerTransactionFactoryTest {
assertThat(transaction.getPayload()).isEqualTo(Bytes.fromBase64String(enclaveKey)); assertThat(transaction.getPayload()).isEqualTo(Bytes.fromBase64String(enclaveKey));
final Transaction nextTransaction = final Transaction nextTransaction =
RlpTransactionProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, "")); RlpTransactionProvider.readFrom(
factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
assertThat(nextTransaction.getSender()).isNotEqualTo(transaction.getSender()); assertThat(nextTransaction.getSender()).isNotEqualTo(transaction.getSender());
} }
} }

@ -21,7 +21,6 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider; import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.messages.BlockBodiesMessage; import org.hyperledger.besu.ethereum.eth.messages.BlockBodiesMessage;
import org.hyperledger.besu.ethereum.eth.messages.BlockHeadersMessage; import org.hyperledger.besu.ethereum.eth.messages.BlockHeadersMessage;

@ -15,8 +15,6 @@
package org.hyperledger.besu.ethereum.eth.messages; package org.hyperledger.besu.ethereum.eth.messages;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider; import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.AbstractMessageData; import org.hyperledger.besu.ethereum.p2p.rlpx.wire.AbstractMessageData;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData; import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData;
@ -43,9 +41,7 @@ public final class PooledTransactionsMessage extends AbstractMessageData {
public static PooledTransactionsMessage create(final List<Transaction> transactions) { public static PooledTransactionsMessage create(final List<Transaction> transactions) {
final BytesValueRLPOutput out = new BytesValueRLPOutput(); final BytesValueRLPOutput out = new BytesValueRLPOutput();
out.writeList( out.writeList(transactions, RlpPooledTransactionProvider::writeTo);
transactions,
RlpPooledTransactionProvider::writeTo);
return new PooledTransactionsMessage(out.encoded()); return new PooledTransactionsMessage(out.encoded());
} }
@ -76,9 +72,7 @@ public final class PooledTransactionsMessage extends AbstractMessageData {
public List<Transaction> transactions() { public List<Transaction> transactions() {
if (pooledTransactions == null) { if (pooledTransactions == null) {
final BytesValueRLPInput in = new BytesValueRLPInput(getData(), false); final BytesValueRLPInput in = new BytesValueRLPInput(getData(), false);
pooledTransactions = pooledTransactions = in.readList(RlpPooledTransactionProvider::readFrom);
in.readList(
RlpPooledTransactionProvider::readFrom);
} }
return pooledTransactions; return pooledTransactions;
} }

@ -799,8 +799,9 @@ public class TransactionPool implements BlockAddedObserver {
allTxs.parallelStream() allTxs.parallelStream()
.takeWhile(unused -> !isCancelled.get()) .takeWhile(unused -> !isCancelled.get())
.map( .map(
ptx -> (ptx.isReceivedFromLocalSource() ? "l" : "r") ptx ->
+ ptx.getTransaction().encoded().toBase64String()) (ptx.isReceivedFromLocalSource() ? "l" : "r")
+ ptx.getTransaction().encoded().toBase64String())
.mapToInt( .mapToInt(
line -> { line -> {
synchronized (bw) { synchronized (bw) {
@ -841,7 +842,8 @@ public class TransactionPool implements BlockAddedObserver {
line -> { line -> {
final boolean isLocal = line.charAt(0) == 'l'; final boolean isLocal = line.charAt(0) == 'l';
final Transaction tx = final Transaction tx =
RlpTransactionProvider.readFrom(Bytes.fromBase64String(line.substring(1))); RlpTransactionProvider.readFrom(
Bytes.fromBase64String(line.substring(1)));
final ValidationResult<TransactionInvalidReason> result = final ValidationResult<TransactionInvalidReason> result =
addTransaction(tx, isLocal); addTransaction(tx, isLocal);

@ -234,8 +234,7 @@ public class LayeredPendingTransactions implements PendingTransactions {
.addArgument(pendingTransaction.getNonce()) .addArgument(pendingTransaction.getNonce())
.addArgument(pendingTransaction.getTransaction().getType()) .addArgument(pendingTransaction.getTransaction().getType())
.addArgument(pendingTransaction::getHash) .addArgument(pendingTransaction::getHash)
.addArgument( .addArgument(() -> pendingTransaction.getTransaction().encoded().toHexString())
() -> pendingTransaction.getTransaction().encoded().toHexString())
.log(); .log();
} }
@ -251,17 +250,14 @@ public class LayeredPendingTransactions implements PendingTransactions {
.addArgument(pendingTransaction.getNonce()) .addArgument(pendingTransaction.getNonce())
.addArgument(pendingTransaction.getTransaction().getType()) .addArgument(pendingTransaction.getTransaction().getType())
.addArgument(pendingTransaction::getHash) .addArgument(pendingTransaction::getHash)
.addArgument( .addArgument(() -> pendingTransaction.getTransaction().encoded().toHexString())
() -> pendingTransaction.getTransaction().encoded().toHexString())
.log(); .log();
LOG.atInfo() LOG.atInfo()
.addMarker(INVALID_TX_REMOVED) .addMarker(INVALID_TX_REMOVED)
.addKeyValue("txhash", pendingTransaction::getHash) .addKeyValue("txhash", pendingTransaction::getHash)
.addKeyValue("txlog", pendingTransaction::toTraceLog) .addKeyValue("txlog", pendingTransaction::toTraceLog)
.addKeyValue("reason", result) .addKeyValue("reason", result)
.addKeyValue( .addKeyValue("txrlp", () -> pendingTransaction.getTransaction().encoded().toHexString())
"txrlp",
() -> pendingTransaction.getTransaction().encoded().toHexString())
.log(); .log();
} }

@ -36,7 +36,6 @@ import org.hyperledger.besu.ethereum.eth.transactions.TransactionAddedResult;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolReplacementHandler; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolReplacementHandler;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import org.hyperledger.besu.evm.account.Account; import org.hyperledger.besu.evm.account.Account;
import org.hyperledger.besu.evm.account.AccountState; import org.hyperledger.besu.evm.account.AccountState;
import org.hyperledger.besu.metrics.BesuMetricCategory; import org.hyperledger.besu.metrics.BesuMetricCategory;
@ -276,9 +275,7 @@ public abstract class AbstractPendingTransactionsSorter implements PendingTransa
.addKeyValue("txhash", pendingTransaction::getHash) .addKeyValue("txhash", pendingTransaction::getHash)
.addKeyValue("txlog", pendingTransaction::toTraceLog) .addKeyValue("txlog", pendingTransaction::toTraceLog)
.addKeyValue("reason", result) .addKeyValue("reason", result)
.addKeyValue( .addKeyValue("txrlp", () -> pendingTransaction.getTransaction().encoded().toHexString())
"txrlp",
() -> pendingTransaction.getTransaction().encoded().toHexString())
.log(); .log();
} }

@ -25,9 +25,7 @@ import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionTestFixture; import org.hyperledger.besu.ethereum.core.TransactionTestFixture;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider; import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider; import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.eth.transactions.layered.BaseTransactionPoolTest; import org.hyperledger.besu.ethereum.eth.transactions.layered.BaseTransactionPoolTest;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPInput; import org.hyperledger.besu.ethereum.rlp.BytesValueRLPInput;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput; import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
@ -76,7 +74,9 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
BytesValueRLPOutput rlpOut = new BytesValueRLPOutput(); BytesValueRLPOutput rlpOut = new BytesValueRLPOutput();
RlpTransactionProvider.writeTo(txTo, rlpOut); RlpTransactionProvider.writeTo(txTo, rlpOut);
txTo = RlpTransactionProvider.readFrom(new BytesValueRLPInput(rlpOut.encoded(), false)).detachedCopy(); txTo =
RlpTransactionProvider.readFrom(new BytesValueRLPInput(rlpOut.encoded(), false))
.detachedCopy();
System.out.println(txTo.getSender()); System.out.println(txTo.getSender());
System.out.println(txTo.getHash()); System.out.println(txTo.getHash());
System.out.println(txTo.getSize()); System.out.println(txTo.getSize());
@ -120,7 +120,8 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
Transaction txPayload = preparedTx.createTransaction(KEYS1); Transaction txPayload = preparedTx.createTransaction(KEYS1);
txPayload = txPayload =
RlpTransactionProvider.readFrom(new BytesValueRLPInput(txPayload.encoded(), false)).detachedCopy(); RlpTransactionProvider.readFrom(new BytesValueRLPInput(txPayload.encoded(), false))
.detachedCopy();
System.out.println(txPayload.getSender()); System.out.println(txPayload.getSender());
System.out.println(txPayload.getHash()); System.out.println(txPayload.getHash());
System.out.println(txPayload.getSize()); System.out.println(txPayload.getSize());
@ -212,8 +213,7 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
RlpPooledTransactionProvider.writeTo(txBlob, rlpOut); RlpPooledTransactionProvider.writeTo(txBlob, rlpOut);
txBlob = txBlob =
RlpPooledTransactionProvider.readFrom( RlpPooledTransactionProvider.readFrom(new BytesValueRLPInput(rlpOut.encoded(), false))
new BytesValueRLPInput(rlpOut.encoded(), false))
.detachedCopy(); .detachedCopy();
System.out.println(txBlob.getSender()); System.out.println(txBlob.getSender());
System.out.println(txBlob.getHash()); System.out.println(txBlob.getHash());
@ -244,8 +244,7 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
RlpPooledTransactionProvider.writeTo(txBlob, rlpOut); RlpPooledTransactionProvider.writeTo(txBlob, rlpOut);
txBlob = txBlob =
RlpPooledTransactionProvider.readFrom( RlpPooledTransactionProvider.readFrom(new BytesValueRLPInput(rlpOut.encoded(), false))
new BytesValueRLPInput(rlpOut.encoded(), false))
.detachedCopy(); .detachedCopy();
System.out.println(txBlob.getSender()); System.out.println(txBlob.getSender());
System.out.println(txBlob.getHash()); System.out.println(txBlob.getHash());
@ -271,7 +270,8 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
Transaction txPayload = preparedTx.createTransaction(KEYS1); Transaction txPayload = preparedTx.createTransaction(KEYS1);
txPayload = txPayload =
RlpTransactionProvider.readFrom(new BytesValueRLPInput(txPayload.encoded(), false)).detachedCopy(); RlpTransactionProvider.readFrom(new BytesValueRLPInput(txPayload.encoded(), false))
.detachedCopy();
System.out.println(txPayload.getSender()); System.out.println(txPayload.getSender());
System.out.println(txPayload.getHash()); System.out.println(txPayload.getHash());
System.out.println(txPayload.getSize()); System.out.println(txPayload.getSize());
@ -301,7 +301,8 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
Transaction txAccessList = preparedTx.accessList(ales).createTransaction(KEYS1); Transaction txAccessList = preparedTx.accessList(ales).createTransaction(KEYS1);
txAccessList = txAccessList =
RlpTransactionProvider.readFrom(new BytesValueRLPInput(txAccessList.encoded(), false)).detachedCopy(); RlpTransactionProvider.readFrom(new BytesValueRLPInput(txAccessList.encoded(), false))
.detachedCopy();
System.out.println(txAccessList.getSender()); System.out.println(txAccessList.getSender());
System.out.println(txAccessList.getHash()); System.out.println(txAccessList.getHash());
System.out.println(txAccessList.getSize()); System.out.println(txAccessList.getSize());
@ -341,7 +342,8 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
Transaction txEip1559 = createEIP1559Transaction(1, KEYS1, 10); Transaction txEip1559 = createEIP1559Transaction(1, KEYS1, 10);
txEip1559 = txEip1559 =
RlpTransactionProvider.readFrom(new BytesValueRLPInput(txEip1559.encoded(), false)).detachedCopy(); RlpTransactionProvider.readFrom(new BytesValueRLPInput(txEip1559.encoded(), false))
.detachedCopy();
System.out.println(txEip1559.getSender()); System.out.println(txEip1559.getSender());
System.out.println(txEip1559.getHash()); System.out.println(txEip1559.getHash());
System.out.println(txEip1559.getSize()); System.out.println(txEip1559.getSize());
@ -383,7 +385,8 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
Transaction txFrontier = createTransaction(TransactionType.FRONTIER, 1, Wei.of(500), 0, KEYS1); Transaction txFrontier = createTransaction(TransactionType.FRONTIER, 1, Wei.of(500), 0, KEYS1);
txFrontier = txFrontier =
RlpTransactionProvider.readFrom(new BytesValueRLPInput(txFrontier.encoded(), false)).detachedCopy(); RlpTransactionProvider.readFrom(new BytesValueRLPInput(txFrontier.encoded(), false))
.detachedCopy();
System.out.println(txFrontier.getSender()); System.out.println(txFrontier.getSender());
System.out.println(txFrontier.getHash()); System.out.println(txFrontier.getHash());
System.out.println(txFrontier.getSize()); System.out.println(txFrontier.getSize());

@ -147,7 +147,8 @@ public class T8nExecutor {
} else if (txNode.isObject()) { } else if (txNode.isObject()) {
if (txNode.has("txBytes")) { if (txNode.has("txBytes")) {
Transaction tx = Transaction tx =
RlpTransactionProvider.readFrom(Bytes.fromHexString(txNode.get("txbytes").asText())); RlpTransactionProvider.readFrom(
Bytes.fromHexString(txNode.get("txbytes").asText()));
transactions.add(tx); transactions.add(tx);
} else { } else {
Transaction.Builder builder = Transaction.builder(); Transaction.Builder builder = Transaction.builder();

Loading…
Cancel
Save