use of org.ethereum.core.TransactionReceipt in project rskj by rsksmart.
the class ReceiptStoreImplTest method addTwoTransactionsAndGetTransactionBySecondBlock.
@Test
public void addTwoTransactionsAndGetTransactionBySecondBlock() {
TransactionReceipt receipt0 = createReceipt();
Keccak256 blockHash0 = new Keccak256("0102030405060708090000000000000000000000000000000000000000000000");
store.add(blockHash0.getBytes(), 3, receipt0);
TransactionReceipt receipt = createReceipt();
Keccak256 blockHash = new Keccak256("0102030405060708000000000000000000000000000000000000000000000000");
store.add(blockHash.getBytes(), 42, receipt);
Optional<TransactionInfo> resultOpt = store.get(receipt.getTransaction().getHash().getBytes(), blockHash.getBytes());
TransactionInfo result = resultOpt.get();
Assert.assertNotNull(result.getBlockHash());
Assert.assertArrayEquals(blockHash.getBytes(), result.getBlockHash());
Assert.assertEquals(42, result.getIndex());
Assert.assertArrayEquals(receipt.getEncoded(), result.getReceipt().getEncoded());
}
use of org.ethereum.core.TransactionReceipt in project rskj by rsksmart.
the class VmDslTest method invokeRecursiveContractsUsing401Levels.
@Test
public void invokeRecursiveContractsUsing401Levels() throws FileNotFoundException, DslProcessorException {
DslParser parser = DslParser.fromResource("dsl/recursive02.txt");
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
processor.processCommands(parser);
Block block = world.getBlockByName("b02");
Assert.assertNotNull(block);
Assert.assertEquals(1, block.getTransactionsList().size());
Transaction creationTransaction = world.getTransactionByName("tx01");
Assert.assertNotNull(creationTransaction);
DataWord counterValue = world.getRepositoryLocator().snapshotAt(block.getHeader()).getStorageValue(creationTransaction.getContractAddress(), DataWord.ZERO);
Assert.assertNull(counterValue);
TransactionReceipt transactionReceipt = world.getTransactionReceiptByName("tx02");
Assert.assertNotNull(transactionReceipt);
byte[] status = transactionReceipt.getStatus();
Assert.assertNotNull(status);
Assert.assertEquals(0, status.length);
}
use of org.ethereum.core.TransactionReceipt in project rskj by rsksmart.
the class VmDslTest method invokeRecursiveContractsUsing400Levels.
@Test
public void invokeRecursiveContractsUsing400Levels() throws FileNotFoundException, DslProcessorException {
System.gc();
DslParser parser = DslParser.fromResource("dsl/recursive01.txt");
World world = new World();
WorldDslProcessor processor = new WorldDslProcessor(world);
processor.processCommands(parser);
Block block = world.getBlockByName("b02");
Assert.assertNotNull(block);
Assert.assertEquals(1, block.getTransactionsList().size());
Transaction creationTransaction = world.getTransactionByName("tx01");
Assert.assertNotNull(creationTransaction);
DataWord counterValue = world.getRepositoryLocator().snapshotAt(block.getHeader()).getStorageValue(creationTransaction.getContractAddress(), DataWord.ZERO);
Assert.assertNotNull(counterValue);
Assert.assertEquals(200, counterValue.intValue());
TransactionReceipt transactionReceipt = world.getTransactionReceiptByName("tx02");
Assert.assertNotNull(transactionReceipt);
byte[] status = transactionReceipt.getStatus();
Assert.assertNotNull(status);
Assert.assertEquals(1, status.length);
Assert.assertEquals(1, status[0]);
}
use of org.ethereum.core.TransactionReceipt in project rskj by rsksmart.
the class Blake2bEipExampleTest method runTest.
@Test
public void runTest() throws FileNotFoundException, DslProcessorException {
TestSystemProperties config = new TestSystemProperties(rawConfig -> rawConfig.withValue("blockchain.config.hardforkActivationHeights.iris300", ConfigValueFactory.fromAnyRef(0)));
World world = new World(config);
WorldDslProcessor processor = new WorldDslProcessor(world);
DslParser parser = DslParser.fromResource("dsl/blake2b/eip_152_example.txt");
processor.processCommands(parser);
TransactionReceipt tx02Receipt = world.getTransactionReceiptByName("tx02");
Assert.assertEquals(1, TransactionReceiptUtil.getEventCount(tx02Receipt, "ResultOk", null));
}
Aggregations