Search in sources :

Example 51 with LogInfo

use of org.ethereum.vm.LogInfo in project rskj by rsksmart.

the class TransactionReceipt method setLogInfoList.

public void setLogInfoList(List<LogInfo> logInfoList) {
    if (logInfoList == null) {
        return;
    }
    this.rlpEncoded = null;
    this.logInfoList = logInfoList;
    for (LogInfo loginfo : logInfoList) {
        bloomFilter.or(loginfo.getBloom());
    }
}
Also used : LogInfo(org.ethereum.vm.LogInfo)

Example 52 with LogInfo

use of org.ethereum.vm.LogInfo in project rskj by rsksmart.

the class Web3RskImplTest method web3_LogFilterElementNullData_toString.

@Test
public void web3_LogFilterElementNullData_toString() {
    LogInfo logInfo = mock(LogInfo.class);
    byte[] valueToTest = HashUtil.keccak256(new byte[] { 1 });
    Mockito.when(logInfo.getData()).thenReturn(null);
    List<DataWord> topics = new ArrayList<>();
    topics.add(DataWord.valueFromHex("c1"));
    topics.add(DataWord.valueFromHex("c2"));
    Mockito.when(logInfo.getTopics()).thenReturn(topics);
    Block block = mock(Block.class);
    Mockito.when(block.getHash()).thenReturn(new Keccak256(valueToTest));
    Mockito.when(block.getNumber()).thenReturn(1L);
    int txIndex = 1;
    Transaction tx = mock(Transaction.class);
    byte[] bytes = new byte[32];
    bytes[0] = 2;
    Mockito.when(tx.getHash()).thenReturn(new Keccak256(bytes));
    int logIdx = 5;
    LogFilterElement logFilterElement = new LogFilterElement(logInfo, block, txIndex, tx, logIdx);
    assertEquals("LogFilterElement{logIndex='0x5', blockNumber='0x1', blockHash='0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2', transactionHash='0x0200000000000000000000000000000000000000000000000000000000000000', transactionIndex='0x1', address='0x', data='0x', topics=[0x00000000000000000000000000000000000000000000000000000000000000c1, 0x00000000000000000000000000000000000000000000000000000000000000c2]}", logFilterElement.toString());
}
Also used : LogFilterElement(org.ethereum.rpc.LogFilterElement) LogInfo(org.ethereum.vm.LogInfo) Transaction(org.ethereum.core.Transaction) ArrayList(java.util.ArrayList) Block(org.ethereum.core.Block) DataWord(org.ethereum.vm.DataWord) Keccak256(co.rsk.crypto.Keccak256) Test(org.junit.Test)

Example 53 with LogInfo

use of org.ethereum.vm.LogInfo in project rskj by rsksmart.

the class Web3RskImplTest method web3_LogFilterElementNullAddress_toString.

@Test
public void web3_LogFilterElementNullAddress_toString() {
    LogInfo logInfo = mock(LogInfo.class);
    byte[] valueToTest = HashUtil.keccak256(new byte[] { 1 });
    Mockito.when(logInfo.getData()).thenReturn(valueToTest);
    List<DataWord> topics = new ArrayList<>();
    topics.add(DataWord.valueFromHex("c1"));
    topics.add(DataWord.valueFromHex("c2"));
    Mockito.when(logInfo.getTopics()).thenReturn(topics);
    Block block = mock(Block.class);
    Mockito.when(block.getHash()).thenReturn(new Keccak256(valueToTest));
    Mockito.when(block.getNumber()).thenReturn(1L);
    int txIndex = 1;
    Transaction tx = mock(Transaction.class);
    byte[] bytes = new byte[32];
    bytes[0] = 2;
    Mockito.when(tx.getHash()).thenReturn(new Keccak256(bytes));
    int logIdx = 5;
    LogFilterElement logFilterElement = new LogFilterElement(logInfo, block, txIndex, tx, logIdx);
    assertEquals("LogFilterElement{logIndex='0x5', blockNumber='0x1', blockHash='0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2', transactionHash='0x0200000000000000000000000000000000000000000000000000000000000000', transactionIndex='0x1', address='0x', data='0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2', topics=[0x00000000000000000000000000000000000000000000000000000000000000c1, 0x00000000000000000000000000000000000000000000000000000000000000c2]}", logFilterElement.toString());
}
Also used : LogFilterElement(org.ethereum.rpc.LogFilterElement) LogInfo(org.ethereum.vm.LogInfo) Transaction(org.ethereum.core.Transaction) ArrayList(java.util.ArrayList) Block(org.ethereum.core.Block) DataWord(org.ethereum.vm.DataWord) Keccak256(co.rsk.crypto.Keccak256) Test(org.junit.Test)

Example 54 with LogInfo

use of org.ethereum.vm.LogInfo in project rskj by rsksmart.

the class LogInfoTest method test_3.

// TODO #POC9
@Ignore
// rlp decode
@Test
public void test_3() {
    // LogInfo{address=f2b1a404bcb6112a0ff2c4197cb02f3de40018b3, topics=[5a360139cff27713da0fe18a2100048a7ce1b7700c953a82bc3ff011437c8c2a 588d7ddcc06c14843ea68e690dfd4ec91ba09a8ada15c5b7fa6fead9c8befe4b ], data=}
    byte[] rlp = Hex.decode("f85a94f2b1a404bcb6112a0ff2c4197cb02f3de40018b3f842a05a360139cff27713da0fe18a2100048a7ce1b7700c953a82bc3ff011437c8c2aa0588d7ddcc06c14843ea68e690dfd4ec91ba09a8ada15c5b7fa6fead9c8befe4b80");
    LogInfo logInfo = new LogInfo(rlp);
    assertEquals("f2b1a404bcb6112a0ff2c4197cb02f3de40018b3", ByteUtil.toHexString(logInfo.getAddress()));
    assertEquals("00800000000000000010000000000000000000000000002000000000000000000012000000100000000050000020000000000000000000000000000000000000", logInfo.getBloom().toString());
    assertEquals("f85a94f2b1a404bcb6112a0ff2c4197cb02f3de40018b3f842a05a360139cff27713da0fe18a2100048a7ce1b7700c953a82bc3ff011437c8c2aa0588d7ddcc06c14843ea68e690dfd4ec91ba09a8ada15c5b7fa6fead9c8befe4b80", ByteUtil.toHexString(logInfo.getEncoded()));
    logger.info("{}", logInfo);
}
Also used : LogInfo(org.ethereum.vm.LogInfo) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 55 with LogInfo

use of org.ethereum.vm.LogInfo in project rskj by rsksmart.

the class LogInfoTest method test_1.

// rlp decode
@Test
public void test_1() {
    // LogInfo{address=d5ccd26ba09ce1d85148b5081fa3ed77949417be, topics=[000000000000000000000000459d3a7595df9eba241365f4676803586d7d199c 436f696e73000000000000000000000000000000000000000000000000000000 ], data=}
    byte[] rlp = Hex.decode("f85a94d5ccd26ba09ce1d85148b5081fa3ed77949417bef842a0000000000000000000000000459d3a7595df9eba241365f4676803586d7d199ca0436f696e7300000000000000000000000000000000000000000000000000000080");
    LogInfo logInfo = new LogInfo(rlp);
    assertEquals("d5ccd26ba09ce1d85148b5081fa3ed77949417be", ByteUtil.toHexString(logInfo.getAddress()));
    assertEquals("", ByteUtil.toHexString(logInfo.getData()));
    assertEquals("000000000000000000000000459d3a7595df9eba241365f4676803586d7d199c", logInfo.getTopics().get(0).toString());
    assertEquals("436f696e73000000000000000000000000000000000000000000000000000000", logInfo.getTopics().get(1).toString());
    logger.info("{}", logInfo);
}
Also used : LogInfo(org.ethereum.vm.LogInfo) Test(org.junit.Test)

Aggregations

LogInfo (org.ethereum.vm.LogInfo)74 DataWord (org.ethereum.vm.DataWord)36 Test (org.junit.Test)35 ArrayList (java.util.ArrayList)25 CallTransaction (org.ethereum.core.CallTransaction)23 Transaction (org.ethereum.core.Transaction)17 RskAddress (co.rsk.core.RskAddress)13 BridgeEventLoggerImpl (co.rsk.peg.utils.BridgeEventLoggerImpl)12 ActivationConfigsForTest (org.ethereum.config.blockchain.upgrades.ActivationConfigsForTest)11 InternalTransaction (org.ethereum.vm.program.InternalTransaction)11 Block (org.ethereum.core.Block)9 Repository (org.ethereum.core.Repository)9 RepositoryImpl (co.rsk.db.RepositoryImpl)8 Keccak256 (co.rsk.crypto.Keccak256)7 BigInteger (java.math.BigInteger)7 ActivationConfig (org.ethereum.config.blockchain.upgrades.ActivationConfig)7 RLPList (org.ethereum.util.RLPList)6 LinkedList (java.util.LinkedList)4 RLPElement (org.ethereum.util.RLPElement)4 Coin (co.rsk.core.Coin)3