Search in sources :

Example 26 with Transaction

use of org.hyperledger.besu.ethereum.core.Transaction in project besu by hyperledger.

the class TransactionDecoderTest method decodeEIP1559NominalCase.

@Test
void decodeEIP1559NominalCase() {
    final Transaction transaction = TransactionDecoder.decodeForWire(RLP.input(Bytes.fromHexString(EIP1559_TX_RLP)));
    assertThat(transaction).isNotNull();
    assertThat(transaction.getMaxPriorityFeePerGas()).hasValue(Wei.of(2L));
    assertThat(transaction.getMaxFeePerGas()).hasValue(Wei.of(new BigInteger("5000000000", 10)));
}
Also used : Transaction(org.hyperledger.besu.ethereum.core.Transaction) BigInteger(java.math.BigInteger) Test(org.junit.jupiter.api.Test)

Example 27 with Transaction

use of org.hyperledger.besu.ethereum.core.Transaction in project besu by hyperledger.

the class TransactionDecoderTest method shouldDecodeWithHighNonce.

@Test
void shouldDecodeWithHighNonce() {
    final Transaction transaction = TransactionDecoder.decodeForWire(RLP.input(Bytes.fromHexString(NONCE_64_BIT_MAX_MINUS_2_TX_RLP)));
    assertThat(transaction).isNotNull();
    assertThat(transaction.getNonce()).isEqualTo(MAX_NONCE - 1);
}
Also used : Transaction(org.hyperledger.besu.ethereum.core.Transaction) Test(org.junit.jupiter.api.Test)

Example 28 with Transaction

use of org.hyperledger.besu.ethereum.core.Transaction in project besu by hyperledger.

the class TransactionDecoderTest method decodeGoQuorumPrivateTransactionRlp.

@Test
void decodeGoQuorumPrivateTransactionRlp() {
    boolean goQuorumCompatibilityMode = true;
    RLPInput input = RLP.input(Bytes.fromHexString(GOQUORUM_PRIVATE_TX_RLP));
    final Transaction transaction = TransactionDecoder.decodeForWire(input, goQuorumCompatibilityMode);
    assertThat(transaction).isNotNull();
    assertThat(transaction.getV()).isEqualTo(38);
    assertThat(transaction.getSender()).isEqualByComparingTo(Address.fromHexString("0xed9d02e382b34818e88b88a309c7fe71e65f419d"));
}
Also used : RLPInput(org.hyperledger.besu.ethereum.rlp.RLPInput) Transaction(org.hyperledger.besu.ethereum.core.Transaction) Test(org.junit.jupiter.api.Test)

Example 29 with Transaction

use of org.hyperledger.besu.ethereum.core.Transaction in project besu by hyperledger.

the class TransactionEncoderTest method shouldEncodeWithHighNonce.

@Test
void shouldEncodeWithHighNonce() {
    final Transaction transaction = TransactionDecoder.decodeForWire(RLP.input(Bytes.fromHexString(NONCE_64_BIT_MAX_MINUS_2_TX_RLP)));
    final BytesValueRLPOutput output = new BytesValueRLPOutput();
    TransactionEncoder.encodeForWire(transaction, output);
    assertThat(output.encoded().toHexString()).isEqualTo(NONCE_64_BIT_MAX_MINUS_2_TX_RLP);
}
Also used : Transaction(org.hyperledger.besu.ethereum.core.Transaction) BytesValueRLPOutput(org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput) Test(org.junit.jupiter.api.Test)

Example 30 with Transaction

use of org.hyperledger.besu.ethereum.core.Transaction in project besu by hyperledger.

the class AccountLocalConfigPermissioningControllerTest method isPermittedShouldReturnFalseIfTransactionDoesNotContainSender.

@Test
public void isPermittedShouldReturnFalseIfTransactionDoesNotContainSender() {
    final Transaction transactionWithoutSender = mock(Transaction.class);
    when(transactionWithoutSender.getSender()).thenReturn(null);
    verifyCountersUntouched();
    boolean permitted = controller.isPermitted(transactionWithoutSender);
    assertThat(permitted).isFalse();
    verifyCountersUnpermitted();
}
Also used : Transaction(org.hyperledger.besu.ethereum.core.Transaction) Test(org.junit.Test)

Aggregations

Transaction (org.hyperledger.besu.ethereum.core.Transaction)249 Test (org.junit.Test)149 ArrayList (java.util.ArrayList)57 BlockHeader (org.hyperledger.besu.ethereum.core.BlockHeader)45 TransactionTestFixture (org.hyperledger.besu.ethereum.core.TransactionTestFixture)45 Optional (java.util.Optional)42 Hash (org.hyperledger.besu.datatypes.Hash)38 Wei (org.hyperledger.besu.datatypes.Wei)38 Block (org.hyperledger.besu.ethereum.core.Block)35 List (java.util.List)33 Address (org.hyperledger.besu.datatypes.Address)33 Account (org.hyperledger.besu.evm.account.Account)29 TransactionInvalidReason (org.hyperledger.besu.ethereum.transaction.TransactionInvalidReason)28 TransactionReceipt (org.hyperledger.besu.ethereum.core.TransactionReceipt)26 Bytes (org.apache.tuweni.bytes.Bytes)24 BlockBody (org.hyperledger.besu.ethereum.core.BlockBody)22 MiningParameters (org.hyperledger.besu.ethereum.core.MiningParameters)22 TransactionValidationParams (org.hyperledger.besu.ethereum.mainnet.TransactionValidationParams)22 KeyPair (org.hyperledger.besu.crypto.KeyPair)21 EthContext (org.hyperledger.besu.ethereum.eth.manager.EthContext)20