Skip to content

Commit

Permalink
feat: add query local min-gas-price (#2627)
Browse files Browse the repository at this point in the history
* feat: add query local min-gas-price

* docs: add changelog

* test: add test for query local min-gas-prices

* test: add test for local min-gas-price query

* fix: test query min-gas-price

(cherry picked from commit 353410e)
  • Loading branch information
yaruwangway authored and mergify[bot] committed Jul 3, 2023
1 parent 8464324 commit 789ab7f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- register NodeService to enable query /cosmos/base/node/v1beta1/config
gRPC query to disclose node operator's configured minimum-gas-price.
([\#2629](https://github.com/cosmos/gaia/issues/2629))
8 changes: 8 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -342,6 +343,8 @@ func (app *GaiaApp) SimulationManager() *module.SimulationManager {
func (app *GaiaApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
clientCtx := apiSvr.ClientCtx
rpc.RegisterRoutes(clientCtx, apiSvr.Router)

nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
// Register legacy tx routes.
authrest.RegisterTxRoutes(clientCtx, apiSvr.Router)
// Register new tx routes from grpc-gateway.
Expand All @@ -359,6 +362,11 @@ func (app *GaiaApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APICo
}
}

// RegisterTxService allows query minimum-gas-prices in app.toml
func (app *GaiaApp) RegisterNodeService(clientCtx client.Context) {
nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter())
}

// RegisterTxService implements the Application.RegisterTxService method.
func (app *GaiaApp) RegisterTxService(clientCtx client.Context) {
authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry)
Expand Down
3 changes: 3 additions & 0 deletions tests/e2e/e2e_rest_regression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const (
slashingParamsModuleQueryPath = "/slashing/parameters"
stakingParamsModuleQueryPath = "/staking/parameters"
missingPath = "/missing_endpoint"
localMinGasPriceQueryPath = "/cosmos/base/node/v1beta1/config"
)

func (s *IntegrationTestSuite) testRestInterfaces() {
Expand Down Expand Up @@ -73,6 +74,8 @@ func (s *IntegrationTestSuite) testRestInterfaces() {
{slashingParamsModuleQueryPath, 200},
{stakingParamsModuleQueryPath, 200},
{missingPath, 501},
// node config Endpoint
{localMinGasPriceQueryPath, 200},
}
)

Expand Down

0 comments on commit 789ab7f

Please sign in to comment.