forked from cerc-io/laconicd-deprecated
changes for tendermint v0.34.21
This commit is contained in:
@@ -16,8 +16,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
tmcfg "github.com/tendermint/tendermint/config"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/ethclient"
|
||||
"github.com/rs/zerolog"
|
||||
@@ -33,7 +31,6 @@ import (
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
"github.com/cosmos/cosmos-sdk/db/memdb"
|
||||
pruningtypes "github.com/cosmos/cosmos-sdk/pruning/types"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/cosmos/cosmos-sdk/server/api"
|
||||
@@ -53,6 +50,7 @@ import (
|
||||
"github.com/cerc-io/laconicd/server/config"
|
||||
ethermint "github.com/cerc-io/laconicd/types"
|
||||
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
|
||||
"github.com/cerc-io/laconicd/app"
|
||||
)
|
||||
@@ -68,7 +66,7 @@ type AppConstructor = func(val Validator) servertypes.Application
|
||||
func NewAppConstructor(encodingCfg params.EncodingConfig) AppConstructor {
|
||||
return func(val Validator) servertypes.Application {
|
||||
return app.NewEthermintApp(
|
||||
val.Ctx.Logger, memdb.NewDB(), nil, true, make(map[int64]bool), val.Ctx.Config.RootDir, 0,
|
||||
val.Ctx.Logger, dbm.NewMemDB(), nil, true, make(map[int64]bool), val.Ctx.Config.RootDir, 0,
|
||||
encodingCfg,
|
||||
simapp.EmptyAppOptions{},
|
||||
baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.AppConfig.Pruning)),
|
||||
@@ -255,7 +253,6 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
|
||||
ctx := server.NewDefaultContext()
|
||||
tmCfg := ctx.Config
|
||||
tmCfg.Consensus.TimeoutCommit = cfg.TimeoutCommit
|
||||
tmCfg.Mode = tmcfg.ModeValidator
|
||||
|
||||
// Only allow the first validator to expose an RPC, API and gRPC
|
||||
// server/client due to Tendermint in-process constraints.
|
||||
|
||||
+23
-14
@@ -8,12 +8,16 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/ethclient"
|
||||
abciclient "github.com/tendermint/tendermint/abci/client"
|
||||
"github.com/tendermint/tendermint/p2p"
|
||||
|
||||
pvm "github.com/tendermint/tendermint/privval"
|
||||
"github.com/tendermint/tendermint/proxy"
|
||||
|
||||
tmos "github.com/tendermint/tendermint/libs/os"
|
||||
tmtime "github.com/tendermint/tendermint/libs/time"
|
||||
"github.com/tendermint/tendermint/node"
|
||||
"github.com/tendermint/tendermint/rpc/client/local"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
tmtime "github.com/tendermint/tendermint/types/time"
|
||||
|
||||
"github.com/cerc-io/laconicd/server"
|
||||
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||
@@ -41,16 +45,26 @@ func startInProcess(cfg Config, val *Validator) error {
|
||||
}
|
||||
|
||||
app := cfg.AppConstructor(*val)
|
||||
genDoc, err := types.GenesisDocFromFile(tmCfg.GenesisFile())
|
||||
// genDoc, err := types.GenesisDocFromFile(tmCfg.GenesisFile())
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
|
||||
nodeKey, err := p2p.LoadOrGenNodeKey(tmCfg.NodeKeyFile())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
val.tmNode, err = node.New(
|
||||
genDocProvider := node.DefaultGenesisDocProviderFunc(tmCfg)
|
||||
tmNode, err := node.NewNode(
|
||||
tmCfg,
|
||||
pvm.LoadOrGenFilePV(tmCfg.PrivValidatorKeyFile(), tmCfg.PrivValidatorStateFile()),
|
||||
nodeKey,
|
||||
proxy.NewLocalClientCreator(app),
|
||||
genDocProvider,
|
||||
node.DefaultDBProvider,
|
||||
node.DefaultMetricsProvider(tmCfg.Instrumentation),
|
||||
logger.With("module", val.Moniker),
|
||||
abciclient.NewLocalCreator(app),
|
||||
genDoc,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -60,15 +74,10 @@ func startInProcess(cfg Config, val *Validator) error {
|
||||
return err
|
||||
}
|
||||
|
||||
val.tmNode = tmNode
|
||||
|
||||
if val.RPCAddress != "" {
|
||||
node, ok := val.tmNode.(local.NodeService)
|
||||
if !ok {
|
||||
panic("can't cast service.Service to NodeService")
|
||||
}
|
||||
val.RPCClient, err = local.New(node)
|
||||
if err != nil {
|
||||
panic("cant create a local node")
|
||||
}
|
||||
val.RPCClient = local.New(tmNode)
|
||||
}
|
||||
|
||||
// We'll need a RPC client if the validator exposes a gRPC or REST endpoint.
|
||||
|
||||
Reference in New Issue
Block a user