diff --git a/itests/eth_filter_test.go b/itests/eth_filter_test.go index 16991069c9c..b278543b6f5 100644 --- a/itests/eth_filter_test.go +++ b/itests/eth_filter_test.go @@ -7,7 +7,6 @@ import ( "encoding/hex" "encoding/json" "fmt" - "math/bits" "os" "sort" "strconv" @@ -615,26 +614,13 @@ func TestTxReceiptBloom(t *testing.T) { // computed by calling EventMatrix/logEventZeroData in remix // note this only contains topic bits - matchMask := "0x00000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - - maskBytes, err := hex.DecodeString(matchMask[2:]) + expectedBloom, err := hex.DecodeString("00000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") require.NoError(t, err) - bitsSet := 0 - for i, maskByte := range maskBytes { - bitsSet += bits.OnesCount8(receipt.LogsBloom[i]) - - if maskByte > 0 { - require.True(t, maskByte&receipt.LogsBloom[i] > 0) - } - } + // We need to add the address bits before comparing. + ethtypes.EthBloomSet(expectedBloom, receipt.To[:]) - // Deflake plan: (Flake: 5 bits instead of 6) - // Debug + search logs for "LogsBloom" - // compare to passing case. - // - // 3 bits from the topic, 3 bits from the address - require.Equal(t, 6, bitsSet) + require.Equal(t, []uint8(expectedBloom), []uint8(receipt.LogsBloom)) } func TestMultipleEvents(t *testing.T) {