Merge decode and encode provider

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
pull/7871/head
Gabriel-Trintinalia 3 weeks ago
parent 15093d9868
commit 910b88ce8f
  1. 4
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/TxParseSubCommand.java
  2. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/GraphQLDataFetchers.java
  3. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayload.java
  4. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/AbstractEeaSendRawTransaction.java
  5. 10
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockResultFactory.java
  6. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/EngineGetPayloadBodiesResultV1.java
  7. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionPendingResult.java
  8. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/util/DomainObjectDecodeUtils.java
  9. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionByHashTest.java
  10. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3Test.java
  11. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/util/DomainObjectDecodeUtilsTest.java
  12. 4
      ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/vm/TraceTransactionIntegrationTest.java
  13. 7
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Block.java
  14. 7
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockBody.java
  15. 10
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java
  16. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/PooledMainnetTransactionEncoder.java
  17. 22
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/PooledTransactionEncoderProvider.java
  18. 3
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/RlpDecoder.java
  19. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/RlpEncoder.java
  20. 22
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/RlpPooledTransactionProvider.java
  21. 25
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/RlpRegistry.java
  22. 21
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/RlpTransactionProvider.java
  23. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/TransactionDecoder.java
  24. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/TransactionEncoder.java
  25. 22
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/registry/TransactionEncoderProvider.java
  26. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BodyValidation.java
  27. 8
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/TransactionIntegrationTest.java
  28. 15
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/BlobTransactionEncodingTest.java
  29. 12
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/TransactionRLPDecoderTest.java
  30. 7
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/TransactionRLPEncoderTest.java
  31. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/IntrinsicGasTest.java
  32. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/ValidationTestUtils.java
  33. 6
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/markertransaction/FixedKeySigningPrivateMarkerTransactionFactoryTest.java
  34. 6
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/markertransaction/RandomSigningPrivateMarkerTransactionFactoryTest.java
  35. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/util/RawBlockIteratorTest.java
  36. 4
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthServer.java
  37. 8
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/PooledTransactionsMessage.java
  38. 7
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/messages/TransactionsMessage.java
  39. 4
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java
  40. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthServerTest.java
  41. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockBodiesMessageTest.java
  42. 29
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/PendingTransactionEstimatedMemorySizeTest.java
  43. 6
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/ReplayTest.java
  44. 9
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/T8nExecutor.java
  45. 4
      ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/BlockchainReferenceTestCaseSpec.java
  46. 8
      ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/core/TransactionTest.java

@ -29,7 +29,7 @@ import java.nio.file.Paths;
import java.util.stream.Stream;
import org.apache.tuweni.bytes.Bytes;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import picocli.CommandLine;
/**
@ -104,7 +104,7 @@ public class TxParseSubCommand implements Runnable {
void dump(final Bytes tx) {
try {
var transaction = TransactionDecoderProvider.decodeOpaqueBytes(tx);
var transaction = RlpTransactionProvider.decodeOpaqueBytes(tx);
// https://github.com/hyperledger/besu/blob/5fe49c60b30fe2954c7967e8475c3b3e9afecf35/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionValidator.java#L252
if (transaction.getChainId().isPresent() && !transaction.getChainId().get().equals(chainId)) {

@ -34,7 +34,7 @@ import org.hyperledger.besu.ethereum.api.query.TransactionWithMetadata;
import org.hyperledger.besu.ethereum.core.LogWithMetadata;
import org.hyperledger.besu.ethereum.core.Synchronizer;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.eth.EthProtocol;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
@ -130,7 +130,7 @@ public class GraphQLDataFetchers {
dataFetchingEnvironment.getGraphQlContext().get(GraphQLContextType.TRANSACTION_POOL);
final Bytes rawTran = dataFetchingEnvironment.getArgument("data");
final Transaction transaction = TransactionDecoderProvider.readFrom(RLP.input(rawTran));
final Transaction transaction = RlpTransactionProvider.readFrom(RLP.input(rawTran));
final ValidationResult<TransactionInvalidReason> validationResult =
transactionPool.addTransactionViaApi(transaction);
if (validationResult.isValid()) {

@ -51,7 +51,7 @@ import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.eth.manager.EthPeers;
import org.hyperledger.besu.ethereum.mainnet.BodyValidation;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
@ -220,7 +220,7 @@ public abstract class AbstractEngineNewPayload extends ExecutionEngineJsonRpcMet
transactions =
blockParam.getTransactions().stream()
.map(Bytes::fromHexString)
.map(TransactionDecoderProvider::decodeOpaqueBytes)
.map(RlpTransactionProvider::decodeOpaqueBytes)
.collect(Collectors.toList());
transactions.forEach(
transaction ->

@ -32,7 +32,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcRespon
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
import org.hyperledger.besu.ethereum.privacy.PrivateTransaction;
@ -156,7 +156,7 @@ public abstract class AbstractEeaSendRawTransaction implements JsonRpcMethod {
final Bytes rlpBytes =
privateMarkerTransactionFactory.create(
unsignedPrivateMarkerTransaction, privateTransaction, privacyUserId);
return TransactionDecoderProvider.readFrom(rlpBytes);
return RlpTransactionProvider.readFrom(rlpBytes);
}
protected abstract long getGasLimit(PrivateTransaction privateTransaction, String pmtPayload);

@ -23,7 +23,7 @@ import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import java.util.ArrayList;
import java.util.Comparator;
@ -96,7 +96,7 @@ public class BlockResultFactory {
final List<String> txs =
block.getBody().getTransactions().stream()
.map(
TransactionEncoderProvider::encodeOpaqueBytes)
RlpTransactionProvider::encodeOpaqueBytes)
.map(Bytes::toHexString)
.collect(Collectors.toList());
@ -108,7 +108,7 @@ public class BlockResultFactory {
final List<String> txs =
blockWithReceipts.getBlock().getBody().getTransactions().stream()
.map(
TransactionEncoderProvider::encodeOpaqueBytes)
RlpTransactionProvider::encodeOpaqueBytes)
.map(Bytes::toHexString)
.collect(Collectors.toList());
@ -133,7 +133,7 @@ public class BlockResultFactory {
final List<String> txs =
blockWithReceipts.getBlock().getBody().getTransactions().stream()
.map(
TransactionEncoderProvider::encodeOpaqueBytes)
RlpTransactionProvider::encodeOpaqueBytes)
.map(Bytes::toHexString)
.collect(Collectors.toList());
@ -152,7 +152,7 @@ public class BlockResultFactory {
final List<String> txs =
blockWithReceipts.getBlock().getBody().getTransactions().stream()
.map(
TransactionEncoderProvider::encodeOpaqueBytes)
RlpTransactionProvider::encodeOpaqueBytes)
.map(Bytes::toHexString)
.collect(Collectors.toList());
final Optional<List<String>> requestsWithoutRequestId =

@ -16,7 +16,7 @@ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.results;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.WithdrawalParameter;
import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import java.util.Collections;
import java.util.List;
@ -53,7 +53,7 @@ public class EngineGetPayloadBodiesResultV1 {
this.transactions =
blockBody.getTransactions().stream()
.map(
TransactionEncoderProvider::encodeOpaqueBytes)
RlpTransactionProvider::encodeOpaqueBytes)
.map(Bytes::toHexString)
.collect(Collectors.toList());
this.withdrawals =

@ -20,7 +20,7 @@ import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.datatypes.VersionedHash;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import java.util.List;
@ -103,7 +103,7 @@ public class TransactionPendingResult implements TransactionResult {
this.nonce = Quantity.create(transaction.getNonce());
this.publicKey = transaction.getPublicKey().orElse(null);
this.raw =
PooledTransactionEncoderProvider.encodeOpaqueBytes(transaction)
RlpPooledTransactionProvider.encodeOpaqueBytes(transaction)
.toString();
this.to = transaction.getTo().map(Address::toHexString).orElse(null);
if (transactionType == TransactionType.FRONTIER) {

@ -17,7 +17,7 @@ package org.hyperledger.besu.ethereum.api.util;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.exception.InvalidJsonRpcRequestException;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.RLPException;
import org.apache.tuweni.bytes.Bytes;
@ -28,7 +28,7 @@ public class DomainObjectDecodeUtils {
throws InvalidJsonRpcRequestException {
try {
Bytes txnBytes = Bytes.fromHexString(rawTransaction);
return PooledTransactionDecoderProvider.decodeOpaqueBytes(txnBytes);
return RlpPooledTransactionProvider.decodeOpaqueBytes(txnBytes);
} catch (final IllegalArgumentException e) {
throw new InvalidJsonRpcRequestException(
"Invalid raw transaction hex", RpcErrorType.INVALID_TRANSACTION_PARAMS, e);

@ -33,7 +33,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.TransactionPen
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.api.query.TransactionWithMetadata;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.eth.transactions.PendingTransaction;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
@ -109,7 +109,7 @@ class EthGetTransactionByHashTest {
@Test
void shouldReturnPendingTransactionWhenTransactionExistsAndIsPending() {
final org.hyperledger.besu.ethereum.core.Transaction transaction =
TransactionDecoderProvider.readFrom(
RlpTransactionProvider.readFrom(
Bytes.fromHexString(VALID_TRANSACTION));
when(transactionPool.getTransactionByHash(transaction.getHash()))
@ -132,7 +132,7 @@ class EthGetTransactionByHashTest {
@Test
void shouldReturnCompleteTransactionWhenTransactionExistsInBlockchain() {
final org.hyperledger.besu.ethereum.core.Transaction transaction =
TransactionDecoderProvider.readFrom(
RlpTransactionProvider.readFrom(
Bytes.fromHexString(VALID_TRANSACTION));
final TransactionWithMetadata transactionWithMetadata =
new TransactionWithMetadata(transaction, 1, Optional.empty(), Hash.ZERO, 0);

@ -48,7 +48,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionTestFixture;
import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.mainnet.BodyValidation;
import org.hyperledger.besu.ethereum.mainnet.CancunTargetingGasLimitCalculator;
import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
@ -225,7 +225,7 @@ public class EngineNewPayloadV3Test extends EngineNewPayloadV2Test {
public void shouldRejectTransactionsWithFullBlobs() {
Bytes transactionWithBlobsBytes =
PooledTransactionEncoderProvider.encodeOpaqueBytes(
RlpPooledTransactionProvider.encodeOpaqueBytes(
createTransactionWithBlobs());
List<String> transactions = List.of(transactionWithBlobsBytes.toString());

@ -21,7 +21,7 @@ import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import java.math.BigInteger;
@ -57,7 +57,7 @@ public class DomainObjectDecodeUtilsTest {
@Test
public void testAccessListRLPSerDes() {
final BytesValueRLPOutput encoded = new BytesValueRLPOutput();
PooledTransactionEncoderProvider.writeTo(accessListTxn, encoded);
RlpPooledTransactionProvider.writeTo(accessListTxn, encoded);
Transaction decoded =
DomainObjectDecodeUtils.decodeRawTransaction(encoded.encoded().toHexString());
Assertions.assertThat(decoded.getAccessList().isPresent()).isTrue();
@ -67,7 +67,7 @@ public class DomainObjectDecodeUtilsTest {
@Test
public void testAccessList2718OpaqueSerDes() {
final Bytes encoded =
PooledTransactionEncoderProvider.encodeOpaqueBytes(accessListTxn);
RlpPooledTransactionProvider.encodeOpaqueBytes(accessListTxn);
Transaction decoded = DomainObjectDecodeUtils.decodeRawTransaction(encoded.toString());
Assertions.assertThat(decoded.getAccessList().isPresent()).isTrue();
Assertions.assertThat(decoded.getAccessList().map(List::size).get()).isEqualTo(1);

@ -30,7 +30,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture;
import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.debug.TraceFrame;
import org.hyperledger.besu.ethereum.debug.TraceOptions;
import org.hyperledger.besu.ethereum.mainnet.MainnetTransactionProcessor;
@ -171,7 +171,7 @@ public class TraceTransactionIntegrationTest {
final DebugOperationTracer tracer =
new DebugOperationTracer(new TraceOptions(true, true, true), false);
final Transaction transaction =
TransactionDecoderProvider.readFrom(
RlpTransactionProvider.readFrom(
new BytesValueRLPInput(Bytes.fromHexString(CONTRACT_CREATION_TX), false));
final BlockHeader genesisBlockHeader = genesisBlock.getHeader();
transactionProcessor.processTransaction(

@ -15,8 +15,7 @@
package org.hyperledger.besu.ethereum.core;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
@ -61,7 +60,7 @@ public class Block {
out.startList();
header.writeTo(out);
out.writeList(body.getTransactions(), TransactionEncoderProvider::writeTo);
out.writeList(body.getTransactions(), RlpTransactionProvider::writeTo);
out.writeList(body.getOmmers(), BlockHeader::writeTo);
body.getWithdrawals().ifPresent(withdrawals -> out.writeList(withdrawals, Withdrawal::writeTo));
@ -71,7 +70,7 @@ public class Block {
public static Block readFrom(final RLPInput in, final BlockHeaderFunctions hashFunction) {
in.enterList();
final BlockHeader header = BlockHeader.readFrom(in, hashFunction);
final List<Transaction> transactions = in.readList(TransactionDecoderProvider::readFrom);
final List<Transaction> transactions = in.readList(RlpTransactionProvider::readFrom);
final List<BlockHeader> ommers = in.readList(rlp -> BlockHeader.readFrom(rlp, hashFunction));
final Optional<List<Withdrawal>> withdrawals =
in.isEndOfCurrentList() ? Optional.empty() : Optional.of(in.readList(Withdrawal::readFrom));

@ -14,8 +14,7 @@
*/
package org.hyperledger.besu.ethereum.core;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
@ -97,7 +96,7 @@ public class BlockBody implements org.hyperledger.besu.plugin.data.BlockBody {
}
public void writeTo(final RLPOutput output) {
output.writeList(getTransactions(), TransactionEncoderProvider::writeTo);
output.writeList(getTransactions(), RlpTransactionProvider::writeTo);
output.writeList(getOmmers(), BlockHeader::writeTo);
withdrawals.ifPresent(withdrawals -> output.writeList(withdrawals, Withdrawal::writeTo));
}
@ -144,7 +143,7 @@ public class BlockBody implements org.hyperledger.besu.plugin.data.BlockBody {
public static BlockBody readFrom(
final RLPInput input, final BlockHeaderFunctions blockHeaderFunctions) {
return new BlockBody(
input.readList(TransactionDecoderProvider::readFrom),
input.readList(RlpTransactionProvider::readFrom),
input.readList(rlp -> BlockHeader.readFrom(rlp, blockHeaderFunctions)),
input.isEndOfCurrentList()
? Optional.empty()

@ -39,9 +39,9 @@ import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.encoding.AccessListTransactionEncoder;
import org.hyperledger.besu.ethereum.core.encoding.BlobTransactionEncoder;
import org.hyperledger.besu.ethereum.core.encoding.CodeDelegationEncoder;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
@ -473,7 +473,7 @@ public class Transaction
@Override
public Bytes encoded() {
final BytesValueRLPOutput rplOutput = new BytesValueRLPOutput();
TransactionEncoderProvider.writeTo(this, rplOutput);
RlpTransactionProvider.writeTo(this, rplOutput);
return rplOutput.encoded();
}
@ -538,11 +538,11 @@ public class Transaction
}
private void memoizeHashAndSize() {
final Bytes bytes = TransactionEncoderProvider.encodeOpaqueBytes(this);
final Bytes bytes = RlpTransactionProvider.encodeOpaqueBytes(this);
hash = Hash.hash(bytes);
if (transactionType.supportsBlob() && getBlobsWithCommitments().isPresent()) {
final Bytes pooledBytes =
PooledTransactionEncoderProvider.encodeOpaqueBytes(this);
RlpPooledTransactionProvider.encodeOpaqueBytes(this);
size = pooledBytes.size();
return;
}

@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap;
import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
public class PooledMainnetTransactionEncoder extends MainnetTransactionEncoder {

@ -1,22 +0,0 @@
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.rlp.RLPOutput;
public class PooledTransactionEncoderProvider {
private PooledTransactionEncoderProvider(){}
public static void writeTo(Transaction transaction, RLPOutput output) {
getEncoder().writeTo(transaction, output);
}
public static Bytes encodeOpaqueBytes(Transaction transaction){
return getEncoder().encodeOpaqueBytes(transaction);
}
private static
TransactionEncoder getEncoder(){
return RLPRegistry.getInstance().getPooledTransactionEncoder();
}
}

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

@ -17,7 +17,7 @@ package org.hyperledger.besu.ethereum.core.encoding.registry;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
public interface RLPEncoder<T> {
public interface RlpEncoder<T> {
void writeTo(T t, RLPOutput output);
}

@ -3,9 +3,11 @@ 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.rlp.RLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
public class TransactionDecoderProvider {
private TransactionDecoderProvider(){}
public class RlpPooledTransactionProvider {
private RlpPooledTransactionProvider(){}
public static Transaction readFrom(final RLPInput rlpInput){
return getDecoder().readFrom(rlpInput);
@ -19,8 +21,22 @@ public class TransactionDecoderProvider {
return getDecoder().decodeOpaqueBytes(bytes);
}
public static void writeTo(Transaction transaction, RLPOutput output) {
getEncoder().writeTo(transaction, output);
}
public static Bytes encodeOpaqueBytes(Transaction transaction){
return getEncoder().encodeOpaqueBytes(transaction);
}
private static
TransactionEncoder getEncoder(){
return RlpRegistry.getInstance().getPooledTransactionEncoder();
}
private static
TransactionDecoder getDecoder(){
return RLPRegistry.getInstance().getPooledTransactionDecoder();
return RlpRegistry.getInstance().getPooledTransactionDecoder();
}
}

@ -15,10 +15,12 @@
package org.hyperledger.besu.ethereum.core.encoding.registry;
import org.hyperledger.besu.ethereum.core.encoding.MainnetTransactionDecoder;
import org.hyperledger.besu.ethereum.core.encoding.MainnetTransactionEncoder;
import org.hyperledger.besu.ethereum.core.encoding.PooledMainnetTransactionDecoder;
import org.hyperledger.besu.ethereum.core.encoding.PooledMainnetTransactionEncoder;
public class RLPRegistry {
private static RLPRegistry INSTANCE;
public class RlpRegistry {
private static RlpRegistry INSTANCE;
private TransactionDecoder transactionDecoder;
private TransactionDecoder pooledTransactionDecoder;
@ -26,13 +28,16 @@ public class RLPRegistry {
private TransactionEncoder transactionEncoder;
private TransactionEncoder pooledTransactionEncoder;
private RLPRegistry() {
registerDefaultDecoders();
private RlpRegistry() {
transactionDecoder = new MainnetTransactionDecoder();
pooledTransactionDecoder = new PooledMainnetTransactionDecoder();
transactionEncoder =new MainnetTransactionEncoder();
pooledTransactionEncoder = new PooledMainnetTransactionEncoder();
}
protected static RLPRegistry getInstance() {
protected static RlpRegistry getInstance() {
if (INSTANCE == null) {
INSTANCE = new RLPRegistry();
INSTANCE = new RlpRegistry();
}
return INSTANCE;
}
@ -53,9 +58,6 @@ public class RLPRegistry {
return pooledTransactionDecoder;
}
public void setTransactionEncoder(final TransactionEncoder encoder){
this.transactionEncoder = encoder;
}
@ -71,9 +73,4 @@ public class RLPRegistry {
public TransactionEncoder getPooledTransactionEncoder(){
return pooledTransactionEncoder;
}
private void registerDefaultDecoders() {
setTransactionDecoder(new MainnetTransactionDecoder());
setPooledTransactionDecoder(new PooledMainnetTransactionDecoder());
}
}

@ -3,10 +3,10 @@ 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.rlp.RLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
public class PooledTransactionDecoderProvider {
private PooledTransactionDecoderProvider(){}
public class RlpTransactionProvider {
private RlpTransactionProvider(){}
public static Transaction readFrom(final RLPInput rlpInput){
return getDecoder().readFrom(rlpInput);
@ -20,8 +20,21 @@ public class PooledTransactionDecoderProvider {
return getDecoder().decodeOpaqueBytes(bytes);
}
public static void writeTo(Transaction transaction, RLPOutput output) {
getEncoder().writeTo(transaction, output);
}
public static Bytes encodeOpaqueBytes(Transaction transaction){
return getEncoder().encodeOpaqueBytes(transaction);
}
private static
TransactionDecoder getDecoder(){
return RLPRegistry.getInstance().getPooledTransactionDecoder();
return RlpRegistry.getInstance().getTransactionDecoder();
}
private static
TransactionEncoder getEncoder(){
return RlpRegistry.getInstance().getTransactionEncoder();
}
}

@ -3,7 +3,7 @@ package org.hyperledger.besu.ethereum.core.encoding.registry;
import org.apache.tuweni.bytes.Bytes;
import org.hyperledger.besu.ethereum.core.Transaction;
public interface TransactionDecoder extends RLPDecoder<Transaction> {
public interface TransactionDecoder extends RlpDecoder<Transaction> {
Transaction decodeOpaqueBytes(Bytes bytes);
}

@ -3,7 +3,7 @@ package org.hyperledger.besu.ethereum.core.encoding.registry;
import org.apache.tuweni.bytes.Bytes;
import org.hyperledger.besu.ethereum.core.Transaction;
public interface TransactionEncoder extends RLPEncoder<Transaction> {
public interface TransactionEncoder extends RlpEncoder<Transaction> {
Bytes encodeOpaqueBytes(
final Transaction transaction);

@ -1,22 +0,0 @@
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.rlp.RLPOutput;
public class TransactionEncoderProvider{
private TransactionEncoderProvider(){}
public static void writeTo(Transaction transaction, RLPOutput output) {
getEncoder().writeTo(transaction, output);
}
public static Bytes encodeOpaqueBytes(Transaction transaction){
return getEncoder().encodeOpaqueBytes(transaction);
}
private static
TransactionEncoder getEncoder(){
return RLPRegistry.getInstance().getTransactionEncoder();
}
}

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

@ -17,7 +17,7 @@ package org.hyperledger.besu.ethereum.core;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
@ -35,7 +35,7 @@ public class TransactionIntegrationTest {
"0xf902560c843b9aca00832dc6c08080b90202608060405234801561001057600080fd5b506040516020806101e283398101604052516000556101ae806100346000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632113522a81146100715780632a1afcd9146100af5780633bc5de30146100d657806360fe47b1146100eb578063db613e8114610105575b600080fd5b34801561007d57600080fd5b5061008661011a565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100bb57600080fd5b506100c4610136565b60408051918252519081900360200190f35b3480156100e257600080fd5b506100c461013c565b3480156100f757600080fd5b50610103600435610142565b005b34801561011157600080fd5b50610086610166565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b60005490565b6000556001805473ffffffffffffffffffffffffffffffffffffffff191633179055565b60015473ffffffffffffffffffffffffffffffffffffffff16905600a165627a7a723058208293fac83e9cc01039adf5e41eefd557d1324a3a4c830a4802fa1dd2515227a20029000000000000000000000000000000000000000000000000000000000000007b820fe8a009e7b69af4c318e7fb915f53649bd9f99e5423d41c2cd6a01ab69bb34a951b2fa01b5d39b7c9041ec022d13e6e89eec2cddbe27572eda7956ada5de1032cd5da15";
final Bytes encoded = Bytes.fromHexString(encodedString);
final RLPInput input = RLP.input(encoded);
final Transaction transaction = TransactionDecoderProvider.readFrom(input);
final Transaction transaction = RlpTransactionProvider.readFrom(input);
assertThat(transaction).isNotNull();
assertThat(transaction.isContractCreation()).isTrue();
assertThat(transaction.getChainId()).contains(BigInteger.valueOf(2018));
@ -49,7 +49,7 @@ public class TransactionIntegrationTest {
"0xf9025780843b9aca00832dc6c08080b90202608060405234801561001057600080fd5b506040516020806101e283398101604052516000556101ae806100346000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632113522a81146100715780632a1afcd9146100af5780633bc5de30146100d657806360fe47b1146100eb578063db613e8114610105575b600080fd5b34801561007d57600080fd5b5061008661011a565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100bb57600080fd5b506100c4610136565b60408051918252519081900360200190f35b3480156100e257600080fd5b506100c461013c565b3480156100f757600080fd5b50610103600435610142565b005b34801561011157600080fd5b50610086610166565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b60005490565b6000556001805473ffffffffffffffffffffffffffffffffffffffff191633179055565b60015473ffffffffffffffffffffffffffffffffffffffff16905600a165627a7a723058208293fac83e9cc01039adf5e41eefd557d1324a3a4c830a4802fa1dd2515227a20029000000000000000000000000000000000000000000000000000000000000000c830628cba0482ba9b1136cd9337408938eea6b991fd153900a014867da2f4bb113d4003888a00c5a2f8f279fe2c86831afb5c9578dd1c3be457e3aca3abe439b1a5dd122e676";
final Bytes encoded = Bytes.fromHexString(encodedString);
final RLPInput input = RLP.input(encoded);
final Transaction transaction = TransactionDecoderProvider.readFrom(input);
final Transaction transaction = RlpTransactionProvider.readFrom(input);
assertThat(transaction.encoded().toString()).isEqualTo(encodedString);
}
@ -59,7 +59,7 @@ public class TransactionIntegrationTest {
"0xf86a018609184e72a0008276c094d30c3d13b07029deba00de1da369cd69a02c20560180850100000021a07d344f26d7329e8932d2878b99f07b12752bbd13a0b3b822644dbf9600fe718da01d6e6b6c66e1aadf4e33e318a7eef03d3bd3602de52662f0cb5af5b372d44dcd";
final Bytes encoded = Bytes.fromHexString(encodedString);
final RLPInput input = RLP.input(encoded);
final Transaction transaction = TransactionDecoderProvider.readFrom(input);
final Transaction transaction = RlpTransactionProvider.readFrom(input);
assertThat(transaction).isNotNull();
assertThat(transaction.isContractCreation()).isFalse();
assertThat(transaction.getChainId()).contains(BigInteger.valueOf(2147483647));

@ -17,10 +17,9 @@ package org.hyperledger.besu.ethereum.core.encoding;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
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.rlp.BytesValueRLPOutput;
import java.io.BufferedReader;
@ -62,13 +61,13 @@ public class BlobTransactionEncodingTest {
Bytes bytes = argument.bytes;
// Decode the transaction from the wire using the TransactionDecoder.
final Transaction transaction =
PooledTransactionDecoderProvider.decodeOpaqueBytes(bytes);
RlpPooledTransactionProvider.decodeOpaqueBytes(bytes);
final BytesValueRLPOutput output = new BytesValueRLPOutput();
new MainnetTransactionEncoder().encodeRLP(transaction.getType(), bytes, output);
final BytesValueRLPOutput bytesValueRLPOutput = new BytesValueRLPOutput();
PooledTransactionEncoderProvider.writeTo(
RlpPooledTransactionProvider.writeTo(
transaction, bytesValueRLPOutput);
assertThat(transaction.getSize()).isEqualTo(bytes.size());
}
@ -79,10 +78,10 @@ public class BlobTransactionEncodingTest {
Bytes bytes = argument.bytes;
// Decode the transaction from the wire using the TransactionDecoder.
final Transaction transaction =
TransactionDecoderProvider.decodeOpaqueBytes(bytes);
RlpTransactionProvider.decodeOpaqueBytes(bytes);
// Encode the transaction for wire using the TransactionEncoder.
Bytes encoded = TransactionEncoderProvider.encodeOpaqueBytes(transaction);
Bytes encoded = RlpTransactionProvider.encodeOpaqueBytes(transaction);
// Assert that the encoded transaction matches the original bytes.
assertThat(encoded.toHexString()).isEqualTo(bytes.toHexString());

@ -23,9 +23,9 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue;
import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
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.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPException;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
@ -72,7 +72,7 @@ class TransactionRLPDecoderTest {
"0x02f84e0101a1648a5f8b2dcad5ea5ba6b720ff069c1d87c21a4a6a5b3766b39e2c2792367bb066a1ffa5ffaf5b0560d3a9fb186c2ede2ae6751bc0b4fef9107cf36389630b6196a38805800180c0010203";
assertThatThrownBy(
() ->
TransactionDecoderProvider.decodeOpaqueBytes(
RlpTransactionProvider.decodeOpaqueBytes(
Bytes.fromHexString(txWithBigFees)))
.isInstanceOf(RLPException.class);
}
@ -119,7 +119,7 @@ class TransactionRLPDecoderTest {
// Decode bytes into a transaction
final Transaction transaction = decodeRLP(RLP.input(bytes));
Bytes transactionBytes =
PooledTransactionEncoderProvider.encodeOpaqueBytes(transaction);
RlpPooledTransactionProvider.encodeOpaqueBytes(transaction);
// Bytes size should be equal to transaction size
assertThat(transaction.getSize()).isEqualTo(transactionBytes.size());
}
@ -157,6 +157,6 @@ class TransactionRLPDecoderTest {
}
private Transaction decodeRLP(final RLPInput input) {
return PooledTransactionDecoderProvider.readFrom(input);
return RlpPooledTransactionProvider.readFrom(input);
}
}

@ -22,8 +22,7 @@ import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import org.hyperledger.besu.ethereum.rlp.RLP;
@ -91,10 +90,10 @@ class TransactionRLPEncoderTest {
}
private Transaction decodeRLP(final RLPInput input) {
return TransactionDecoderProvider.readFrom(input);
return RlpTransactionProvider.readFrom(input);
}
private void encodeRLP(final Transaction transaction, final BytesValueRLPOutput output) {
TransactionEncoderProvider.writeTo(transaction, output);
RlpTransactionProvider.writeTo(transaction, output);
}
}

@ -17,7 +17,7 @@ package org.hyperledger.besu.ethereum.mainnet;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.evm.gascalculator.FrontierGasCalculator;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
@ -89,7 +89,7 @@ public class IntrinsicGasTest {
@MethodSource("data")
public void validateGasCost(
final GasCalculator gasCalculator, final long expectedGas, final String txRlp) {
Transaction t = TransactionDecoderProvider.readFrom(RLP.input(Bytes.fromHexString(txRlp)));
Transaction t = RlpTransactionProvider.readFrom(RLP.input(Bytes.fromHexString(txRlp)));
Assertions.assertThat(
gasCalculator.transactionIntrinsicGasCost(t.getPayload(), t.isContractCreation()))
.isEqualTo(expectedGas);

@ -19,7 +19,7 @@ import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
@ -52,7 +52,7 @@ public final class ValidationTestUtils {
false);
input.enterList();
input.skipNext();
final List<Transaction> transactions = input.readList(TransactionDecoderProvider::readFrom);
final List<Transaction> transactions = input.readList(RlpTransactionProvider::readFrom);
final List<BlockHeader> ommers =
input.readList(rlp -> BlockHeader.readFrom(rlp, new MainnetBlockHeaderFunctions()));
final Optional<List<Withdrawal>> withdrawals =

@ -24,7 +24,7 @@ import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.Util;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.privacy.PrivateTransaction;
import java.util.Optional;
@ -65,7 +65,7 @@ public class FixedKeySigningPrivateMarkerTransactionFactoryTest {
.build();
final Transaction transaction =
TransactionDecoderProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
RlpTransactionProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
assertThat(transaction.getNonce()).isEqualTo(providedNonce);
assertThat(transaction.getGasLimit()).isEqualTo(gasLimit);
@ -77,7 +77,7 @@ public class FixedKeySigningPrivateMarkerTransactionFactoryTest {
assertThat(transaction.getPayload()).isEqualTo(Bytes.fromBase64String(enclaveKey));
final Transaction nextTransaction =
TransactionDecoderProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
RlpTransactionProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
assertThat(nextTransaction.getSender()).isEqualTo(transaction.getSender());
}
}

@ -21,7 +21,7 @@ import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.privacy.PrivateTransaction;
import java.util.Optional;
@ -61,7 +61,7 @@ public class RandomSigningPrivateMarkerTransactionFactoryTest {
new RandomSigningPrivateMarkerTransactionFactory();
final Transaction transaction =
TransactionDecoderProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
RlpTransactionProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
assertThat(transaction.getNonce()).isEqualTo(0);
assertThat(transaction.getGasLimit()).isEqualTo(gasLimit);
@ -71,7 +71,7 @@ public class RandomSigningPrivateMarkerTransactionFactoryTest {
assertThat(transaction.getPayload()).isEqualTo(Bytes.fromBase64String(enclaveKey));
final Transaction nextTransaction =
TransactionDecoderProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
RlpTransactionProvider.readFrom(factory.create(unsignedPrivateMarkerTransaction, privTransaction, ""));
assertThat(nextTransaction.getSender()).isNotEqualTo(transaction.getSender());
}
}

@ -20,7 +20,7 @@ import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
@ -99,7 +99,7 @@ public class RawBlockIteratorTest {
final BytesValueRLPOutput out = new BytesValueRLPOutput();
out.startList();
block.getHeader().writeTo(out);
out.writeList(block.getBody().getTransactions(), TransactionEncoderProvider::writeTo);
out.writeList(block.getBody().getTransactions(), RlpTransactionProvider::writeTo);
out.writeList(block.getBody().getOmmers(), BlockHeader::writeTo);
out.endList();
return out.encoded().toArray();

@ -20,7 +20,7 @@ import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.messages.BlockBodiesMessage;
@ -273,7 +273,7 @@ class EthServer {
}
final BytesValueRLPOutput txRlp = new BytesValueRLPOutput();
PooledTransactionEncoderProvider.writeTo(maybeTx.get(), txRlp);
RlpPooledTransactionProvider.writeTo(maybeTx.get(), txRlp);
final int encodedSize = txRlp.encodedSize();
if (responseSizeEstimate + encodedSize > maxMessageSize) {
break;

@ -15,9 +15,9 @@
package org.hyperledger.besu.ethereum.eth.messages;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionDecoderProvider;
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.MessageData;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPInput;
@ -45,7 +45,7 @@ public final class PooledTransactionsMessage extends AbstractMessageData {
final BytesValueRLPOutput out = new BytesValueRLPOutput();
out.writeList(
transactions,
PooledTransactionEncoderProvider::writeTo);
RlpPooledTransactionProvider::writeTo);
return new PooledTransactionsMessage(out.encoded());
}
@ -78,7 +78,7 @@ public final class PooledTransactionsMessage extends AbstractMessageData {
final BytesValueRLPInput in = new BytesValueRLPInput(getData(), false);
pooledTransactions =
in.readList(
PooledTransactionDecoderProvider::readFrom);
RlpPooledTransactionProvider::readFrom);
}
return pooledTransactions;
}

@ -15,8 +15,7 @@
package org.hyperledger.besu.ethereum.eth.messages;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.AbstractMessageData;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPInput;
@ -44,7 +43,7 @@ public class TransactionsMessage extends AbstractMessageData {
final BytesValueRLPOutput tmp = new BytesValueRLPOutput();
tmp.startList();
for (final Transaction transaction : transactions) {
TransactionEncoderProvider.writeTo(transaction, tmp);
RlpTransactionProvider.writeTo(transaction, tmp);
}
tmp.endList();
return new TransactionsMessage(tmp.encoded());
@ -60,6 +59,6 @@ public class TransactionsMessage extends AbstractMessageData {
}
public List<Transaction> transactions() {
return new BytesValueRLPInput(data, false).readList(TransactionDecoderProvider::readFrom);
return new BytesValueRLPInput(data, false).readList(RlpTransactionProvider::readFrom);
}
}

@ -31,7 +31,7 @@ import org.hyperledger.besu.ethereum.chain.BlockAddedObserver;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.eth.manager.EthContext;
import org.hyperledger.besu.ethereum.eth.manager.EthPeer;
import org.hyperledger.besu.ethereum.eth.manager.EthScheduler;
@ -841,7 +841,7 @@ public class TransactionPool implements BlockAddedObserver {
line -> {
final boolean isLocal = line.charAt(0) == 'l';
final Transaction tx =
TransactionDecoderProvider.readFrom(Bytes.fromBase64String(line.substring(1)));
RlpTransactionProvider.readFrom(Bytes.fromBase64String(line.substring(1)));
final ValidationResult<TransactionInvalidReason> result =
addTransaction(tx, isLocal);

@ -28,7 +28,7 @@ import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.messages.BlockBodiesMessage;
import org.hyperledger.besu.ethereum.eth.messages.BlockHeadersMessage;
@ -388,7 +388,7 @@ public class EthServerTest {
}
private int calculateRlpEncodedSize(final Transaction tx) {
return RLP.encode(output -> TransactionEncoderProvider.writeTo(tx, output)).size();
return RLP.encode(output -> RlpTransactionProvider.writeTo(tx, output)).size();
}
private int calculateRlpEncodedSize(final Bytes data) {

@ -22,7 +22,7 @@ import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions;
import org.hyperledger.besu.ethereum.core.MiningConfiguration;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
@ -83,7 +83,7 @@ public final class BlockBodiesMessageTest {
bodies.add(
// We know the test data to only contain Frontier blocks
new BlockBody(
oneBlock.readList(TransactionDecoderProvider::readFrom),
oneBlock.readList(RlpTransactionProvider::readFrom),
oneBlock.readList(
rlp -> BlockHeader.readFrom(rlp, new MainnetBlockHeaderFunctions()))));
}

@ -24,11 +24,10 @@ import org.hyperledger.besu.datatypes.TransactionType;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionTestFixture;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpPooledTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.PooledTransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
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.rlp.BytesValueRLPInput;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
@ -75,9 +74,9 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
Transaction txTo =
preparedTx.to(Optional.of(Address.extract(Bytes32.random()))).createTransaction(KEYS1);
BytesValueRLPOutput rlpOut = new BytesValueRLPOutput();
TransactionEncoderProvider.writeTo(txTo, rlpOut);
RlpTransactionProvider.writeTo(txTo, rlpOut);
txTo = TransactionDecoderProvider.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.getHash());
System.out.println(txTo.getSize());
@ -121,7 +120,7 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
Transaction txPayload = preparedTx.createTransaction(KEYS1);
txPayload =
TransactionDecoderProvider.readFrom(new BytesValueRLPInput(txPayload.encoded(), false)).detachedCopy();
RlpTransactionProvider.readFrom(new BytesValueRLPInput(txPayload.encoded(), false)).detachedCopy();
System.out.println(txPayload.getSender());
System.out.println(txPayload.getHash());
System.out.println(txPayload.getSize());
@ -210,10 +209,10 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
prepareTransaction(TransactionType.BLOB, 10, Wei.of(500), Wei.of(50), 10, 1);
Transaction txBlob = preparedTx.createTransaction(KEYS1);
BytesValueRLPOutput rlpOut = new BytesValueRLPOutput();
PooledTransactionEncoderProvider.writeTo(txBlob, rlpOut);
RlpPooledTransactionProvider.writeTo(txBlob, rlpOut);
txBlob =
PooledTransactionDecoderProvider.readFrom(
RlpPooledTransactionProvider.readFrom(
new BytesValueRLPInput(rlpOut.encoded(), false))
.detachedCopy();
System.out.println(txBlob.getSender());
@ -242,10 +241,10 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
prepareTransaction(TransactionType.BLOB, 10, Wei.of(500), Wei.of(50), 10, 1);
Transaction txBlob = preparedTx.createTransaction(KEYS1);
BytesValueRLPOutput rlpOut = new BytesValueRLPOutput();
PooledTransactionEncoderProvider.writeTo(txBlob, rlpOut);
RlpPooledTransactionProvider.writeTo(txBlob, rlpOut);
txBlob =
PooledTransactionDecoderProvider.readFrom(
RlpPooledTransactionProvider.readFrom(
new BytesValueRLPInput(rlpOut.encoded(), false))
.detachedCopy();
System.out.println(txBlob.getSender());
@ -272,7 +271,7 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
Transaction txPayload = preparedTx.createTransaction(KEYS1);
txPayload =
TransactionDecoderProvider.readFrom(new BytesValueRLPInput(txPayload.encoded(), false)).detachedCopy();
RlpTransactionProvider.readFrom(new BytesValueRLPInput(txPayload.encoded(), false)).detachedCopy();
System.out.println(txPayload.getSender());
System.out.println(txPayload.getHash());
System.out.println(txPayload.getSize());
@ -302,7 +301,7 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
Transaction txAccessList = preparedTx.accessList(ales).createTransaction(KEYS1);
txAccessList =
TransactionDecoderProvider.readFrom(new BytesValueRLPInput(txAccessList.encoded(), false)).detachedCopy();
RlpTransactionProvider.readFrom(new BytesValueRLPInput(txAccessList.encoded(), false)).detachedCopy();
System.out.println(txAccessList.getSender());
System.out.println(txAccessList.getHash());
System.out.println(txAccessList.getSize());
@ -342,7 +341,7 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
Transaction txEip1559 = createEIP1559Transaction(1, KEYS1, 10);
txEip1559 =
TransactionDecoderProvider.readFrom(new BytesValueRLPInput(txEip1559.encoded(), false)).detachedCopy();
RlpTransactionProvider.readFrom(new BytesValueRLPInput(txEip1559.encoded(), false)).detachedCopy();
System.out.println(txEip1559.getSender());
System.out.println(txEip1559.getHash());
System.out.println(txEip1559.getSize());
@ -384,7 +383,7 @@ public class PendingTransactionEstimatedMemorySizeTest extends BaseTransactionPo
Transaction txFrontier = createTransaction(TransactionType.FRONTIER, 1, Wei.of(500), 0, KEYS1);
txFrontier =
TransactionDecoderProvider.readFrom(new BytesValueRLPInput(txFrontier.encoded(), false)).detachedCopy();
RlpTransactionProvider.readFrom(new BytesValueRLPInput(txFrontier.encoded(), false)).detachedCopy();
System.out.println(txFrontier.getSender());
System.out.println(txFrontier.getHash());
System.out.println(txFrontier.getSize());

@ -27,7 +27,7 @@ import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.MiningConfiguration;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.eth.manager.EthScheduler;
import org.hyperledger.besu.ethereum.eth.transactions.BlobCache;
import org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration;
@ -295,7 +295,7 @@ public class ReplayTest {
final LayeredPendingTransactions pendingTransactions,
final AbstractPrioritizedTransactions prioritizedTransactions) {
final Bytes rlp = Bytes.fromHexString(commaSplit[commaSplit.length - 1]);
final Transaction tx = TransactionDecoderProvider.readFrom(rlp);
final Transaction tx = RlpTransactionProvider.readFrom(rlp);
final Account mockAccount = mock(Account.class);
final long nonce = Long.parseLong(commaSplit[4]);
when(mockAccount.getNonce()).thenReturn(nonce);
@ -319,7 +319,7 @@ public class ReplayTest {
private void processInvalid(
final String[] commaSplit, final AbstractPrioritizedTransactions prioritizedTransactions) {
final Bytes rlp = Bytes.fromHexString(commaSplit[commaSplit.length - 1]);
final Transaction tx = TransactionDecoderProvider.readFrom(rlp);
final Transaction tx = RlpTransactionProvider.readFrom(rlp);
if (tx.getSender().equals(senderToLog)) {
LOG.warn("D {}, Before {}", tx.getNonce(), prioritizedTransactions.logSender(senderToLog));
}

@ -37,8 +37,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.mainnet.BodyValidation;
import org.hyperledger.besu.ethereum.mainnet.MainnetTransactionProcessor;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
@ -142,13 +141,13 @@ public class T8nExecutor {
new BytesValueRLPInput(Bytes.fromHexString(txNode.asText()), false);
rlpInput.enterList();
while (!rlpInput.isEndOfCurrentList()) {
Transaction tx = TransactionDecoderProvider.readFrom(rlpInput);
Transaction tx = RlpTransactionProvider.readFrom(rlpInput);
transactions.add(tx);
}
} else if (txNode.isObject()) {
if (txNode.has("txBytes")) {
Transaction tx =
TransactionDecoderProvider.readFrom(Bytes.fromHexString(txNode.get("txbytes").asText()));
RlpTransactionProvider.readFrom(Bytes.fromHexString(txNode.get("txbytes").asText()));
transactions.add(tx);
} else {
Transaction.Builder builder = Transaction.builder();
@ -617,7 +616,7 @@ public class T8nExecutor {
});
BytesValueRLPOutput rlpOut = new BytesValueRLPOutput();
rlpOut.writeList(transactions, TransactionEncoderProvider::writeTo);
rlpOut.writeList(transactions, RlpTransactionProvider::writeTo);
TextNode bodyBytes = TextNode.valueOf(rlpOut.encoded().toHexString());
return new T8nResult(allocObject, bodyBytes, resultObject);
}

@ -32,7 +32,7 @@ import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider;
import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.ParsedExtraData;
import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPInput;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
@ -286,7 +286,7 @@ public class BlockchainReferenceTestCaseSpec {
final BlockHeader header = BlockHeader.readFrom(input, blockHeaderFunctions);
final BlockBody body =
new BlockBody(
input.readList(TransactionDecoderProvider::readFrom),
input.readList(RlpTransactionProvider::readFrom),
input.readList(inputData -> BlockHeader.readFrom(inputData, blockHeaderFunctions)),
input.isEndOfCurrentList()
? Optional.empty()

@ -17,8 +17,8 @@ package org.hyperledger.besu.ethereum.core;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionEncoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.TransactionDecoderProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.core.encoding.registry.RlpTransactionProvider;
import org.hyperledger.besu.ethereum.mainnet.TransactionValidator;
import org.hyperledger.besu.ethereum.mainnet.TransactionValidationParams;
import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
@ -174,7 +174,7 @@ public class TransactionTest {
}
// Test transaction deserialization (will throw an exception if it fails).
final Transaction transaction = TransactionDecoderProvider.readFrom(RLP.input(rlp));
final Transaction transaction = RlpTransactionProvider.readFrom(RLP.input(rlp));
final ValidationResult<TransactionInvalidReason> validation =
transactionValidator(milestone)
.validate(transaction, baseFee, Optional.empty(), TransactionValidationParams.processingBlock());
@ -185,7 +185,7 @@ public class TransactionTest {
}
// Test rlp encoding
final Bytes actualRlp = RLP.encode(output -> TransactionEncoderProvider.writeTo(transaction, output));
final Bytes actualRlp = RLP.encode(output -> RlpTransactionProvider.writeTo(transaction, output));
assertThat(expected.isSucceeds())
.withFailMessage("Transaction " + name + "/" + milestone + " was supposed to be invalid")
.isTrue();

Loading…
Cancel
Save