use of org.hyperledger.besu.evm.log.Log in project besu by hyperledger.
the class LogsQueryTest method multivariateTopicMatchRedundantMultivariateQueryReturnTrue.
@Test
public void multivariateTopicMatchRedundantMultivariateQueryReturnTrue() {
final Address address = Address.fromHexString("0x1111111111111111111111111111111111111111");
final LogTopic topic1 = LogTopic.fromHexString("0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
final LogTopic topic2 = LogTopic.fromHexString("0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
final LogTopic topic3 = LogTopic.fromHexString("0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc");
final List<LogTopic> logTopics = new ArrayList<>();
logTopics.add(topic1);
logTopics.add(topic3);
final List<LogTopic> queryTopics1 = new ArrayList<>();
queryTopics1.add(topic1);
queryTopics1.add(topic2);
final List<LogTopic> queryTopics2 = new ArrayList<>();
queryTopics2.add(topic1);
queryTopics2.add(topic2);
final List<List<LogTopic>> queryParameter = new ArrayList<>();
queryParameter.add(queryTopics1);
queryParameter.add(queryTopics2);
final LogsQuery query = new LogsQuery.Builder().address(address).topics(queryParameter).build();
final Log log = new Log(address, data, logTopics);
assertThat(query.matches(log)).isFalse();
}
use of org.hyperledger.besu.evm.log.Log in project besu by hyperledger.
the class LogsQueryTest method univariateTopicQueryMismatchReturnFalse.
@Test
public void univariateTopicQueryMismatchReturnFalse() {
final Address address = Address.fromHexString("0x1111111111111111111111111111111111111111");
final LogTopic topic = LogTopic.fromHexString("0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
final List<LogTopic> topics = Lists.newArrayList(topic);
final List<List<LogTopic>> topicsQuery = new ArrayList<>();
topicsQuery.add(topics);
final LogsQuery query = new LogsQuery.Builder().address(address).topics(topicsQuery).build();
topics.add(LogTopic.fromHexString("0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"));
final Log log = new Log(address, data, Lists.newArrayList());
assertThat(query.matches(log)).isFalse();
}
use of org.hyperledger.besu.evm.log.Log in project besu by hyperledger.
the class LogsQueryTest method univariateAddressMatchReturnsTrue.
@Test
public void univariateAddressMatchReturnsTrue() {
final Address address = Address.fromHexString("0x1111111111111111111111111111111111111111");
final LogsQuery query = new LogsQuery.Builder().address(address).build();
final List<LogTopic> topics = new ArrayList<>();
final Log log = new Log(address, data, topics);
assertThat(query.couldMatch(LogsBloomFilter.builder().insertLog(log).build())).isTrue();
assertThat(query.matches(log)).isTrue();
}
use of org.hyperledger.besu.evm.log.Log in project besu by hyperledger.
the class GoQuorumPrivateTxBloomBlockchainQueriesTest method setupClass.
@BeforeClass
public static void setupClass() {
final Address testAddress = Address.fromHexString("0x123456");
final Bytes testMessage = Bytes.fromHexString("0x9876");
final Log testLog = new Log(testAddress, testMessage, List.of());
testLogsBloomFilter = LogsBloomFilter.builder().insertLog(testLog).build();
logsQuery = new LogsQuery(List.of(testAddress), List.of());
}
use of org.hyperledger.besu.evm.log.Log in project besu by hyperledger.
the class GoQuorumPrivateTransactionLogBloomCacherTest method setupClass.
@BeforeClass
public static void setupClass() {
testAddress = Address.fromHexString("0x123456");
testMessage = Bytes.fromHexString("0x9876");
final Log testLog = new Log(testAddress, testMessage, List.of());
testLogsBloomFilter = LogsBloomFilter.builder().insertLog(testLog).build();
logsQuery = new LogsQuery(List.of(testAddress), List.of());
}
Aggregations