From 8e21f8849550eee548e7c516bdc29597d20d9515 Mon Sep 17 00:00:00 2001
From: Aleksandr Bezobchuk <aleks.bezobchuk@gmail.com>
Date: Thu, 20 Jan 2022 14:50:13 -0500
Subject: [PATCH 1/3] updates

---
 x/auth/tx/service.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go
index a0deedae6aa2..4fa0ec368cd5 100644
--- a/x/auth/tx/service.go
+++ b/x/auth/tx/service.go
@@ -135,6 +135,10 @@ func (s txServer) GetTx(ctx context.Context, req *txtypes.GetTxRequest) (*txtype
 	// https://github.com/cosmos/cosmos-sdk/issues/7036.
 	result, err := QueryTx(s.clientCtx, req.Hash)
 	if err != nil {
+		if strings.Contains(err.Error(), "not found") {
+			return nil, status.Errorf(codes.NotFound, "tx not found: %s", req.Hash)
+		}
+
 		return nil, err
 	}
 

From a90666bd1bff675b03bef7a286660656a9c868e0 Mon Sep 17 00:00:00 2001
From: Aleksandr Bezobchuk <aleks.bezobchuk@gmail.com>
Date: Thu, 20 Jan 2022 14:52:46 -0500
Subject: [PATCH 2/3] cl++

---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d1ca41f204a5..7cdd3e5f140c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -155,6 +155,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
 
 ### Bug Fixes
 
+* (grpc) [\#10985](https://github.com/cosmos/cosmos-sdk/pull/10992) The `/cosmos/tx/v1beta1/txs/{hash}` endpoint returns a 404 when a tx does not exist.
 * (rosetta) [\#10340](https://github.com/cosmos/cosmos-sdk/pull/10340) Use `GenesisChunked(ctx)` instead `Genesis(ctx)` to get genesis block height
 * [#10180](https://github.com/cosmos/cosmos-sdk/issues/10180) Documentation: make references to Cosmos SDK consistent
 * [\#9651](https://github.com/cosmos/cosmos-sdk/pull/9651) Change inconsistent limit of `0` to `MaxUint64` on InfiniteGasMeter and add GasRemaining func to GasMeter.

From f195e3df45042ba01e19bb9b7890c754df4d4510 Mon Sep 17 00:00:00 2001
From: Aleksandr Bezobchuk <aleks.bezobchuk@gmail.com>
Date: Fri, 21 Jan 2022 14:52:45 -0500
Subject: [PATCH 3/3] updates

---
 x/auth/tx/service.go      | 4 ++++
 x/auth/tx/service_test.go | 8 ++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go
index 4fa0ec368cd5..00f123c57112 100644
--- a/x/auth/tx/service.go
+++ b/x/auth/tx/service.go
@@ -131,6 +131,10 @@ func (s txServer) GetTx(ctx context.Context, req *txtypes.GetTxRequest) (*txtype
 		return nil, status.Error(codes.InvalidArgument, "request cannot be nil")
 	}
 
+	if len(req.Hash) == 0 {
+		return nil, status.Error(codes.InvalidArgument, "tx hash cannot be empty")
+	}
+
 	// TODO We should also check the proof flag in gRPC header.
 	// https://github.com/cosmos/cosmos-sdk/issues/7036.
 	result, err := QueryTx(s.clientCtx, req.Hash)
diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go
index 06242bd50eaa..1856d0f8a3d7 100644
--- a/x/auth/tx/service_test.go
+++ b/x/auth/tx/service_test.go
@@ -341,8 +341,8 @@ func (s IntegrationTestSuite) TestGetTx_GRPC() {
 		expErrMsg string
 	}{
 		{"nil request", nil, true, "request cannot be nil"},
-		{"empty request", &tx.GetTxRequest{}, true, "transaction hash cannot be empty"},
-		{"request with dummy hash", &tx.GetTxRequest{Hash: "deadbeef"}, true, "tx (DEADBEEF) not found"},
+		{"empty request", &tx.GetTxRequest{}, true, "tx hash cannot be empty"},
+		{"request with dummy hash", &tx.GetTxRequest{Hash: "deadbeef"}, true, "code = NotFound desc = tx not found: deadbeef"},
 		{"good request", &tx.GetTxRequest{Hash: s.txRes.TxHash}, false, ""},
 	}
 	for _, tc := range testCases {
@@ -371,12 +371,12 @@ func (s IntegrationTestSuite) TestGetTx_GRPCGateway() {
 		{
 			"empty params",
 			fmt.Sprintf("%s/cosmos/tx/v1beta1/txs/", val.APIAddress),
-			true, "transaction hash cannot be empty",
+			true, "tx hash cannot be empty",
 		},
 		{
 			"dummy hash",
 			fmt.Sprintf("%s/cosmos/tx/v1beta1/txs/%s", val.APIAddress, "deadbeef"),
-			true, "tx (DEADBEEF) not found",
+			true, "code = NotFound desc = tx not found: deadbeef",
 		},
 		{
 			"good hash",