-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
C:rpcComponent: JSON RPC, gRPCComponent: JSON RPC, gRPCT:bugType Bug (Confirmed)Type Bug (Confirmed)
Milestone
Description
Tendermint version: 0.22.8
The patch below adds a unit test that fails:
--- a/state/txindex/kv/kv_test.go
+++ b/state/txindex/kv/kv_test.go
@@ -89,6 +89,8 @@ func TestTxSearch(t *testing.T) {
{"account.owner CONTAINS 'an'", 1},
// search using CONTAINS
{"account.owner CONTAINS 'Vlad'", 0},
+ // search using a prefix of the stored value
+ {"account.owner = 'Iv'", 0},
}
for _, tc := range testCases {
The stored value for account.owner is Ivan, but searching for just Iv produces a false positive.
The reason this happens is that startKey in state/txindex/kv/kv.go returns a prefix that matches too much: account.owner/Iv in this case. To avoid false positives, it should rather return account.owner/Iv/.
There is probably a similar bug where matchRange looks up key when it really should look up key/.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C:rpcComponent: JSON RPC, gRPCComponent: JSON RPC, gRPCT:bugType Bug (Confirmed)Type Bug (Confirmed)