Sync from fork #74
@ -59,6 +59,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||||||
* (test) [#1311](https://github.com/evmos/ethermint/pull/1311) Add integration test for the `rollback` cmd
|
* (test) [#1311](https://github.com/evmos/ethermint/pull/1311) Add integration test for the `rollback` cmd
|
||||||
* (ledger) [#1277](https://github.com/evmos/ethermint/pull/1277) Add Ledger preprocessing transaction hook for EIP-712-signed Cosmos payloads.
|
* (ledger) [#1277](https://github.com/evmos/ethermint/pull/1277) Add Ledger preprocessing transaction hook for EIP-712-signed Cosmos payloads.
|
||||||
* (rpc) [#1296](https://github.com/evmos/ethermint/pull/1296) Add RPC Backend unit tests.
|
* (rpc) [#1296](https://github.com/evmos/ethermint/pull/1296) Add RPC Backend unit tests.
|
||||||
|
* (rpc) [#1352](https://github.com/evmos/ethermint/pull/1352) Make the grpc queries run concurrently, don't block the consensus state machine.
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -17,6 +18,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
|
|
||||||
abciserver "github.com/tendermint/tendermint/abci/server"
|
abciserver "github.com/tendermint/tendermint/abci/server"
|
||||||
tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
|
tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
|
||||||
@ -39,6 +41,7 @@ import (
|
|||||||
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
|
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
|
||||||
servergrpc "github.com/cosmos/cosmos-sdk/server/grpc"
|
servergrpc "github.com/cosmos/cosmos-sdk/server/grpc"
|
||||||
"github.com/cosmos/cosmos-sdk/server/types"
|
"github.com/cosmos/cosmos-sdk/server/types"
|
||||||
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
|
|
||||||
"github.com/evmos/ethermint/indexer"
|
"github.com/evmos/ethermint/indexer"
|
||||||
ethdebug "github.com/evmos/ethermint/rpc/namespaces/ethereum/debug"
|
ethdebug "github.com/evmos/ethermint/rpc/namespaces/ethereum/debug"
|
||||||
@ -363,17 +366,57 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, appCreator ty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var apiSrv *api.Server
|
if config.API.Enable || config.JSONRPC.Enable {
|
||||||
if config.API.Enable {
|
|
||||||
genDoc, err := genDocProvider()
|
genDoc, err := genDocProvider()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
clientCtx := clientCtx.
|
clientCtx = clientCtx.
|
||||||
WithHomeDir(home).
|
WithHomeDir(home).
|
||||||
WithChainID(genDoc.ChainID)
|
WithChainID(genDoc.ChainID)
|
||||||
|
|
||||||
|
// Set `GRPCClient` to `clientCtx` to enjoy concurrent grpc query.
|
||||||
|
// only use it if gRPC server is enabled.
|
||||||
|
if config.GRPC.Enable {
|
||||||
|
_, port, err := net.SplitHostPort(config.GRPC.Address)
|
||||||
|
if err != nil {
|
||||||
|
return sdkerrors.Wrapf(err, "invalid grpc address %s", config.GRPC.Address)
|
||||||
|
}
|
||||||
|
|
||||||
|
maxSendMsgSize := config.GRPC.MaxSendMsgSize
|
||||||
|
if maxSendMsgSize == 0 {
|
||||||
|
maxSendMsgSize = serverconfig.DefaultGRPCMaxSendMsgSize
|
||||||
|
}
|
||||||
|
|
||||||
|
maxRecvMsgSize := config.GRPC.MaxRecvMsgSize
|
||||||
|
if maxRecvMsgSize == 0 {
|
||||||
|
maxRecvMsgSize = serverconfig.DefaultGRPCMaxRecvMsgSize
|
||||||
|
}
|
||||||
|
|
||||||
|
grpcAddress := fmt.Sprintf("127.0.0.1:%s", port)
|
||||||
|
|
||||||
|
// If grpc is enabled, configure grpc client for grpc gateway and json-rpc.
|
||||||
|
grpcClient, err := grpc.Dial(
|
||||||
|
grpcAddress,
|
||||||
|
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||||
|
grpc.WithDefaultCallOptions(
|
||||||
|
grpc.ForceCodec(codec.NewProtoCodec(clientCtx.InterfaceRegistry).GRPCCodec()),
|
||||||
|
grpc.MaxCallRecvMsgSize(maxRecvMsgSize),
|
||||||
|
grpc.MaxCallSendMsgSize(maxSendMsgSize),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
clientCtx = clientCtx.WithGRPCClient(grpcClient)
|
||||||
|
ctx.Logger.Debug("gRPC client assigned to client context", "address", grpcAddress)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var apiSrv *api.Server
|
||||||
|
if config.API.Enable {
|
||||||
apiSrv = api.New(clientCtx, ctx.Logger.With("server", "api"))
|
apiSrv = api.New(clientCtx, ctx.Logger.With("server", "api"))
|
||||||
app.RegisterAPIRoutes(apiSrv, config.API)
|
app.RegisterAPIRoutes(apiSrv, config.API)
|
||||||
errCh := make(chan error)
|
errCh := make(chan error)
|
||||||
|
@ -106,7 +106,7 @@ func (k Keeper) ValidatorAccount(c context.Context, req *types.QueryValidatorAcc
|
|||||||
|
|
||||||
validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
|
validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, consAddr)
|
||||||
if !found {
|
if !found {
|
||||||
return nil, nil
|
return nil, fmt.Errorf("validator not found for %s", consAddr.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
accAddr := sdk.AccAddress(validator.GetOperator())
|
accAddr := sdk.AccAddress(validator.GetOperator())
|
||||||
|
Loading…
Reference in New Issue
Block a user