Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gRPC server for TxStatus endpoint (backport #3754) #3755

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,10 @@ import (
"os"
"path/filepath"

<<<<<<< HEAD
celestiatx "github.com/celestiaorg/celestia-app/app/grpc/tx"
"github.com/celestiaorg/celestia-app/x/mint"
mintkeeper "github.com/celestiaorg/celestia-app/x/mint/keeper"
minttypes "github.com/celestiaorg/celestia-app/x/mint/types"
=======
"github.com/celestiaorg/celestia-app/v3/app/ante"
"github.com/celestiaorg/celestia-app/v3/app/encoding"
celestiatx "github.com/celestiaorg/celestia-app/v3/app/grpc/tx"
"github.com/celestiaorg/celestia-app/v3/app/module"
"github.com/celestiaorg/celestia-app/v3/app/posthandler"
appv1 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v1"
appv2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2"
"github.com/celestiaorg/celestia-app/v3/pkg/proof"
blobkeeper "github.com/celestiaorg/celestia-app/v3/x/blob/keeper"
blobtypes "github.com/celestiaorg/celestia-app/v3/x/blob/types"
blobstreamkeeper "github.com/celestiaorg/celestia-app/v3/x/blobstream/keeper"
blobstreamtypes "github.com/celestiaorg/celestia-app/v3/x/blobstream/types"
"github.com/celestiaorg/celestia-app/v3/x/minfee"
mintkeeper "github.com/celestiaorg/celestia-app/v3/x/mint/keeper"
minttypes "github.com/celestiaorg/celestia-app/v3/x/mint/types"
"github.com/celestiaorg/celestia-app/v3/x/paramfilter"
"github.com/celestiaorg/celestia-app/v3/x/signal"
signaltypes "github.com/celestiaorg/celestia-app/v3/x/signal/types"
"github.com/celestiaorg/celestia-app/v3/x/tokenfilter"
>>>>>>> bb4f7128 (feat: gRPC server for TxStatus endpoint (#3754))
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
Expand Down
41 changes: 10 additions & 31 deletions app/test/std_sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,11 @@ import (
"testing"
"time"

<<<<<<< HEAD
"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
"github.com/celestiaorg/celestia-app/app/grpc/tx"
"github.com/celestiaorg/celestia-app/test/util/testnode"
=======
"github.com/celestiaorg/celestia-app/v3/app"
"github.com/celestiaorg/celestia-app/v3/app/encoding"
"github.com/celestiaorg/celestia-app/v3/app/grpc/tx"
v2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2"
"github.com/celestiaorg/celestia-app/v3/pkg/user"
"github.com/celestiaorg/celestia-app/v3/test/util/blobfactory"
"github.com/celestiaorg/celestia-app/v3/test/util/testfactory"
"github.com/celestiaorg/celestia-app/v3/test/util/testnode"
"github.com/celestiaorg/celestia-app/v3/x/minfee"
signal "github.com/celestiaorg/celestia-app/v3/x/signal/types"
"github.com/celestiaorg/go-square/namespace"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
>>>>>>> bb4f7128 (feat: gRPC server for TxStatus endpoint (#3754))
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/testutil/mock"
Expand Down Expand Up @@ -308,7 +295,6 @@ func (s *StandardSDKIntegrationTestSuite) TestStandardSDK() {
}
}

<<<<<<< HEAD
func getAddress(account string, kr keyring.Keyring) sdk.AccAddress {
rec, err := kr.Key(account)
if err != nil {
Expand All @@ -319,22 +305,15 @@ func getAddress(account string, kr keyring.Keyring) sdk.AccAddress {
panic(err)
}
return addr
=======
}

func (s *StandardSDKIntegrationTestSuite) TestGRPCQueries() {
t := s.T()
t.Run("testnode can query network min gas price", func(t *testing.T) {
queryClient := minfee.NewQueryClient(s.cctx.GRPCClient)
resp, err := queryClient.NetworkMinGasPrice(s.cctx.GoContext(), &minfee.QueryNetworkMinGasPrice{})
require.NoError(t, err)
got, err := resp.NetworkMinGasPrice.Float64()
require.NoError(t, err)
assert.Equal(t, v2.NetworkMinGasPrice, got)
})
t.Run("testnode can query local min gas price", func(t *testing.T) {
serviceClient := nodeservice.NewServiceClient(s.cctx.GRPCClient)
resp, err := serviceClient.Config(s.cctx.GoContext(), &nodeservice.ConfigRequest{})
require.NoError(t, err)
want := "0.002000000000000000utia"
want := ""
rootulp marked this conversation as resolved.
Show resolved Hide resolved
assert.Equal(t, want, resp.MinimumGasPrice)
})

Expand All @@ -352,17 +331,17 @@ func (s *StandardSDKIntegrationTestSuite) TestGRPCQueries() {
require.NoError(t, err)
assert.Equal(t, resp.Status, "UNKNOWN")

txSubmitter, err := user.SetupTxClient(s.cctx.GoContext(), s.cctx.Keyring, s.cctx.GRPCClient, s.ecfg)
require.NoError(t, err)
blobs := blobfactory.RandBlobsWithNamespace([]namespace.Namespace{namespace.RandomNamespace()}, []int{1000})
res, err := txSubmitter.SubmitPayForBlob(s.cctx.GoContext(), blobs, blobfactory.DefaultTxOpts()...)
fromAddr := s.unusedAccount()
toAddr := s.unusedAccount()

msg := banktypes.NewMsgSend(getAddress(fromAddr, s.cctx.Keyring), getAddress(toAddr, s.cctx.Keyring), sdk.NewCoins(sdk.NewCoin(app.BondDenom, sdk.NewInt(1))))
res, err := testnode.SignAndBroadcastTx(s.ecfg, s.cctx.Context, fromAddr, msg)
require.NoError(t, err)

resp, err = txClient.TxStatus(s.cctx.GoContext(), &tx.TxStatusRequest{
TxId: res.TxHash,
})
require.NoError(t, err)
assert.Equal(t, resp.Status, "COMMITTED")
assert.Equal(t, resp.Status, "PENDING")
})
>>>>>>> bb4f7128 (feat: gRPC server for TxStatus endpoint (#3754))
}
18 changes: 0 additions & 18 deletions test/util/testnode/testnode_test.go

This file was deleted.

Loading