Skip to content

Commit

Permalink
fix: query tx events with >= and <= operators (backport #16994) (#…
Browse files Browse the repository at this point in the history
…16996)

Co-authored-by: Rootul P <rootulp@gmail.com>
  • Loading branch information
mergify[bot] and rootulp committed Jul 14, 2023
1 parent 031162f commit f7b6886
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions tests/e2e/tx/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ func TestEventRegex(t *testing.T) {
event: "tx.signature='foobar/baz123=='",
match: true,
},
{
name: "valid: with >= operator",
event: "tx.height>=10'",
match: true,
},
{
name: "valid: with <= operator",
event: "tx.height<=10'",
match: true,
},
}

for _, tc := range testCases {
Expand Down
3 changes: 2 additions & 1 deletion x/auth/tx/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ var (
_ txtypes.ServiceServer = txServer{}

// EventRegex checks that an event string is formatted with {alphabetic}.{alphabetic}={value}
EventRegex = regexp.MustCompile(`^[a-zA-Z_]+\.[a-zA-Z_]+=\S+$`)
// Note: in addition to equality, the `>=` and `<=` operators are also valid.
EventRegex = regexp.MustCompile(`^[a-zA-Z_]+\.[a-zA-Z_]+[<>]?=\S+$`)
)

const (
Expand Down

0 comments on commit f7b6886

Please sign in to comment.