From 14c582f30ec1f6f0c661e916f4dccf46b7305701 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 14 Nov 2022 13:49:59 -0500 Subject: [PATCH] fix: Allow underscores in EventRegex (#13861) --- CHANGELOG.md | 3 ++- tests/e2e/tx/service_test.go | 5 +++++ x/auth/tx/service.go | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c7dba82b727..9a0ec3cbb2a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/tests/e2e/tx/service_test.go b/tests/e2e/tx/service_test.go index 095db7d6412f..45c7ff3cde15 100644 --- a/tests/e2e/tx/service_test.go +++ b/tests/e2e/tx/service_test.go @@ -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", diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index 8f72205a20f7..1d5b846dbda1 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -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 (