fix : fix the chain start
This commit is contained in:
parent
feae504ff8
commit
9d7333d4fb
@ -76,9 +76,7 @@ func (md MD) CheckTx(ctx context.Context, req tx.Request, checkReq tx.RequestChe
|
|||||||
// return tx.Response{}, tx.ResponseCheckTx{}, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid transaction type: %T", reqTx)
|
// return tx.Response{}, tx.ResponseCheckTx{}, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "invalid transaction type: %T", reqTx)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
anteHandler = md.cosmosMiddleware
|
return md.cosmosMiddleware.CheckTx(ctx, req, checkReq)
|
||||||
|
|
||||||
return anteHandler.CheckTx(ctx, req, checkReq)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeliverTx implements tx.Handler
|
// DeliverTx implements tx.Handler
|
||||||
@ -107,8 +105,7 @@ func (md MD) DeliverTx(ctx context.Context, req tx.Request) (tx.Response, error)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
anteHandler = md.cosmosMiddleware
|
return md.cosmosMiddleware.DeliverTx(ctx, req)
|
||||||
return anteHandler.DeliverTx(ctx, req)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SimulateTx implements tx.Handler
|
// SimulateTx implements tx.Handler
|
||||||
@ -137,8 +134,7 @@ func (md MD) SimulateTx(ctx context.Context, req tx.Request) (tx.Response, error
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
anteHandler = md.cosmosMiddleware
|
return md.cosmosMiddleware.SimulateTx(ctx, req)
|
||||||
return anteHandler.SimulateTx(ctx, req)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ authante.SignatureVerificationGasConsumer = DefaultSigVerificationGasConsumer
|
var _ authante.SignatureVerificationGasConsumer = DefaultSigVerificationGasConsumer
|
||||||
|
@ -80,11 +80,8 @@ func newEthAuthMiddleware(options HandlerOptions) (tx.Handler, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newCosmosAuthMiddleware(options HandlerOptions) (tx.Handler, error) {
|
func newCosmosAuthMiddleware(options HandlerOptions) (tx.Handler, error) {
|
||||||
|
|
||||||
return authmiddleware.ComposeMiddlewares(
|
return authmiddleware.ComposeMiddlewares(
|
||||||
authmiddleware.NewRunMsgsTxHandler(options.MsgServiceRouter, options.LegacyRouter),
|
authmiddleware.NewRunMsgsTxHandler(options.MsgServiceRouter, options.LegacyRouter),
|
||||||
// reject MsgEthereumTxs
|
|
||||||
NewRejectMessagesDecorator(),
|
|
||||||
authmiddleware.NewTxDecoderMiddleware(options.TxDecoder),
|
authmiddleware.NewTxDecoderMiddleware(options.TxDecoder),
|
||||||
// Set a new GasMeter on sdk.Context.
|
// Set a new GasMeter on sdk.Context.
|
||||||
//
|
//
|
||||||
@ -130,8 +127,6 @@ func newCosmosAnteHandlerEip712(options HandlerOptions) (tx.Handler, error) {
|
|||||||
|
|
||||||
return authmiddleware.ComposeMiddlewares(
|
return authmiddleware.ComposeMiddlewares(
|
||||||
authmiddleware.NewRunMsgsTxHandler(options.MsgServiceRouter, options.LegacyRouter),
|
authmiddleware.NewRunMsgsTxHandler(options.MsgServiceRouter, options.LegacyRouter),
|
||||||
// reject MsgEthereumTxs
|
|
||||||
NewRejectMessagesDecorator(),
|
|
||||||
authmiddleware.NewTxDecoderMiddleware(options.TxDecoder),
|
authmiddleware.NewTxDecoderMiddleware(options.TxDecoder),
|
||||||
// Set a new GasMeter on sdk.Context.
|
// Set a new GasMeter on sdk.Context.
|
||||||
//
|
//
|
||||||
|
@ -36,16 +36,37 @@ func (rmd RejectMessagesDecorator) CheckTx(ctx context.Context, req tx.Request,
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rmd.next.CheckTx(ctx, req, checkReq)
|
return rmd.next.CheckTx(ctx, req, checkReq)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeliverTx implements tx.Handler
|
// DeliverTx implements tx.Handler
|
||||||
func (rmd RejectMessagesDecorator) DeliverTx(ctx context.Context, req tx.Request) (tx.Response, error) {
|
func (rmd RejectMessagesDecorator) DeliverTx(ctx context.Context, req tx.Request) (tx.Response, error) {
|
||||||
|
reqTx := req.Tx
|
||||||
|
for _, msg := range reqTx.GetMsgs() {
|
||||||
|
if _, ok := msg.(*evmtypes.MsgEthereumTx); ok {
|
||||||
|
return tx.Response{}, sdkerrors.Wrapf(
|
||||||
|
sdkerrors.ErrInvalidType,
|
||||||
|
"MsgEthereumTx needs to be contained within a tx with 'ExtensionOptionsEthereumTx' option",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return rmd.next.DeliverTx(ctx, req)
|
return rmd.next.DeliverTx(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SimulateTx implements tx.Handler
|
// SimulateTx implements tx.Handler
|
||||||
func (rmd RejectMessagesDecorator) SimulateTx(ctx context.Context, req tx.Request) (tx.Response, error) {
|
func (rmd RejectMessagesDecorator) SimulateTx(ctx context.Context, req tx.Request) (tx.Response, error) {
|
||||||
|
reqTx := req.Tx
|
||||||
|
for _, msg := range reqTx.GetMsgs() {
|
||||||
|
if _, ok := msg.(*evmtypes.MsgEthereumTx); ok {
|
||||||
|
return tx.Response{}, sdkerrors.Wrapf(
|
||||||
|
sdkerrors.ErrInvalidType,
|
||||||
|
"MsgEthereumTx needs to be contained within a tx with 'ExtensionOptionsEthereumTx' option",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return rmd.next.SimulateTx(ctx, req)
|
return rmd.next.SimulateTx(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/improbable-eng/grpc-web/go/grpcweb"
|
"github.com/improbable-eng/grpc-web/go/grpcweb"
|
||||||
@ -42,31 +43,32 @@ func AddCommands(rootCmd *cobra.Command, defaultNodeHome string, appCreator type
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ConnectTmWS(tmRPCAddr, tmEndpoint string, logger tmlog.Logger) *rpcclient.WSClient {
|
func ConnectTmWS(tmRPCAddr, tmEndpoint string, logger tmlog.Logger) *rpcclient.WSClient {
|
||||||
// tmWsClient, err := rpcclient.NewWS(tmRPCAddr, tmEndpoint,
|
tmWsClient, err := rpcclient.NewWSWithOptions(tmRPCAddr, tmEndpoint, rpcclient.WSOptions{
|
||||||
// rpcclient.MaxReconnectAttempts(256),
|
MaxReconnectAttempts: 256, // first: 2 sec, last: 17 min.
|
||||||
// rpcclient.ReadWait(120*time.Second),
|
WriteWait: 120 * time.Second,
|
||||||
// rpcclient.WriteWait(120*time.Second),
|
ReadWait: 120 * time.Second,
|
||||||
// rpcclient.PingPeriod(50*time.Second),
|
PingPeriod: 50 * time.Second,
|
||||||
// rpcclient.OnReconnect(func() {
|
})
|
||||||
// logger.Debug("EVM RPC reconnects to Tendermint WS", "address", tmRPCAddr+tmEndpoint)
|
|
||||||
// }),
|
|
||||||
// )
|
|
||||||
|
|
||||||
// if err != nil {
|
tmWsClient.OnReconnect(func() {
|
||||||
// logger.Error(
|
logger.Debug("EVM RPC reconnects to Tendermint WS", "address", tmRPCAddr+tmEndpoint)
|
||||||
// "Tendermint WS client could not be created",
|
})
|
||||||
// "address", tmRPCAddr+tmEndpoint,
|
|
||||||
// "error", err,
|
|
||||||
// )
|
|
||||||
// } else if err := tmWsClient.OnStart(); err != nil {
|
|
||||||
// logger.Error(
|
|
||||||
// "Tendermint WS client could not start",
|
|
||||||
// "address", tmRPCAddr+tmEndpoint,
|
|
||||||
// "error", err,
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
return nil
|
if err != nil {
|
||||||
|
logger.Error(
|
||||||
|
"Tendermint WS client could not be created",
|
||||||
|
"address", tmRPCAddr+tmEndpoint,
|
||||||
|
"error", err,
|
||||||
|
)
|
||||||
|
} else if err := tmWsClient.Start(); err != nil {
|
||||||
|
logger.Error(
|
||||||
|
"Tendermint WS client could not start",
|
||||||
|
"address", tmRPCAddr+tmEndpoint,
|
||||||
|
"error", err,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return tmWsClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func MountGRPCWebServices(
|
func MountGRPCWebServices(
|
||||||
|
Loading…
Reference in New Issue
Block a user