Skip to content

Commit

Permalink
fix: Allow underscores in EventRegex (#13861) (#13863)
Browse files Browse the repository at this point in the history
(cherry picked from commit 14c582f)

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
  • Loading branch information
mergify[bot] and alexanderbez committed Nov 14, 2022
1 parent 02a0d82 commit bd66288
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -186,7 +186,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/gov) [#13045](https://github.com/cosmos/cosmos-sdk/pull/13045) Fix gov migrations for v3(0.46).
* (snapshot) [#13400](https://github.com/cosmos/cosmos-sdk/pull/13400) Fix snapshot checksum issue in golang 1.19.
* (x/gov) [#13728](https://github.com/cosmos/cosmos-sdk/pull/13728) Fix propagation of message events to the current context in `EndBlocker`.
* (server) [#13778](https://github.com/cosmos/cosmos-sdk/pull/13778) Set Cosmos SDK default endpoints to localhost to avoid unknown exposure of endpoints.
* (server) [#13778](https://github.com/cosmos/cosmos-sdk/pull/13778) Set Cosmos SDK default endpoints to localhost to avoid unknown exposure of endpoints.
* [#13861](https://github.com/cosmos/cosmos-sdk/pull/13861) Allow `_` characters in tx event queries, i.e. `GetTxsEvent`.

### Deprecated

Expand Down
5 changes: 5 additions & 0 deletions tests/e2e/tx/service_test.go
Expand Up @@ -161,6 +161,11 @@ func TestEventRegex(t *testing.T) {
event: "tx.message='something'",
match: true,
},
{
name: "valid: with underscores",
event: "claim_reward.message_action='something'",
match: true,
},
{
name: "valid: no quotes",
event: "tx.message=something",
Expand Down
2 changes: 1 addition & 1 deletion x/auth/tx/service.go
Expand Up @@ -44,7 +44,7 @@ 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+$`)
EventRegex = regexp.MustCompile(`^[a-zA-Z_]+\.[a-zA-Z_]+=\S+$`)
)

const (
Expand Down

0 comments on commit bd66288

Please sign in to comment.