public void or_topics_filter_matches_bloom() { var filter = FilterBuilder.New(ref _filterCounter) .WithTopicExpressions(TestTopicExpressions.Or(TestTopicExpressions.Specific(TestItem.KeccakB), TestTopicExpressions.Specific(TestItem.KeccakA))) .Build(); var bloom = GetBloom(GetLogEntry(TestItem.AddressB, TestItem.KeccakB)); filter.Matches(bloom).Should().BeTrue(); }
public void logs_should_be_empty_for_non_existing_or_topic() => LogsShouldBeEmpty(filter => filter .WithTopicExpressions(TestTopicExpressions.Or(new[] { TestTopicExpressions.Specific(TestItem.KeccakA), TestTopicExpressions.Specific(TestItem.KeccakD) })), receipt => receipt .WithLogs(new[] { Build.A.LogEntry.WithTopics(new[] { TestItem.KeccakB, TestItem.KeccakC }).TestObject }));
public void logs_should_be_empty_for_existing_block_and_addresses_and_non_existing_topic() => LogsShouldBeEmpty(filter => filter .FromBlock(1L) .ToBlock(10L) .WithAddresses(new[] { TestItem.AddressA, TestItem.AddressB }) .WithTopicExpressions(TestTopicExpressions.Or(new[] { TestTopicExpressions.Specific(TestItem.KeccakC), TestTopicExpressions.Specific(TestItem.KeccakD) })), receipt => receipt .WithBlockNumber(6L) .WithLogs(new[] { Build.A.LogEntry.WithAddress(TestItem.AddressA) .WithTopics(new[] { TestItem.KeccakB, TestItem.KeccakC }).TestObject }));
public void logs_should_not_be_empty_for_existing_block_and_address_and_topics() => LogsShouldNotBeEmpty(filter => filter .FromBlock(UInt256.One) .ToBlock(new UInt256(10)) .WithAddress(TestItem.AddressA) .WithTopicExpressions(TestTopicExpressions.Or(new[] { TestTopicExpressions.Specific(TestItem.KeccakB), TestTopicExpressions.Specific(TestItem.KeccakD) })), receipt => receipt .WithBlockNumber(new UInt256(6)) .WithLogs(new[] { Build.A.LogEntry.WithAddress(TestItem.AddressA) .WithTopics(new[] { TestItem.KeccakB, TestItem.KeccakC }).TestObject }));
public void complex_filter_doesnt_match_bloom() { var filter = FilterBuilder.New(ref _filterCounter) .WithTopicExpressions(TestTopicExpressions.Specific(TestItem.KeccakA), TestTopicExpressions.Or(TestTopicExpressions.Specific(TestItem.KeccakB), TestTopicExpressions.Specific(TestItem.KeccakC))) .WithAddress(TestItem.AddressD) .Build(); var bloom = GetBloom(GetLogEntry(TestItem.AddressA, TestItem.KeccakA, TestItem.KeccakD)); filter.Matches(bloom).Should().BeFalse(); }