Search in sources :

Example 1 with EthereumTransaction

use of com.hedera.mirror.common.domain.transaction.EthereumTransaction in project hedera-mirror-node by hashgraph.

the class EthereumTransactionRepositoryTest method saveFileId.

@Test
void saveFileId() {
    EthereumTransaction ethereumTransaction = domainBuilder.ethereumTransaction(false).persist();
    assertThat(ethereumTransactionRepository.findById(ethereumTransaction.getId())).get().usingRecursiveComparison().ignoringFields("callDataId.type").isEqualTo(ethereumTransaction);
}
Also used : EthereumTransaction(com.hedera.mirror.common.domain.transaction.EthereumTransaction) Test(org.junit.jupiter.api.Test)

Example 2 with EthereumTransaction

use of com.hedera.mirror.common.domain.transaction.EthereumTransaction in project hedera-mirror-node by hashgraph.

the class EthereumTransactionRepositoryTest method saveInitCode.

@Test
void saveInitCode() {
    EthereumTransaction ethereumTransaction = domainBuilder.ethereumTransaction(true).persist();
    assertThat(ethereumTransactionRepository.findById(ethereumTransaction.getId())).get().usingRecursiveComparison().ignoringFields("callDataId.type").isEqualTo(ethereumTransaction);
}
Also used : EthereumTransaction(com.hedera.mirror.common.domain.transaction.EthereumTransaction) Test(org.junit.jupiter.api.Test)

Example 3 with EthereumTransaction

use of com.hedera.mirror.common.domain.transaction.EthereumTransaction in project hedera-mirror-node by hashgraph.

the class LegacyEthereumTransactionParserTest method eip155Decode.

@SneakyThrows
@Test
void eip155Decode() {
    var ethereumTransaction = ethereumTransactionParser.decode(Hex.decodeHex(EIP155_RAW_TX));
    assertThat(ethereumTransaction).isNotNull().satisfies(t -> assertThat(t.getType()).isZero()).satisfies(t -> assertThat(Hex.encodeHexString(t.getChainId())).isEqualTo("01")).satisfies(t -> assertThat(t.getNonce()).isEqualTo(9)).satisfies(t -> assertThat(Hex.encodeHexString(t.getGasPrice())).isEqualTo("04a817c800")).satisfies(t -> assertThat(t.getMaxPriorityFeePerGas()).isNull()).satisfies(t -> assertThat(t.getMaxFeePerGas()).isNull()).satisfies(t -> assertThat(t.getGasLimit()).isEqualTo(21_000L)).satisfies(t -> assertThat(Hex.encodeHexString(t.getToAddress())).isEqualTo("3535353535353535353535353535353535353535")).satisfies(t -> assertThat(t.getValue()).isEqualTo(new BigInteger("0de0b6b3a7640000", 16).toByteArray())).satisfies(t -> assertThat(t.getCallData()).isEmpty()).satisfies(t -> assertThat(t.getAccessList()).isNull()).satisfies(t -> assertThat(t.getRecoveryId()).isZero()).satisfies(t -> assertThat(Hex.encodeHexString(t.getSignatureV())).isEqualTo("25")).satisfies(t -> assertThat(Hex.encodeHexString(t.getSignatureR())).isEqualTo("28ef61340bd939bc2195fe537567866003e1a15d3c71ff63e1590620aa636276")).satisfies(t -> assertThat(Hex.encodeHexString(t.getSignatureS())).isEqualTo("67cbe9d8997f761aecb703304b3800ccf555c9f3dc64214b297fb1966a3b6d83"));
}
Also used : Test(org.junit.jupiter.api.Test) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) SneakyThrows(lombok.SneakyThrows) BeforeAll(org.junit.jupiter.api.BeforeAll) InvalidEthereumBytesException(com.hedera.mirror.importer.exception.InvalidEthereumBytesException) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Integers(com.esaulpaugh.headlong.util.Integers) RLPEncoder(com.esaulpaugh.headlong.rlp.RLPEncoder) BigInteger(java.math.BigInteger) Hex(org.apache.commons.codec.binary.Hex) EthereumTransaction(com.hedera.mirror.common.domain.transaction.EthereumTransaction) BigInteger(java.math.BigInteger) Test(org.junit.jupiter.api.Test) SneakyThrows(lombok.SneakyThrows)

Aggregations

EthereumTransaction (com.hedera.mirror.common.domain.transaction.EthereumTransaction)3 Test (org.junit.jupiter.api.Test)3 RLPEncoder (com.esaulpaugh.headlong.rlp.RLPEncoder)1 Integers (com.esaulpaugh.headlong.util.Integers)1 InvalidEthereumBytesException (com.hedera.mirror.importer.exception.InvalidEthereumBytesException)1 BigInteger (java.math.BigInteger)1 SneakyThrows (lombok.SneakyThrows)1 Hex (org.apache.commons.codec.binary.Hex)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1