Search in sources :

Example 11 with AionTxReceipt

use of org.aion.zero.types.AionTxReceipt in project aion by aionnetwork.

the class AionTxExecSummaryTest method testRLPEncoding.

@Test
public void testRLPEncoding() {
    AionTransaction mockTx = new AionTransaction(BigInteger.ONE.toByteArray(), defaultAddress, defaultAddress, BigInteger.ONE.toByteArray(), HashUtil.EMPTY_DATA_HASH, 1L, 1L);
    AionTxReceipt txReceipt = new AionTxReceipt(HashUtil.EMPTY_TRIE_HASH, new Bloom(), Collections.EMPTY_LIST);
    txReceipt.setNrgUsed(1);
    txReceipt.setTransaction(mockTx);
    AionTxExecSummary.Builder builder = AionTxExecSummary.builderFor(txReceipt);
    builder.markAsFailed().result(new byte[0]);
    AionTxExecSummary summary = builder.build();
    byte[] encodedSummary = summary.getEncoded();
    AionTxExecSummary newSummary = new AionTxExecSummary(encodedSummary);
    newSummary.getReceipt().setTransaction(mockTx);
    assertThat(newSummary.getFee()).isEqualTo(BigInteger.ONE);
}
Also used : Bloom(org.aion.mcf.vm.types.Bloom) AionTxExecSummary(org.aion.zero.types.AionTxExecSummary) AionTransaction(org.aion.zero.types.AionTransaction) AionTxReceipt(org.aion.zero.types.AionTxReceipt) Test(org.junit.Test)

Aggregations

AionTxReceipt (org.aion.zero.types.AionTxReceipt)11 AionTransaction (org.aion.zero.types.AionTransaction)6 ByteArrayWrapper (org.aion.base.util.ByteArrayWrapper)3 Bloom (org.aion.mcf.vm.types.Bloom)3 Log (org.aion.mcf.vm.types.Log)3 AionBlock (org.aion.zero.impl.types.AionBlock)2 AionBlockSummary (org.aion.zero.impl.types.AionBlockSummary)2 AionTxInfo (org.aion.zero.impl.types.AionTxInfo)2 Test (org.junit.Test)2 ByteString (com.google.protobuf.ByteString)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 BigInteger (java.math.BigInteger)1 ByteBuffer (java.nio.ByteBuffer)1 java.util (java.util)1 ArrayList (java.util.ArrayList)1 Entry (java.util.Map.Entry)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 Collectors (java.util.stream.Collectors)1 LongStream (java.util.stream.LongStream)1 ApiAion (org.aion.api.server.ApiAion)1